org.pentaho.di.job.entry
Class JobEntryBase

java.lang.Object
  extended by org.pentaho.di.job.entry.JobEntryBase
All Implemented Interfaces:
Cloneable, CheckResultSourceInterface, LoggingObjectInterface, VariableSpace, ResourceHolderInterface
Direct Known Subclasses:
JobEntryAbort, JobEntryAddResultFilenames, JobEntryCheckDbConnections, JobEntryCheckFilesLocked, JobEntryColumnsExist, JobEntryConnectedToRepository, JobEntryCopyFiles, JobEntryCopyMoveResultFilenames, JobEntryCreateFile, JobEntryCreateFolder, JobEntryDelay, JobEntryDeleteFile, JobEntryDeleteFiles, JobEntryDeleteFolders, JobEntryDeleteResultFilenames, JobEntryDosToUnix, JobEntryDTDValidator, JobEntryEmpty, JobEntryEval, JobEntryEvalFilesMetrics, JobEntryEvalTableContent, JobEntryExportRepository, JobEntryFileCompare, JobEntryFileExists, JobEntryFilesExist, JobEntryFolderIsEmpty, JobEntryFoldersCompare, JobEntryFTP, JobEntryFTPDelete, JobEntryFTPPUT, JobEntryFTPSGet, JobEntryFTPSPUT, JobEntryGetPOP, JobEntryHTTP, JobEntryJob, JobEntryMail, JobEntryMailValidator, JobEntryMoveFiles, JobEntryMSAccessBulkLoad, JobEntryMsgBoxInfo, JobEntryMssqlBulkLoad, JobEntryMysqlBulkFile, JobEntryMysqlBulkLoad, JobEntryPGPDecryptFiles, JobEntryPGPEncryptFiles, JobEntryPGPVerify, JobEntryPing, JobEntrySetVariables, JobEntrySFTP, JobEntrySFTPPUT, JobEntryShell, JobEntrySimpleEval, JobEntrySNMPTrap, JobEntrySpecial, JobEntrySQL, JobEntrySSH2GET, JobEntrySSH2PUT, JobEntrySuccess, JobEntrySyslog, JobEntryTableExists, JobEntryTalendJobExec, JobEntryTrans, JobEntryTruncateTables, JobEntryUnZip, JobEntryWaitForFile, JobEntryWaitForSQL, JobEntryWebServiceAvailable, JobEntryWriteToFile, JobEntryWriteToLog, JobEntryXMLWellFormed, JobEntryXSDValidator, JobEntryXSLT, JobEntryZipFile

public class JobEntryBase
extends Object
implements Cloneable, VariableSpace, CheckResultSourceInterface, ResourceHolderInterface, LoggingObjectInterface

Base class for the different types of job-entries...

Author:
Matt Created on 18-jun-04

Constructor Summary
JobEntryBase()
           
