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
- Direct Known Subclasses:
TransWebSocketEngineAdapter
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[]argumentsThe command line arguments for the transformation.intclass_nrThe class number.static StringCONFIGURATION_IN_EXPORT_FILENAMEConstant specifying a filename containing XML to inject into a ZIP file created during resource export.protected StringcontainerObjectIdThe container object id.protected Hashtable<String,org.pentaho.di.core.Counter>countersA table of named counters.protected org.pentaho.di.core.logging.LogChannelInterfacelogThe log channel interface.protected intlogCommitSizeThe log commit size.protected org.pentaho.di.core.logging.LogLevellogLevelThe log level.protected org.pentaho.metastore.api.IMetaStoremetaStoreThe MetaStore to usestatic StringREPLAY_DATE_FORMATThe replay date format.protected RepositoryrepositoryThe repository we are referencing.protected List<org.pentaho.di.core.ResultFile>resultFilesprotected List<org.pentaho.di.core.RowMetaAndData>resultRowsList<org.pentaho.di.core.RowSet>rowsetsA list of all the row sets.static StringSTRING_FINISHEDConstant indicating a transformation status of Finished.static StringSTRING_FINISHED_WITH_ERRORSConstant indicating a transformation status of Finished (with errors).static StringSTRING_HALTINGConstant indicating a transformation status of Halting.static StringSTRING_INITIALIZINGConstant indicating a transformation status of Initializing.static StringSTRING_PAUSEDConstant indicating a transformation status of Paused.static StringSTRING_PREPARINGConstant indicating a transformation status of Preparing for execution.static StringSTRING_RUNNINGConstant indicating a transformation status of Running.static StringSTRING_STOPPEDConstant indicating a transformation status of Stopped.static StringSTRING_STOPPED_WITH_ERRORSConstant indicating a transformation status of Stopped (with errors).static StringSTRING_WAITINGConstant indicating a transformation status of Waiting.protected TransMetatransMetaThe transformation metadata to execute.static intTYPE_DISP_1_1Constant indicating a dispatch type of 1-to-1.static intTYPE_DISP_1_NConstant indicating a dispatch type of 1-to-N.static intTYPE_DISP_N_1Constant indicating a dispatch type of N-to-1.static intTYPE_DISP_N_MConstant indicating a dispatch type of N-to-M.static intTYPE_DISP_N_NConstant 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.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidactivateParameters()Activates all parameters by setting their values.voidaddActiveSubTransformation(String subTransName, Trans subTrans)voidaddDelegationListener(DelegationListener delegationListener)voidaddParameterDefinition(String key, String defValue, String description)Adds a parameter definition to this transformation.RowProduceraddRowProducer(String stepname, int copynr)This adds a row producer to the transformation that just got set up.protected voidaddStepPerformanceSnapShot()Adds a step performance snapshot.voidaddTransListener(TransListener transListener)Adds a transformation listener.voidaddTransStoppedListener(TransStoppedListener transStoppedListener)Adds a stop-event listener to the transformation.voidbeginProcessing()Begin processing.voidcalculateBatchIdAndDateRange()Calculate the batch id and date range for the transformation.StringcalculateTransactionId()Calculates the transaction ID for the transformation.voidcallAfterLog()voidcallBeforeLog()voidcleanup()This method performs any cleanup operations, typically called after the transformation has finished.static intcleanupCluster(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 voidcleanupSlaveServer(TransSplitter transSplitter, SlaveServer slaveServer, TransMeta slaveTransMeta)Cleanup the slave server as part of a clustered transformation.voidclearError()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.voidclearParameters()Clear the values of all parameters.voidcopyParametersFrom(org.pentaho.di.core.parameters.NamedParams params)Copy parameters from a NamedParams object.voidcopyVariablesFrom(org.pentaho.di.core.variables.VariableSpace space)Copies variables from a given variable space to this transformation.protected org.pentaho.di.core.database.DatabasecreateDataBase(org.pentaho.di.core.database.DatabaseMeta meta)voiddoTopologySortOfSteps()StringenvironmentSubstitute(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).voideraseParameters()Remove all parameters.voidexecute(String[] arguments)Executes the transformation.static voidexecuteClustered(TransSplitter transSplitter, TransExecutionConfiguration executionConfiguration)Executes an existing TransSplitter, with the transformation already split.static TransSplitterexecuteClustered(TransMeta transMeta, TransExecutionConfiguration executionConfiguration)Execute the transformation in a clustered fashion.StringfieldSubstitute(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.StepDataInterfacefindDataInterface(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.RowSetfindRowSet(String rowsetname)Finds the RowSet with the specified name.org.pentaho.di.core.RowSetfindRowSet(String from, int fromcopy, String to, int tocopy)Finds the RowSet between two steps (or copies of steps).StepInterfacefindRunThread(String stepname)Find the run thread for the step with the specified name.StepInterfacefindStepInterface(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 voidfireTransFinishedListeners()Make attempt to fire all registered listeners if possible.protected voidfireTransStartedListeners()Fires the start-event listeners (if any are registered).Map<String,Job>getActiveSubjobs()Gets the active sub-jobs.TransgetActiveSubTransformation(String subTransName)Map<String,Trans>getActiveSubtransformations()Deprecated.String[]getArguments()longgetBatchId()Gets the batch ID of the transformation.booleangetBooleanValueOfVariable(String variableName, boolean defaultValue)Returns a boolean representation of the specified variable after performing any necessary substitution.static org.pentaho.di.core.ResultgetClusteredTransformationResult(org.pentaho.di.core.logging.LogChannelInterface log, TransSplitter transSplitter, Job parentJob)Gets the clustered transformation result.static org.pentaho.di.core.ResultgetClusteredTransformationResult(org.pentaho.di.core.logging.LogChannelInterface log, TransSplitter transSplitter, Job parentJob, boolean loggingRemoteWork)Gets the clustered transformation result.StringgetContainerObjectId()Gets the container object ID.Hashtable<String,org.pentaho.di.core.Counter>getCounters()DategetCurrentDate()Gets the current date/time object.List<DelegationListener>getDelegationListeners()DategetDepDate()Gets the dependency date for the transformation.DategetEndDate()Gets the end date/time object for the transformation.intgetEnded()Gets the number of steps in the transformation that are in an end state, such as Finished, Halted, or Stopped.intgetErrors()Gets the number of errors that have occurred during execution of the transformation.StringgetExecutingServer()Gets the name of the executing server.StringgetExecutingUser()Gets the name of the executing user.Map<String,Object>getExtensionDataMap()StringgetFilename()Gets the filename of the transformation, or null if no filename existsDategetJobEndDate()Gets the job end date.DategetJobStartDate()Gets the job start date.longgetLastProcessed()Gets a representable metric of the "processed" lines of the last step.org.pentaho.di.core.logging.LogChannelInterfacegetLogChannel()Gets the log channel interface for the transformation.StringgetLogChannelId()Gets the log channel ID.DategetLogDate()Gets the date the transformation was logged.List<org.pentaho.di.core.logging.LoggingHierarchy>getLoggingHierarchy()Gets the logging hierarchy.org.pentaho.di.core.logging.LogLevelgetLogLevel()Gets the log level.StringgetMappingStepName()Gets the mapping step name.org.pentaho.metastore.api.IMetaStoregetMetaStore()StringgetName()Gets the name of the transformation.StringgetObjectCopy()Gets the object copy.org.pentaho.di.repository.ObjectIdgetObjectId()Gets the object ID.StringgetObjectName()Gets the object name.org.pentaho.di.repository.ObjectRevisiongetObjectRevision()Gets the object revision.org.pentaho.di.core.logging.LoggingObjectTypegetObjectType()Gets the object type.StringgetParameterDefault(String key)Gets the default value of the specified parameter.StringgetParameterDescription(String key)Gets the description of the specified parameter.StringgetParameterValue(String key)Gets the value of the specified parameter.org.pentaho.di.core.logging.LoggingObjectInterfacegetParent()Gets the parent logging object interface.JobgetParentJob()Gets the parent job, or null if there is no parent.TransgetParentTrans()Gets the parent transformation, which is null if no parent transformation exists.org.pentaho.di.core.variables.VariableSpacegetParentVariableSpace()Gets the parent variable space.longgetPassedBatchId()Get the batch ID that is passed from the parent job to the transformation.org.pentaho.di.core.ResultgetPreviousResult()DategetRegistrationDate()Gets the registration date.DategetReplayDate()Gets the replay date.RepositorygetRepository()Gets the repository object for the transformation.org.pentaho.di.repository.RepositoryDirectoryInterfacegetRepositoryDirectory()Gets the repository directory.org.pentaho.di.core.ResultgetResult()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.StepInterfacegetRunThread(int i)Gets the run thread for the step at the specified index.StepInterfacegetRunThread(String name, int copy)Gets the run thread for the step with the specified name and copy number.PrintWritergetServletPrintWriter()Gets the servlet print writer.javax.servlet.http.HttpServletRequestgetServletRequest()javax.servlet.http.HttpServletResponsegetServletResponse()SocketRepositorygetSocketRepository()Gets the socket repository.DategetStartDate()Gets the start date/time object for the transformation.StringgetStatus()Gets the status of the transformation (Halting, Finished, Paused, etc.)StepDataInterfacegetStepDataInterface(String stepname, int stepcopy)Finds the StepDataInterface (currently) associated with the specified step.StepInterfacegetStepInterface(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.StringgetThreadName()Deprecated.StringgetTransactionId()Gets the transaction ID for the transformation.List<TransListener>getTransListeners()Gets a list of the transformation listeners.TransMetagetTransMeta()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.StringgetVariable(String variableName)Gets the value of the specified variable, or returns a default value if no such variable exists.StringgetVariable(String variableName, String defaultValue)Gets the value of the specified variable, or returns a default value if no such variable exists.booleanhasHaltedSteps()Checks whether the transformation has any steps that are halted.booleanhasStepStarted(String sname, int copy)Checks whether the specified step (or step copy) has started.voidinitializeVariablesFrom(org.pentaho.di.core.variables.VariableSpace parent)Sets the values of the transformation's variables to the values from the parent variables.voidinjectVariables(Map<String,String> prop)Injects variables using the given Map.booleanisExecutingClustered()booleanisFinished()Checks if the transformation is finished\.booleanisFinishedOrStopped()booleanisForcingSeparateLogging()booleanisGatheringMetrics()booleanisInitializing()Checks whether the transformation is initializing.booleanisMonitored()Checks whether the running transformation is being monitored.booleanisPaused()Checks if the transformation is paused.booleanisPreparing()Checks whether the transformation is preparing for execution.booleanisPreview()Checks whether the transformation is being previewed.booleanisReadyToStart()Checks whether the transformation is ready to start (i.e.booleanisResultRowsSet()booleanisRunning()Checks whether the transformation is running.booleanisSafeModeEnabled()Checks whether safe mode is enabled.booleanisStopped()Checks if the transformation is stopped.voidkillAll()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.voidlogSummary(StepInterface si)Logs a summary message for the specified step.voidmergeParametersWith(org.pentaho.di.core.parameters.NamedParams params, boolean replace)static longmonitorClusteredTransformation(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 longmonitorClusteredTransformation(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 voidmonitorRemoteTransformation(org.pentaho.di.core.logging.LogChannelInterface log, String carteObjectId, String transName, SlaveServer remoteSlaveServer)Monitors a remote transformation every 5 seconds.static voidmonitorRemoteTransformation(org.pentaho.di.core.logging.LogChannelInterface log, String carteObjectId, String transName, SlaveServer remoteSlaveServer, int sleepTimeSeconds)Monitors a remote transformation at the specified interval.voidnotifyStoppedListeners()intnrActiveSteps()Gets the number of active (i.e.intnrSteps()Gets the number of steps in this transformation.voidpauseRunning()Pauses the transformation (pause all steps).voidprepareExecution(String[] arguments)Prepares the transformation for execution.voidprintStats(int seconds)Logs the execution statistics for the transformation for the specified time interval.TransremoveActiveSubTransformation(String subTransName)voidresumeRunning()Resumes running the transformation after a pause (resume all steps).voidsafeStop()Stops only input steps so that all downstream steps can finish processing rows that have already been inputstatic StringsendToSlaveServer(TransMeta transMeta, TransExecutionConfiguration executionConfiguration, Repository repository, org.pentaho.metastore.api.IMetaStore metaStore)Send the transformation for execution to a Carte slave server.voidsetArguments(String[] arguments)voidsetBatchId(long batchId)Sets the batch ID of the transformation.voidsetContainerObjectId(String containerObjectId)Sets the container object ID.voidsetCounters(Hashtable<String,org.pentaho.di.core.Counter> counters)voidsetDelegationListeners(List<DelegationListener> delegationListeners)voidsetExecutingClustered(boolean executingClustered)voidsetExecutingServer(String executingServer)Sets the name of the executing server.voidsetExecutingUser(String executingUser)Sets the name of the executing user.protected voidsetFinished(boolean finished)voidsetForcingSeparateLogging(boolean forcingSeparateLogging)voidsetGatheringMetrics(boolean gatheringMetrics)voidsetInitializing(boolean initializing)Sets whether the transformation is initializing.protected voidsetInternalEntryCurrentDirectory(boolean hasFilename, boolean hasRepoDir)voidsetInternalKettleVariables(org.pentaho.di.core.variables.VariableSpace var)Sets the internal kettle variables.voidsetJobEndDate(Date jobEndDate)Sets the job end date.voidsetJobStartDate(Date jobStartDate)Sets the job start date.voidsetLog(org.pentaho.di.core.logging.LogChannelInterface log)Sets the log channel interface for the transformation.voidsetLogLevel(org.pentaho.di.core.logging.LogLevel logLevel)Sets the log level.voidsetMappingStepName(String mappingStepName)Sets the mapping step name.voidsetMetaStore(org.pentaho.metastore.api.IMetaStore metaStore)voidsetMonitored(boolean monitored)Sets whether the running transformation should be monitored.voidsetParameterValue(String key, String value)Sets the value for the specified parameter.voidsetParent(org.pentaho.di.core.logging.LoggingObjectInterface parent)Sets the parent logging object.voidsetParentJob(Job parentJob)Sets the parent job for the transformation.voidsetParentTrans(Trans parentTrans)Sets the parent transformation.voidsetParentVariableSpace(org.pentaho.di.core.variables.VariableSpace parent)Sets the parent variable space.voidsetPassedBatchId(long jobBatchId)Sets the passed batch ID of the transformation from the batch ID of the parent job.voidsetPaused(boolean paused)voidsetPreparing(boolean preparing)Sets whether the transformation is preparing for execution.voidsetPreview(boolean preview)Sets whether the transformation is being previewed.voidsetPreviousResult(org.pentaho.di.core.Result previousResult)protected voidsetReadyToStart(boolean ready)voidsetReplayDate(Date replayDate)Sets the replay date.voidsetRepository(Repository repository)Sets the repository object for the transformation.voidsetResultFiles(List<org.pentaho.di.core.ResultFile> resultFiles)voidsetResultRows(List<org.pentaho.di.core.RowMetaAndData> resultRows)voidsetResultRowSet(boolean resultRowsSet)voidsetRunning(boolean running)Sets whether the transformation is running.voidsetSafeModeEnabled(boolean safeModeEnabled)Turn on safe mode during running: the transformation will run slower but with more checking enabled.voidsetServletPrintWriter(PrintWriter servletPrintWriter)Sets the servlet print writer.voidsetServletReponse(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.voidsetServletRequest(javax.servlet.http.HttpServletRequest request)voidsetSocketRepository(SocketRepository socketRepository)Sets the socket repository.voidsetStepPerformanceSnapShots(Map<String,List<StepPerformanceSnapShot>> stepPerformanceSnapShots)Sets the named list (map) of step performance snapshots.protected voidsetSteps(List<StepMetaDataCombi> steps)voidsetStopped(boolean stopped)voidsetThreadName(String threadName)Deprecated.voidsetTransactionId(String transactionId)Sets the transaction ID for the transformation.voidsetTransListeners(List<TransListener> transListeners)Sets the list of transformation listeners.voidsetTransMeta(TransMeta transMeta)Sets the meta-data for the transformation.voidsetTransStoppedListeners(List<TransStoppedListener> transStoppedListeners)Sets the list of stop-event listeners for the transformation.voidsetVariable(String variableName, String variableValue)Sets the value of the specified variable to the specified value.voidshareVariablesWith(org.pentaho.di.core.variables.VariableSpace space)Shares a variable space from another variable space.protected voidshutdownHeartbeat(ExecutorService heartbeat)protected ExecutorServicestartHeartbeat(long intervalInSeconds)voidstartThreads()Starts the threads prepared by prepareThreads().voidstopAll()Stops all steps from running, and alerts any registered listeners.voidstopStep(StepMetaDataCombi combi, boolean safeStop)StringtoString()Gets a string representation of the transformation.voidwaitUntilFinished()Waits until all RunThreads have finished.protected voidwriteLogChannelInformation()Writes log channel information to a channel logging table (if one has been configured).protected voidwriteMetricsInformation()protected voidwriteStepLogInformation()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.
-
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.KettleExceptionInstantiates 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
-
-
Method Detail
-
setParent
public void setParent(org.pentaho.di.core.logging.LoggingObjectInterface parent)
Sets the parent logging object.- Parameters:
parent- the new parent
-
getLogChannel
public org.pentaho.di.core.logging.LogChannelInterface getLogChannel()
Gets the log channel interface for the transformation.- Specified by:
getLogChannelin 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.KettleExceptionStarts 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.KettleExceptionMake 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.KettleExceptionFires 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.KettleTransExceptionCalculate 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.KettleTransExceptionBegin 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.KettleExceptionWrites 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.KettleExceptionWrites 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:
toStringin 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:
copyVariablesFromin 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:
environmentSubstitutein 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:
environmentSubstitutein 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:
fieldSubstitutein 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:
getParentVariableSpacein 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:
setParentVariableSpacein 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:
getVariablein 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:
getVariablein 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:
getBooleanValueOfVariablein 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:
initializeVariablesFromin 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:
listVariablesin 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:
setVariablein 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:
shareVariablesWithin 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:
injectVariablesin 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:
addParameterDefinitionin 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:
getParameterDefaultin 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:
getParameterDescriptionin 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:
getParameterValuein 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:
listParametersin 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:
setParameterValuein 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:
eraseParametersin interfaceorg.pentaho.di.core.parameters.NamedParams- See Also:
NamedParams.eraseParameters()
-
clearParameters
public void clearParameters()
Clear the values of all parameters.- Specified by:
clearParametersin 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:
activateParametersin 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:
copyParametersFromin 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:
mergeParametersWithin 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:
getObjectNamein 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:
getObjectCopyin 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:
getFilenamein interfaceorg.pentaho.di.core.logging.LoggingObjectInterface- Returns:
- the filename
- See Also:
LoggingObjectInterface.getFilename()
-
getLogChannelId
public String getLogChannelId()
Gets the log channel ID.- Specified by:
getLogChannelIdin 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:
getObjectIdin 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:
getObjectRevisionin 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:
getObjectTypein 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:
getParentin 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:
getRepositoryDirectoryin 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:
getLogLevelin 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
-
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:
getContainerObjectIdin 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:
getRegistrationDatein 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:
getExecutingServerin interfaceExecutorInterface- Returns:
- the executingServer
-
setExecutingServer
public void setExecutingServer(String executingServer)
Sets the name of the executing server.- Specified by:
setExecutingServerin interfaceExecutorInterface- Parameters:
executingServer- the executingServer to set
-
getExecutingUser
public String getExecutingUser()
Gets the name of the executing user.- Specified by:
getExecutingUserin interfaceExecutorInterface- Returns:
- the executingUser
-
setExecutingUser
public void setExecutingUser(String executingUser)
Sets the name of the executing user.- Specified by:
setExecutingUserin interfaceExecutorInterface- Parameters:
executingUser- the executingUser to set
-
isGatheringMetrics
public boolean isGatheringMetrics()
- Specified by:
isGatheringMetricsin interfaceorg.pentaho.di.core.logging.LoggingObjectInterface
-
setGatheringMetrics
public void setGatheringMetrics(boolean gatheringMetrics)
- Specified by:
setGatheringMetricsin interfaceorg.pentaho.di.core.logging.LoggingObjectInterface
-
isForcingSeparateLogging
public boolean isForcingSeparateLogging()
- Specified by:
isForcingSeparateLoggingin interfaceorg.pentaho.di.core.logging.LoggingObjectInterface
-
setForcingSeparateLogging
public void setForcingSeparateLogging(boolean forcingSeparateLogging)
- Specified by:
setForcingSeparateLoggingin 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:
getExtensionDataMapin interfaceorg.pentaho.di.core.ExtensionDataInterface
-
startHeartbeat
protected ExecutorService startHeartbeat(long intervalInSeconds)
-
shutdownHeartbeat
protected void shutdownHeartbeat(ExecutorService heartbeat)
-
callBeforeLog
public void callBeforeLog()
- Specified by:
callBeforeLogin interfaceorg.pentaho.di.core.logging.LoggingObjectLifecycleInterface
-
callAfterLog
public void callAfterLog()
- Specified by:
callAfterLogin interfaceorg.pentaho.di.core.logging.LoggingObjectLifecycleInterface
-
-