/** * Writes a single OpenCms VFS file to the RFS export.<p> * * @param file the OpenCms VFS file to write * @param name the name of the file in the export * * @throws IOException in case of file access issues */ protected void writeFile2Rfs(CmsFile file, String name) throws IOException { String fileName = getRfsFileName(name); File rfsFile = new File(fileName); if (!rfsFile.getParentFile().exists()) { rfsFile.getParentFile().mkdirs(); } rfsFile.createNewFile(); FileOutputStream rfsFileOut = new FileOutputStream(rfsFile); rfsFileOut.write(file.getContents()); rfsFileOut.close(); }
/** * Writes a single OpenCms VFS file to the export.<p> * * @param file the OpenCms VFS file to write * @param name the name of the file in the export * * @throws IOException in case of file access issues */ public void writeFile(CmsFile file, String name) throws IOException { if (m_isExportAsFiles) { writeFile2Rfs(file, name); } else { writeFile2Zip(file, name); } }
/** * Writes the OpenCms manifest.xml file to the export.<p> * * @param xmlSaxWriter the SAX writer to use * * @throws SAXException in case of issues creating the manifest.xml * @throws IOException in case of file access issues */ public void writeManifest(CmsXmlSaxWriter xmlSaxWriter) throws IOException, SAXException { if (m_isExportAsFiles) { writeManifest2Rfs(xmlSaxWriter); } else { writeManifest2Zip(xmlSaxWriter); } }
m_exportWriter = new CmsExportHelper( getExportFileName(), m_parameters.isExportAsFiles(), m_parameters.isXmlValidation()); setSaxWriter(m_exportWriter.getSaxWriter());
m_isExportAsFiles = exportAsFiles; removeOldExport(exportPath); m_exportPath = m_exportPath + "/"; String fileName = getRfsFileName(CmsImportExportManager.EXPORT_MANIFEST); File rfsFile = new File(fileName); rfsFile.getParentFile().mkdirs();
/** * Closes the export ZIP file and saves the XML document for the manifest.<p> * * @param exportNode the export root node * * @throws SAXException if something goes wrong processing the manifest.xml * @throws IOException if something goes wrong while closing the export file */ protected void closeExportFile(Element exportNode) throws IOException, SAXException { // close the <export> Tag getSaxWriter().writeClose(exportNode); // close the XML document CmsXmlSaxWriter xmlSaxWriter = (CmsXmlSaxWriter)getSaxWriter().getContentHandler(); // write the manifest file m_exportWriter.writeManifest(xmlSaxWriter); }
m_exportWriter.writeFile(file, source);
m_exportWriter = new CmsExportHelper( getExportFileName(), m_parameters.isExportAsFiles(), m_parameters.isXmlValidation()); setSaxWriter(m_exportWriter.getSaxWriter());
m_isExportAsFiles = exportAsFiles; removeOldExport(exportPath); m_exportPath = m_exportPath + "/"; String fileName = getRfsFileName(CmsImportExportManager.EXPORT_MANIFEST); File rfsFile = new File(fileName); rfsFile.getParentFile().mkdirs();
/** * Closes the export ZIP file and saves the XML document for the manifest.<p> * * @param exportNode the export root node * * @throws SAXException if something goes wrong processing the manifest.xml * @throws IOException if something goes wrong while closing the export file */ protected void closeExportFile(Element exportNode) throws IOException, SAXException { // close the <export> Tag getSaxWriter().writeClose(exportNode); // close the XML document CmsXmlSaxWriter xmlSaxWriter = (CmsXmlSaxWriter)getSaxWriter().getContentHandler(); // write the manifest file m_exportWriter.writeManifest(xmlSaxWriter); }
m_exportWriter.writeFile(file, source);
/** * Writes a single OpenCms VFS file to the export.<p> * * @param file the OpenCms VFS file to write * @param name the name of the file in the export * * @throws IOException in case of file access issues */ public void writeFile(CmsFile file, String name) throws IOException { if (m_isExportAsFiles) { writeFile2Rfs(file, name); } else { writeFile2Zip(file, name); } }
/** * Writes the OpenCms manifest.xml file to the export.<p> * * @param xmlSaxWriter the SAX writer to use * * @throws SAXException in case of issues creating the manifest.xml * @throws IOException in case of file access issues */ public void writeManifest(CmsXmlSaxWriter xmlSaxWriter) throws IOException, SAXException { if (m_isExportAsFiles) { writeManifest2Rfs(xmlSaxWriter); } else { writeManifest2Zip(xmlSaxWriter); } }
/** * Writes a single OpenCms VFS file to the RFS export.<p> * * @param file the OpenCms VFS file to write * @param name the name of the file in the export * * @throws IOException in case of file access issues */ protected void writeFile2Rfs(CmsFile file, String name) throws IOException { String fileName = getRfsFileName(name); File rfsFile = new File(fileName); if (!rfsFile.getParentFile().exists()) { rfsFile.getParentFile().mkdirs(); } rfsFile.createNewFile(); FileOutputStream rfsFileOut = new FileOutputStream(rfsFile); rfsFileOut.write(file.getContents()); rfsFileOut.close(); }