JobEntryBase(String name, String description)
           
 
Method Summary
 void check(List<CheckResultInterface> remarks, JobMeta jobMeta)
          Support for overrides not having to put in a check method
 void clear()
           
 Object clone()
           
 void copyVariablesFrom(VariableSpace space)
          Copy the variables from another space, without initializing with the defaults.
 String environmentSubstitute(String aString)
          Substitute the string using the current variable space.
 String[] environmentSubstitute(String[] aString)
          Replaces environment variables in an array of strings.
 boolean equals(Object obj)
           
 boolean evaluates()
          check whether or not this job entry evaluates.
 String exportResources(VariableSpace space, Map<String,ResourceDefinition> definitions, ResourceNamingInterface namingInterface, Repository repository)
           
 boolean getBooleanValueOfVariable(String variableName, boolean defaultValue)
          This method returns a boolean for the new variable check boxes.
 String getContainerObjectId()
           
 String getDescription()
           
 String getDialogClassName()
          This returns the expected name for the dialog that edits a job entry.
 String getFilename()
           
 String getHolderType()
          Gets the high-level type of resource holder.
 LogChannelInterface getLogChannel()
           
 String getLogChannelId()
           
 LogLevel getLogLevel()
           
 String getName()
           
 String getObjectCopy()
           
 ObjectId getObjectId()
           
 String getObjectName()
           
 ObjectRevision getObjectRevision()
           
 LoggingObjectType getObjectType()
           
 LoggingObjectInterface getParent()
           
 Job getParentJob()
           
 VariableSpace getParentVariableSpace()
          Get the parent of the variable space.
 String getPluginId()
           
 String getRealFilename()
           
 Date getRegistrationDate()
          Stub
 Repository getRepository()
           
 RepositoryDirectory getRepositoryDirectory()
           
 List<ResourceReference> getResourceDependencies(JobMeta jobMeta)
          Get a list of all the resource dependencies that the step is depending on.
 List<SQLStatement> getSQLStatements(Repository repository)
           
 List<SQLStatement> getSQLStatements(Repository repository, VariableSpace space)
           
 String getTypeDesc()
           
 String getTypeId()
          Deprecated. in favor of getPluginId()
 DatabaseMeta[] getUsedDatabaseConnections()
          This method returns all the database connections that are used by the job entry.
 String getVariable(String variableName)
          Get the value of a variable.
 String getVariable(String variableName, String defaultValue)
          Get the value of a variable with a default in case the variable is not found.
 String getXML()
           
 boolean hasChanged()
           
 boolean hasRepositoryReferences()
           
 void initializeVariablesFrom(VariableSpace parent)
          Initialize variable space using the defaults, copy over the variables from the parent (using copyVariablesFrom()), after this the "injected" variables should be inserted (injectVariables()).
 void injectVariables(Map<String,String> prop)
          Inject variables.
 boolean isBasic()
           
 boolean isDebug()
           
 boolean isDetailed()
           
 boolean isDummy()
           
 boolean isEvaluation()
           
 boolean isFTP()
           
 boolean isHTTP()
           
 boolean isJob()
           
 boolean isMail()
           
 boolean isRowlevel()
           
 boolean isSFTP()
           
 boolean isShell()
           
 boolean isSpecial()
           
 boolean isStart()
           
 boolean isTransformation()
           
 boolean isUnconditional()
           
 String[] listVariables()
          List the variables (not the values) that are currently in the variable space.
 void loadRep(Repository rep, ObjectId id_jobentry, List<DatabaseMeta> databases, List<SlaveServer> slaveServers)
           
 void loadXML(Node entrynode, List<DatabaseMeta> databases, List<SlaveServer> slaveServers)
           
 void logBasic(String message)
           
 void logBasic(String message, Object... arguments)
           
 void logDebug(String message)
           
 void logDebug(String message, Object... arguments)
           
 void logDetailed(String message)
           
 void logDetailed(String message, Object... arguments)
           
 void logError(String message)
           
 void logError(String message, Object... arguments)
           
 void logError(String message, Throwable e)
           
 void logMinimal(String message)
           
 void logMinimal(String message, Object... arguments)
           
 void logRowlevel(String message)
           
 void logRowlevel(String message, Object... arguments)
           
 void lookupRepositoryReferences(Repository repository)
          Look up the references after import
 void parseRepositoryObjects(Repository rep)
           
 boolean resetErrorsBeforeExecution()
           
 void saveRep(Repository rep, ObjectId id_job)
           
 void setChanged()
           
 void setChanged(boolean ch)
           
 void setContainerObjectId(String containerObjectId)
           
 void setDescription(String Description)
           
 void setID(long id)
           
 void setLogLevel(LogLevel logLevel)
           
 void setName(String name)
           
 void setObjectId(ObjectId id)
           
 void setParentJob(Job parentJob)
           
 void setParentVariableSpace(VariableSpace parent)
          Set the parent variable space
 void setPluginId(String configId)
           
 void setRepository(Repository repository)
           
 void setTypeId(String typeId)
          Deprecated. in favor of setPluginId()
 void setVariable(String variableName, String variableValue)
          Sets a variable in the Kettle Variables list.
 void shareVariablesWith(VariableSpace space)
          Share a variable space from another variable space.
 String toString()
           
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JobEntryBase

public JobEntryBase()

JobEntryBase

public JobEntryBase(String name,
                    String description)
Method Detail

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

clear

public void clear()

setObjectId

public void setObjectId(ObjectId id)

setID

public void setID(long id)

getObjectId

