use of org.pentaho.platform.plugin.services.importexport.ExportException in project pentaho-platform by pentaho.
the class PentahoPlatformExporter method performExport.
/**
* Performs the export process, returns a zip File object
*
* @throws ExportException indicates an error in import processing
*/
@Override
public File performExport(RepositoryFile exportRepositoryFile) throws ExportException, IOException {
// always export root
exportRepositoryFile = getUnifiedRepository().getFile(ROOT);
// create temp file
exportFile = File.createTempFile(EXPORT_TEMP_FILENAME_PREFIX, EXPORT_TEMP_FILENAME_EXT);
exportFile.deleteOnExit();
zos = new ZipOutputStream(new FileOutputStream(exportFile));
exportFileContent(exportRepositoryFile);
exportDatasources();
exportMondrianSchemas();
exportMetadataModels();
exportSchedules();
exportUsersAndRoles();
exportMetastore();
if (this.withManifest) {
// write manifest to zip output stream
ZipEntry entry = new ZipEntry(EXPORT_MANIFEST_FILENAME);
zos.putNextEntry(entry);
// pass output stream to manifest class for writing
try {
getExportManifest().toXml(zos);
} catch (Exception e) {
// todo: add to messages.properties
log.error("Error generating export XML");
}
zos.closeEntry();
}
zos.close();
// clean up
exportManifest = null;
zos = null;
return exportFile;
}
Aggregations