Package org.opencms.importexport
Class CmsExportHelper
java.lang.Object
org.opencms.importexport.CmsExportHelper
Wrapper to write exported OpenCms resources either to a .ZIP file or to the file system.
- Since:
- 7.5.1
- 
Constructor SummaryConstructorsConstructorDescriptionCmsExportHelper(String exportPath, boolean exportAsFiles, boolean validateXml) Creates a new export helper.
- 
Method SummaryModifier and TypeMethodDescriptionvoidEnsures the zip stream is closed (if there is one).protected StringgetRfsFileName(String name) Returns the RFS file name for the given OpenCms VFS file name.org.dom4j.io.SAXWriterReturns the SAX writer for the Manifest file.protected voidremoveOldExport(String exportPath) Removes the old export output, which may be an existing file or directory.voidWrites a single OpenCms VFS file to the export.protected voidwriteFile2Rfs(CmsFile file, String name) Writes a single OpenCms VFS file to the RFS export.protected voidwriteFile2Zip(CmsFile file, String name) Writes a single OpenCms VFS file to the ZIP export.voidwriteManifest(CmsXmlSaxWriter xmlSaxWriter) Writes the OpenCms manifest.xml file to the export.protected voidwriteManifest2Rfs(CmsXmlSaxWriter xmlSaxWriter) Writes the OpenCms manifest.xml file to the RFS export.protected voidwriteManifest2Zip(CmsXmlSaxWriter xmlSaxWriter) Writes the OpenCms manifest.xml file to the ZIP export.
- 
Constructor Details- 
CmsExportHelperpublic CmsExportHelper(String exportPath, boolean exportAsFiles, boolean validateXml) throws SAXException, IOException Creates a new export helper.- Parameters:
- exportPath- the export path
- exportAsFiles- indicates if the resources should be exported as individual files or in one big ZIP file
- validateXml- indicates of the manifest.xml should be validated
- Throws:
- SAXException- in case of issues creating the manifest.xml
- IOException- in case of file access issues
 
 
- 
- 
Method Details- 
ensureZipStreamClosedEnsures the zip stream is closed (if there is one).
- 
getSaxWriterReturns the SAX writer for the Manifest file.- Returns:
- the SAX writer for the Manifest file
 
- 
writeFileWrites a single OpenCms VFS file to the export.- Parameters:
- file- the OpenCms VFS file to write
- name- the name of the file in the export
- Throws:
- IOException- in case of file access issues
 
- 
writeManifestWrites the OpenCms manifest.xml file to the export.- Parameters:
- xmlSaxWriter- the SAX writer to use
- Throws:
- SAXException- in case of issues creating the manifest.xml
- IOException- in case of file access issues
 
- 
getRfsFileNameReturns the RFS file name for the given OpenCms VFS file name.- Parameters:
- name- the OpenCms VFS file name
- Returns:
- the RFS file name for the given OpenCms VFS file name
 
- 
removeOldExportRemoves the old export output, which may be an existing file or directory.- Parameters:
- exportPath- the export output path
 
- 
writeFile2RfsWrites a single OpenCms VFS file to the RFS export.- Parameters:
- file- the OpenCms VFS file to write
- name- the name of the file in the export
- Throws:
- IOException- in case of file access issues
 
- 
writeFile2ZipWrites a single OpenCms VFS file to the ZIP export.- Parameters:
- file- the OpenCms VFS file to write
- name- the name of the file in the export
- Throws:
- IOException- in case of file access issues
 
- 
writeManifest2RfsWrites the OpenCms manifest.xml file to the RFS export.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. - Parameters:
- xmlSaxWriter- the SAX writer to use
- Throws:
- SAXException- in case of issues creating the manifest.xml
- IOException- in case of issues closing the file writer
 
- 
writeManifest2ZipWrites the OpenCms manifest.xml file to the ZIP export.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. - Parameters:
- xmlSaxWriter- the SAX writer to use
- Throws:
- SAXException- in case of issues creating the manifest.xml
- IOException- in case of file access issues
 
 
-