public ObjectId getObjectId()
Specified by:
getObjectId in interface CheckResultSourceInterface
Specified by:
getObjectId in interface LoggingObjectInterface
Specified by:
getObjectId in interface ResourceHolderInterface
Returns:
The ID of the source generating the CheckResult

getTypeDesc

public String getTypeDesc()

setName

public void setName(String name)

getName

public String getName()
Specified by:
getName in interface CheckResultSourceInterface
Specified by:
getName in interface ResourceHolderInterface
Returns:
The name of the source generating the CheckResult

setDescription

public void setDescription(String Description)

getDescription

public String getDescription()
Specified by:
getDescription in interface CheckResultSourceInterface
Specified by:
getDescription in interface ResourceHolderInterface
Returns:
The description of the source generating the CheckResult

setChanged

public void setChanged()

setChanged

public void setChanged(boolean ch)

hasChanged

public boolean hasChanged()

isStart

public boolean isStart()

isDummy

public boolean isDummy()

isEvaluation

public boolean isEvaluation()

isJob

public boolean isJob()

isMail

public boolean isMail()

isShell

public boolean isShell()

isSpecial

public boolean isSpecial()

isTransformation

public boolean isTransformation()

isFTP

public boolean isFTP()

isSFTP

public boolean isSFTP()

isHTTP

public boolean isHTTP()

getXML

public String getXML()

loadXML

public void loadXML(Node entrynode,
                    List<DatabaseMeta> databases,
                    List<SlaveServer> slaveServers)
             throws KettleXMLException
Throws:
KettleXMLException

parseRepositoryObjects

public void parseRepositoryObjects(Repository rep)
                            throws KettleException
Throws:
KettleException

loadRep

public void loadRep(Repository rep,
                    ObjectId id_jobentry,
                    List<DatabaseMeta> databases,
                    List<SlaveServer> slaveServers)
             throws KettleException
Throws:
KettleException

saveRep

public void saveRep(Repository rep,
                    ObjectId id_job)
             throws KettleException
Throws:
KettleException

clone

public Object clone()
Overrides:
clone in class Object

toString

public String toString()
Overrides:
toString in class Object

resetErrorsBeforeExecution

public boolean resetErrorsBeforeExecution()
Returns:
true if a reset of the number of errors is required before execution.

evaluates

public boolean evaluates()
check whether or not this job entry evaluates.

Returns:
true if the job entry evaluates

isUnconditional

public boolean isUnconditional()

getSQLStatements

public List<SQLStatement> getSQLStatements(Repository repository)
                                    throws KettleException
Throws:
KettleException

getSQLStatements

public List<SQLStatement> getSQLStatements(Repository repository,
                                           VariableSpace space)
                                    throws KettleException
Throws:
KettleException

getFilename

public String getFilename()
Specified by:
getFilename in interface LoggingObjectInterface
Returns:
the filename

getRealFilename

public String getRealFilename()

getUsedDatabaseConnections

public DatabaseMeta[] getUsedDatabaseConnections()
This method returns all the database connections that are used by the job entry.

Returns:
an array of database connections meta-data. Return an empty array if no connections are used.

copyVariablesFrom

public void copyVariablesFrom(VariableSpace space)
Description copied from interface: VariableSpace
Copy the variables from another space, without initializing with the defaults. This does not affect any parent relationship.

Specified by:
copyVariablesFrom in interface VariableSpace
Parameters:
space - the space to copy the variables from.

environmentSubstitute

public String environmentSubstitute(String aString)
Description copied from interface: VariableSpace
Substitute the string using the current variable space.

Specified by:
environmentSubstitute in interface VariableSpace
Parameters:
aString - The string to substitute.
Returns:
The substituted string.

environmentSubstitute

public String[] environmentSubstitute(String[] aString)
Description copied from interface: VariableSpace
Replaces environment variables in an array of strings. See also: environmentSubstitute(String string)

Specified by:
environmentSubstitute in interface VariableSpace
Parameters:
aString - The array of strings that wants its variables to be replaced.
Returns:
the array with the environment variables replaced.

getParentVariableSpace

public VariableSpace getParentVariableSpace()
Description copied from interface: VariableSpace
Get the parent of the variable space.

