Search in sources :

Example 1 with ExportException

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;
}
Also used : ZipOutputStream(java.util.zip.ZipOutputStream) FileOutputStream(java.io.FileOutputStream) ZipEntry(java.util.zip.ZipEntry) DatasourceMgmtServiceException(org.pentaho.platform.api.repository.datasource.DatasourceMgmtServiceException) SchedulerException(org.pentaho.platform.api.scheduler2.SchedulerException) FileNotFoundException(java.io.FileNotFoundException) KettleException(org.pentaho.di.core.exception.KettleException) ExportException(org.pentaho.platform.plugin.services.importexport.ExportException) IOException(java.io.IOException)

Aggregations

FileNotFoundException (java.io.FileNotFoundException)1 FileOutputStream (java.io.FileOutputStream)1 IOException (java.io.IOException)1 ZipEntry (java.util.zip.ZipEntry)1 ZipOutputStream (java.util.zip.ZipOutputStream)1 KettleException (org.pentaho.di.core.exception.KettleException)1 DatasourceMgmtServiceException (org.pentaho.platform.api.repository.datasource.DatasourceMgmtServiceException)1 SchedulerException (org.pentaho.platform.api.scheduler2.SchedulerException)1 ExportException (org.pentaho.platform.plugin.services.importexport.ExportException)1