Package org.opencms.db
Class CmsTempFolderExportPointDriver
java.lang.Object
org.opencms.db.CmsExportPointDriver
org.opencms.db.CmsTempFolderExportPointDriver
- All Implemented Interfaces:
I_CmsExportPointDriver
An alternative export point driver which replaces the RFS targets of some export points with locations in a temporary export folder.
This is designed specifically for export points which map to WEB-INF/lib and WEB-INF/classes. The problem with these is that replacing
jar files or classes does not work at runtime. If these files are written to a temp folder (which is not picked up by the servlet coontainer's
class loader) instead, an external script can be used to update the actual export point locations based on the temp folder while the servlet
container is stopped.
Since the script needs to know which files to delete in the 'real' (not temporary) export point locations, deletions of files which are mapped
to the temp export point folder are not handled by deleting the files in that folder, but rather by replacing them with "dummy" files containing
a specific marker string (which is contained in the DELETE_MARKER variable), so the script that updates the 'real' folder needs to delete files
if it comes across a file starting with that marker string.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The content to be used for dummy files in the temporary export point folders which represent deleted files.protected static byte[]
The byte array used to mark files as deleted.static final String
The temp folder for export points.Fields inherited from class org.opencms.db.CmsExportPointDriver
m_exportpointLookupMap, m_exportpoints
-
Constructor Summary
ConstructorDescriptionCmsTempFolderExportPointDriver
(Set<CmsExportPoint> exportpoints, List<String> tempFolderDestinations) Constructor for a CmsExportPointDriver. -
Method Summary
Methods inherited from class org.opencms.db.CmsExportPointDriver
createFolder, getExportPoint, getExportPointFile, getExportPointPaths, writeResource, writeResource
-
Field Details
-
DELETE_MARKER
The content to be used for dummy files in the temporary export point folders which represent deleted files.- See Also:
-
DELETE_MARKER_BYTES
The byte array used to mark files as deleted. -
TEMP_EXPORTPOINT_FOLDER
The temp folder for export points.- See Also:
-
-
Constructor Details
-
CmsTempFolderExportPointDriver
public CmsTempFolderExportPointDriver(Set<CmsExportPoint> exportpoints, List<String> tempFolderDestinations) Constructor for a CmsExportPointDriver.- Parameters:
exportpoints
- the list of export pointstempFolderDestinations
- the export point destinations (relative to the web application folder) which should be replaced with
-
-
Method Details
-
deleteResource
Description copied from class:CmsExportPointDriver
Deletes a file or a folder in the real file sytem.If the given resource name points to a folder, then this folder is only deleted if it is empty. This is required since the same export point RFS target folder may be used by multiple export points. For example, this is usually the case with the
/WEB-INF/classes/
and/WEB-INF/lib/
folders which are export point for multiple modules. If all resources in the RFS target folder where deleted, uninstalling one module would delete the exportclasses
andlib
resources of all other modules.- Specified by:
deleteResource
in interfaceI_CmsExportPointDriver
- Overrides:
deleteResource
in classCmsExportPointDriver
- Parameters:
resourceName
- the root path of the resource to be deletedexportpoint
- the name of the export point- See Also:
-
writeFile
Description copied from class:CmsExportPointDriver
Writes the file with the given root path to the real file system.If required, missing parent folders in the real file system are automatically created.
- Specified by:
writeFile
in interfaceI_CmsExportPointDriver
- Overrides:
writeFile
in classCmsExportPointDriver
- Parameters:
resourceName
- the root path of the file to writeexportpoint
- the export point to write file tocontent
- the contents of the file to write- See Also:
-