Specified by:
getParentVariableSpace in interface VariableSpace
Returns:
the parent.

setParentVariableSpace

public void setParentVariableSpace(VariableSpace parent)
Description copied from interface: VariableSpace
Set the parent variable space

Specified by:
setParentVariableSpace in interface VariableSpace
Parameters:
parent - The parent variable space to set

getVariable

public String getVariable(String variableName,
                          String defaultValue)
Description copied from interface: VariableSpace
Get the value of a variable with a default in case the variable is not found.

Specified by:
getVariable in interface VariableSpace
Parameters:
variableName - The name of the variable
defaultValue - The default value in case the variable could not be found
Returns:
the String value of a variable

getVariable

public String getVariable(String variableName)
Description copied from interface: VariableSpace
Get the value of a variable.

Specified by:
getVariable in interface VariableSpace
Parameters:
variableName - The name of the variable
Returns:
the String value of a variable or null in case the variable could not be found.

getBooleanValueOfVariable

public boolean getBooleanValueOfVariable(String variableName,
                                         boolean defaultValue)
Description copied from interface: VariableSpace
This method returns a boolean for the new variable check boxes. If the variable name is not set or the variable name is not specified, this method simply returns the default value. If not, it convert the variable value to a boolean. "Y", "YES" and "TRUE" all convert to true. (case insensitive)

Specified by:
getBooleanValueOfVariable in interface VariableSpace
Parameters:
variableName - The variable to look up.
defaultValue - The default value to return.
Returns:
See Also:
static method ValueMeta.convertStringToBoolean()

initializeVariablesFrom

public void initializeVariablesFrom(VariableSpace parent)
Description copied from interface: VariableSpace
Initialize variable space using the defaults, copy over the variables from the parent (using copyVariablesFrom()), after this the "injected" variables should be inserted (injectVariables()). The parent is set as parent variable space.

Specified by:
initializeVariablesFrom in interface VariableSpace
Parameters:
parent - the parent to start from, or null if root.

listVariables

public String[] listVariables()
Description copied from interface: VariableSpace
List the variables (not the values) that are currently in the variable space.

Specified by:
listVariables in interface VariableSpace
Returns:
Array of String variable names.

setVariable

public void setVariable(String variableName,
                        String variableValue)
Description copied from interface: VariableSpace
Sets a variable in the Kettle Variables list.

Specified by:
setVariable in interface VariableSpace
Parameters:
variableName - The name of the variable to set
variableValue - The value of the variable to set. If the variableValue is null, the variable is cleared from the list.

shareVariablesWith

public void shareVariablesWith(VariableSpace space)
Description copied from interface: VariableSpace
Share a variable space from another variable space. This means that the object should take over the space used as argument.

Specified by:
shareVariablesWith in interface VariableSpace
Parameters:
space - Variable space to be shared.

injectVariables

public void injectVariables(Map<String,String> prop)
Description copied from interface: VariableSpace
Inject variables. The behaviour should be that the properties object will be stored and at the time the VariableSpace is initialized (or upon calling this method if the space is already initialized). After injecting the link of the properties object should be removed.

Specified by:
injectVariables in interface VariableSpace
Parameters:
prop - Properties object containing key-value pairs.

check

public void check(List<CheckResultInterface> remarks,
                  JobMeta jobMeta)
Support for overrides not having to put in a check method

Parameters:
remarks - CheckResults from checking the job entry
jobMeta - JobMeta information letting threading back to the JobMeta possible

getResourceDependencies

public List<ResourceReference> getResourceDependencies(JobMeta jobMeta)
Get a list of all the resource dependencies that the step is depending on.

Returns:
a list of all the resource dependencies that the step is depending on

exportResources

public String exportResources(VariableSpace space,
                              Map<String,ResourceDefinition> definitions,
                              ResourceNamingInterface namingInterface,
                              Repository repository)
                       throws KettleException
Throws:
KettleException

getPluginId

public String getPluginId()

setPluginId

public void setPluginId(String configId)

getTypeId

public String getTypeId()
Deprecated. in favor of getPluginId()

