public class Job extends Thread implements org.pentaho.di.core.variables.VariableSpace, org.pentaho.di.core.parameters.NamedParams, HasLogChannelInterface, org.pentaho.di.core.logging.LoggingObjectInterface, ExecutorInterface, org.pentaho.di.core.ExtensionDataInterface
The definition of a PDI job is represented by a JobMeta object. It is typically loaded from a .kjb file, a PDI repository, or it is generated dynamically. The declared parameters of the job definition are then queried using listParameters() and assigned values using calls to setParameterValue(..).
Thread.State, Thread.UncaughtExceptionHandler
Modifier and Type | Field and Description |
---|---|
static String |
CONFIGURATION_IN_EXPORT_FILENAME |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
Constructor and Description |
---|
Job()
Empty constructor, for Class.newInstance()
|
Job(Repository repository,
JobMeta jobMeta)
Instantiates a new job.
|
Job(Repository repository,
JobMeta jobMeta,
org.pentaho.di.core.logging.LoggingObjectInterface parentLogging)
Instantiates a new job.
|
Job(String name,
String file,
String[] args)
Instantiates a new job.
|
Modifier and Type | Method and Description |
---|---|
void |
activateParameters() |
void |
addDelegationListener(DelegationListener delegationListener) |
void |
addErrors(int nrToAdd)
Add a number of errors to the total number of erros that occured
during execution.
|
void |
addJobEntryListener(JobEntryListener jobEntryListener)
Adds the job entry listener.
|
void |
addJobListener(JobListener jobListener)
Add a job listener to the job
|
void |
addParameterDefinition(String key,
String defValue,
String description) |
boolean |
beginProcessing()
Handle logging at start
|
void |
clearParameters() |
void |
copyParametersFrom(org.pentaho.di.core.parameters.NamedParams params) |
void |
copyVariablesFrom(org.pentaho.di.core.variables.VariableSpace space) |
static Job |
createJobWithNewClassLoader()
Creates the job with new class loader.
|
String |
environmentSubstitute(String aString) |
String[] |
environmentSubstitute(String[] aString) |
void |
eraseParameters() |
org.pentaho.di.core.Result |
execute(int nr,
org.pentaho.di.core.Result result)
Execute a job with previous results passed in.
Execute called by JobEntryJob: don't clear the jobEntryResults. |
String |
fieldSubstitute(String aString,
org.pentaho.di.core.row.RowMetaInterface rowMeta,
Object[] rowData) |
void |
fireJobFinishListeners()
Sets the finished flag.
Then launch all the job listeners and call the jobFinished method for each.
|
void |
fireJobStartListeners()
Call all the jobStarted method for each listener.
|
Map<JobEntryCopy,JobEntryJob> |
getActiveJobEntryJobs()
Gets the activeJobEntryJobs.
|
Map<JobEntryCopy,JobEntryTrans> |
getActiveJobEntryTransformations()
Gets the activeJobEntryTransformations.
|
String[] |
getArguments() |
long |
getBatchId()
Gets the batchId.
|
boolean |
getBooleanValueOfVariable(String variableName,
boolean defaultValue) |
String |
getContainerObjectId()
Gets the carteObjectId.
|
Date |
getCurrentDate()
Gets the current date.
|
List<DelegationListener> |
getDelegationListeners() |
Date |
getDepDate()
Gets the dep date.
|
Date |
getEndDate()
Gets the end date.
|
int |
getErrors()
Get the number of errors that happened in the job.
|
String |
getExecutingServer()
Gets the executing server.
|
String |
getExecutingUser()
Gets the executing user.
|
Map<String,Object> |
getExtensionDataMap() |
String |
getFilename()
Gets the file name.
|
List<JobEntryListener> |
getJobEntryListeners()
Gets the job entry listeners.
|
List<JobEntryResult> |
getJobEntryResults()
Gets a flat list of results in THIS job, in the order of execution of job entries.
|
List<JobListener> |
getJobListeners()
Gets the job listeners.
|
JobMeta |
getJobMeta()
Gets the job meta.
|
String |
getJobname()
Gets the jobname.
|
JobTracker |
getJobTracker()
Gets the job tracker.
|
org.pentaho.di.core.logging.LogChannelInterface |
getLogChannel()
Gets the log channel interface.
|
String |
getLogChannelId()
Gets the log channel id.
|
Date |
getLogDate()
Gets the log date.
|
List<org.pentaho.di.core.logging.LoggingHierarchy> |
getLoggingHierarchy()
Gets the logging hierarchy.
|
org.pentaho.di.core.logging.LogLevel |
getLogLevel()
Gets the logLevel.
|
String |
getObjectCopy()
Always returns null for Job.
|
org.pentaho.di.repository.ObjectId |
getObjectId()
Gets the jobMeta's object id.
|
String |
getObjectName()
Gets the job name.
|
org.pentaho.di.repository.ObjectRevision |
getObjectRevision()
Gets the job meta's object revision.
|
org.pentaho.di.core.logging.LoggingObjectType |
getObjectType()
Gets LoggingObjectType.JOB, which is always the value for Job.
|
String |
getParameterDefault(String key) |
String |
getParameterDescription(String key) |
String |
getParameterValue(String key) |
org.pentaho.di.core.logging.LoggingObjectInterface |
getParent()
Gets parent logging object.
|
Job |
getParentJob()
Gets the parent job.
|
org.pentaho.di.core.logging.LoggingObjectInterface |
getParentLoggingObject()
Gets the parent logging object.
|
Trans |
getParentTrans() |
org.pentaho.di.core.variables.VariableSpace |
getParentVariableSpace() |
long |
getPassedBatchId()
Gets the passedBatchId.
|
Date |
getRegistrationDate()
Gets the registration date.
|
Repository |
getRep()
Gets the rep (repository).
|
org.pentaho.di.repository.RepositoryDirectoryInterface |
getRepositoryDirectory()
Gets the job meta's repository directory interface.
|
org.pentaho.di.core.Result |
getResult()
Gets the result.
|
SocketRepository |
getSocketRepository()
Gets the socket repository.
|
List<org.pentaho.di.core.RowMetaAndData> |
getSourceRows()
Gets the source rows.
|
Date |
getStartDate()
Gets the start date.
|
JobEntryCopy |
getStartJobEntryCopy()
Gets the start job entry copy.
|
org.pentaho.di.core.Result |
getStartJobEntryResult() |
String |
getStatus()
Gets the status.
|
Thread |
getThread()
Gets the thread.
|
String |
getTransactionId()
Gets the transaction id.
|
String |
getVariable(String variableName) |
String |
getVariable(String variableName,
String defaultValue) |
void |
init()
Initializes the Job.
|
void |
initializeVariablesFrom(org.pentaho.di.core.variables.VariableSpace parent) |
void |
injectVariables(Map<String,String> prop) |
boolean |
isActive()
Checks if is active.
|
boolean |
isFinished()
Gets the boolean value of finished.
|
boolean |
isForcingSeparateLogging() |
boolean |
isGatheringMetrics() |
boolean |
isInitialized()
Gets the boolean value of initialized.
|
boolean |
isInteractive()
Gets the boolean value of interactive.
|
boolean |
isStopped()
Gets the stopped status of this Job.
|
String[] |
listParameters() |
String[] |
listVariables() |
void |
removeJobEntryListener(JobEntryListener jobEntryListener)
Remove a job entry listener from the job
|
void |
removeJobListener(JobListener jobListener)
Remove a job listener from the job
|
void |
resetErrors()
Set the number of occured errors to 0.
|
void |
run()
Threads main loop: called by Thread.start();
|
static String |
sendToSlaveServer(JobMeta jobMeta,
JobExecutionConfiguration executionConfiguration,
Repository repository,
org.pentaho.metastore.api.IMetaStore metaStore)
Send to slave server.
|
void |
setArguments(String[] arguments) |
void |
setBatchId(long batchId)
Sets the batchId.
|
void |
setContainerObjectId(String containerObjectId)
Sets the execution container object id (containerObjectId).
|
void |
setDelegationListeners(List<DelegationListener> delegationListeners) |
void |
setExecutingServer(String executingServer)
Sets the executing server.
|
void |
setExecutingUser(String executingUser)
Sets the executing user.
|
void |
setFinished(boolean finished)
Sets the value of finished.
|
void |
setForcingSeparateLogging(boolean forcingSeparateLogging) |
void |
setGatheringMetrics(boolean gatheringMetrics) |
void |
setInteractive(boolean interactive)
Sets the value of interactive.
|
void |
setInternalKettleVariables(org.pentaho.di.core.variables.VariableSpace var)
Sets the internal kettle variables.
|
void |
setJobTracker(JobTracker jobTracker)
Sets the job tracker.
|
void |
setLogLevel(org.pentaho.di.core.logging.LogLevel logLevel)
Sets the log level.
|
void |
setParameterValue(String key,
String value) |
void |
setParentJob(Job parentJob)
Sets the parent job.
|
void |
setParentTrans(Trans parentTrans) |
void |
setParentVariableSpace(org.pentaho.di.core.variables.VariableSpace parent) |
void |
setPassedBatchId(long jobBatchId)
Sets the passedBatchId.
|
void |
setRepository(Repository rep)
Sets the repository.
|
void |
setResult(org.pentaho.di.core.Result result)
Sets the result.
|
void |
setSocketRepository(SocketRepository socketRepository)
Sets the socket repository.
|
void |
setSourceRows(List<org.pentaho.di.core.RowMetaAndData> sourceRows)
Sets the source rows.
|
void |
setStartJobEntryCopy(JobEntryCopy startJobEntryCopy)
Sets the start job entry copy.
|
void |
setStartJobEntryResult(org.pentaho.di.core.Result startJobEntryResult) |
void |
setStopped(boolean stopped)
Sets the stopped.
|
void |
setTransactionId(String transactionId)
Sets the transaction id.
|
void |
setVariable(String variableName,
String variableValue) |
void |
shareVariablesWith(org.pentaho.di.core.variables.VariableSpace space) |
void |
stopAll()
Stop all activity by setting the stopped property to true.
|
String |
toString()
Gets the name property of the JobMeta property.
|
void |
waitUntilFinished()
Wait until this job has finished.
|
void |
waitUntilFinished(long maxMiliseconds)
Wait until this job has finished.
|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, yield
public static final String CONFIGURATION_IN_EXPORT_FILENAME
public Job(String name, String file, String[] args)
name
- the namefile
- the fileargs
- the argspublic Job(Repository repository, JobMeta jobMeta)
repository
- the repositoryjobMeta
- the job metapublic Job(Repository repository, JobMeta jobMeta, org.pentaho.di.core.logging.LoggingObjectInterface parentLogging)
repository
- the repositoryjobMeta
- the job metaparentLogging
- the parent loggingpublic Job()
public void init()
public String toString()
public static final Job createJobWithNewClassLoader() throws org.pentaho.di.core.exception.KettleException
org.pentaho.di.core.exception.KettleException
- the kettle exceptionpublic String getJobname()
public void setRepository(Repository rep)
rep
- the new repositorypublic void run()
public org.pentaho.di.core.Result execute(int nr, org.pentaho.di.core.Result result) throws org.pentaho.di.core.exception.KettleException
nr
- The job entry numberresult
- the result of the previous executionorg.pentaho.di.core.exception.KettleJobException
org.pentaho.di.core.exception.KettleException
public void fireJobFinishListeners() throws org.pentaho.di.core.exception.KettleException
org.pentaho.di.core.exception.KettleException
JobListener.jobFinished(Job)
public void fireJobStartListeners() throws org.pentaho.di.core.exception.KettleException
org.pentaho.di.core.exception.KettleException
JobListener.jobStarted(Job)
public void waitUntilFinished()
public void waitUntilFinished(long maxMiliseconds)
maxMiliseconds
- the maximum number of ms to waitpublic int getErrors()
public void resetErrors()
public void addErrors(int nrToAdd)
nrToAdd
- nr of errors to add.public boolean beginProcessing() throws org.pentaho.di.core.exception.KettleException
org.pentaho.di.core.exception.KettleException
public boolean isActive()
public void stopAll()
public void setStopped(boolean stopped)
stopped
- the new stoppedpublic boolean isStopped()
public Date getStartDate()
public Date getEndDate()
public Date getCurrentDate()
public Date getDepDate()
public Date getLogDate()
public JobMeta getJobMeta()
public Repository getRep()
public Thread getThread()
public JobTracker getJobTracker()
public void setJobTracker(JobTracker jobTracker)
jobTracker
- The jobTracker to setpublic void setSourceRows(List<org.pentaho.di.core.RowMetaAndData> sourceRows)
sourceRows
- the new source rowspublic List<org.pentaho.di.core.RowMetaAndData> getSourceRows()
public Job getParentJob()
public void setParentJob(Job parentJob)
parentJob
- The parentJob to set.public org.pentaho.di.core.Result getResult()
public void setResult(org.pentaho.di.core.Result result)
result
- the new resultpublic boolean isInitialized()
public long getBatchId()
public void setBatchId(long batchId)
batchId
- The batchId to setpublic long getPassedBatchId()
public void setPassedBatchId(long jobBatchId)
jobBatchId
- the jobBatchId to setpublic void setInternalKettleVariables(org.pentaho.di.core.variables.VariableSpace var)
var
- the new internal kettle variables.public void copyVariablesFrom(org.pentaho.di.core.variables.VariableSpace space)
copyVariablesFrom
in interface org.pentaho.di.core.variables.VariableSpace
public String environmentSubstitute(String aString)
environmentSubstitute
in interface org.pentaho.di.core.variables.VariableSpace
public String[] environmentSubstitute(String[] aString)
environmentSubstitute
in interface org.pentaho.di.core.variables.VariableSpace
public String fieldSubstitute(String aString, org.pentaho.di.core.row.RowMetaInterface rowMeta, Object[] rowData) throws org.pentaho.di.core.exception.KettleValueException
fieldSubstitute
in interface org.pentaho.di.core.variables.VariableSpace
org.pentaho.di.core.exception.KettleValueException
public org.pentaho.di.core.variables.VariableSpace getParentVariableSpace()
getParentVariableSpace
in interface org.pentaho.di.core.variables.VariableSpace
public void setParentVariableSpace(org.pentaho.di.core.variables.VariableSpace parent)
setParentVariableSpace
in interface org.pentaho.di.core.variables.VariableSpace
public String getVariable(String variableName, String defaultValue)
getVariable
in interface org.pentaho.di.core.variables.VariableSpace
public String getVariable(String variableName)
getVariable
in interface org.pentaho.di.core.variables.VariableSpace
public boolean getBooleanValueOfVariable(String variableName, boolean defaultValue)
getBooleanValueOfVariable
in interface org.pentaho.di.core.variables.VariableSpace
public void initializeVariablesFrom(org.pentaho.di.core.variables.VariableSpace parent)
initializeVariablesFrom
in interface org.pentaho.di.core.variables.VariableSpace
public String[] listVariables()
listVariables
in interface org.pentaho.di.core.variables.VariableSpace
public void setVariable(String variableName, String variableValue)
setVariable
in interface org.pentaho.di.core.variables.VariableSpace
public void shareVariablesWith(org.pentaho.di.core.variables.VariableSpace space)
shareVariablesWith
in interface org.pentaho.di.core.variables.VariableSpace
public void injectVariables(Map<String,String> prop)
injectVariables
in interface org.pentaho.di.core.variables.VariableSpace
public String getStatus()
public static String sendToSlaveServer(JobMeta jobMeta, JobExecutionConfiguration executionConfiguration, Repository repository, org.pentaho.metastore.api.IMetaStore metaStore) throws org.pentaho.di.core.exception.KettleException
jobMeta
- the job metaexecutionConfiguration
- the execution configurationrepository
- the repositorymetaStore
- the metaStoreorg.pentaho.di.core.exception.KettleException
- the kettle exceptionpublic void addJobListener(JobListener jobListener)
jobListener
- the job listener to addpublic void addJobEntryListener(JobEntryListener jobEntryListener)
jobEntryListener
- the job entry listenerpublic void removeJobListener(JobListener jobListener)
jobListener
- the job listener to removepublic void removeJobEntryListener(JobEntryListener jobEntryListener)
jobListener
- the job entry listener to removepublic List<JobEntryListener> getJobEntryListeners()
public List<JobListener> getJobListeners()
public boolean isFinished()
public void setFinished(boolean finished)
finished
- the finished to setpublic void addParameterDefinition(String key, String defValue, String description) throws org.pentaho.di.core.parameters.DuplicateParamException
addParameterDefinition
in interface org.pentaho.di.core.parameters.NamedParams
org.pentaho.di.core.parameters.DuplicateParamException
public String getParameterDescription(String key) throws org.pentaho.di.core.parameters.UnknownParamException
getParameterDescription
in interface org.pentaho.di.core.parameters.NamedParams
org.pentaho.di.core.parameters.UnknownParamException
public String getParameterDefault(String key) throws org.pentaho.di.core.parameters.UnknownParamException
getParameterDefault
in interface org.pentaho.di.core.parameters.NamedParams
org.pentaho.di.core.parameters.UnknownParamException
public String getParameterValue(String key) throws org.pentaho.di.core.parameters.UnknownParamException
getParameterValue
in interface org.pentaho.di.core.parameters.NamedParams
org.pentaho.di.core.parameters.UnknownParamException
public String[] listParameters()
listParameters
in interface org.pentaho.di.core.parameters.NamedParams
public void setParameterValue(String key, String value) throws org.pentaho.di.core.parameters.UnknownParamException
setParameterValue
in interface org.pentaho.di.core.parameters.NamedParams
org.pentaho.di.core.parameters.UnknownParamException
public void eraseParameters()
eraseParameters
in interface org.pentaho.di.core.parameters.NamedParams
public void clearParameters()
clearParameters
in interface org.pentaho.di.core.parameters.NamedParams
public void activateParameters()
activateParameters
in interface org.pentaho.di.core.parameters.NamedParams
public void copyParametersFrom(org.pentaho.di.core.parameters.NamedParams params)
copyParametersFrom
in interface org.pentaho.di.core.parameters.NamedParams
public void setSocketRepository(SocketRepository socketRepository)
socketRepository
- the new socket repositorypublic SocketRepository getSocketRepository()
public org.pentaho.di.core.logging.LogChannelInterface getLogChannel()
getLogChannel
in interface HasLogChannelInterface
public String getObjectName()
getObjectName
in interface org.pentaho.di.core.logging.LoggingObjectInterface
public String getObjectCopy()
getObjectCopy
in interface org.pentaho.di.core.logging.LoggingObjectInterface
public String getFilename()
getFilename
in interface org.pentaho.di.core.logging.LoggingObjectInterface
public String getLogChannelId()
getLogChannelId
in interface org.pentaho.di.core.logging.LoggingObjectInterface
public org.pentaho.di.repository.ObjectId getObjectId()
getObjectId
in interface org.pentaho.di.core.logging.LoggingObjectInterface
public org.pentaho.di.repository.ObjectRevision getObjectRevision()
getObjectRevision
in interface org.pentaho.di.core.logging.LoggingObjectInterface
public org.pentaho.di.core.logging.LoggingObjectType getObjectType()
getObjectType
in interface org.pentaho.di.core.logging.LoggingObjectInterface
public org.pentaho.di.core.logging.LoggingObjectInterface getParent()
getParent
in interface org.pentaho.di.core.logging.LoggingObjectInterface
public org.pentaho.di.repository.RepositoryDirectoryInterface getRepositoryDirectory()
getRepositoryDirectory
in interface org.pentaho.di.core.logging.LoggingObjectInterface
public org.pentaho.di.core.logging.LogLevel getLogLevel()
getLogLevel
in interface org.pentaho.di.core.logging.LoggingObjectInterface
public void setLogLevel(org.pentaho.di.core.logging.LogLevel logLevel)
logLevel
- the new log levelpublic List<org.pentaho.di.core.logging.LoggingHierarchy> getLoggingHierarchy()
public boolean isInteractive()
public void setInteractive(boolean interactive)
interactive
- the interactive to setpublic Map<JobEntryCopy,JobEntryTrans> getActiveJobEntryTransformations()
public Map<JobEntryCopy,JobEntryJob> getActiveJobEntryJobs()
public List<JobEntryResult> getJobEntryResults()
public String getContainerObjectId()
getContainerObjectId
in interface org.pentaho.di.core.logging.LoggingObjectInterface
public void setContainerObjectId(String containerObjectId)
containerObjectId
- the execution container object id to setpublic org.pentaho.di.core.logging.LoggingObjectInterface getParentLoggingObject()
public Date getRegistrationDate()
getRegistrationDate
in interface org.pentaho.di.core.logging.LoggingObjectInterface
public JobEntryCopy getStartJobEntryCopy()
public void setStartJobEntryCopy(JobEntryCopy startJobEntryCopy)
startJobEntryCopy
- the startJobEntryCopy to setpublic String getExecutingServer()
getExecutingServer
in interface ExecutorInterface
public void setExecutingServer(String executingServer)
setExecutingServer
in interface ExecutorInterface
executingServer
- the executingServer to setpublic String getExecutingUser()
getExecutingUser
in interface ExecutorInterface
public void setExecutingUser(String executingUser)
setExecutingUser
in interface ExecutorInterface
executingUser
- the executingUser to setpublic boolean isGatheringMetrics()
isGatheringMetrics
in interface org.pentaho.di.core.logging.LoggingObjectInterface
public void setGatheringMetrics(boolean gatheringMetrics)
setGatheringMetrics
in interface org.pentaho.di.core.logging.LoggingObjectInterface
public boolean isForcingSeparateLogging()
isForcingSeparateLogging
in interface org.pentaho.di.core.logging.LoggingObjectInterface
public void setForcingSeparateLogging(boolean forcingSeparateLogging)
setForcingSeparateLogging
in interface org.pentaho.di.core.logging.LoggingObjectInterface
public String getTransactionId()
public void setTransactionId(String transactionId)
transactionId
- the transactionId to setpublic List<DelegationListener> getDelegationListeners()
public void setDelegationListeners(List<DelegationListener> delegationListeners)
public void addDelegationListener(DelegationListener delegationListener)
public String[] getArguments()
public void setArguments(String[] arguments)
public Trans getParentTrans()
public void setParentTrans(Trans parentTrans)
public Map<String,Object> getExtensionDataMap()
getExtensionDataMap
in interface org.pentaho.di.core.ExtensionDataInterface
public org.pentaho.di.core.Result getStartJobEntryResult()
public void setStartJobEntryResult(org.pentaho.di.core.Result startJobEntryResult)