|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opencms.importexport.CmsExport
public class CmsExport
Provides the functionality to export files from the OpenCms VFS to a ZIP file.
The ZIP file written will contain a copy of all exported files with their contents.
It will also contain a manifest.xml
file in which all meta-information
about this files are stored, like permissions etc.
Constructor Summary | |
---|---|
CmsExport()
Constructs a new uninitialized export, required for special subclass data export. |
|
CmsExport(CmsObject cms,
I_CmsReport report)
Constructs a new export. |
|
CmsExport(CmsObject cms,
java.lang.String exportFile,
java.util.List resourcesToExport,
boolean includeSystem,
boolean includeUnchanged)
Deprecated. use the CmsExportParameters constructor instead |
|
CmsExport(CmsObject cms,
java.lang.String exportFile,
java.util.List resourcesToExport,
boolean includeSystem,
boolean includeUnchanged,
org.dom4j.Element moduleElement,
boolean exportUserdata,
long contentAge,
I_CmsReport report)
Deprecated. use the CmsExportParameters constructor instead |
|
CmsExport(CmsObject cms,
java.lang.String exportFile,
java.util.List resourcesToExport,
boolean includeSystem,
boolean includeUnchanged,
org.dom4j.Element moduleElement,
boolean exportUserdata,
long contentAge,
I_CmsReport report,
boolean recursive)
Deprecated. use the CmsExportParameters constructor instead |
Method Summary | |
---|---|
protected void |
addChildResources(java.lang.String folderName)
Exports the given folder and all child resources. |
protected void |
addFiles(java.util.List<java.lang.String> fileNames)
Adds all files in fileNames to the manifest.xml file. |
protected void |
addParentFolders(java.lang.String resourceName)
Adds the parent folders of the given resource to the config file, starting at the top, excluding the root folder. |
protected void |
addPropertyNode(org.dom4j.Element propertiesElement,
java.lang.String propertyName,
java.lang.String propertyValue,
boolean shared)
Adds a property node to the manifest.xml. |
protected void |
addRelationNode(org.dom4j.Element relationsElement,
java.lang.String structureId,
java.lang.String sitePath,
java.lang.String relationType)
Adds a relation node to the manifest.xml . |
protected void |
appendResourceToManifest(CmsResource resource,
boolean source)
Writes the data for a resource (like access-rights) to the manifest.xml file. |
protected boolean |
checkExportResource(java.lang.String resourcename)
Returns true if the checked resource name can be exported depending on the include settings. |
protected void |
closeExportFile(org.dom4j.Element exportNode)
Closes the export ZIP file and saves the XML document for the manifest. |
protected void |
digestElement(org.dom4j.Element parent,
org.dom4j.Element output)
Writes the output element to the XML output writer and detaches it from it's parent element. |
protected void |
exportAllResources(org.dom4j.Element parent,
java.util.List<java.lang.String> resourcesToExport)
Exports all resources and possible sub-folders form the provided list of resources. |
void |
exportData(CmsExportParameters parameters)
Export the data. |
protected void |
exportFile(CmsFile file)
Exports one single file with all its data and content. |
protected void |
exportGroup(org.dom4j.Element parent,
CmsGroup group)
Exports one single group with all it's data. |
protected void |
exportGroups(org.dom4j.Element parent,
CmsOrganizationalUnit orgunit)
Exports all groups of the given organizational unit. |
protected void |
exportOrgUnit(org.dom4j.Element parent,
CmsOrganizationalUnit orgunit)
Exports one single organizational unit with all it's data. |
protected void |
exportOrgUnits(org.dom4j.Element parent)
Exports all organizational units with all data. |
protected void |
exportProject(org.dom4j.Element parent,
CmsProject project)
Exports one single project with all it's data. |
protected void |
exportProjects(org.dom4j.Element parent)
Exports all projects with all data. |
protected void |
exportUser(org.dom4j.Element parent,
CmsUser user)
Exports one single user with all its data. |
protected void |
exportUsers(org.dom4j.Element parent,
CmsOrganizationalUnit orgunit)
Exports all users of the given organizational unit. |
protected CmsObject |
getCms()
Returns the OpenCms context object this export was initialized with. |
protected java.lang.String |
getExportFileName()
Returns the name of the export file. |
protected java.lang.String |
getExportNodeName()
Returns the name of the main export node. |
protected I_CmsReport |
getReport()
Returns the report to write progress messages to. |
protected java.lang.String |
getResourceNodeName()
Returns the name for the main resource node. |
protected org.dom4j.io.SAXWriter |
getSaxWriter()
Returns the SAX based xml writer to write the XML output to. |
protected boolean |
isIgnoredProperty(CmsProperty property)
Checks if a property should be written to the export or not. |
protected boolean |
isInExportableProject(CmsResource res)
Checks if a resource is belongs to the correct project for exporting. |
protected org.dom4j.Element |
openExportFile()
Opens the export ZIP file and initializes the internal XML document for the manifest. |
protected void |
setSaxWriter(org.dom4j.io.SAXWriter saxWriter)
Sets the SAX based XML writer to write the XML output to. |
protected java.lang.String |
trimResourceName(java.lang.String resourceName)
Cuts leading and trailing '/' from the given resource name. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CmsExport()
public CmsExport(CmsObject cms, I_CmsReport report) throws CmsRoleViolationException
cms
- the cms contextreport
- the report
CmsRoleViolationException
- if the current user has not the required rolepublic CmsExport(CmsObject cms, java.lang.String exportFile, java.util.List resourcesToExport, boolean includeSystem, boolean includeUnchanged) throws CmsImportExportException, CmsRoleViolationException
CmsExportParameters
constructor instead
cms
- the cmsObject to work withexportFile
- the file or folder to export toresourcesToExport
- the paths of folders and files to exportincludeSystem
- if true
, the system folder is includedincludeUnchanged
- true
, if unchanged files should be included
CmsImportExportException
- if something goes wrong
CmsRoleViolationException
- if the current user has not the required rolepublic CmsExport(CmsObject cms, java.lang.String exportFile, java.util.List resourcesToExport, boolean includeSystem, boolean includeUnchanged, org.dom4j.Element moduleElement, boolean exportUserdata, long contentAge, I_CmsReport report) throws CmsImportExportException, CmsRoleViolationException
CmsExportParameters
constructor instead
cms
- the cmsObject to work withexportFile
- the file or folder to export toresourcesToExport
- the paths of folders and files to exportincludeSystem
- if true
, the system folder is includedincludeUnchanged
- true
, if unchanged files should be includedmoduleElement
- module informations in a Node for module exportexportUserdata
- if true
, the user and group data will also be exportedcontentAge
- export contents changed after this date/timereport
- to handle the log messages
CmsImportExportException
- if something goes wrong
CmsRoleViolationException
- if the current user has not the required rolepublic CmsExport(CmsObject cms, java.lang.String exportFile, java.util.List resourcesToExport, boolean includeSystem, boolean includeUnchanged, org.dom4j.Element moduleElement, boolean exportUserdata, long contentAge, I_CmsReport report, boolean recursive) throws CmsImportExportException, CmsRoleViolationException
CmsExportParameters
constructor instead
cms
- the cmsObject to work withexportFile
- the file or folder to export toresourcesToExport
- the paths of folders and files to exportincludeSystem
- if true
, the system folder is includedincludeUnchanged
- true
, if unchanged files should be includedmoduleElement
- module informations in a Node for module exportexportUserdata
- if true
, the user and group data will also be exportedcontentAge
- export contents changed after this date/timereport
- to handle the log messagesrecursive
- recursive flag
CmsImportExportException
- if something goes wrong
CmsRoleViolationException
- if the current user has not the required roleMethod Detail |
---|
public void exportData(CmsExportParameters parameters) throws CmsImportExportException
parameters
- the export parameters
CmsImportExportException
- if something goes wrongprotected void addChildResources(java.lang.String folderName) throws CmsImportExportException, java.io.IOException, org.xml.sax.SAXException
folderName
- to complete path to the resource to export
CmsImportExportException
- if something goes wrong
org.xml.sax.SAXException
- if something goes wrong processing the manifest.xml
java.io.IOException
- if not all resources could be appended to the ZIP archiveprotected void addFiles(java.util.List<java.lang.String> fileNames) throws CmsImportExportException, java.io.IOException, org.xml.sax.SAXException
fileNames
- list of path Strings, e.g. /folder/index.html
CmsImportExportException
- if something goes wrong
java.io.IOException
- if a file could not be exported
org.xml.sax.SAXException
- if something goes wrong processing the manifest.xmlprotected void addParentFolders(java.lang.String resourceName) throws CmsImportExportException, org.xml.sax.SAXException
resourceName
- the name of a resource in the VFS
CmsImportExportException
- if something goes wrong
org.xml.sax.SAXException
- if something goes wrong processing the manifest.xmlprotected void addPropertyNode(org.dom4j.Element propertiesElement, java.lang.String propertyName, java.lang.String propertyValue, boolean shared)
propertiesElement
- the parent element to append the node topropertyName
- the name of the propertypropertyValue
- the value of the propertyshared
- if true
, add a shared property attribute to the generated property nodeprotected void addRelationNode(org.dom4j.Element relationsElement, java.lang.String structureId, java.lang.String sitePath, java.lang.String relationType)
manifest.xml
.
relationsElement
- the parent element to append the node tostructureId
- the structure id of the target relationsitePath
- the site path of the target relationrelationType
- the type of the relationprotected void appendResourceToManifest(CmsResource resource, boolean source) throws CmsImportExportException, org.xml.sax.SAXException
manifest.xml
file.
resource
- the resource to get the data fromsource
- flag to show if the source information in the xml file must be written
CmsImportExportException
- if something goes wrong
org.xml.sax.SAXException
- if something goes wrong processing the manifest.xmlprotected boolean checkExportResource(java.lang.String resourcename)
resourcename
- the absolute path of the resource
protected void closeExportFile(org.dom4j.Element exportNode) throws java.io.IOException, org.xml.sax.SAXException
exportNode
- the export root node
org.xml.sax.SAXException
- if something goes wrong processing the manifest.xml
java.io.IOException
- if something goes wrong while closing the export fileprotected void digestElement(org.dom4j.Element parent, org.dom4j.Element output) throws org.xml.sax.SAXException
parent
- the parent elementoutput
- the output element
org.xml.sax.SAXException
- if something goes wrong processing the manifest.xmlprotected void exportAllResources(org.dom4j.Element parent, java.util.List<java.lang.String> resourcesToExport) throws CmsImportExportException, java.io.IOException, org.xml.sax.SAXException
parent
- the parent node to add the resources toresourcesToExport
- the list of resources to export
CmsImportExportException
- if something goes wrong
org.xml.sax.SAXException
- if something goes wrong processing the manifest.xml
java.io.IOException
- if not all resources could be appended to the ZIP archiveprotected void exportFile(CmsFile file) throws CmsImportExportException, org.xml.sax.SAXException, java.io.IOException
file
- the file to be exported
CmsImportExportException
- if something goes wrong
org.xml.sax.SAXException
- if something goes wrong processing the manifest.xml
java.io.IOException
- if the ZIP entry for the file could be appended to the ZIP archiveprotected void exportGroup(org.dom4j.Element parent, CmsGroup group) throws CmsImportExportException, org.xml.sax.SAXException
parent
- the parent node to add the groups togroup
- the group to be exported
CmsImportExportException
- if something goes wrong
org.xml.sax.SAXException
- if something goes wrong processing the manifest.xmlprotected void exportGroups(org.dom4j.Element parent, CmsOrganizationalUnit orgunit) throws CmsImportExportException, org.xml.sax.SAXException
parent
- the parent node to add the groups toorgunit
- the organizational unit to write the groups for
CmsImportExportException
- if something goes wrong
org.xml.sax.SAXException
- if something goes wrong processing the manifest.xmlprotected void exportOrgUnit(org.dom4j.Element parent, CmsOrganizationalUnit orgunit) throws org.xml.sax.SAXException, CmsException
parent
- the parent node to add the groups toorgunit
- the group to be exported
org.xml.sax.SAXException
- if something goes wrong processing the manifest.xml
CmsException
- if something goes wrong reading the data to exportprotected void exportOrgUnits(org.dom4j.Element parent) throws CmsImportExportException, org.xml.sax.SAXException
parent
- the parent node to add the organizational units to
CmsImportExportException
- if something goes wrong
org.xml.sax.SAXException
- if something goes wrong processing the manifest.xmlprotected void exportProject(org.dom4j.Element parent, CmsProject project) throws CmsImportExportException, org.xml.sax.SAXException
parent
- the parent node to add the project toproject
- the project to be exported
CmsImportExportException
- if something goes wrong
org.xml.sax.SAXException
- if something goes wrong processing the manifest.xmlprotected void exportProjects(org.dom4j.Element parent) throws CmsImportExportException, org.xml.sax.SAXException
parent
- the parent node to add the projects to
CmsImportExportException
- if something goes wrong
org.xml.sax.SAXException
- if something goes wrong processing the manifest.xmlprotected void exportUser(org.dom4j.Element parent, CmsUser user) throws CmsImportExportException, org.xml.sax.SAXException
parent
- the parent node to add the users touser
- the user to be exported
CmsImportExportException
- if something goes wrong
org.xml.sax.SAXException
- if something goes wrong processing the manifest.xmlprotected void exportUsers(org.dom4j.Element parent, CmsOrganizationalUnit orgunit) throws CmsImportExportException, org.xml.sax.SAXException
parent
- the parent node to add the users toorgunit
- the organizational unit to write the groups for
CmsImportExportException
- if something goes wrong
org.xml.sax.SAXException
- if something goes wrong processing the manifest.xmlprotected CmsObject getCms()
protected java.lang.String getExportFileName()
protected java.lang.String getExportNodeName()
protected I_CmsReport getReport()
protected java.lang.String getResourceNodeName()
protected org.dom4j.io.SAXWriter getSaxWriter()
protected boolean isIgnoredProperty(CmsProperty property)
property
- the property to check
protected boolean isInExportableProject(CmsResource res)
res
- the resource to check
true
, if the resource can be exported, false otherwiseprotected org.dom4j.Element openExportFile() throws java.io.IOException, org.xml.sax.SAXException
org.xml.sax.SAXException
- if something goes wrong processing the manifest.xml
java.io.IOException
- if something goes wrong while closing the export fileprotected void setSaxWriter(org.dom4j.io.SAXWriter saxWriter)
saxWriter
- the SAX based XML writer to write the XML output toprotected java.lang.String trimResourceName(java.lang.String resourceName)
resourceName
- the absolute path of a resource
|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |