public class CmsExportHelper
extends java.lang.Object
构造器和说明 |
---|
CmsExportHelper(java.lang.String exportPath,
boolean exportAsFiles,
boolean validateXml)
Creates a new export helper.
|
限定符和类型 | 方法和说明 |
---|---|
protected java.lang.String |
getRfsFileName(java.lang.String name)
Returns the RFS file name for the given OpenCms VFS file name.
|
org.dom4j.io.SAXWriter |
getSaxWriter()
Returns the SAX writer for the Manifest file.
|
protected void |
removeOldExport(java.lang.String exportPath)
Removes the old export output, which may be an existing file or directory.
|
void |
writeFile(CmsFile file,
java.lang.String name)
Writes a single OpenCms VFS file to the export.
|
protected void |
writeFile2Rfs(CmsFile file,
java.lang.String name)
Writes a single OpenCms VFS file to the RFS export.
|
protected void |
writeFile2Zip(CmsFile file,
java.lang.String name)
Writes a single OpenCms VFS file to the ZIP export.
|
void |
writeManifest(CmsXmlSaxWriter xmlSaxWriter)
Writes the OpenCms manifest.xml file to the export.
|
protected void |
writeManifest2Rfs(CmsXmlSaxWriter xmlSaxWriter)
Writes the OpenCms manifest.xml file to the RFS export.
|
protected void |
writeManifest2Zip(CmsXmlSaxWriter xmlSaxWriter)
Writes the OpenCms manifest.xml file to the ZIP export.
|
public CmsExportHelper(java.lang.String exportPath, boolean exportAsFiles, boolean validateXml) throws org.xml.sax.SAXException, java.io.IOException
exportPath
- the export pathexportAsFiles
- indicates if the resources should be exported as individual files or in one big ZIP filevalidateXml
- indicates of the manifest.xml should be validatedorg.xml.sax.SAXException
- in case of issues creating the manifest.xmljava.io.IOException
- in case of file access issuespublic org.dom4j.io.SAXWriter getSaxWriter()
public void writeFile(CmsFile file, java.lang.String name) throws java.io.IOException
file
- the OpenCms VFS file to writename
- the name of the file in the exportjava.io.IOException
- in case of file access issuespublic void writeManifest(CmsXmlSaxWriter xmlSaxWriter) throws java.io.IOException, org.xml.sax.SAXException
xmlSaxWriter
- the SAX writer to useorg.xml.sax.SAXException
- in case of issues creating the manifest.xmljava.io.IOException
- in case of file access issuesprotected java.lang.String getRfsFileName(java.lang.String name)
name
- the OpenCms VFS file nameprotected void removeOldExport(java.lang.String exportPath)
exportPath
- the export output pathprotected void writeFile2Rfs(CmsFile file, java.lang.String name) throws java.io.IOException
file
- the OpenCms VFS file to writename
- the name of the file in the exportjava.io.IOException
- in case of file access issuesprotected void writeFile2Zip(CmsFile file, java.lang.String name) throws java.io.IOException
file
- the OpenCms VFS file to writename
- the name of the file in the exportjava.io.IOException
- in case of file access issuesprotected void writeManifest2Rfs(CmsXmlSaxWriter xmlSaxWriter) throws org.xml.sax.SAXException, java.io.IOException
In case of the RFS export the file is directly written to a file output stream, so calling this method just closes the XML and finishes the stream.
xmlSaxWriter
- the SAX writer to useorg.xml.sax.SAXException
- in case of issues creating the manifest.xmljava.io.IOException
- in case of issues closing the file writerprotected void writeManifest2Zip(CmsXmlSaxWriter xmlSaxWriter) throws java.io.IOException, org.xml.sax.SAXException
In case of the ZIP export the manifest is written to an internal StringBuffer first, which is then stored in the ZIP file when this method is called.
xmlSaxWriter
- the SAX writer to useorg.xml.sax.SAXException
- in case of issues creating the manifest.xmljava.io.IOException
- in case of file access issues