Package org.pentaho.di.repository
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 Summary
Fields Modifier and Type Field Description static String
IMPORT_ASK_ABOUT_REPLACE_CS
static String
IMPORT_ASK_ABOUT_REPLACE_DB
static String
IMPORT_ASK_ABOUT_REPLACE_PS
static String
IMPORT_ASK_ABOUT_REPLACE_SS
-
Constructor Summary
Constructors Constructor Description RepositoryImporter(Repository repository)
RepositoryImporter(Repository repository, org.pentaho.di.core.logging.LogChannelInterface log)
RepositoryImporter(Repository repository, ImportRules importRules, List<String> limitDirs)
RepositoryImporter(Repository repository, ImportRules importRules, List<String> limitDirs, org.pentaho.di.core.logging.LogChannelInterface log)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addLog(String line)
boolean
askContinueOnErrorQuestion(String title, String message)
void
beginTask(String message, int nrWorks)
void
done()
protected boolean
equals(ClusterSchema clusterSchema, ClusterSchema clusterSchema2)
protected boolean
equals(SlaveServer slaveServer, SlaveServer slaveServer2)
protected boolean
equals(org.pentaho.di.core.database.DatabaseMeta databaseMeta, org.pentaho.di.core.database.DatabaseMeta databaseMeta2)
Adapted from KettleDatabaseRepositoryDatabaseDelegate.saveDatabaseMetaprotected boolean
equals(PartitionSchema partitionSchema, PartitionSchema partitionSchema2)
void
fatalXmlErrorEncountered(SAXParseException e)
List<Exception>
getExceptions()
Returns a list of exceptions that the implementation may maintain.ImportRules
getImportRules()
String
getJobDirOverride()
protected <T extends org.pentaho.di.shared.SharedObjectInterface>
List<T>getSharedObjects(Class<T> clazz)
String
getTransDirOverride()
String
getVersionComment()
void
importAll(RepositoryImportFeedbackInterface feedback, String fileDirectory, String[] filenames, org.pentaho.di.repository.RepositoryDirectoryInterface baseDirectory, boolean overwrite, boolean continueOnError, String versionComment)
Import objects from an XML document to a repository.protected boolean
importJob(Node jobnode, RepositoryImportFeedbackInterface feedback)
protected boolean
importTransformation(Node transnode, RepositoryImportFeedbackInterface feedback)
boolean
isAskingOverwriteConfirmation()
boolean
isCanceled()
boolean
jobElementRead(String xml, RepositoryImportFeedbackInterface feedback)
boolean
jobOverwritePrompt(JobMeta jobMeta)
protected void
loadSharedObjects()
Load the shared objects up front, replace them in the xforms/jobs loaded from XML.protected void
replaceSharedObjects(JobMeta transMeta)
protected void
replaceSharedObjects(TransMeta transMeta)
protected void
saveJobMeta(JobMeta jobMeta)
protected void
saveTransMeta(TransMeta transMeta)
protected void
setBaseDirectory(org.pentaho.di.repository.RepositoryDirectoryInterface baseDirectory)
void
setImportRules(ImportRules importRules)
Set the list of rules that need to be applied to every imported object.void
setJobDirOverride(String jobDirOverride)
Overrides repository directory for all imported jobs.void
setLabel(String labelText)
void
setLimitDirs(List<String> limitDirs)
void
setOverwrite(boolean overwrite)
void
setTaskName(String taskName)
void
setTransDirOverride(String transDirOverride)
Overrides repository directory for all imported transformations.void
showError(String title, String message, Exception e)
void
subTask(String message)
boolean
transformationElementRead(String xml, RepositoryImportFeedbackInterface feedback)
boolean
transOverwritePrompt(TransMeta transMeta)
void
updateDisplay()
static void
validateImportedElement(ImportRules importRules, Object subject)
Validates the repository element that is about to get imported against the list of import rules.void
worked(int nrWorks)
-
-
-
Field Detail
-
IMPORT_ASK_ABOUT_REPLACE_DB
public static final String IMPORT_ASK_ABOUT_REPLACE_DB
- See Also:
- Constant Field Values
-
IMPORT_ASK_ABOUT_REPLACE_SS
public static final String IMPORT_ASK_ABOUT_REPLACE_SS
- See Also:
- Constant Field Values
-
IMPORT_ASK_ABOUT_REPLACE_CS
public static final String IMPORT_ASK_ABOUT_REPLACE_CS
- See Also:
- Constant Field Values
-
IMPORT_ASK_ABOUT_REPLACE_PS
public static final String IMPORT_ASK_ABOUT_REPLACE_PS
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
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 Detail
-
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 interfaceIRepositoryImporter
- Parameters:
feedback
- Required to provide feedback to the user.fileDirectory
- Base directory to load files (namedfilenames
) fromfilenames
- Names of files found infileDirectory
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 interfaceRepositoryImportFeedbackInterface
-
setLabel
public void setLabel(String labelText)
- Specified by:
setLabel
in interfaceRepositoryImportFeedbackInterface
-
transOverwritePrompt
public boolean transOverwritePrompt(TransMeta transMeta)
- Specified by:
transOverwritePrompt
in interfaceRepositoryImportFeedbackInterface
-
jobOverwritePrompt
public boolean jobOverwritePrompt(JobMeta jobMeta)
- Specified by:
jobOverwritePrompt
in interfaceRepositoryImportFeedbackInterface
-
updateDisplay
public void updateDisplay()
- Specified by:
updateDisplay
in interfaceRepositoryImportFeedbackInterface
-
showError
public void showError(String title, String message, Exception e)
- Specified by:
showError
in interfaceRepositoryImportFeedbackInterface
-
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 interfaceRepositoryElementReadListener
-
jobElementRead
public boolean jobElementRead(String xml, RepositoryImportFeedbackInterface feedback)
- Specified by:
jobElementRead
in interfaceRepositoryElementReadListener
-
fatalXmlErrorEncountered
public void fatalXmlErrorEncountered(SAXParseException e)
- Specified by:
fatalXmlErrorEncountered
in interfaceRepositoryElementReadListener
-
askContinueOnErrorQuestion
public boolean askContinueOnErrorQuestion(String title, String message)
- Specified by:
askContinueOnErrorQuestion
in interfaceRepositoryImportFeedbackInterface
-
beginTask
public void beginTask(String message, int nrWorks)
- Specified by:
beginTask
in interfaceorg.pentaho.di.core.ProgressMonitorListener
-
done
public void done()
- Specified by:
done
in interfaceorg.pentaho.di.core.ProgressMonitorListener
-
isCanceled
public boolean isCanceled()
- Specified by:
isCanceled
in interfaceorg.pentaho.di.core.ProgressMonitorListener
-
setTaskName
public void setTaskName(String taskName)
- Specified by:
setTaskName
in interfaceorg.pentaho.di.core.ProgressMonitorListener
-
subTask
public void subTask(String message)
- Specified by:
subTask
in interfaceorg.pentaho.di.core.ProgressMonitorListener
-
worked
public void worked(int nrWorks)
- Specified by:
worked
in interfaceorg.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 interfaceIRepositoryImporter
-
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 interfaceIRepositoryImporter
-
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 interfaceIRepositoryImporter
- Parameters:
importRules
- The rules to use during import into the repository
-
getImportRules
public ImportRules getImportRules()
-
isAskingOverwriteConfirmation
public boolean isAskingOverwriteConfirmation()
- Specified by:
isAskingOverwriteConfirmation
in interfaceRepositoryImportFeedbackInterface
-
getExceptions
public List<Exception> getExceptions()
Description copied from interface:IRepositoryImporter
Returns a list of exceptions that the implementation may maintain.- Specified by:
getExceptions
in interfaceIRepositoryImporter
- Returns:
-
setLimitDirs
public void setLimitDirs(List<String> limitDirs)
- Specified by:
setLimitDirs
in interfaceCanLimitDirs
-
setBaseDirectory
protected void setBaseDirectory(org.pentaho.di.repository.RepositoryDirectoryInterface baseDirectory)
-
setOverwrite
public void setOverwrite(boolean overwrite)
-
getVersionComment
public String getVersionComment()
-
-