Package org.opencms.module
Class CmsModuleImportExportHandler
java.lang.Object
org.opencms.module.CmsModuleImportExportHandler
- All Implemented Interfaces:
I_CmsImportExportHandler
Import/export handler implementation for Cms modules.
- Since:
- 6.0.0
-
Constructor Summary
ConstructorDescriptionCreates a new Cms module import/export handler. -
Method Summary
Modifier and TypeMethodDescriptionvoid
exportData
(CmsObject cms, I_CmsReport report) Exports the data from the Cms.Returns the VFS resources to be exported additionally with the module.Returns the description of this import/export handler.static CmsModuleImportExportHandler
getExportHandler
(CmsObject cms, CmsModule module, String handlerDescription) Gets the module export handler containing all resources used in the module export.Returns the name of the export file in the real file system.Returns the import parameters.Returns the (package) name of the module to be exported.Returns the VFS resources to be exported additionally with the module as a list.void
importData
(CmsObject cms, String importFile, String importPath, I_CmsReport report) Deprecated.void
importData
(CmsObject cms, I_CmsReport report) Imports the data into the Cms.boolean
matches
(org.dom4j.Document manifest) Checks, if this import/export handler matches with a specified manifest document of an import, so that it is able to import the data listed in the manifest document.static CmsModule
readModuleFromImport
(String importResource) Reads a module object from an external file source.static CmsModule
readModuleFromManifest
(byte[] manifest) Reads a module object from an external file source.static void
reportBeginImport
(I_CmsReport report, String modulePackageName) Writes the messages for starting an import to the given report.static void
reportEndImport
(I_CmsReport report) Writes the messages for finishing an import to the given report.void
setAdditionalResources
(String[] resources) Sets the VFS resources to be exported additionally with the module.void
setDescription
(String description) Sets the description of this import/export handler.void
setFileName
(String fileName) Sets the name of the export file in the real file system.void
setImportParameters
(CmsImportParameters importParams) Sets the import parameters.void
setModule
(CmsModuleXmlHandler moduleHandler) Will be called by the digester if a module was imported.void
setModuleName
(String moduleName) Sets the (package) name of the module to be exported.
-
Constructor Details
-
CmsModuleImportExportHandler
public CmsModuleImportExportHandler()Creates a new Cms module import/export handler.
-
-
Method Details
-
getExportHandler
public static CmsModuleImportExportHandler getExportHandler(CmsObject cms, CmsModule module, String handlerDescription) Gets the module export handler containing all resources used in the module export.- Parameters:
cms
- theCmsObject
used by to set up the handler. The object's site root might be adjusted to the import site of the module.module
- The module to exporthandlerDescription
- A description of the export handler, shown when the export thread using the handler runs.- Returns:
- CmsModuleImportExportHandler with all module resources
-
readModuleFromImport
public static CmsModule readModuleFromImport(String importResource) throws CmsConfigurationException Reads a module object from an external file source.- Parameters:
importResource
- the name of the input source- Returns:
- the imported module
- Throws:
CmsConfigurationException
- if the module could not be imported
-
readModuleFromManifest
Reads a module object from an external file source.- Parameters:
manifest
- the manifest data- Returns:
- the imported module
- Throws:
CmsConfigurationException
- if the module could not be imported
-
reportBeginImport
Writes the messages for starting an import to the given report.- Parameters:
report
- the report to write tomodulePackageName
- the module name
-
reportEndImport
Writes the messages for finishing an import to the given report.- Parameters:
report
- the report to write to
-
exportData
public void exportData(CmsObject cms, I_CmsReport report) throws CmsConfigurationException, CmsImportExportException, CmsRoleViolationException Description copied from interface:I_CmsImportExportHandler
Exports the data from the Cms.- Specified by:
exportData
in interfaceI_CmsImportExportHandler
- Parameters:
cms
- the current OpenCms context objectreport
- a Cms report to print log messages- Throws:
CmsConfigurationException
- if a specified module to be exported does not existCmsImportExportException
- if operation was not successfulCmsRoleViolationException
- if the current user has not the required role- See Also:
-
getAdditionalResources
Returns the VFS resources to be exported additionally with the module.- Returns:
- the VFS resources to be exported additionally with the module
-
getDescription
Description copied from interface:I_CmsImportExportHandler
Returns the description of this import/export handler.The description is useful to print some info about the purpose of this handler.
- Specified by:
getDescription
in interfaceI_CmsImportExportHandler
- Returns:
- the description of this import/export handler
- See Also:
-
getFileName
Returns the name of the export file in the real file system.- Returns:
- the name of the export file in the real file system
-
getImportParameters
Returns the import parameters.- Specified by:
getImportParameters
in interfaceI_CmsImportExportHandler
- Returns:
- the import parameters
-
getModuleName
Returns the (package) name of the module to be exported.- Returns:
- the (package) name of the module to be exported
-
getResourcesAsList
Returns the VFS resources to be exported additionally with the module as a list.- Returns:
- the VFS resources to be exported additionally with the module as a list
-
importData
public void importData(CmsObject cms, I_CmsReport report) throws CmsXmlException, CmsImportExportException, CmsRoleViolationException, CmsException Description copied from interface:I_CmsImportExportHandler
Imports the data into the Cms.- Specified by:
importData
in interfaceI_CmsImportExportHandler
- Parameters:
cms
- the current OpenCms context objectreport
- a Cms report to print log messages- Throws:
CmsXmlException
- if the manifest of the import could not be unmarshalledCmsImportExportException
- if operation was not successfulCmsRoleViolationException
- if the current user has not the required roleCmsException
- in case of errors accessing the VFS- See Also:
-
importData
@Deprecated public void importData(CmsObject cms, String importFile, String importPath, I_CmsReport report) throws CmsXmlException, CmsImportExportException, CmsRoleViolationException, CmsException Deprecated.useimportData(CmsObject, I_CmsReport)
insteadDescription copied from interface:I_CmsImportExportHandler
Imports the data into the Cms.- Specified by:
importData
in interfaceI_CmsImportExportHandler
- Parameters:
cms
- the current OpenCms context objectimportFile
- the name (absolute path) of the resource (zip file or folder) to be importedimportPath
- the name (absolute path) of the destination folder in the Cms (if required)report
- a Cms report to print log messages- Throws:
CmsXmlException
- if the manifest of the import could not be unmarshalledCmsImportExportException
- if operation was not successfulCmsRoleViolationException
- if the current user has not the required roleCmsException
- in case of errors accessing the VFS- See Also:
-
matches
Description copied from interface:I_CmsImportExportHandler
Checks, if this import/export handler matches with a specified manifest document of an import, so that it is able to import the data listed in the manifest document.- Specified by:
matches
in interfaceI_CmsImportExportHandler
- Parameters:
manifest
- the manifest.xml of the import as a dom4j XML document- Returns:
- true, this handler is able to import the data listed in the manifest document
- See Also:
-
setAdditionalResources
Sets the VFS resources to be exported additionally with the module.- Parameters:
resources
- the VFS resources to be exported additionally with the module
-
setDescription
Description copied from interface:I_CmsImportExportHandler
Sets the description of this import/export handler.The description is useful to print some info about the purpose of this handler.
- Specified by:
setDescription
in interfaceI_CmsImportExportHandler
- Parameters:
description
- the description of this import/export handler- See Also:
-
setFileName
Sets the name of the export file in the real file system.- Parameters:
fileName
- the name of the export file in the real file system
-
setImportParameters
Sets the import parameters.- Specified by:
setImportParameters
in interfaceI_CmsImportExportHandler
- Parameters:
importParams
- the parameters to set
-
setModule
Will be called by the digester if a module was imported.- Parameters:
moduleHandler
- contains the imported module
-
setModuleName
Sets the (package) name of the module to be exported.- Parameters:
moduleName
- the (package) name of the module to be exported
-
importData(CmsObject, I_CmsReport)
instead