Specified by:
getTypeId in interface CheckResultSourceInterface
Specified by:
getTypeId in interface ResourceHolderInterface
Returns:
The Type ID of the source generating the CheckResult. The Type ID is the system-defined type identifier (like TRANS or SORT).

setTypeId

public void setTypeId(String typeId)
Deprecated. in favor of setPluginId()


getDialogClassName

public String getDialogClassName()
This returns the expected name for the dialog that edits a job entry. The expected name is in the org.pentaho.di.ui tree and has a class name that is the name of the job entry with 'Dialog' added to the end. e.g. if the job entry is org.pentaho.di.job.entries.zipfile.JobEntryZipFile the dialog would be org.pentaho.di.ui.job.entries.zipfile.JobEntryZipFileDialog If the dialog class for a job entry does not match this pattern it should override this method and return the appropriate class name

Returns:
full class name of the dialog

getHolderType

public String getHolderType()
Description copied from interface: ResourceHolderInterface
Gets the high-level type of resource holder.

Specified by:
getHolderType in interface ResourceHolderInterface
Returns:
JOBENTRY, STEP, etc.

setRepository

public void setRepository(Repository repository)

getRepository

public Repository getRepository()

setParentJob

public void setParentJob(Job parentJob)

getParentJob

public Job getParentJob()

isBasic

public boolean isBasic()

isDetailed

public boolean isDetailed()

isDebug

public boolean isDebug()

isRowlevel

public boolean isRowlevel()

logMinimal

public void logMinimal(String message)

logMinimal

public void logMinimal(String message,
                       Object... arguments)

logBasic

public void logBasic(String message)

logBasic

public void logBasic(String message,
                     Object... arguments)

logDetailed

public void logDetailed(String message)

logDetailed

public void logDetailed(String message,
                        Object... arguments)

logDebug

public void logDebug(String message)

logDebug

public void logDebug(String message,
                     Object... arguments)

logRowlevel

public void logRowlevel(String message)

logRowlevel

public void logRowlevel(String message,
                        Object... arguments)

logError

public void logError(String message)

logError

public void logError(String message,
                     Throwable e)

logError

public void logError(String message,
                     Object... arguments)

getLogChannel

public LogChannelInterface getLogChannel()

getLogChannelId

public String getLogChannelId()
Specified by:
getLogChannelId in interface LoggingObjectInterface
Returns:
the log channel id

getObjectName

public String getObjectName()
Specified by:
getObjectName in interface LoggingObjectInterface
Returns:
the name

getObjectCopy

public String getObjectCopy()
Specified by:
getObjectCopy in interface LoggingObjectInterface
Returns:
A string identifying a copy in a series of steps...

getObjectRevision

public ObjectRevision getObjectRevision()
Specified by:
getObjectRevision in interface LoggingObjectInterface
Returns:
the object revision in a repository

getObjectType

public LoggingObjectType getObjectType()
Specified by:
getObjectType in interface LoggingObjectInterface
Returns:
the objectType

getParent

public LoggingObjectInterface getParent()
Specified by:
getParent in interface LoggingObjectInterface
Returns:
the parent

getRepositoryDirectory

public RepositoryDirectory getRepositoryDirectory()
Specified by:
getRepositoryDirectory in interface LoggingObjectInterface
Returns:
the repositoryDirectory

getLogLevel

public LogLevel getLogLevel()
Specified by:
getLogLevel in interface LoggingObjectInterface
Returns:
The logging level of the log channel of this logging object.

setLogLevel

public void setLogLevel(LogLevel logLevel)

getContainerObjectId

public String getContainerObjectId()
Specified by:
getContainerObjectId in interface LoggingObjectInterface
Returns:
the carteObjectId

setContainerObjectId

public void setContainerObjectId(String containerObjectId)
Parameters:
containerObjectId - the carteObjectId to set

getRegistrationDate

public Date getRegistrationDate()
Stub

Specified by:
getRegistrationDate in interface LoggingObjectInterface
Returns:
The registration date of this logging object. Null if it's not registered.

hasRepositoryReferences

public boolean hasRepositoryReferences()

lookupRepositoryReferences

public void lookupRepositoryReferences(Repository repository)
                                throws KettleException
Look up the references after import

Parameters:
repository - the repository to reference.
Throws:
KettleException