Class RepositoryImporter

java.lang.Object
org.pentaho.di.repository.RepositoryImporter
All Implemented Interfaces:
org.pentaho.di.core.ProgressMonitorListener, CanLimitDirs, IRepositoryImporter, RepositoryElementReadListener, RepositoryImportFeedbackInterface

public class RepositoryImporter extends Object implements IRepositoryImporter, CanLimitDirs
  • Field Details

  • Constructor Details

    • RepositoryImporter

      public RepositoryImporter(Repository repository)
    • RepositoryImporter

      public RepositoryImporter(Repository repository, org.pentaho.di.core.logging.LogChannelInterface log)
    • RepositoryImporter

      public RepositoryImporter(Repository repository, ImportRules importRules, List<String> limitDirs)
    • RepositoryImporter

      public RepositoryImporter(Repository repository, ImportRules importRules, List<String> limitDirs, org.pentaho.di.core.logging.LogChannelInterface log)
  • Method Details

    • importAll

      public void importAll(RepositoryImportFeedbackInterface feedback, String fileDirectory, String[] filenames, org.pentaho.di.repository.RepositoryDirectoryInterface baseDirectory, boolean overwrite, boolean continueOnError, String versionComment)
      Description copied from interface: IRepositoryImporter
      Import objects from an XML document to a repository.
      Specified by:
      importAll in interface IRepositoryImporter
      Parameters:
      feedback - Required to provide feedback to the user.
      fileDirectory - Base directory to load files (named filenames) from
      filenames - Names of files found in fileDirectory to be imported.
      baseDirectory - Base directory to load objects into.
      overwrite - Should objects in the repository be overwritten with ones we're importing?
      continueOnError - Should the import continue if there is an error importing an object?
      versionComment - Comment to use when saving imported objects.
    • loadSharedObjects

      protected void loadSharedObjects() throws org.pentaho.di.core.exception.KettleException
      Load the shared objects up front, replace them in the xforms/jobs loaded from XML. We do this for performance reasons.
      Throws:
      org.pentaho.di.core.exception.KettleException
    • validateImportedElement

      public static void validateImportedElement(ImportRules importRules, Object subject) throws org.pentaho.di.core.exception.KettleException
      Validates the repository element that is about to get imported against the list of import rules.
      Parameters:
      importRules - import rules to validate against.
      subject -
      Throws:
      org.pentaho.di.core.exception.KettleException
    • addLog

      public void addLog(String line)
      Specified by:
      addLog in interface RepositoryImportFeedbackInterface
    • setLabel

      public void setLabel(String labelText)
      Specified by:
      setLabel in interface RepositoryImportFeedbackInterface
    • transOverwritePrompt

      public boolean transOverwritePrompt(TransMeta transMeta)
      Specified by:
      transOverwritePrompt in interface RepositoryImportFeedbackInterface
    • jobOverwritePrompt

      public boolean jobOverwritePrompt(JobMeta jobMeta)
      Specified by:
      jobOverwritePrompt in interface RepositoryImportFeedbackInterface
    • updateDisplay

      public void updateDisplay()
      Specified by:
      updateDisplay in interface RepositoryImportFeedbackInterface
    • showError

      public void showError(String title, String message, Exception e)
      Specified by:
      showError in interface RepositoryImportFeedbackInterface
    • getSharedObjects

      protected <T extends org.pentaho.di.shared.SharedObjectInterface> List<T> getSharedObjects(Class<T> clazz)
    • equals

      protected boolean equals(org.pentaho.di.core.database.DatabaseMeta databaseMeta, org.pentaho.di.core.database.DatabaseMeta databaseMeta2)
      Adapted from KettleDatabaseRepositoryDatabaseDelegate.saveDatabaseMeta
    • equals

      protected boolean equals(SlaveServer slaveServer, SlaveServer slaveServer2)
    • equals

      protected boolean equals(PartitionSchema partitionSchema, PartitionSchema partitionSchema2)
    • equals

      protected boolean equals(ClusterSchema clusterSchema, ClusterSchema clusterSchema2)
    • replaceSharedObjects

      protected void replaceSharedObjects(TransMeta transMeta) throws org.pentaho.di.core.exception.KettleException
      Throws:
      org.pentaho.di.core.exception.KettleException
    • replaceSharedObjects

      protected void replaceSharedObjects(JobMeta transMeta) throws org.pentaho.di.core.exception.KettleException
      Throws:
      org.pentaho.di.core.exception.KettleException
    • saveTransMeta

      protected void saveTransMeta(TransMeta transMeta) throws org.pentaho.di.core.exception.KettleException
      Throws:
      org.pentaho.di.core.exception.KettleException
    • importTransformation

      protected boolean importTransformation(Node transnode, RepositoryImportFeedbackInterface feedback) throws org.pentaho.di.core.exception.KettleException
      Parameters:
      transnode - The XML DOM node to read the transformation from
      Returns:
      false if the import should be canceled.
      Throws:
      org.pentaho.di.core.exception.KettleException - in case there is an unexpected error
    • saveJobMeta

      protected void saveJobMeta(JobMeta jobMeta) throws org.pentaho.di.core.exception.KettleException
      Throws:
      org.pentaho.di.core.exception.KettleException
    • importJob

      protected boolean importJob(Node jobnode, RepositoryImportFeedbackInterface feedback) throws org.pentaho.di.core.exception.KettleException
      Throws:
      org.pentaho.di.core.exception.KettleException
    • transformationElementRead

      public boolean transformationElementRead(String xml, RepositoryImportFeedbackInterface feedback)
      Specified by:
      transformationElementRead in interface RepositoryElementReadListener
    • jobElementRead

      public boolean jobElementRead(String xml, RepositoryImportFeedbackInterface feedback)
      Specified by:
      jobElementRead in interface RepositoryElementReadListener
    • fatalXmlErrorEncountered

      public void fatalXmlErrorEncountered(SAXParseException e)
      Specified by:
      fatalXmlErrorEncountered in interface RepositoryElementReadListener
    • askContinueOnErrorQuestion

      public boolean askContinueOnErrorQuestion(String title, String message)
      Specified by:
      askContinueOnErrorQuestion in interface RepositoryImportFeedbackInterface
    • beginTask

      public void beginTask(String message, int nrWorks)
      Specified by:
      beginTask in interface org.pentaho.di.core.ProgressMonitorListener
    • done

      public void done()
      Specified by:
      done in interface org.pentaho.di.core.ProgressMonitorListener
    • isCanceled

      public boolean isCanceled()
      Specified by:
      isCanceled in interface org.pentaho.di.core.ProgressMonitorListener
    • setTaskName

      public void setTaskName(String taskName)
      Specified by:
      setTaskName in interface org.pentaho.di.core.ProgressMonitorListener
    • subTask

      public void subTask(String message)
      Specified by:
      subTask in interface org.pentaho.di.core.ProgressMonitorListener
    • worked

      public void worked(int nrWorks)
      Specified by:
      worked in interface org.pentaho.di.core.ProgressMonitorListener
    • getTransDirOverride

      public String getTransDirOverride()
    • setTransDirOverride

      public void setTransDirOverride(String transDirOverride)
      Description copied from interface: IRepositoryImporter
      Overrides repository directory for all imported transformations.
      Specified by:
      setTransDirOverride in interface IRepositoryImporter
    • getJobDirOverride

      public String getJobDirOverride()
    • setJobDirOverride

      public void setJobDirOverride(String jobDirOverride)
      Description copied from interface: IRepositoryImporter
      Overrides repository directory for all imported jobs.
      Specified by:
      setJobDirOverride in interface IRepositoryImporter
    • setImportRules

      public void setImportRules(ImportRules importRules)
      Description copied from interface: IRepositoryImporter
      Set the list of rules that need to be applied to every imported object.
      Specified by:
      setImportRules in interface IRepositoryImporter
      Parameters:
      importRules - The rules to use during import into the repository
    • getImportRules

      public ImportRules getImportRules()
    • isAskingOverwriteConfirmation

      public boolean isAskingOverwriteConfirmation()
      Specified by:
      isAskingOverwriteConfirmation in interface RepositoryImportFeedbackInterface
    • getExceptions

      public List<Exception> getExceptions()
      Description copied from interface: IRepositoryImporter
      Returns a list of exceptions that the implementation may maintain.
      Specified by:
      getExceptions in interface IRepositoryImporter
      Returns:
    • setLimitDirs

      public void setLimitDirs(List<String> limitDirs)
      Specified by:
      setLimitDirs in interface CanLimitDirs
    • setBaseDirectory

      protected void setBaseDirectory(org.pentaho.di.repository.RepositoryDirectoryInterface baseDirectory)
    • setOverwrite

      public void setOverwrite(boolean overwrite)
    • getVersionComment

      public String getVersionComment()