Package org.opencms.staticexport
Class CmsAfterPublishStaticExportHandler
java.lang.Object
org.opencms.staticexport.A_CmsStaticExportHandler
org.opencms.staticexport.CmsAfterPublishStaticExportHandler
- All Implemented Interfaces:
I_CmsStaticExportHandler
- Direct Known Subclasses:
CmsAfterPublishMultiLanguageStaticExportHandler
Implementation for the
I_CmsStaticExportHandler
interface.This handler exports all changes immediately after something is published.
- Since:
- 6.0.0
- See Also:
-
Field Summary
Fields inherited from class org.opencms.staticexport.A_CmsStaticExportHandler
m_busy
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
doExportAfterPublish
(List<CmsPublishedResource> resources, I_CmsReport report) Does the actual static export.protected void
exportAfterPublish
(CmsUUID publishHistoryId, I_CmsReport report) Starts the static export on publish.protected boolean
exportNonTemplateResources
(CmsObject cms, List<CmsPublishedResource> publishedResources, I_CmsReport report) Exports all non template resources found in a list of published resources.protected int
exportTemplateResource
(CmsStaticExportData data, StringBuffer cookies) Exports a single (template) resource specified by its export data.protected void
exportTemplateResources
(CmsObject cms, List<String> publishedTemplateResources, I_CmsReport report) Exports all template resources found in a list of published resources.getAllResources
(CmsObject cms) Returns all resources within the current OpenCms site that are not marked as internal.getRelatedFilesToPurge
(String exportFileName, String vfsName) Returns a list of related files to purge.protected List<CmsPublishedResource>
getRelatedResources
(CmsObject cms, List<CmsPublishedResource> publishedResources) Creates a list of
objects containing all related resources of the VFS tree.CmsPublishedResource
protected Set<CmsPublishedResource>
getSiblings
(CmsObject cms, CmsPublishedResource pubResource) Returns all siblings of the published resource as list ofCmsPublishedResource
.void
performEventPublishProject
(CmsUUID publishHistoryId, I_CmsReport report) Scrubs files from the export folder that might have been changed.protected boolean
readNonTemplateResourcesToExport
(CmsObject cms, List<CmsPublishedResource> publishedResources, List<CmsStaticExportData> resourcesToExport) Returns all non template resources found in a list of published resources.Methods inherited from class org.opencms.staticexport.A_CmsStaticExportHandler
addMovedLinkSources, getSiblingsList, isBusy, purgeFile, scrubExportFolders, scrubResource
-
Constructor Details
-
CmsAfterPublishStaticExportHandler
public CmsAfterPublishStaticExportHandler()
-
-
Method Details
-
doExportAfterPublish
public void doExportAfterPublish(List<CmsPublishedResource> resources, I_CmsReport report) throws CmsException, IOException, javax.servlet.ServletException Does the actual static export.- Parameters:
resources
- a list of CmsPublishedREsources to start the static export withreport
- an
instance to print output message, orI_CmsReport
null
to write messages to the log file- Throws:
CmsException
- in case of errors accessing the VFSIOException
- in case of errors writing to the export output streamjavax.servlet.ServletException
- in case of errors accessing the servlet
-
getAllResources
Returns all resources within the current OpenCms site that are not marked as internal.The result list contains objects of type
CmsPublishedResource
.- Parameters:
cms
- the cms context- Returns:
- all resources within the current OpenCms site that are not marked as internal
- Throws:
CmsException
- if something goes wrong
-
performEventPublishProject
Description copied from interface:I_CmsStaticExportHandler
Scrubs files from the export folder that might have been changed.- Specified by:
performEventPublishProject
in interfaceI_CmsStaticExportHandler
- Specified by:
performEventPublishProject
in classA_CmsStaticExportHandler
- Parameters:
publishHistoryId
- the
of the published projectCmsUUID
report
- an
instance to print output message, orI_CmsReport
null
to write messages to the log file- See Also:
-
exportAfterPublish
protected void exportAfterPublish(CmsUUID publishHistoryId, I_CmsReport report) throws CmsException, IOException, javax.servlet.ServletException Starts the static export on publish.Exports all modified resources after a publish process into the real FS.
- Parameters:
publishHistoryId
- the publichHistoryId of the published projectreport
- an
instance to print output message, orI_CmsReport
null
to write messages to the log file- Throws:
CmsException
- in case of errors accessing the VFSIOException
- in case of errors writing to the export output streamjavax.servlet.ServletException
- in case of errors accessing the servlet
-
exportNonTemplateResources
protected boolean exportNonTemplateResources(CmsObject cms, List<CmsPublishedResource> publishedResources, I_CmsReport report) throws CmsException, IOException, javax.servlet.ServletException Exports all non template resources found in a list of published resources.- Parameters:
cms
- the current cms objectpublishedResources
- the list of published resourcesreport
- an I_CmsReport instance to print output message, or null to write messages to the log file- Returns:
- true if some template resources were found while looping the list of published resources
- Throws:
CmsException
- in case of errors accessing the VFSIOException
- in case of errors writing to the export output streamjavax.servlet.ServletException
- in case of errors accessing the servlet
-
exportTemplateResource
protected int exportTemplateResource(CmsStaticExportData data, StringBuffer cookies) throws IOException Exports a single (template) resource specified by its export data.- Parameters:
data
- the export datacookies
- cookies to keep the session- Returns:
- the status of the http request used to perform the export
- Throws:
IOException
- if the http request fails
-
exportTemplateResources
protected void exportTemplateResources(CmsObject cms, List<String> publishedTemplateResources, I_CmsReport report) Exports all template resources found in a list of published resources.- Parameters:
cms
- the cms context, in the root site as Export userpublishedTemplateResources
- list of potential candidates to exportreport
- an I_CmsReport instance to print output message, or null to write messages to the log file
-
getRelatedFilesToPurge
Description copied from class:A_CmsStaticExportHandler
Returns a list of related files to purge.- Specified by:
getRelatedFilesToPurge
in classA_CmsStaticExportHandler
- Parameters:
exportFileName
- the previous exported rfs filename (already purged)vfsName
- the vfs name of the resource (to be used to compute more sofisticated sets of related files to purge- Returns:
- a list of related files to purge
- See Also:
-
getRelatedResources
protected List<CmsPublishedResource> getRelatedResources(CmsObject cms, List<CmsPublishedResource> publishedResources) throws CmsException Creates a list of
objects containing all related resources of the VFS tree.CmsPublishedResource
If the static export has been triggered by the OpenCms workplace, publishedResources is null and all resources in the VFS tree are returned.
If really an after publish static export is triggered, then only the related resources are returned.
- Parameters:
cms
- the current cms objectpublishedResources
- the list of published resources- Returns:
- list of CmsPulishedResource objects containing all resources of the VFS tree
- Throws:
CmsException
- in case of errors accessing the VFS
-
getSiblings
protected Set<CmsPublishedResource> getSiblings(CmsObject cms, CmsPublishedResource pubResource) throws CmsException Returns all siblings of the published resource as list ofCmsPublishedResource
.- Parameters:
cms
- the cms objectpubResource
- the published resource- Returns:
- all siblings of the published resource
- Throws:
CmsException
- if something goes wrong
-
readNonTemplateResourcesToExport
protected boolean readNonTemplateResourcesToExport(CmsObject cms, List<CmsPublishedResource> publishedResources, List<CmsStaticExportData> resourcesToExport) throws CmsException Returns all non template resources found in a list of published resources.- Parameters:
cms
- the current cms objectpublishedResources
- the list of published resourcesresourcesToExport
- the list of non-template resources- Returns:
true
if some template resources were found while looping the list of published resources- Throws:
CmsException
- in case of errors accessing the VFS
-