org.opencms.module
Class CmsModuleImportExportHandler

java.lang.Object
  extended by org.opencms.module.CmsModuleImportExportHandler
All Implemented Interfaces:
I_CmsImportExportHandler

public class CmsModuleImportExportHandler
extends java.lang.Object
implements I_CmsImportExportHandler

Import/export handler implementation for Cms modules.

Since:
6.0.0
Version:
$Revision: 1.41 $
Author:
Thomas Weckert

Constructor Summary
CmsModuleImportExportHandler()
          Creates a new Cms module import/export handler.
 
Method Summary
 void exportData(CmsObject cms, I_CmsReport report)
          Exports the data from the Cms.
protected  void finalize()
           
 java.util.List getAdditionalResources()
          Returns the VFS resources to be exported additionally with the module.
 java.lang.String getDescription()
          Returns the description of this import/export handler.
 java.lang.String getFileName()
          Returns the name of the export file in the real file system.
 CmsImportParameters getImportParameters()
          Returns the import parameters.
 java.lang.String getModuleName()
          Returns the (package) name of the module to be exported.
 java.util.List getResourcesAsList()
          Returns the VFS resources to be exported additionally with the module as a list.
 void importData(CmsObject cms, I_CmsReport report)
          Imports the data into the Cms.
 void importData(CmsObject cms, java.lang.String importFile, java.lang.String importPath, I_CmsReport report)
          Deprecated. use importData(CmsObject, I_CmsReport) instead
 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(java.lang.String importResource)
          Reads a module object from an external file source.
 void setAdditionalResources(java.lang.String[] resources)
          Sets the VFS resources to be exported additionally with the module.
 void setDescription(java.lang.String description)
          Sets the description of this import/export handler.
 void setFileName(java.lang.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(java.lang.String moduleName)
          Sets the (package) name of the module to be exported.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CmsModuleImportExportHandler

public CmsModuleImportExportHandler()
Creates a new Cms module import/export handler.

Method Detail

readModuleFromImport

public static CmsModule readModuleFromImport(java.lang.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

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 interface I_CmsImportExportHandler
Parameters:
cms - the current OpenCms context object
report - a Cms report to print log messages
Throws:
CmsConfigurationException - if a specified module to be exported does not exist
CmsImportExportException - if operation was not successful
CmsRoleViolationException - if the current user has not the required role
See Also:
I_CmsImportExportHandler.exportData(org.opencms.file.CmsObject, org.opencms.report.I_CmsReport)

getAdditionalResources

public java.util.List getAdditionalResources()
Returns the VFS resources to be exported additionally with the module.

Returns:
the VFS resources to be exported additionally with the module

getDescription

public java.lang.String 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 interface I_CmsImportExportHandler
Returns:
the description of this import/export handler
See Also:
I_CmsImportExportHandler.getDescription()

getFileName

public java.lang.String 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

public CmsImportParameters getImportParameters()
Returns the import parameters.

Specified by:
getImportParameters in interface I_CmsImportExportHandler
Returns:
the import parameters

getModuleName

public java.lang.String getModuleName()
Returns the (package) name of the module to be exported.

Returns:
the (package) name of the module to be exported

getResourcesAsList

public java.util.List 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 interface I_CmsImportExportHandler
Parameters:
cms - the current OpenCms context object
report - a Cms report to print log messages
Throws:
CmsXmlException - if the manifest of the import could not be unmarshalled
CmsImportExportException - if operation was not successful
CmsRoleViolationException - if the current user has not the required role
CmsException - in case of errors accessing the VFS
See Also:
I_CmsImportExportHandler.importData(CmsObject, I_CmsReport)

importData

public void importData(CmsObject cms,
                       java.lang.String importFile,
                       java.lang.String importPath,
                       I_CmsReport report)
                throws CmsXmlException,
                       CmsImportExportException,
                       CmsRoleViolationException,
                       CmsException
Deprecated. use importData(CmsObject, I_CmsReport) instead

Description copied from interface: I_CmsImportExportHandler
Imports the data into the Cms.

Specified by:
importData in interface I_CmsImportExportHandler
Parameters:
cms - the current OpenCms context object
importFile - the name (absolute path) of the resource (zip file or folder) to be imported
importPath - 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 unmarshalled
CmsImportExportException - if operation was not successful
CmsRoleViolationException - if the current user has not the required role
CmsException - in case of errors accessing the VFS
See Also:
I_CmsImportExportHandler.importData(org.opencms.file.CmsObject, java.lang.String, java.lang.String, org.opencms.report.I_CmsReport)

matches

public boolean matches(org.dom4j.Document manifest)
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 interface I_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:
I_CmsImportExportHandler.matches(org.dom4j.Document)

setAdditionalResources

public void setAdditionalResources(java.lang.String[] resources)
Sets the VFS resources to be exported additionally with the module.

Parameters:
resources - the VFS resources to be exported additionally with the module

setDescription

public void setDescription(java.lang.String description)
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 interface I_CmsImportExportHandler
Parameters:
description - the description of this import/export handler
See Also:
I_CmsImportExportHandler.setDescription(java.lang.String)

setFileName

public void setFileName(java.lang.String fileName)
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

public void setImportParameters(CmsImportParameters importParams)
Sets the import parameters.

Specified by:
setImportParameters in interface I_CmsImportExportHandler
Parameters:
importParams - the parameters to set

setModule

public void setModule(CmsModuleXmlHandler moduleHandler)
Will be called by the digester if a module was imported.

Parameters:
moduleHandler - contains the imported module

setModuleName

public void setModuleName(java.lang.String moduleName)
Sets the (package) name of the module to be exported.

Parameters:
moduleName - the (package) name of the module to be exported

finalize

protected void finalize()
                 throws java.lang.Throwable
Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable
See Also:
Object.finalize()