Package org.opencms.db
Class CmsExportPointDriver
- java.lang.Object
-
- org.opencms.db.CmsExportPointDriver
-
- All Implemented Interfaces:
I_CmsExportPointDriver
- Direct Known Subclasses:
CmsTempFolderExportPointDriver
public class CmsExportPointDriver extends java.lang.Object implements I_CmsExportPointDriver
Provides methods to write export points to the "real" file system.- Since:
- 6.0.0
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Map<java.lang.String,java.lang.String>
m_exportpointLookupMap
The export points resolved to a lookup map.protected java.util.Set<CmsExportPoint>
m_exportpoints
The configured export points.
-
Constructor Summary
Constructors Modifier Constructor Description protected
CmsExportPointDriver()
Empty default constructor, necessary for subclasses which may need to do initialization differently.CmsExportPointDriver(java.util.Set<CmsExportPoint> exportpoints)
Constructor for a CmsExportPointDriver.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
createFolder(java.lang.String resourceName, java.lang.String exportpoint)
If required, creates the folder with the given root path in the real file system.void
deleteResource(java.lang.String resourceName, java.lang.String exportpoint)
Deletes a file or a folder in the real file sytem.java.lang.String
getExportPoint(java.lang.String rootPath)
Returns the export point path for the given resource root path, ornull
if the resource is not contained in any export point.protected java.io.File
getExportPointFile(java.lang.String rootPath, java.lang.String exportpoint)
Returns the File for the given export point resource.java.util.Set<java.lang.String>
getExportPointPaths()
Returns the set of all VFS paths that are exported as an export point.void
writeFile(java.lang.String resourceName, java.lang.String exportpoint, byte[] content)
Writes the file with the given root path to the real file system.protected void
writeResource(java.io.File file, byte[] content)
Writes file data to the RFS.protected void
writeResource(java.lang.String resourceName, java.lang.String exportpoint, byte[] content)
Writes (if required creates) a resource with the given name to the real file system.
-
-
-
Field Detail
-
m_exportpointLookupMap
protected java.util.Map<java.lang.String,java.lang.String> m_exportpointLookupMap
The export points resolved to a lookup map.
-
m_exportpoints
protected java.util.Set<CmsExportPoint> m_exportpoints
The configured export points.
-
-
Constructor Detail
-
CmsExportPointDriver
public CmsExportPointDriver(java.util.Set<CmsExportPoint> exportpoints)
Constructor for a CmsExportPointDriver.- Parameters:
exportpoints
- the list of export points
-
CmsExportPointDriver
protected CmsExportPointDriver()
Empty default constructor, necessary for subclasses which may need to do initialization differently.
-
-
Method Detail
-
createFolder
public void createFolder(java.lang.String resourceName, java.lang.String exportpoint)
If required, creates the folder with the given root path in the real file system.- Specified by:
createFolder
in interfaceI_CmsExportPointDriver
- Parameters:
resourceName
- the root path of the folder to createexportpoint
- the export point to create the folder in
-
deleteResource
public void deleteResource(java.lang.String resourceName, java.lang.String exportpoint)
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
- Parameters:
resourceName
- the root path of the resource to be deletedexportpoint
- the name of the export point
-
getExportPoint
public java.lang.String getExportPoint(java.lang.String rootPath)
Returns the export point path for the given resource root path, ornull
if the resource is not contained in any export point.- Specified by:
getExportPoint
in interfaceI_CmsExportPointDriver
- Parameters:
rootPath
- the root path of a resource in the OpenCms VFS- Returns:
- the export point path for the given resource, or
null
if the resource is not contained in any export point
-
getExportPointPaths
public java.util.Set<java.lang.String> getExportPointPaths()
Returns the set of all VFS paths that are exported as an export point.- Specified by:
getExportPointPaths
in interfaceI_CmsExportPointDriver
- Returns:
- the set of all VFS paths that are exported as an export point
-
writeFile
public void writeFile(java.lang.String resourceName, java.lang.String exportpoint, byte[] content)
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
- Parameters:
resourceName
- the root path of the file to writeexportpoint
- the export point to write file tocontent
- the contents of the file to write
-
getExportPointFile
protected java.io.File getExportPointFile(java.lang.String rootPath, java.lang.String exportpoint)
Returns the File for the given export point resource.- Parameters:
rootPath
- name of a file in the VFSexportpoint
- the name of the export point- Returns:
- the File for the given export point resource
-
writeResource
protected void writeResource(java.io.File file, byte[] content)
Writes file data to the RFS.- Parameters:
file
- the RFS file locationcontent
- the file content
-
writeResource
protected void writeResource(java.lang.String resourceName, java.lang.String exportpoint, byte[] content)
Writes (if required creates) a resource with the given name to the real file system.- Parameters:
resourceName
- the root path of the resource to writeexportpoint
- the name of the export pointcontent
- the contents of the file to write
-
-