Package org.pentaho.di.trans
Class Trans
- java.lang.Object
-
- org.pentaho.di.trans.Trans
-
- All Implemented Interfaces:
ExecutorInterface
,org.pentaho.di.core.ExtensionDataInterface
,HasLogChannelInterface
,org.pentaho.di.core.logging.LoggingObjectInterface
,org.pentaho.di.core.logging.LoggingObjectLifecycleInterface
,org.pentaho.di.core.parameters.NamedParams
,org.pentaho.di.core.variables.VariableSpace
public class Trans extends Object 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
This class represents the information and operations associated with the concept of a Transformation. It loads, instantiates, initializes, runs, and monitors the execution of the transformation contained in the specified TransInfo object.- Since:
- 07-04-2003
- Author:
- Matt
-
-
Field Summary
Fields Modifier and Type Field Description protected String[]
arguments
The command line arguments for the transformation.int
class_nr
The class number.static String
CONFIGURATION_IN_EXPORT_FILENAME
Constant specifying a filename containing XML to inject into a ZIP file created during resource export.protected String
containerObjectId
The container object id.protected Hashtable<String,org.pentaho.di.core.Counter>
counters
A table of named counters.protected org.pentaho.di.core.logging.LogChannelInterface
log
The log channel interface.protected int
logCommitSize
The log commit size.protected boolean
loggingObjectInUse
protected org.pentaho.di.core.logging.LogLevel
logLevel
The log level.protected org.pentaho.metastore.api.IMetaStore
metaStore
The MetaStore to usestatic String
REPLAY_DATE_FORMAT
The replay date format.protected Repository
repository
The repository we are referencing.protected List<org.pentaho.di.core.ResultFile>
resultFiles
protected List<org.pentaho.di.core.RowMetaAndData>
resultRows
List<org.pentaho.di.core.RowSet>
rowsets
A list of all the row sets.static String
STRING_FINISHED
Constant indicating a transformation status of Finished.static String
STRING_FINISHED_WITH_ERRORS
Constant indicating a transformation status of Finished (with errors).static String
STRING_HALTING
Constant indicating a transformation status of Halting.static String
STRING_INITIALIZING
Constant indicating a transformation status of Initializing.static String
STRING_PAUSED
Constant indicating a transformation status of Paused.static String
STRING_PREPARING
Constant indicating a transformation status of Preparing for execution.static String
STRING_RUNNING
Constant indicating a transformation status of Running.static String
STRING_STOPPED
Constant indicating a transformation status of Stopped.static String
STRING_STOPPED_WITH_ERRORS
Constant indicating a transformation status of Stopped (with errors).static String
STRING_WAITING
Constant indicating a transformation status of Waiting.protected TransMeta
transMeta
The transformation metadata to execute.static int
TYPE_DISP_1_1
Constant indicating a dispatch type of 1-to-1.static int
TYPE_DISP_1_N
Constant indicating a dispatch type of 1-to-N.static int
TYPE_DISP_N_1
Constant indicating a dispatch type of N-to-1.static int
TYPE_DISP_N_M
Constant indicating a dispatch type of N-to-M.static int
TYPE_DISP_N_N
Constant indicating a dispatch type of N-to-N.
-
Constructor Summary
Constructors Constructor Description Trans()
Instantiates a new transformation.Trans(TransMeta transMeta)
Initializes a transformation from transformation meta-data defined in memory.Trans(TransMeta transMeta, org.pentaho.di.core.logging.LoggingObjectInterface parent)
Initializes a transformation from transformation meta-data defined in memory.Trans(Parent parent, Repository rep, String name, String dirname, String filename)
Instantiates a new transformation using any of the provided parameters including the variable bindings, a repository, a name, a repository directory name, and a filename.Trans(Parent parent, Repository rep, String name, String dirname, String filename, TransMeta parentTransMeta)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
activateParameters()
Activates all parameters by setting their values.void
addActiveSubTransformation(String subTransName, Trans subTrans)
void
addDelegationListener(DelegationListener delegationListener)
void
addParameterDefinition(String key, String defValue, String description)
Adds a parameter definition to this transformation.RowProducer
addRowProducer(String stepname, int copynr)
This adds a row producer to the transformation that just got set up.protected void
addStepPerformanceSnapShot()
Adds a step performance snapshot.void
addTransListener(TransListener transListener)
Adds a transformation listener.void
addTransStoppedListener(TransStoppedListener transStoppedListener)
Adds a stop-event listener to the transformation.void
beginProcessing()
Begin processing.void
calculateBatchIdAndDateRange()
Calculate the batch id and date range for the transformation.String
calculateTransactionId()
Calculates the transaction ID for the transformation.void
callAfterLog()
void
callBeforeLog()
void
cleanup()
This method performs any cleanup operations, typically called after the transformation has finished.static int
cleanupCluster(org.pentaho.di.core.logging.LogChannelInterface log, TransSplitter transSplitter)
Cleanup the cluster, including the master and all slaves, and return the number of errors that occurred.static void
cleanupSlaveServer(TransSplitter transSplitter, SlaveServer slaveServer, TransMeta slaveTransMeta)
Cleanup the slave server as part of a clustered transformation.void
clearError()
Clear the error in the transformation, clear all the rows from all the row sets, to make sure the transformation can continue with other data.void
clearParameters()
Clear the values of all parameters.void
copyParametersFrom(org.pentaho.di.core.parameters.NamedParams params)
Copy parameters from a NamedParams object.void
copyVariablesFrom(org.pentaho.di.core.variables.VariableSpace space)
Copies variables from a given variable space to this transformation.protected org.pentaho.di.core.database.Database
createDataBase(org.pentaho.di.core.database.DatabaseMeta meta)
void
doTopologySortOfSteps()
String
environmentSubstitute(String aString)
Substitutes any variable values into the given string, and returns the resolved string.String[]
environmentSubstitute(String[] aString)
Substitutes any variable values into each of the given strings, and returns an array containing the resolved string(s).void
eraseParameters()
Remove all parameters.void
execute(String[] arguments)
Executes the transformation.static void
executeClustered(TransSplitter transSplitter, TransExecutionConfiguration executionConfiguration)
Executes an existing TransSplitter, with the transformation already split.static TransSplitter
executeClustered(TransMeta transMeta, TransExecutionConfiguration executionConfiguration)
Execute the transformation in a clustered fashion.String
fieldSubstitute(String aString, org.pentaho.di.core.row.RowMetaInterface rowMeta, Object[] rowData)
List<StepInterface>
findBaseSteps(String stepname)
Find the base steps for the step with the specified name.StepDataInterface
findDataInterface(String name)
Find the data interface for the step with the specified name.MappingInput[]
findMappingInput()
Gets the mapping inputs for each step in the transformation.MappingOutput[]
findMappingOutput()
Gets the mapping outputs for each step in the transformation.org.pentaho.di.core.RowSet
findRowSet(String rowsetname)
Finds the RowSet with the specified name.org.pentaho.di.core.RowSet
findRowSet(String from, int fromcopy, String to, int tocopy)
Finds the RowSet between two steps (or copies of steps).StepInterface
findRunThread(String stepname)
Find the run thread for the step with the specified name.StepInterface
findStepInterface(String stepname, int copyNr)
Find the executing step copy for the step with the specified name and copy numberList<StepInterface>
findStepInterfaces(String stepname)
Find the available executing step copies for the step with the specified nameprotected void
fireTransFinishedListeners()
Make attempt to fire all registered listeners if possible.protected void
fireTransStartedListeners()
Fires the start-event listeners (if any are registered).Map<String,Job>
getActiveSubjobs()
Gets the active sub-jobs.Trans
getActiveSubTransformation(String subTransName)
Map<String,Trans>
getActiveSubtransformations()
Deprecated.String[]
getArguments()
long
getBatchId()
Gets the batch ID of the transformation.boolean
getBooleanValueOfVariable(String variableName, boolean defaultValue)
Returns a boolean representation of the specified variable after performing any necessary substitution.static org.pentaho.di.core.Result
getClusteredTransformationResult(org.pentaho.di.core.logging.LogChannelInterface log, TransSplitter transSplitter, Job parentJob)
Gets the clustered transformation result.static org.pentaho.di.core.Result
getClusteredTransformationResult(org.pentaho.di.core.logging.LogChannelInterface log, TransSplitter transSplitter, Job parentJob, boolean loggingRemoteWork)
Gets the clustered transformation result.String
getContainerObjectId()
Gets the container object ID.Hashtable<String,org.pentaho.di.core.Counter>
getCounters()
Date
getCurrentDate()
Gets the current date/time object.List<DelegationListener>
getDelegationListeners()
Date
getDepDate()
Gets the dependency date for the transformation.Date
getEndDate()
Gets the end date/time object for the transformation.int
getEnded()
Gets the number of steps in the transformation that are in an end state, such as Finished, Halted, or Stopped.int
getErrors()
Gets the number of errors that have occurred during execution of the transformation.String
getExecutingServer()
Gets the name of the executing server.String
getExecutingUser()
Gets the name of the executing user.Map<String,Object>
getExtensionDataMap()
String
getFilename()
Gets the filename of the transformation, or null if no filename existsDate
getJobEndDate()
Gets the job end date.Date
getJobStartDate()
Gets the job start date.long
getLastProcessed()
Gets a representable metric of the "processed" lines of the last step.int
getLogBufferStartLine()
Gets the logBufferStartLine.org.pentaho.di.core.logging.LogChannelInterface
getLogChannel()
Gets the log channel interface for the transformation.String
getLogChannelId()
Gets the log channel ID.Date
getLogDate()
Gets the date the transformation was logged.List<org.pentaho.di.core.logging.LoggingHierarchy>
getLoggingHierarchy()
Gets the logging hierarchy.org.pentaho.di.core.logging.LogLevel
getLogLevel()
Gets the log level.String
getMappingStepName()
Gets the mapping step name.org.pentaho.metastore.api.IMetaStore
getMetaStore()
String
getName()
Gets the name of the transformation.String
getObjectCopy()
Gets the object copy.org.pentaho.di.repository.ObjectId
getObjectId()
Gets the object ID.String
getObjectName()
Gets the object name.org.pentaho.di.repository.ObjectRevision
getObjectRevision()
Gets the object revision.org.pentaho.di.core.logging.LoggingObjectType
getObjectType()
Gets the object type.String
getParameterDefault(String key)
Gets the default value of the specified parameter.String
getParameterDescription(String key)
Gets the description of the specified parameter.String
getParameterValue(String key)
Gets the value of the specified parameter.org.pentaho.di.core.logging.LoggingObjectInterface
getParent()
Gets the parent logging object interface.Job
getParentJob()
Gets the parent job, or null if there is no parent.Trans
getParentTrans()
Gets the parent transformation, which is null if no parent transformation exists.org.pentaho.di.core.variables.VariableSpace
getParentVariableSpace()
Gets the parent variable space.long
getPassedBatchId()
Get the batch ID that is passed from the parent job to the transformation.org.pentaho.di.core.Result
getPreviousResult()
Date
getRegistrationDate()
Gets the registration date.Date
getReplayDate()
Gets the replay date.Repository
getRepository()
Gets the repository object for the transformation.org.pentaho.di.repository.RepositoryDirectoryInterface
getRepositoryDirectory()
Gets the repository directory.org.pentaho.di.core.Result
getResult()
Gets the result of the transformation.List<org.pentaho.di.core.ResultFile>
getResultFiles()
List<org.pentaho.di.core.RowMetaAndData>
getResultRows()
List<org.pentaho.di.core.RowSet>
getRowsets()
Gets the rowsets for the transformation.StepInterface
getRunThread(int i)
Gets the run thread for the step at the specified index.StepInterface
getRunThread(String name, int copy)
Gets the run thread for the step with the specified name and copy number.PrintWriter
getServletPrintWriter()
Gets the servlet print writer.javax.servlet.http.HttpServletRequest
getServletRequest()
javax.servlet.http.HttpServletResponse
getServletResponse()
SocketRepository
getSocketRepository()
Gets the socket repository.Date
getStartDate()
Gets the start date/time object for the transformation.String
getStatus()
Gets the status of the transformation (Halting, Finished, Paused, etc.)StepDataInterface
getStepDataInterface(String stepname, int stepcopy)
Finds the StepDataInterface (currently) associated with the specified step.StepInterface
getStepInterface(String stepname, int copy)
Find the StepInterface (thread) by looking it up using the name.Map<String,List<StepPerformanceSnapShot>>
getStepPerformanceSnapShots()
Gets a named list (map) of step performance snapshots.List<StepMetaDataCombi>
getSteps()
Gets a list of steps in the transformation.String
getThreadName()
Deprecated.String
getTransactionId()
Gets the transaction ID for the transformation.List<TransListener>
getTransListeners()
Gets a list of the transformation listeners.TransMeta
getTransMeta()
Gets the meta-data for the transformation.BaseStepData.StepExecutionStatus[]
getTransStepExecutionStatusLookup()
Checks the execution status of each step in the transformations.boolean[]
getTransStepIsRunningLookup()
Checks whether the transformation steps are running lookup.List<TransStoppedListener>
getTransStoppedListeners()
Gets the list of stop-event listeners for the transformation.String
getVariable(String variableName)
Gets the value of the specified variable, or returns a default value if no such variable exists.String
getVariable(String variableName, String defaultValue)
Gets the value of the specified variable, or returns a default value if no such variable exists.boolean
hasHaltedSteps()
Checks whether the transformation has any steps that are halted.boolean
hasStepStarted(String sname, int copy)
Checks whether the specified step (or step copy) has started.void
initializeVariablesFrom(org.pentaho.di.core.variables.VariableSpace parent)
Sets the values of the transformation's variables to the values from the parent variables.void
injectVariables(Map<String,String> prop)
Injects variables using the given Map.boolean
isExecutingClustered()
boolean
isFinished()
Checks if the transformation is finished\.boolean
isFinishedOrStopped()
boolean
isForcingSeparateLogging()
boolean
isGatheringMetrics()
boolean
isInitializing()
Checks whether the transformation is initializing.boolean
isLoggingObjectInUse()
boolean
isMonitored()
Checks whether the running transformation is being monitored.boolean
isPaused()
Checks if the transformation is paused.boolean
isPreparing()
Checks whether the transformation is preparing for execution.boolean
isPreview()
Checks whether the transformation is being previewed.boolean
isReadyToStart()
Checks whether the transformation is ready to start (i.e.boolean
isResultRowsSet()
boolean
isRunning()
Checks whether the transformation is running.boolean
isSafeModeEnabled()
Checks whether safe mode is enabled.boolean
isStopped()
Checks if the transformation is stopped.void
killAll()
Deprecated.Deprecated as of 8.0.String[]
listParameters()
Gets a list of the parameters for the transformation.String[]
listVariables()
Gets a list of variable names for the transformation.void
logSummary(StepInterface si)
Logs a summary message for the specified step.void
mergeParametersWith(org.pentaho.di.core.parameters.NamedParams params, boolean replace)
static long
monitorClusteredTransformation(org.pentaho.di.core.logging.LogChannelInterface log, TransSplitter transSplitter, Job parentJob)
Monitors a clustered transformation every second, after all the transformations in a cluster schema are running.static long
monitorClusteredTransformation(org.pentaho.di.core.logging.LogChannelInterface log, TransSplitter transSplitter, Job parentJob, int sleepTimeSeconds)
Monitors a clustered transformation every second, after all the transformations in a cluster schema are running.static void
monitorRemoteTransformation(org.pentaho.di.core.logging.LogChannelInterface log, String carteObjectId, String transName, SlaveServer remoteSlaveServer)
Monitors a remote transformation every 5 seconds.static void
monitorRemoteTransformation(org.pentaho.di.core.logging.LogChannelInterface log, String carteObjectId, String transName, SlaveServer remoteSlaveServer, int sleepTimeSeconds)
Monitors a remote transformation at the specified interval.void
notifyStoppedListeners()
int
nrActiveSteps()
Gets the number of active (i.e.int
nrSteps()
Gets the number of steps in this transformation.void
pauseRunning()
Pauses the transformation (pause all steps).void
prepareExecution(String[] arguments)
Prepares the transformation for execution.void
printStats(int seconds)
Logs the execution statistics for the transformation for the specified time interval.Trans
removeActiveSubTransformation(String subTransName)
void
resumeRunning()
Resumes running the transformation after a pause (resume all steps).void
safeStop()
Stops only input steps so that all downstream steps can finish processing rows that have already been inputstatic String
sendToSlaveServer(TransMeta transMeta, TransExecutionConfiguration executionConfiguration, Repository repository, org.pentaho.metastore.api.IMetaStore metaStore)
Send the transformation for execution to a Carte slave server.void
setArguments(String[] arguments)
void
setBatchId(long batchId)
Sets the batch ID of the transformation.void
setContainerObjectId(String containerObjectId)
Sets the container object ID.void
setCounters(Hashtable<String,org.pentaho.di.core.Counter> counters)
void
setDelegationListeners(List<DelegationListener> delegationListeners)
void
setExecutingClustered(boolean executingClustered)
void
setExecutingServer(String executingServer)
Sets the name of the executing server.void
setExecutingUser(String executingUser)
Sets the name of the executing user.protected void
setFinished(boolean finished)
void
setForcingSeparateLogging(boolean forcingSeparateLogging)
void
setGatheringMetrics(boolean gatheringMetrics)
void
setInitializing(boolean initializing)
Sets whether the transformation is initializing.void
setInitialLogBufferStartLine()
Sets logBufferStartLine based on LoggingBuffer last line numberprotected void
setInternalEntryCurrentDirectory(boolean hasFilename, boolean hasRepoDir)
void
setInternalKettleVariables(org.pentaho.di.core.variables.VariableSpace var)
Sets the internal kettle variables.void
setJobEndDate(Date jobEndDate)
Sets the job end date.void
setJobStartDate(Date jobStartDate)
Sets the job start date.void
setLog(org.pentaho.di.core.logging.LogChannelInterface log)
Sets the log channel interface for the transformation.void
setLogBufferStartLine(int lineNr)
Sets the logBufferStartLine.void
setLoggingObjectInUse(boolean inUse)
void
setLogLevel(org.pentaho.di.core.logging.LogLevel logLevel)
Sets the log level.void
setMappingStepName(String mappingStepName)
Sets the mapping step name.void
setMetaStore(org.pentaho.metastore.api.IMetaStore metaStore)
void
setMonitored(boolean monitored)
Sets whether the running transformation should be monitored.void
setParameterValue(String key, String value)
Sets the value for the specified parameter.void
setParent(org.pentaho.di.core.logging.LoggingObjectInterface parent)
Sets the parent logging object.void
setParentJob(Job parentJob)
Sets the parent job for the transformation.void
setParentTrans(Trans parentTrans)
Sets the parent transformation.void
setParentVariableSpace(org.pentaho.di.core.variables.VariableSpace parent)
Sets the parent variable space.void
setPassedBatchId(long jobBatchId)
Sets the passed batch ID of the transformation from the batch ID of the parent job.void
setPaused(boolean paused)
void
setPreparing(boolean preparing)
Sets whether the transformation is preparing for execution.void
setPreview(boolean preview)
Sets whether the transformation is being previewed.void
setPreviousResult(org.pentaho.di.core.Result previousResult)
protected void
setReadyToStart(boolean ready)
void
setReplayDate(Date replayDate)
Sets the replay date.void
setRepository(Repository repository)
Sets the repository object for the transformation.void
setResultFiles(List<org.pentaho.di.core.ResultFile> resultFiles)
void
setResultRows(List<org.pentaho.di.core.RowMetaAndData> resultRows)
void
setResultRowSet(boolean resultRowsSet)
void
setRunning(boolean running)
Sets whether the transformation is running.void
setSafeModeEnabled(boolean safeModeEnabled)
Turn on safe mode during running: the transformation will run slower but with more checking enabled.void
setServletPrintWriter(PrintWriter servletPrintWriter)
Sets the servlet print writer.void
setServletReponse(javax.servlet.http.HttpServletResponse response)
Sets encoding of HttpServletResponse according to System encoding.Check if system encoding is null or an empty and set it to HttpServletResponse when not and writes error to log if null.void
setServletRequest(javax.servlet.http.HttpServletRequest request)
void
setSocketRepository(SocketRepository socketRepository)
Sets the socket repository.void
setStepPerformanceSnapShots(Map<String,List<StepPerformanceSnapShot>> stepPerformanceSnapShots)
Sets the named list (map) of step performance snapshots.protected void
setSteps(List<StepMetaDataCombi> steps)
void
setStopped(boolean stopped)
void
setThreadName(String threadName)
Deprecated.void
setTransactionId(String transactionId)
Sets the transaction ID for the transformation.void
setTransListeners(List<TransListener> transListeners)
Sets the list of transformation listeners.void
setTransMeta(TransMeta transMeta)
Sets the meta-data for the transformation.void
setTransStoppedListeners(List<TransStoppedListener> transStoppedListeners)
Sets the list of stop-event listeners for the transformation.void
setVariable(String variableName, String variableValue)
Sets the value of the specified variable to the specified value.void
shareVariablesWith(org.pentaho.di.core.variables.VariableSpace space)
Shares a variable space from another variable space.protected void
shutdownHeartbeat(ExecutorService heartbeat)
protected ExecutorService
startHeartbeat(long intervalInSeconds)
void
startThreads()
Starts the threads prepared by prepareThreads().void
stopAll()
Stops all steps from running, and alerts any registered listeners.void
stopStep(StepMetaDataCombi combi, boolean safeStop)
String
toString()
Gets a string representation of the transformation.void
waitUntilFinished()
Waits until all RunThreads have finished.protected void
writeLogChannelInformation()
Writes log channel information to a channel logging table (if one has been configured).protected void
writeMetricsInformation()
protected void
writeStepLogInformation()
Writes step information to a step logging table (if one has been configured).
-
-
-
Field Detail
-
REPLAY_DATE_FORMAT
public static final String REPLAY_DATE_FORMAT
The replay date format.- See Also:
- Constant Field Values
-
log
protected org.pentaho.di.core.logging.LogChannelInterface log
The log channel interface.
-
loggingObjectInUse
protected boolean loggingObjectInUse
-
logLevel
protected org.pentaho.di.core.logging.LogLevel logLevel
The log level.
-
containerObjectId
protected String containerObjectId
The container object id.
-
logCommitSize
protected int logCommitSize
The log commit size.
-
transMeta
protected TransMeta transMeta
The transformation metadata to execute.
-
repository
protected Repository repository
The repository we are referencing.
-
metaStore
protected org.pentaho.metastore.api.IMetaStore metaStore
The MetaStore to use
-
rowsets
public List<org.pentaho.di.core.RowSet> rowsets
A list of all the row sets.
-
class_nr
public int class_nr
The class number.
-
TYPE_DISP_1_1
public static final int TYPE_DISP_1_1
Constant indicating a dispatch type of 1-to-1.- See Also:
- Constant Field Values
-
TYPE_DISP_1_N
public static final int TYPE_DISP_1_N
Constant indicating a dispatch type of 1-to-N.- See Also:
- Constant Field Values
-
TYPE_DISP_N_1
public static final int TYPE_DISP_N_1
Constant indicating a dispatch type of N-to-1.- See Also:
- Constant Field Values
-
TYPE_DISP_N_N
public static final int TYPE_DISP_N_N
Constant indicating a dispatch type of N-to-N.- See Also:
- Constant Field Values
-
TYPE_DISP_N_M
public static final int TYPE_DISP_N_M
Constant indicating a dispatch type of N-to-M.- See Also:
- Constant Field Values
-
STRING_FINISHED
public static final String STRING_FINISHED
Constant indicating a transformation status of Finished.- See Also:
- Constant Field Values
-
STRING_FINISHED_WITH_ERRORS
public static final String STRING_FINISHED_WITH_ERRORS
Constant indicating a transformation status of Finished (with errors).- See Also:
- Constant Field Values
-
STRING_RUNNING
public static final String STRING_RUNNING
Constant indicating a transformation status of Running.- See Also:
- Constant Field Values
-
STRING_PAUSED
public static final String STRING_PAUSED
Constant indicating a transformation status of Paused.- See Also:
- Constant Field Values
-
STRING_PREPARING
public static final String STRING_PREPARING
Constant indicating a transformation status of Preparing for execution.- See Also:
- Constant Field Values
-
STRING_INITIALIZING
public static final String STRING_INITIALIZING
Constant indicating a transformation status of Initializing.- See Also:
- Constant Field Values
-
STRING_WAITING
public static final String STRING_WAITING
Constant indicating a transformation status of Waiting.- See Also:
- Constant Field Values
-
STRING_STOPPED
public static final String STRING_STOPPED
Constant indicating a transformation status of Stopped.- See Also:
- Constant Field Values
-
STRING_STOPPED_WITH_ERRORS
public static final String STRING_STOPPED_WITH_ERRORS
Constant indicating a transformation status of Stopped (with errors).- See Also:
- Constant Field Values
-
STRING_HALTING
public static final String STRING_HALTING
Constant indicating a transformation status of Halting.- See Also:
- Constant Field Values
-
CONFIGURATION_IN_EXPORT_FILENAME
public static final String CONFIGURATION_IN_EXPORT_FILENAME
Constant specifying a filename containing XML to inject into a ZIP file created during resource export.- See Also:
- Constant Field Values
-
resultRows
protected List<org.pentaho.di.core.RowMetaAndData> resultRows
-
resultFiles
protected List<org.pentaho.di.core.ResultFile> resultFiles
-
arguments
protected String[] arguments
The command line arguments for the transformation.
-
-
Constructor Detail
-
Trans
public Trans()
Instantiates a new transformation.
-
Trans
public Trans(TransMeta transMeta)
Initializes a transformation from transformation meta-data defined in memory.- Parameters:
transMeta
- the transformation meta-data to use.
-
Trans
public Trans(TransMeta transMeta, org.pentaho.di.core.logging.LoggingObjectInterface parent)
Initializes a transformation from transformation meta-data defined in memory. Also take into account the parent log channel interface (job or transformation) for logging lineage purposes.- Parameters:
transMeta
- the transformation meta-data to use.parent
- the parent job that is executing this transformation
-
Trans
public Trans(Parent parent, Repository rep, String name, String dirname, String filename) throws org.pentaho.di.core.exception.KettleException
Instantiates a new transformation using any of the provided parameters including the variable bindings, a repository, a name, a repository directory name, and a filename. This is a multi-purpose method that supports loading a transformation from a file (if the filename is provided but not a repository object) or from a repository (if the repository object, repository directory name, and transformation name are specified).- Parameters:
parent
- the parent variable space and named paramsrep
- the repositoryname
- the name of the transformationdirname
- the dirname the repository directory namefilename
- the filename containing the transformation definition- Throws:
org.pentaho.di.core.exception.KettleException
- if any error occurs during loading, parsing, or creation of the transformation
-
Trans
public Trans(Parent parent, Repository rep, String name, String dirname, String filename, TransMeta parentTransMeta) throws org.pentaho.di.core.exception.KettleException
- Throws:
org.pentaho.di.core.exception.KettleException
-
-
Method Detail
-
setParent
public void setParent(org.pentaho.di.core.logging.LoggingObjectInterface parent)
Sets the parent logging object.- Parameters:
parent
- the new parent
-
isLoggingObjectInUse
public boolean isLoggingObjectInUse()
- Specified by:
isLoggingObjectInUse
in interfaceorg.pentaho.di.core.logging.LoggingObjectInterface
-
setLoggingObjectInUse
public void setLoggingObjectInUse(boolean inUse)
-
getLogChannel
public org.pentaho.di.core.logging.LogChannelInterface getLogChannel()
Gets the log channel interface for the transformation.- Specified by:
getLogChannel
in interfaceHasLogChannelInterface
- Returns:
- the log channel
- See Also:
HasLogChannelInterface.getLogChannel()
-
setLog
public void setLog(org.pentaho.di.core.logging.LogChannelInterface log)
Sets the log channel interface for the transformation.- Parameters:
log
- the new log channel interface
-
getName
public String getName()
Gets the name of the transformation.- Returns:
- the transformation name
-
execute
public void execute(String[] arguments) throws org.pentaho.di.core.exception.KettleException
Executes the transformation. This method will prepare the transformation for execution and then start all the threads associated with the transformation and its steps.- Parameters:
arguments
- the arguments- Throws:
org.pentaho.di.core.exception.KettleException
- if the transformation could not be prepared (initialized)
-
prepareExecution
public void prepareExecution(String[] arguments) throws org.pentaho.di.core.exception.KettleException
Prepares the transformation for execution. This includes setting the arguments and parameters as well as preparing and tracking the steps and hops in the transformation.- Parameters:
arguments
- the arguments to use for this transformation- Throws:
org.pentaho.di.core.exception.KettleException
- in case the transformation could not be prepared (initialized)
-
startThreads
public void startThreads() throws org.pentaho.di.core.exception.KettleException
Starts the threads prepared by prepareThreads(). Before you start the threads, you can add RowListeners to them.- Throws:
org.pentaho.di.core.exception.KettleException
- if there is a communication error with a remote output socket.
-
fireTransFinishedListeners
protected void fireTransFinishedListeners() throws org.pentaho.di.core.exception.KettleException
Make attempt to fire all registered listeners if possible.- Throws:
org.pentaho.di.core.exception.KettleException
- if any errors occur during notification
-
fireTransStartedListeners
protected void fireTransStartedListeners() throws org.pentaho.di.core.exception.KettleException
Fires the start-event listeners (if any are registered).- Throws:
org.pentaho.di.core.exception.KettleException
- if any errors occur during notification
-
addStepPerformanceSnapShot
protected void addStepPerformanceSnapShot()
Adds a step performance snapshot.
-
cleanup
public void cleanup()
This method performs any cleanup operations, typically called after the transformation has finished. Specifically, after ALL the slave transformations in a clustered run have finished.
-
logSummary
public void logSummary(StepInterface si)
Logs a summary message for the specified step.- Parameters:
si
- the step interface
-
waitUntilFinished
public void waitUntilFinished()
Waits until all RunThreads have finished.
-
getErrors
public int getErrors()
Gets the number of errors that have occurred during execution of the transformation.- Returns:
- the number of errors
-
getEnded
public int getEnded()
Gets the number of steps in the transformation that are in an end state, such as Finished, Halted, or Stopped.- Returns:
- the number of ended steps
-
isFinished
public boolean isFinished()
Checks if the transformation is finished\.- Returns:
- true if the transformation is finished, false otherwise
-
setFinished
protected void setFinished(boolean finished)
-
isFinishedOrStopped
public boolean isFinishedOrStopped()
-
killAll
@Deprecated public void killAll()
Deprecated.Deprecated as of 8.0. Seems unused; will be to remove in 8.1 (ccaspanello)Attempts to stops all running steps and subtransformations. If all steps have finished, the transformation is marked as Finished.
-
printStats
public void printStats(int seconds)
Logs the execution statistics for the transformation for the specified time interval. If the total length of execution is supplied as the interval, then the statistics represent the average throughput (lines read/written/updated/rejected/etc. per second) for the entire execution.- Parameters:
seconds
- the time interval (in seconds)
-
getLastProcessed
public long getLastProcessed()
Gets a representable metric of the "processed" lines of the last step.- Returns:
- the number of lines processed by the last step
-
findRowSet
public org.pentaho.di.core.RowSet findRowSet(String rowsetname)
Finds the RowSet with the specified name.- Parameters:
rowsetname
- the rowsetname- Returns:
- the row set, or null if none found
-
findRowSet
public org.pentaho.di.core.RowSet findRowSet(String from, int fromcopy, String to, int tocopy)
Finds the RowSet between two steps (or copies of steps).- Parameters:
from
- the name of the "from" stepfromcopy
- the copy number of the "from" stepto
- the name of the "to" steptocopy
- the copy number of the "to" step- Returns:
- the row set, or null if none found
-
hasStepStarted
public boolean hasStepStarted(String sname, int copy)
Checks whether the specified step (or step copy) has started.- Parameters:
sname
- the step namecopy
- the copy number- Returns:
- true the specified step (or step copy) has started, false otherwise
-
safeStop
public void safeStop()
Stops only input steps so that all downstream steps can finish processing rows that have already been input
-
stopAll
public void stopAll()
Stops all steps from running, and alerts any registered listeners.
-
stopStep
public void stopStep(StepMetaDataCombi combi, boolean safeStop)
-
notifyStoppedListeners
public void notifyStoppedListeners()
-
nrSteps
public int nrSteps()
Gets the number of steps in this transformation.- Returns:
- the number of steps
-
nrActiveSteps
public int nrActiveSteps()
Gets the number of active (i.e. not finished) steps in this transformation- Returns:
- the number of active steps
-
getTransStepIsRunningLookup
public boolean[] getTransStepIsRunningLookup()
Checks whether the transformation steps are running lookup.- Returns:
- a boolean array associated with the step list, indicating whether that step is running a lookup.
-
getTransStepExecutionStatusLookup
public BaseStepData.StepExecutionStatus[] getTransStepExecutionStatusLookup()
Checks the execution status of each step in the transformations.- Returns:
- an array associated with the step list, indicating the status of that step.
-
getRunThread
public StepInterface getRunThread(int i)
Gets the run thread for the step at the specified index.- Parameters:
i
- the index of the desired step- Returns:
- a StepInterface object corresponding to the run thread for the specified step
-
getRunThread
public StepInterface getRunThread(String name, int copy)
Gets the run thread for the step with the specified name and copy number.- Parameters:
name
- the step namecopy
- the copy number- Returns:
- a StepInterface object corresponding to the run thread for the specified step
-
calculateBatchIdAndDateRange
public void calculateBatchIdAndDateRange() throws org.pentaho.di.core.exception.KettleTransException
Calculate the batch id and date range for the transformation.- Throws:
org.pentaho.di.core.exception.KettleTransException
- if there are any errors during calculation
-
beginProcessing
public void beginProcessing() throws org.pentaho.di.core.exception.KettleTransException
Begin processing. Also handle logging operations related to the start of the transformation- Throws:
org.pentaho.di.core.exception.KettleTransException
- the kettle trans exception
-
writeLogChannelInformation
protected void writeLogChannelInformation() throws org.pentaho.di.core.exception.KettleException
Writes log channel information to a channel logging table (if one has been configured).- Throws:
org.pentaho.di.core.exception.KettleException
- if any errors occur during logging
-
writeStepLogInformation
protected void writeStepLogInformation() throws org.pentaho.di.core.exception.KettleException
Writes step information to a step logging table (if one has been configured).- Throws:
org.pentaho.di.core.exception.KettleException
- if any errors occur during logging
-
createDataBase
protected org.pentaho.di.core.database.Database createDataBase(org.pentaho.di.core.database.DatabaseMeta meta)
-
writeMetricsInformation
protected void writeMetricsInformation() throws org.pentaho.di.core.exception.KettleException
- Throws:
org.pentaho.di.core.exception.KettleException
-
getResult
public org.pentaho.di.core.Result getResult()
Gets the result of the transformation. The Result object contains such measures as the number of errors, number of lines read/written/input/output/updated/rejected, etc.- Returns:
- the Result object containing resulting measures from execution of the transformation
-
findRunThread
public StepInterface findRunThread(String stepname)
Find the run thread for the step with the specified name.- Parameters:
stepname
- the step name- Returns:
- a StepInterface object corresponding to the run thread for the specified step
-
findBaseSteps
public List<StepInterface> findBaseSteps(String stepname)
Find the base steps for the step with the specified name.- Parameters:
stepname
- the step name- Returns:
- the list of base steps for the specified step
-
findStepInterface
public StepInterface findStepInterface(String stepname, int copyNr)
Find the executing step copy for the step with the specified name and copy number- Parameters:
stepname
- the step namecopyNr
-- Returns:
- the executing step found or null if no copy could be found.
-
findStepInterfaces
public List<StepInterface> findStepInterfaces(String stepname)
Find the available executing step copies for the step with the specified name- Parameters:
stepname
- the step name- Returns:
- the list of executing step copies found or null if no steps are available yet (incorrect usage)
-
findDataInterface
public StepDataInterface findDataInterface(String name)
Find the data interface for the step with the specified name.- Parameters:
name
- the step name- Returns:
- the step data interface
-
getStartDate
public Date getStartDate()
Gets the start date/time object for the transformation.- Returns:
- Returns the startDate.
-
getEndDate
public Date getEndDate()
Gets the end date/time object for the transformation.- Returns:
- Returns the endDate.
-
isMonitored
public boolean isMonitored()
Checks whether the running transformation is being monitored.- Returns:
- true the running transformation is being monitored, false otherwise
-
setMonitored
public void setMonitored(boolean monitored)
Sets whether the running transformation should be monitored.- Parameters:
monitored
- true if the running transformation should be monitored, false otherwise
-
getTransMeta
public TransMeta getTransMeta()
Gets the meta-data for the transformation.- Returns:
- Returns the transformation meta-data
-
setTransMeta
public void setTransMeta(TransMeta transMeta)
Sets the meta-data for the transformation.- Parameters:
transMeta
- The transformation meta-data to set.
-
getCurrentDate
public Date getCurrentDate()
Gets the current date/time object.- Returns:
- the current date
-
getDepDate
public Date getDepDate()
Gets the dependency date for the transformation. A transformation can have a list of dependency fields. If any of these fields have a maximum date higher than the dependency date of the last run, the date range is set to to (-oo, now). The use-case is the incremental population of Slowly Changing Dimensions (SCD).- Returns:
- Returns the dependency date
-
getLogDate
public Date getLogDate()
Gets the date the transformation was logged.- Returns:
- the log date
-
getRowsets
public List<org.pentaho.di.core.RowSet> getRowsets()
Gets the rowsets for the transformation.- Returns:
- a list of rowsets
-
getSteps
public List<StepMetaDataCombi> getSteps()
Gets a list of steps in the transformation.- Returns:
- a list of the steps in the transformation
-
setSteps
protected void setSteps(List<StepMetaDataCombi> steps)
-
toString
public String toString()
Gets a string representation of the transformation.- Overrides:
toString
in classObject
- Returns:
- the string representation of the transformation
- See Also:
Object.toString()
-
findMappingInput
public MappingInput[] findMappingInput()
Gets the mapping inputs for each step in the transformation.- Returns:
- an array of MappingInputs
-
findMappingOutput
public MappingOutput[] findMappingOutput()
Gets the mapping outputs for each step in the transformation.- Returns:
- an array of MappingOutputs
-
getStepInterface
public StepInterface getStepInterface(String stepname, int copy)
Find the StepInterface (thread) by looking it up using the name.- Parameters:
stepname
- The name of the step to look forcopy
- the copy number of the step to look for- Returns:
- the StepInterface or null if nothing was found.
-
getReplayDate
public Date getReplayDate()
Gets the replay date. The replay date is used to indicate that the transformation was replayed (re-tried, run again) with that particular replay date. You can use this in Text File/Excel Input to allow you to save error line numbers into a file (SOURCE_FILE.line for example) During replay, only the lines that have errors in them are passed to the next steps, the other lines are ignored. This is for the use case: if the document contained errors (bad dates, chars in numbers, etc), you simply send the document back to the source (the user/departement that created it probably) and when you get it back, re-run the last transformation.- Returns:
- the replay date
-
setReplayDate
public void setReplayDate(Date replayDate)
Sets the replay date. The replay date is used to indicate that the transformation was replayed (re-tried, run again) with that particular replay date. You can use this in Text File/Excel Input to allow you to save error line numbers into a file (SOURCE_FILE.line for example) During replay, only the lines that have errors in them are passed to the next steps, the other lines are ignored. This is for the use case: if the document contained errors (bad dates, chars in numbers, etc), you simply send the document back to the source (the user/departement that created it probably) and when you get it back, re-run the last transformation.- Parameters:
replayDate
- the new replay date
-
setSafeModeEnabled
public void setSafeModeEnabled(boolean safeModeEnabled)
Turn on safe mode during running: the transformation will run slower but with more checking enabled.- Parameters:
safeModeEnabled
- true for safe mode
-
isSafeModeEnabled
public boolean isSafeModeEnabled()
Checks whether safe mode is enabled.- Returns:
- Returns true if the safe mode is enabled: the transformation will run slower but with more checking enabled
-
addRowProducer
public RowProducer addRowProducer(String stepname, int copynr) throws org.pentaho.di.core.exception.KettleException
This adds a row producer to the transformation that just got set up. It is preferable to run this BEFORE execute() but after prepareExecution()- Parameters:
stepname
- The step to produce rows forcopynr
- The copynr of the step to produce row for (normally 0 unless you have multiple copies running)- Returns:
- the row producer
- Throws:
org.pentaho.di.core.exception.KettleException
- in case the thread/step to produce rows for could not be found.- See Also:
execute(String[])
,prepareExecution(String[])
-
getParentJob
public Job getParentJob()
Gets the parent job, or null if there is no parent.- Returns:
- the parent job, or null if there is no parent
-
setParentJob
public void setParentJob(Job parentJob)
Sets the parent job for the transformation.- Parameters:
parentJob
- The parent job to set
-
getStepDataInterface
public StepDataInterface getStepDataInterface(String stepname, int stepcopy)
Finds the StepDataInterface (currently) associated with the specified step.- Parameters:
stepname
- The name of the step to look forstepcopy
- The copy number (0 based) of the step- Returns:
- The StepDataInterface or null if non found.
-
hasHaltedSteps
public boolean hasHaltedSteps()
Checks whether the transformation has any steps that are halted.- Returns:
- true if one or more steps are halted, false otherwise
-
getJobStartDate
public Date getJobStartDate()
Gets the job start date.- Returns:
- the job start date
-
getJobEndDate
public Date getJobEndDate()
Gets the job end date.- Returns:
- the job end date
-
setJobEndDate
public void setJobEndDate(Date jobEndDate)
Sets the job end date.- Parameters:
jobEndDate
- the jobEndDate to set
-
setJobStartDate
public void setJobStartDate(Date jobStartDate)
Sets the job start date.- Parameters:
jobStartDate
- the jobStartDate to set
-
getPassedBatchId
public long getPassedBatchId()
Get the batch ID that is passed from the parent job to the transformation. If nothing is passed, it's the transformation's batch ID- Returns:
- the parent job's batch ID, or the transformation's batch ID if there is no parent job
-
setPassedBatchId
public void setPassedBatchId(long jobBatchId)
Sets the passed batch ID of the transformation from the batch ID of the parent job.- Parameters:
jobBatchId
- the jobBatchId to set
-
getBatchId
public long getBatchId()
Gets the batch ID of the transformation.- Returns:
- the batch ID of the transformation
-
setBatchId
public void setBatchId(long batchId)
Sets the batch ID of the transformation.- Parameters:
batchId
- the batch ID to set
-
getThreadName
@Deprecated public String getThreadName()
Deprecated.Gets the name of the thread that contains the transformation.- Returns:
- the thread name
-
setThreadName
@Deprecated public void setThreadName(String threadName)
Deprecated.Sets the thread name for the transformation.- Parameters:
threadName
- the thread name
-
getStatus
public String getStatus()
Gets the status of the transformation (Halting, Finished, Paused, etc.)- Returns:
- the status of the transformation
-
isInitializing
public boolean isInitializing()
Checks whether the transformation is initializing.- Returns:
- true if the transformation is initializing, false otherwise
-
setInitializing
public void setInitializing(boolean initializing)
Sets whether the transformation is initializing.- Parameters:
initializing
- true if the transformation is initializing, false otherwise
-
isPreparing
public boolean isPreparing()
Checks whether the transformation is preparing for execution.- Returns:
- true if the transformation is preparing for execution, false otherwise
-
setPreparing
public void setPreparing(boolean preparing)
Sets whether the transformation is preparing for execution.- Parameters:
preparing
- true if the transformation is preparing for execution, false otherwise
-
isRunning
public boolean isRunning()
Checks whether the transformation is running.- Returns:
- true if the transformation is running, false otherwise
-
setRunning
public void setRunning(boolean running)
Sets whether the transformation is running.- Parameters:
running
- true if the transformation is running, false otherwise
-
executeClustered
public static TransSplitter executeClustered(TransMeta transMeta, TransExecutionConfiguration executionConfiguration) throws org.pentaho.di.core.exception.KettleException
Execute the transformation in a clustered fashion. The transformation steps are split and collected in a TransSplitter object- Parameters:
transMeta
- the transformation's meta-dataexecutionConfiguration
- the execution configuration- Returns:
- the transformation splitter object
- Throws:
org.pentaho.di.core.exception.KettleException
- the kettle exception
-
executeClustered
public static void executeClustered(TransSplitter transSplitter, TransExecutionConfiguration executionConfiguration) throws org.pentaho.di.core.exception.KettleException
Executes an existing TransSplitter, with the transformation already split.- Parameters:
transSplitter
- the trans splitterexecutionConfiguration
- the execution configuration- Throws:
org.pentaho.di.core.exception.KettleException
- the kettle exception- See Also:
org.pentaho.di.ui.spoon.delegates.SpoonTransformationDelegate
-
monitorClusteredTransformation
public static final long monitorClusteredTransformation(org.pentaho.di.core.logging.LogChannelInterface log, TransSplitter transSplitter, Job parentJob)
Monitors a clustered transformation every second, after all the transformations in a cluster schema are running.
Now we should verify that they are all running as they should.
If a transformation has an error, we should kill them all.
This should happen in a separate thread to prevent blocking of the UI.
When the master and slave transformations have all finished, we should also run
a cleanup on those transformations to release sockets, etc.
- Parameters:
log
- the log interface channeltransSplitter
- the transformation splitter objectparentJob
- the parent job when executed in a job, otherwise just set to null- Returns:
- the number of errors encountered
-
monitorClusteredTransformation
public static final long monitorClusteredTransformation(org.pentaho.di.core.logging.LogChannelInterface log, TransSplitter transSplitter, Job parentJob, int sleepTimeSeconds)
Monitors a clustered transformation every second, after all the transformations in a cluster schema are running.
Now we should verify that they are all running as they should.
If a transformation has an error, we should kill them all.
This should happen in a separate thread to prevent blocking of the UI.
When the master and slave transformations have all finished, we should also run
a cleanup on those transformations to release sockets, etc.
- Parameters:
log
- the subject to use for loggingtransSplitter
- the transformation splitter objectparentJob
- the parent job when executed in a job, otherwise just set to nullsleepTimeSeconds
- the sleep time in seconds in between slave transformation status polling- Returns:
- the number of errors encountered
-
cleanupCluster
public static int cleanupCluster(org.pentaho.di.core.logging.LogChannelInterface log, TransSplitter transSplitter)
Cleanup the cluster, including the master and all slaves, and return the number of errors that occurred.- Parameters:
log
- the log channel interfacetransSplitter
- the TransSplitter object- Returns:
- the number of errors that occurred in the clustered transformation
-
cleanupSlaveServer
public static void cleanupSlaveServer(TransSplitter transSplitter, SlaveServer slaveServer, TransMeta slaveTransMeta) throws org.pentaho.di.core.exception.KettleException
Cleanup the slave server as part of a clustered transformation.- Parameters:
transSplitter
- the TransSplitter objectslaveServer
- the slave serverslaveTransMeta
- the slave transformation meta-data- Throws:
org.pentaho.di.core.exception.KettleException
- if any errors occur during cleanup
-
getClusteredTransformationResult
public static final org.pentaho.di.core.Result getClusteredTransformationResult(org.pentaho.di.core.logging.LogChannelInterface log, TransSplitter transSplitter, Job parentJob)
Gets the clustered transformation result.- Parameters:
log
- the log channel interfacetransSplitter
- the TransSplitter objectparentJob
- the parent job- Returns:
- the clustered transformation result
-
getClusteredTransformationResult
public static final org.pentaho.di.core.Result getClusteredTransformationResult(org.pentaho.di.core.logging.LogChannelInterface log, TransSplitter transSplitter, Job parentJob, boolean loggingRemoteWork)
Gets the clustered transformation result.- Parameters:
log
- the log channel interfacetransSplitter
- the TransSplitter objectparentJob
- the parent jobloggingRemoteWork
- log remote execution logs locally- Returns:
- the clustered transformation result
-
sendToSlaveServer
public static String sendToSlaveServer(TransMeta transMeta, TransExecutionConfiguration executionConfiguration, Repository repository, org.pentaho.metastore.api.IMetaStore metaStore) throws org.pentaho.di.core.exception.KettleException
Send the transformation for execution to a Carte slave server.- Parameters:
transMeta
- the transformation meta-dataexecutionConfiguration
- the transformation execution configurationrepository
- the repository- Returns:
- The Carte object ID on the server.
- Throws:
org.pentaho.di.core.exception.KettleException
- if any errors occur during the dispatch to the slave server
-
isReadyToStart
public boolean isReadyToStart()
Checks whether the transformation is ready to start (i.e. execution preparation was successful)- Returns:
- true if the transformation was prepared for execution successfully, false otherwise
- See Also:
prepareExecution(String[])
-
setReadyToStart
protected void setReadyToStart(boolean ready)
-
setInternalKettleVariables
public void setInternalKettleVariables(org.pentaho.di.core.variables.VariableSpace var)
Sets the internal kettle variables.- Parameters:
var
- the new internal kettle variables
-
setInternalEntryCurrentDirectory
protected void setInternalEntryCurrentDirectory(boolean hasFilename, boolean hasRepoDir)
-
copyVariablesFrom
public void copyVariablesFrom(org.pentaho.di.core.variables.VariableSpace space)
Copies variables from a given variable space to this transformation.- Specified by:
copyVariablesFrom
in interfaceorg.pentaho.di.core.variables.VariableSpace
- Parameters:
space
- the variable space- See Also:
VariableSpace.copyVariablesFrom(org.pentaho.di.core.variables.VariableSpace)
-
environmentSubstitute
public String environmentSubstitute(String aString)
Substitutes any variable values into the given string, and returns the resolved string.- Specified by:
environmentSubstitute
in interfaceorg.pentaho.di.core.variables.VariableSpace
- Parameters:
aString
- the string to resolve against environment variables- Returns:
- the string after variables have been resolved/susbstituted
- See Also:
VariableSpace.environmentSubstitute(java.lang.String)
-
environmentSubstitute
public String[] environmentSubstitute(String[] aString)
Substitutes any variable values into each of the given strings, and returns an array containing the resolved string(s).- Specified by:
environmentSubstitute
in interfaceorg.pentaho.di.core.variables.VariableSpace
- Parameters:
aString
- an array of strings to resolve against environment variables- Returns:
- the array of strings after variables have been resolved/susbstituted
- See Also:
VariableSpace.environmentSubstitute(java.lang.String[])
-
fieldSubstitute
public String fieldSubstitute(String aString, org.pentaho.di.core.row.RowMetaInterface rowMeta, Object[] rowData) throws org.pentaho.di.core.exception.KettleValueException
- Specified by:
fieldSubstitute
in interfaceorg.pentaho.di.core.variables.VariableSpace
- Throws:
org.pentaho.di.core.exception.KettleValueException
-
getParentVariableSpace
public org.pentaho.di.core.variables.VariableSpace getParentVariableSpace()
Gets the parent variable space.- Specified by:
getParentVariableSpace
in interfaceorg.pentaho.di.core.variables.VariableSpace
- Returns:
- the parent variable space
- See Also:
VariableSpace.getParentVariableSpace()
-
setParentVariableSpace
public void setParentVariableSpace(org.pentaho.di.core.variables.VariableSpace parent)
Sets the parent variable space.- Specified by:
setParentVariableSpace
in interfaceorg.pentaho.di.core.variables.VariableSpace
- Parameters:
parent
- the new parent variable space- See Also:
VariableSpace.setParentVariableSpace( org.pentaho.di.core.variables.VariableSpace)
-
getVariable
public String getVariable(String variableName, String defaultValue)
Gets the value of the specified variable, or returns a default value if no such variable exists.- Specified by:
getVariable
in interfaceorg.pentaho.di.core.variables.VariableSpace
- Parameters:
variableName
- the variable namedefaultValue
- the default value- Returns:
- the value of the specified variable, or returns a default value if no such variable exists
- See Also:
VariableSpace.getVariable(java.lang.String, java.lang.String)
-
getVariable
public String getVariable(String variableName)
Gets the value of the specified variable, or returns a default value if no such variable exists.- Specified by:
getVariable
in interfaceorg.pentaho.di.core.variables.VariableSpace
- Parameters:
variableName
- the variable name- Returns:
- the value of the specified variable, or returns a default value if no such variable exists
- See Also:
VariableSpace.getVariable(java.lang.String)
-
getBooleanValueOfVariable
public boolean getBooleanValueOfVariable(String variableName, boolean defaultValue)
Returns a boolean representation of the specified variable after performing any necessary substitution. Truth values include case-insensitive versions of "Y", "YES", "TRUE" or "1".- Specified by:
getBooleanValueOfVariable
in interfaceorg.pentaho.di.core.variables.VariableSpace
- Parameters:
variableName
- the variable namedefaultValue
- the default value- Returns:
- a boolean representation of the specified variable after performing any necessary substitution
- See Also:
VariableSpace.getBooleanValueOfVariable(java.lang.String, boolean)
-
initializeVariablesFrom
public void initializeVariablesFrom(org.pentaho.di.core.variables.VariableSpace parent)
Sets the values of the transformation's variables to the values from the parent variables.- Specified by:
initializeVariablesFrom
in interfaceorg.pentaho.di.core.variables.VariableSpace
- Parameters:
parent
- the parent- See Also:
VariableSpace.initializeVariablesFrom( org.pentaho.di.core.variables.VariableSpace)
-
listVariables
public String[] listVariables()
Gets a list of variable names for the transformation.- Specified by:
listVariables
in interfaceorg.pentaho.di.core.variables.VariableSpace
- Returns:
- a list of variable names
- See Also:
VariableSpace.listVariables()
-
setVariable
public void setVariable(String variableName, String variableValue)
Sets the value of the specified variable to the specified value.- Specified by:
setVariable
in interfaceorg.pentaho.di.core.variables.VariableSpace
- Parameters:
variableName
- the variable namevariableValue
- the variable value- See Also:
VariableSpace.setVariable(java.lang.String, java.lang.String)
-
shareVariablesWith
public void shareVariablesWith(org.pentaho.di.core.variables.VariableSpace space)
Shares a variable space from another variable space. This means that the object should take over the space used as argument.- Specified by:
shareVariablesWith
in interfaceorg.pentaho.di.core.variables.VariableSpace
- Parameters:
space
- the variable space- See Also:
VariableSpace.shareVariablesWith(org.pentaho.di.core.variables.VariableSpace)
-
injectVariables
public void injectVariables(Map<String,String> prop)
Injects variables using the given Map. The behavior 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 interfaceorg.pentaho.di.core.variables.VariableSpace
- Parameters:
prop
- the property map- See Also:
VariableSpace.injectVariables(java.util.Map)
-
pauseRunning
public void pauseRunning()
Pauses the transformation (pause all steps).
-
resumeRunning
public void resumeRunning()
Resumes running the transformation after a pause (resume all steps).
-
isPreview
public boolean isPreview()
Checks whether the transformation is being previewed.- Returns:
- true if the transformation is being previewed, false otherwise
-
setPreview
public void setPreview(boolean preview)
Sets whether the transformation is being previewed.- Parameters:
preview
- true if the transformation is being previewed, false otherwise
-
getRepository
public Repository getRepository()
Gets the repository object for the transformation.- Returns:
- the repository
-
setRepository
public void setRepository(Repository repository)
Sets the repository object for the transformation.- Parameters:
repository
- the repository object to set
-
getStepPerformanceSnapShots
public Map<String,List<StepPerformanceSnapShot>> getStepPerformanceSnapShots()
Gets a named list (map) of step performance snapshots.- Returns:
- a named list (map) of step performance snapshots
-
setStepPerformanceSnapShots
public void setStepPerformanceSnapShots(Map<String,List<StepPerformanceSnapShot>> stepPerformanceSnapShots)
Sets the named list (map) of step performance snapshots.- Parameters:
stepPerformanceSnapShots
- a named list (map) of step performance snapshots to set
-
getTransListeners
public List<TransListener> getTransListeners()
Gets a list of the transformation listeners. Please do not attempt to modify this list externally. Returned list is mutable only for backward compatibility purposes.- Returns:
- the transListeners
-
setTransListeners
public void setTransListeners(List<TransListener> transListeners)
Sets the list of transformation listeners.- Parameters:
transListeners
- the transListeners to set
-
addTransListener
public void addTransListener(TransListener transListener)
Adds a transformation listener.- Parameters:
transListener
- the trans listener
-
setTransStoppedListeners
public void setTransStoppedListeners(List<TransStoppedListener> transStoppedListeners)
Sets the list of stop-event listeners for the transformation.- Parameters:
transStoppedListeners
- the list of stop-event listeners to set
-
getTransStoppedListeners
public List<TransStoppedListener> getTransStoppedListeners()
Gets the list of stop-event listeners for the transformation. This is not concurrent safe. Please note this is mutable implementation only for backward compatibility reasons.- Returns:
- the list of stop-event listeners
-
addTransStoppedListener
public void addTransStoppedListener(TransStoppedListener transStoppedListener)
Adds a stop-event listener to the transformation.- Parameters:
transStoppedListener
- the stop-event listener to add
-
isPaused
public boolean isPaused()
Checks if the transformation is paused.- Returns:
- true if the transformation is paused, false otherwise
-
setPaused
public void setPaused(boolean paused)
-
isStopped
public boolean isStopped()
Checks if the transformation is stopped.- Returns:
- true if the transformation is stopped, false otherwise
-
setStopped
public void setStopped(boolean stopped)
-
monitorRemoteTransformation
public static void monitorRemoteTransformation(org.pentaho.di.core.logging.LogChannelInterface log, String carteObjectId, String transName, SlaveServer remoteSlaveServer)
Monitors a remote transformation every 5 seconds.- Parameters:
log
- the log channel interfacecarteObjectId
- the Carte object IDtransName
- the transformation nameremoteSlaveServer
- the remote slave server
-
monitorRemoteTransformation
public static void monitorRemoteTransformation(org.pentaho.di.core.logging.LogChannelInterface log, String carteObjectId, String transName, SlaveServer remoteSlaveServer, int sleepTimeSeconds)
Monitors a remote transformation at the specified interval.- Parameters:
log
- the log channel interfacecarteObjectId
- the Carte object IDtransName
- the transformation nameremoteSlaveServer
- the remote slave serversleepTimeSeconds
- the sleep time (in seconds)
-
addParameterDefinition
public void addParameterDefinition(String key, String defValue, String description) throws org.pentaho.di.core.parameters.DuplicateParamException
Adds a parameter definition to this transformation.- Specified by:
addParameterDefinition
in interfaceorg.pentaho.di.core.parameters.NamedParams
- Parameters:
key
- the name of the parameterdefValue
- the default value for the parameterdescription
- the description of the parameter- Throws:
org.pentaho.di.core.parameters.DuplicateParamException
- the duplicate param exception- See Also:
NamedParams.addParameterDefinition(java.lang.String, java.lang.String, java.lang.String)
-
getParameterDefault
public String getParameterDefault(String key) throws org.pentaho.di.core.parameters.UnknownParamException
Gets the default value of the specified parameter.- Specified by:
getParameterDefault
in interfaceorg.pentaho.di.core.parameters.NamedParams
- Parameters:
key
- the name of the parameter- Returns:
- the default value of the parameter
- Throws:
org.pentaho.di.core.parameters.UnknownParamException
- if the parameter does not exist- See Also:
NamedParams.getParameterDefault(java.lang.String)
-
getParameterDescription
public String getParameterDescription(String key) throws org.pentaho.di.core.parameters.UnknownParamException
Gets the description of the specified parameter.- Specified by:
getParameterDescription
in interfaceorg.pentaho.di.core.parameters.NamedParams
- Parameters:
key
- the name of the parameter- Returns:
- the parameter description
- Throws:
org.pentaho.di.core.parameters.UnknownParamException
- if the parameter does not exist- See Also:
NamedParams.getParameterDescription(java.lang.String)
-
getParameterValue
public String getParameterValue(String key) throws org.pentaho.di.core.parameters.UnknownParamException
Gets the value of the specified parameter.- Specified by:
getParameterValue
in interfaceorg.pentaho.di.core.parameters.NamedParams
- Parameters:
key
- the name of the parameter- Returns:
- the parameter value
- Throws:
org.pentaho.di.core.parameters.UnknownParamException
- if the parameter does not exist- See Also:
NamedParams.getParameterValue(java.lang.String)
-
listParameters
public String[] listParameters()
Gets a list of the parameters for the transformation.- Specified by:
listParameters
in interfaceorg.pentaho.di.core.parameters.NamedParams
- Returns:
- an array of strings containing the names of all parameters for the transformation
- See Also:
NamedParams.listParameters()
-
setParameterValue
public void setParameterValue(String key, String value) throws org.pentaho.di.core.parameters.UnknownParamException
Sets the value for the specified parameter.- Specified by:
setParameterValue
in interfaceorg.pentaho.di.core.parameters.NamedParams
- Parameters:
key
- the name of the parametervalue
- the name of the value- Throws:
org.pentaho.di.core.parameters.UnknownParamException
- if the parameter does not exist- See Also:
NamedParams.setParameterValue(java.lang.String, java.lang.String)
-
eraseParameters
public void eraseParameters()
Remove all parameters.- Specified by:
eraseParameters
in interfaceorg.pentaho.di.core.parameters.NamedParams
- See Also:
NamedParams.eraseParameters()
-
clearParameters
public void clearParameters()
Clear the values of all parameters.- Specified by:
clearParameters
in interfaceorg.pentaho.di.core.parameters.NamedParams
- See Also:
NamedParams.clearParameters()
-
activateParameters
public void activateParameters()
Activates all parameters by setting their values. If no values already exist, the method will attempt to set the parameter to the default value. If no default value exists, the method will set the value of the parameter to the empty string ("").- Specified by:
activateParameters
in interfaceorg.pentaho.di.core.parameters.NamedParams
- See Also:
NamedParams.activateParameters()
-
copyParametersFrom
public void copyParametersFrom(org.pentaho.di.core.parameters.NamedParams params)
Copy parameters from a NamedParams object.- Specified by:
copyParametersFrom
in interfaceorg.pentaho.di.core.parameters.NamedParams
- Parameters:
params
- the NamedParams object from which to copy the parameters- See Also:
NamedParams.copyParametersFrom(org.pentaho.di.core.parameters.NamedParams)
-
mergeParametersWith
public void mergeParametersWith(org.pentaho.di.core.parameters.NamedParams params, boolean replace)
- Specified by:
mergeParametersWith
in interfaceorg.pentaho.di.core.parameters.NamedParams
-
getParentTrans
public Trans getParentTrans()
Gets the parent transformation, which is null if no parent transformation exists.- Returns:
- a reference to the parent transformation's Trans object, or null if no parent transformation exists
-
setParentTrans
public void setParentTrans(Trans parentTrans)
Sets the parent transformation.- Parameters:
parentTrans
- the parentTrans to set
-
getMappingStepName
public String getMappingStepName()
Gets the mapping step name.- Returns:
- the name of the mapping step that created this transformation
-
setMappingStepName
public void setMappingStepName(String mappingStepName)
Sets the mapping step name.- Parameters:
mappingStepName
- the name of the mapping step that created this transformation
-
setSocketRepository
public void setSocketRepository(SocketRepository socketRepository)
Sets the socket repository.- Parameters:
socketRepository
- the new socket repository
-
getSocketRepository
public SocketRepository getSocketRepository()
Gets the socket repository.- Returns:
- the socket repository
-
getObjectName
public String getObjectName()
Gets the object name.- Specified by:
getObjectName
in interfaceorg.pentaho.di.core.logging.LoggingObjectInterface
- Returns:
- the object name
- See Also:
LoggingObjectInterface.getObjectName()
-
getObjectCopy
public String getObjectCopy()
Gets the object copy. For Trans, this always returns null- Specified by:
getObjectCopy
in interfaceorg.pentaho.di.core.logging.LoggingObjectInterface
- Returns:
- null
- See Also:
LoggingObjectInterface.getObjectCopy()
-
getFilename
public String getFilename()
Gets the filename of the transformation, or null if no filename exists- Specified by:
getFilename
in interfaceorg.pentaho.di.core.logging.LoggingObjectInterface
- Returns:
- the filename
- See Also:
LoggingObjectInterface.getFilename()
-
getLogChannelId
public String getLogChannelId()
Gets the log channel ID.- Specified by:
getLogChannelId
in interfaceorg.pentaho.di.core.logging.LoggingObjectInterface
- Returns:
- the log channel ID
- See Also:
LoggingObjectInterface.getLogChannelId()
-
getObjectId
public org.pentaho.di.repository.ObjectId getObjectId()
Gets the object ID.- Specified by:
getObjectId
in interfaceorg.pentaho.di.core.logging.LoggingObjectInterface
- Returns:
- the object ID
- See Also:
LoggingObjectInterface.getObjectId()
-
getObjectRevision
public org.pentaho.di.repository.ObjectRevision getObjectRevision()
Gets the object revision.- Specified by:
getObjectRevision
in interfaceorg.pentaho.di.core.logging.LoggingObjectInterface
- Returns:
- the object revision
- See Also:
LoggingObjectInterface.getObjectRevision()
-
getObjectType
public org.pentaho.di.core.logging.LoggingObjectType getObjectType()
Gets the object type. For Trans, this always returns LoggingObjectType.TRANS- Specified by:
getObjectType
in interfaceorg.pentaho.di.core.logging.LoggingObjectInterface
- Returns:
- the object type
- See Also:
LoggingObjectInterface.getObjectType()
-
getParent
public org.pentaho.di.core.logging.LoggingObjectInterface getParent()
Gets the parent logging object interface.- Specified by:
getParent
in interfaceorg.pentaho.di.core.logging.LoggingObjectInterface
- Returns:
- the parent
- See Also:
LoggingObjectInterface.getParent()
-
getRepositoryDirectory
public org.pentaho.di.repository.RepositoryDirectoryInterface getRepositoryDirectory()
Gets the repository directory.- Specified by:
getRepositoryDirectory
in interfaceorg.pentaho.di.core.logging.LoggingObjectInterface
- Returns:
- the repository directory
- See Also:
LoggingObjectInterface.getRepositoryDirectory()
-
getLogLevel
public org.pentaho.di.core.logging.LogLevel getLogLevel()
Gets the log level.- Specified by:
getLogLevel
in interfaceorg.pentaho.di.core.logging.LoggingObjectInterface
- Returns:
- the log level
- See Also:
LoggingObjectInterface.getLogLevel()
-
setLogLevel
public void setLogLevel(org.pentaho.di.core.logging.LogLevel logLevel)
Sets the log level.- Parameters:
logLevel
- the new log level
-
getLogBufferStartLine
public int getLogBufferStartLine()
Gets the logBufferStartLine.- Returns:
- logBufferStartLine
-
setLogBufferStartLine
public void setLogBufferStartLine(int lineNr)
Sets the logBufferStartLine.- Parameters:
lineNr
- the log buffer starting line for this transformation
-
setInitialLogBufferStartLine
public void setInitialLogBufferStartLine()
Sets logBufferStartLine based on LoggingBuffer last line number
-
getLoggingHierarchy
public List<org.pentaho.di.core.logging.LoggingHierarchy> getLoggingHierarchy()
Gets the logging hierarchy.- Returns:
- the logging hierarchy
-
getActiveSubtransformations
@Deprecated public Map<String,Trans> getActiveSubtransformations()
Deprecated.Use: {@link #addActiveSubTransformation(String, Trans),getActiveSubTransformation(String)
,removeActiveSubTransformation(String)
instead
-
addActiveSubTransformation
public void addActiveSubTransformation(String subTransName, Trans subTrans)
-
getActiveSubjobs
public Map<String,Job> getActiveSubjobs()
Gets the active sub-jobs.- Returns:
- a map (by name) of the active sub-jobs
-
getContainerObjectId
public String getContainerObjectId()
Gets the container object ID.- Specified by:
getContainerObjectId
in interfaceorg.pentaho.di.core.logging.LoggingObjectInterface
- Returns:
- the Carte object ID
-
setContainerObjectId
public void setContainerObjectId(String containerObjectId)
Sets the container object ID.- Parameters:
containerObjectId
- the Carte object ID to set
-
getRegistrationDate
public Date getRegistrationDate()
Gets the registration date. For Trans, this always returns null- Specified by:
getRegistrationDate
in interfaceorg.pentaho.di.core.logging.LoggingObjectInterface
- Returns:
- null
-
setServletPrintWriter
public void setServletPrintWriter(PrintWriter servletPrintWriter)
Sets the servlet print writer.- Parameters:
servletPrintWriter
- the new servlet print writer
-
getServletPrintWriter
public PrintWriter getServletPrintWriter()
Gets the servlet print writer.- Returns:
- the servlet print writer
-
getExecutingServer
public String getExecutingServer()
Gets the name of the executing server.- Specified by:
getExecutingServer
in interfaceExecutorInterface
- Returns:
- the executingServer
-
setExecutingServer
public void setExecutingServer(String executingServer)
Sets the name of the executing server.- Specified by:
setExecutingServer
in interfaceExecutorInterface
- Parameters:
executingServer
- the executingServer to set
-
getExecutingUser
public String getExecutingUser()
Gets the name of the executing user.- Specified by:
getExecutingUser
in interfaceExecutorInterface
- Returns:
- the executingUser
-
setExecutingUser
public void setExecutingUser(String executingUser)
Sets the name of the executing user.- Specified by:
setExecutingUser
in interfaceExecutorInterface
- Parameters:
executingUser
- the executingUser to set
-
isGatheringMetrics
public boolean isGatheringMetrics()
- Specified by:
isGatheringMetrics
in interfaceorg.pentaho.di.core.logging.LoggingObjectInterface
-
setGatheringMetrics
public void setGatheringMetrics(boolean gatheringMetrics)
- Specified by:
setGatheringMetrics
in interfaceorg.pentaho.di.core.logging.LoggingObjectInterface
-
isForcingSeparateLogging
public boolean isForcingSeparateLogging()
- Specified by:
isForcingSeparateLogging
in interfaceorg.pentaho.di.core.logging.LoggingObjectInterface
-
setForcingSeparateLogging
public void setForcingSeparateLogging(boolean forcingSeparateLogging)
- Specified by:
setForcingSeparateLogging
in interfaceorg.pentaho.di.core.logging.LoggingObjectInterface
-
getResultFiles
public List<org.pentaho.di.core.ResultFile> getResultFiles()
-
setResultFiles
public void setResultFiles(List<org.pentaho.di.core.ResultFile> resultFiles)
-
getResultRows
public List<org.pentaho.di.core.RowMetaAndData> getResultRows()
-
setResultRows
public void setResultRows(List<org.pentaho.di.core.RowMetaAndData> resultRows)
-
getPreviousResult
public org.pentaho.di.core.Result getPreviousResult()
-
setPreviousResult
public void setPreviousResult(org.pentaho.di.core.Result previousResult)
-
getArguments
public String[] getArguments()
-
setArguments
public void setArguments(String[] arguments)
-
clearError
public void clearError()
Clear the error in the transformation, clear all the rows from all the row sets, to make sure the transformation can continue with other data. This is intended for use when running single threaded.
-
getTransactionId
public String getTransactionId()
Gets the transaction ID for the transformation.- Returns:
- the transactionId
-
setTransactionId
public void setTransactionId(String transactionId)
Sets the transaction ID for the transformation.- Parameters:
transactionId
- the transactionId to set
-
calculateTransactionId
public String calculateTransactionId()
Calculates the transaction ID for the transformation.- Returns:
- the calculated transaction ID for the transformation.
-
getMetaStore
public org.pentaho.metastore.api.IMetaStore getMetaStore()
-
setMetaStore
public void setMetaStore(org.pentaho.metastore.api.IMetaStore metaStore)
-
setServletReponse
public void setServletReponse(javax.servlet.http.HttpServletResponse response)
Sets encoding of HttpServletResponse according to System encoding.Check if system encoding is null or an empty and set it to HttpServletResponse when not and writes error to log if null. Throw IllegalArgumentException if input parameter is null.- Parameters:
response
- the HttpServletResponse to set encoding, mayn't be null
-
getServletResponse
public javax.servlet.http.HttpServletResponse getServletResponse()
-
setServletRequest
public void setServletRequest(javax.servlet.http.HttpServletRequest request)
-
getServletRequest
public javax.servlet.http.HttpServletRequest getServletRequest()
-
getDelegationListeners
public List<DelegationListener> getDelegationListeners()
-
setDelegationListeners
public void setDelegationListeners(List<DelegationListener> delegationListeners)
-
addDelegationListener
public void addDelegationListener(DelegationListener delegationListener)
-
doTopologySortOfSteps
public void doTopologySortOfSteps()
-
setResultRowSet
public void setResultRowSet(boolean resultRowsSet)
-
isResultRowsSet
public boolean isResultRowsSet()
-
isExecutingClustered
public boolean isExecutingClustered()
-
setExecutingClustered
public void setExecutingClustered(boolean executingClustered)
-
getExtensionDataMap
public Map<String,Object> getExtensionDataMap()
- Specified by:
getExtensionDataMap
in interfaceorg.pentaho.di.core.ExtensionDataInterface
-
startHeartbeat
protected ExecutorService startHeartbeat(long intervalInSeconds)
-
shutdownHeartbeat
protected void shutdownHeartbeat(ExecutorService heartbeat)
-
callBeforeLog
public void callBeforeLog()
- Specified by:
callBeforeLog
in interfaceorg.pentaho.di.core.logging.LoggingObjectLifecycleInterface
-
callAfterLog
public void callAfterLog()
- Specified by:
callAfterLog
in interfaceorg.pentaho.di.core.logging.LoggingObjectLifecycleInterface
-
-