Class RepositoryExporter

  • All Implemented Interfaces:
    IRepositoryExporter, IRepositoryExporterFeedback

    public class RepositoryExporter
    extends Object
    implements IRepositoryExporterFeedback

    This class is used to read repository, load jobs and transformations, and export them into xml file. Xml file will be overwrite. In case of not success export this file will be deleted.

    It is possible to set some export rules (similar as import rules). In case of export rule violation - whole export process will be treated as unsuccessful, export xml file will be deleted.

    In case of during export some item form repository will be failed to load in case of missing step plugin etc - same as before - whole export process will be treated as failed, export xml file will be deleted.

    Internally this implementation uses 2 types of output xml writers - actual and null implementation. When during export some item violates export rule - output xml file will be deleted, actual writer implementation will be replaced by null (nothing-to-do) implementation. Monitor current status will be replaced by error message with number of rule violation errors.

    Monitor's progress bar is not the actual progress, as we don't actually know the amount of real export. In current implementation we avoid to discover repository for total amount of export work to show more sophisticated progress bar. Export may be canceled using this monitor cancel action. Using monitor cancel is only the way to interrupt running export without exception. In case of export is canceled - output export file will not be created.

    See Also:
    ProgressMonitorListener, IRepositoryExporter, IRepositoryExporterFeedback
    • Constructor Detail

      • RepositoryExporter

        public RepositoryExporter​(Repository repository)
        Parameters:
        repository -
    • Method Detail

      • isRulesViolation

        public boolean isRulesViolation()
        Description copied from interface: IRepositoryExporterFeedback
        Call to this fast-access way to determine that export had rules violations. This avoid full scan of export results for possible failures. If this method returns true - we may be sure that one or more export rules was violated.
        Specified by:
        isRulesViolation in interface IRepositoryExporterFeedback
        Returns:
      • setImportRulesToValidate

        public void setImportRulesToValidate​(ImportRules importRules)
        Description copied from interface: IRepositoryExporter
        Pass a set of import rules to the exporter to validate against during the export. This will allow a user to make sure that the export transformations can be imported with the given set of rules.
        Specified by:
        setImportRulesToValidate in interface IRepositoryExporter
        Parameters:
        importRules - The import rules to adhere to during export.
      • exportAllObjectsWithFeedback

        public List<ExportFeedback> exportAllObjectsWithFeedback​(org.pentaho.di.core.ProgressMonitorListener monitorOuter,
                                                                 String xmlFilename,
                                                                 org.pentaho.di.repository.RepositoryDirectoryInterface root,
                                                                 String exportType)
                                                          throws org.pentaho.di.core.exception.KettleException

        This implementation attempts to scan whole repository for all items according to export type. If we have one or more export rules defined - it will NOT throw exception on first export rule violation. Instead of it this method attempts to scan whole repository to get full picture how many items violates export rules. This information is available as collection of feedbacks. To determine possible export rule violations and not perform full collection scan for error feedbacks use isRuleViolation() call

        Specified by:
        exportAllObjectsWithFeedback in interface IRepositoryExporterFeedback
        Parameters:
        monitorOuter - - export monitor.
        xmlFilename - - export output file name
        root - - repository to export from
        exportType - - type of items to export
        Returns:
        - list of processed items (Jobs and transformations) with exported statuses. Note - this list is not a list of a really exported objects, but only export report. Some exporters that implements this interface may not create output export file in case of not success exports.
        Throws:
        org.pentaho.di.core.exception.KettleException
        See Also:
        isRulesViolation()
      • exportAllObjects

        public void exportAllObjects​(org.pentaho.di.core.ProgressMonitorListener monitorOuter,
                                     String xmlFilename,
                                     org.pentaho.di.repository.RepositoryDirectoryInterface root,
                                     String exportType)
                              throws org.pentaho.di.core.exception.KettleException
        This implementation is backward compatible. This means if we have some export rules defined, and during export one rule will be violated - we will throw exception and we will stop export.
        Specified by:
        exportAllObjects in interface IRepositoryExporter
        Parameters:
        monitorOuter - Progress Monitor for providing feedback during the export process.
        xmlFilename - Filename to write out to.
        root - Root directory to start export from.
        exportType - Type of objects to export: "all", "trans", "job"
        Throws:
        org.pentaho.di.core.exception.KettleException