|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.pentaho.di.trans.Trans
public class Trans
This class is responsible for the execution of Transformations. It loads, instantiates, initializes, runs, monitors the execution of the transformation contained in the TransInfo object you feed it.
Field Summary | |
---|---|
int |
class_nr
|
static String |
CONFIGURATION_IN_EXPORT_FILENAME
|
static String |
REPLAY_DATE_FORMAT
|
static String |
STRING_FINISHED
|
static String |
STRING_HALTING
|
static String |
STRING_INITIALIZING
|
static String |
STRING_PAUSED
|
static String |
STRING_PREPARING
|
static String |
STRING_RUNNING
|
static String |
STRING_STOPPED
|
static String |
STRING_WAITING
|
static int |
TYPE_DISP_1_1
|
static int |
TYPE_DISP_1_N
|
static int |
TYPE_DISP_N_1
|
static int |
TYPE_DISP_N_M
|
static int |
TYPE_DISP_N_N
|
Constructor Summary | |
---|---|
Trans()
|
|
Trans(TransMeta transMeta)
Initialize a transformation from transformation meta-data defined in memory |
|
Trans(TransMeta transMeta,
LoggingObjectInterface parent)
Initialize a transformation from transformation meta-data defined in memory. |
|
Trans(VariableSpace parentVariableSpace,
Repository rep,
String name,
String dirname,
String filename)
|
Method Summary | |
---|---|
void |
activateParameters()
Activate the currently set parameters |
void |
addParameterDefinition(String key,
String defValue,
String description)
Add a parameter definition to this set. |
RowProducer |
addRowProducer(String stepname,
int copynr)
This adds a row producer to the transformation that just got set up. |
void |
addTransListener(TransListener transListener)
|
void |
addTransStoppedListener(TransStoppedListener transStoppedListener)
|
void |
beginProcessing()
|
void |
calculateBatchIdAndDateRange()
|
void |
cleanup()
Call this method after the transformation has finished. |
static int |
cleanupCluster(LogChannelInterface log,
TransSplitter transSplitter)
|
static void |
cleanupSlaveServer(TransSplitter transSplitter,
SlaveServer slaveServer,
TransMeta slaveTransMeta)
|
void |
clearParameters()
Clear all parameters |
void |
copyParametersFrom(NamedParams params)
Copy params to these named parameters (clearing out first). |
void |
copyVariablesFrom(VariableSpace space)
Copy the variables from another space, without initializing with the defaults. |
String |
environmentSubstitute(String aString)
Substitute the string using the current variable space. |
String[] |
environmentSubstitute(String[] aString)
Replaces environment variables in an array of strings. |
void |
eraseParameters()
Clear the values. |
void |
execute(String[] arguments)
Execute this transformation. |
static TransSplitter |
executeClustered(TransMeta transMeta,
TransExecutionConfiguration executionConfiguration)
|
static void |
executeClustered(TransSplitter transSplitter,
TransExecutionConfiguration executionConfiguration)
executes an existing transSplitter, with transformation already split. |
List<StepInterface> |
findBaseSteps(String stepname)
|
StepDataInterface |
findDataInterface(String name)
|
MappingInput[] |
findMappingInput()
|
MappingOutput[] |
findMappingOutput()
|
RowSet |
findRowSet(String rowsetname)
|
RowSet |
findRowSet(String from,
int fromcopy,
String to,
int tocopy)
|
StepInterface |
findRunThread(String stepname)
|
Map<String,Trans> |
getActiveSubtransformations()
|
long |
getBatchId()
|
boolean |
getBooleanValueOfVariable(String variableName,
boolean defaultValue)
This method returns a boolean for the new variable check boxes. |
static Result |
getClusteredTransformationResult(LogChannelInterface log,
TransSplitter transSplitter,
Job parentJob)
|
String |
getContainerObjectId()
|
Date |
getCurrentDate()
|
Date |
getDepDate()
|
Date |
getEndDate()
|
int |
getEnded()
|
int |
getErrors()
|
String |
getFilename()
|
Date |
getJobEndDate()
|
Date |
getJobStartDate()
|
long |
getLastProcessed()
|
LogChannelInterface |
getLogChannel()
|
String |
getLogChannelId()
|
Date |
getLogDate()
|
List<LoggingHierarchy> |
getLoggingHierarchy()
|
LogLevel |
getLogLevel()
|
String |
getMappingStepName()
|
String |
getName()
|
String |
getObjectCopy()
|
ObjectId |
getObjectId()
|
String |
getObjectName()
|
ObjectRevision |
getObjectRevision()
|
LoggingObjectType |
getObjectType()
|
String |
getParameterDefault(String key)
Get the default value of a parameter. |
String |
getParameterDescription(String key)
Get the description of a parameter. |
String |
getParameterValue(String key)
Get the value of a parameter. |
LoggingObjectInterface |
getParent()
|
Job |
getParentJob()
|
Trans |
getParentTrans()
|
VariableSpace |
getParentVariableSpace()
Get the parent of the variable space. |
long |
getPassedBatchId()
|
Date |
getRegistrationDate()
Stub |
Date |
getReplayDate()
|
Repository |
getRepository()
|
RepositoryDirectoryInterface |
getRepositoryDirectory()
|
Result |
getResult()
|
List<RowSet> |
getRowsets()
|
StepInterface |
getRunThread(int i)
|
StepInterface |
getRunThread(String name,
int copy)
|
PrintWriter |
getServletPrintWriter()
|
SocketRepository |
getSocketRepository()
|
Date |
getStartDate()
|
String |
getStatus()
|
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()
|
List<StepMetaDataCombi> |
getSteps()
|
String |
getThreadName()
|
List<TransListener> |
getTransListeners()
|
TransMeta |
getTransMeta()
|
BaseStepData.StepExecutionStatus[] |
getTransStepExecutionStatusLookup()
|
boolean[] |
getTransStepIsRunningLookup()
|
List<TransStoppedListener> |
getTransStoppedListeners()
|
String |
getVariable(String variableName)
Get the value of a variable. |
String |
getVariable(String variableName,
String defaultValue)
Get the value of a variable with a default in case the variable is not found. |
boolean |
hasHaltedSteps()
|
boolean |
hasStepStarted(String sname,
int copy)
|
void |
initializeVariablesFrom(VariableSpace parent)
Initialize variable space using the defaults, copy over the variables from the parent (using copyVariablesFrom()), after this the "injected" variables should be inserted (injectVariables()). |
void |
injectVariables(Map<String,String> prop)
Inject variables. |
boolean |
isFinished()
|
boolean |
isInitializing()
|
boolean |
isMonitored()
|
boolean |
isPaused()
|
boolean |
isPreparing()
|
boolean |
isPreview()
|
boolean |
isReadyToStart()
|
boolean |
isRunning()
|
boolean |
isSafeModeEnabled()
|
boolean |
isStopped()
|
void |
killAll()
|
String[] |
listParameters()
List the parameters. |
String[] |
listVariables()
List the variables (not the values) that are currently in the variable space. |
void |
logSummary(StepInterface si)
|
static long |
monitorClusteredTransformation(LogChannelInterface log,
TransSplitter transSplitter,
Job parentJob)
Consider that all the transformations in a cluster schema are running now... 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. |
static long |
monitorClusteredTransformation(LogChannelInterface log,
TransSplitter transSplitter,
Job parentJob,
int sleepTimeSeconds)
Consider that all the transformations in a cluster schema are running now... 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. |
static void |
monitorRemoteTransformation(LogChannelInterface log,
String carteObjectId,
String transName,
SlaveServer remoteSlaveServer)
|
static void |
monitorRemoteTransformation(LogChannelInterface log,
String carteObjectId,
String transName,
SlaveServer remoteSlaveServer,
int sleepTimeSeconds)
|
int |
nrActiveSteps()
|
int |
nrSteps()
|
void |
pauseRunning()
Pause the transformation (pause all steps) |
void |
prepareExecution(String[] arguments)
Prepare the execution of the transformation. |
void |
printStats(int seconds)
|
void |
resumeRunning()
Resume running the transformation after a pause (resume all steps) |
static String |
sendToSlaveServer(TransMeta transMeta,
TransExecutionConfiguration executionConfiguration,
Repository repository)
Send the transformation for execution to a carte slave server |
void |
setBatchId(long batchId)
|
void |
setContainerObjectId(String containerObjectId)
|
void |
setInitializing(boolean initializing)
|
void |
setInternalKettleVariables(VariableSpace var)
|
void |
setJobEndDate(Date jobEndDate)
|
void |
setJobStartDate(Date jobStartDate)
|
void |
setLog(LogChannelInterface log)
|
void |
setLogLevel(LogLevel logLevel)
|
void |
setMappingStepName(String mappingStepName)
|
void |
setMonitored(boolean monitored)
|
void |
setParameterValue(String key,
String value)
Set the value of a parameter. |
void |
setParent(LoggingObjectInterface parent)
|
void |
setParentJob(Job parentJob)
|
void |
setParentTrans(Trans parentTrans)
|
void |
setParentVariableSpace(VariableSpace parent)
Set the parent variable space |
void |
setPassedBatchId(long jobBatchId)
|
void |
setPreparing(boolean preparing)
|
void |
setPreview(boolean preview)
|
void |
setReplayDate(Date replayDate)
|
void |
setRepository(Repository repository)
|
void |
setRunning(boolean 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)
|
void |
setSocketRepository(SocketRepository socketRepository)
|
void |
setStepPerformanceSnapShots(Map<String,List<StepPerformanceSnapShot>> stepPerformanceSnapShots)
|
void |
setThreadName(String threadName)
|
void |
setTransListeners(List<TransListener> transListeners)
|
void |
setTransMeta(TransMeta transMeta)
|
void |
setTransStoppedListeners(List<TransStoppedListener> transStoppedListeners)
|
void |
setVariable(String variableName,
String variableValue)
Sets a variable in the Kettle Variables list. |
void |
shareVariablesWith(VariableSpace space)
Share a variable space from another variable space. |
void |
startThreads()
Start the threads prepared by prepareThreads(); Before you start the threads, you can add RowListeners to them. |
void |
stopAll()
|
String |
toString()
|
void |
waitUntilFinished()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String REPLAY_DATE_FORMAT
public int class_nr
public static final int TYPE_DISP_1_1
public static final int TYPE_DISP_1_N
public static final int TYPE_DISP_N_1
public static final int TYPE_DISP_N_N
public static final int TYPE_DISP_N_M
public static final String STRING_FINISHED
public static final String STRING_RUNNING
public static final String STRING_PAUSED
public static final String STRING_PREPARING
public static final String STRING_INITIALIZING
public static final String STRING_WAITING
public static final String STRING_STOPPED
public static final String STRING_HALTING
public static final String CONFIGURATION_IN_EXPORT_FILENAME
Constructor Detail |
---|
public Trans()
public Trans(TransMeta transMeta)
transMeta
- the transformation meta-data to use.public Trans(TransMeta transMeta, LoggingObjectInterface parent)
transMeta
- the transformation meta-data to use.parent
- the parent job that is executing this transformationpublic Trans(VariableSpace parentVariableSpace, Repository rep, String name, String dirname, String filename) throws KettleException
KettleException
Method Detail |
---|
public void setParent(LoggingObjectInterface parent)
public LogChannelInterface getLogChannel()
getLogChannel
in interface HasLogChannelInterface
public void setLog(LogChannelInterface log)
public String getName()
public void execute(String[] arguments) throws KettleException
KettleException
- in case the transformation could not be prepared (initialized)public void prepareExecution(String[] arguments) throws KettleException
arguments
- the arguments to use for this transformation
KettleException
- in case the transformation could not be prepared (initialized)public void startThreads() throws KettleException
KettleException
- in case there is a communication error with a remote output socket.public void cleanup()
public void logSummary(StepInterface si)
public void waitUntilFinished()
public int getErrors()
public int getEnded()
public boolean isFinished()
public void killAll()
public void printStats(int seconds)
public long getLastProcessed()
public RowSet findRowSet(String rowsetname)
public RowSet findRowSet(String from, int fromcopy, String to, int tocopy)
public boolean hasStepStarted(String sname, int copy)
public void stopAll()
public int nrSteps()
public int nrActiveSteps()
public boolean[] getTransStepIsRunningLookup()
public BaseStepData.StepExecutionStatus[] getTransStepExecutionStatusLookup()
public StepInterface getRunThread(int i)
public StepInterface getRunThread(String name, int copy)
public void calculateBatchIdAndDateRange() throws KettleTransException
KettleTransException
public void beginProcessing() throws KettleTransException
KettleTransException
public Result getResult()
public StepInterface findRunThread(String stepname)
public List<StepInterface> findBaseSteps(String stepname)
public StepDataInterface findDataInterface(String name)
public Date getStartDate()
public Date getEndDate()
public boolean isMonitored()
public void setMonitored(boolean monitored)
monitored
- Indicate we want to monitor the running transformationpublic TransMeta getTransMeta()
public void setTransMeta(TransMeta transMeta)
transMeta
- The transMeta to set.public Date getCurrentDate()
public Date getDepDate()
public Date getLogDate()
public List<RowSet> getRowsets()
public List<StepMetaDataCombi> getSteps()
public String toString()
toString
in class Object
public MappingInput[] findMappingInput()
public MappingOutput[] findMappingOutput()
public StepInterface getStepInterface(String stepname, int copy)
stepname
- The name of the step to look forcopy
- the copy number of the step to look for
public Date getReplayDate()
public void setReplayDate(Date replayDate)
public void setSafeModeEnabled(boolean safeModeEnabled)
safeModeEnabled
- true for safe modepublic boolean isSafeModeEnabled()
public RowProducer addRowProducer(String stepname, int copynr) throws KettleException
stepname
- The step to produce rows forcopynr
- The copynr of the step to produce row for (normally 0 unless you have multiple copies running)
KettleException
- in case the thread/step to produce rows for could not be found.public Job getParentJob()
public void setParentJob(Job parentJob)
parentJob
- The parentJob to set.public StepDataInterface getStepDataInterface(String stepname, int stepcopy)
stepname
- The name of the step to look forstepcopy
- The copy number (0 based) of the step
public boolean hasHaltedSteps()
public Date getJobStartDate()
public Date getJobEndDate()
public void setJobEndDate(Date jobEndDate)
jobEndDate
- the jobEndDate to setpublic void setJobStartDate(Date jobStartDate)
jobStartDate
- the jobStartDate to setpublic long getPassedBatchId()
public void setPassedBatchId(long jobBatchId)
jobBatchId
- the jobBatchId to setpublic long getBatchId()
public void setBatchId(long batchId)
batchId
- the batchId to setpublic String getThreadName()
public void setThreadName(String threadName)
threadName
- the threadName to setpublic String getStatus()
public boolean isInitializing()
public void setInitializing(boolean initializing)
initializing
- the initializing to setpublic boolean isPreparing()
public void setPreparing(boolean preparing)
preparing
- the preparing to setpublic boolean isRunning()
public void setRunning(boolean running)
running
- the running to setpublic static final TransSplitter executeClustered(TransMeta transMeta, TransExecutionConfiguration executionConfiguration) throws KettleException
KettleException
public static final void executeClustered(TransSplitter transSplitter, TransExecutionConfiguration executionConfiguration) throws KettleException
transSplitter
- executionConfiguration
-
KettleException
public static final long monitorClusteredTransformation(LogChannelInterface log, TransSplitter transSplitter, Job parentJob)
logSubject
- 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
public static final long monitorClusteredTransformation(LogChannelInterface log, TransSplitter transSplitter, Job parentJob, int sleepTimeSeconds)
logSubject
- 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
public static int cleanupCluster(LogChannelInterface log, TransSplitter transSplitter)
public static void cleanupSlaveServer(TransSplitter transSplitter, SlaveServer slaveServer, TransMeta slaveTransMeta) throws KettleException
KettleException
public static final Result getClusteredTransformationResult(LogChannelInterface log, TransSplitter transSplitter, Job parentJob)
public static String sendToSlaveServer(TransMeta transMeta, TransExecutionConfiguration executionConfiguration, Repository repository) throws KettleException
transMeta
- executionConfiguration
- repository
-
KettleException
public boolean isReadyToStart()
prepareExecution(String[])
public void setInternalKettleVariables(VariableSpace var)
public void copyVariablesFrom(VariableSpace space)
VariableSpace
copyVariablesFrom
in interface VariableSpace
space
- the space to copy the variables from.public String environmentSubstitute(String aString)
VariableSpace
environmentSubstitute
in interface VariableSpace
aString
- The string to substitute.
public String[] environmentSubstitute(String[] aString)
VariableSpace
environmentSubstitute
in interface VariableSpace
aString
- The array of strings that wants its variables to be replaced.
public VariableSpace getParentVariableSpace()
VariableSpace
getParentVariableSpace
in interface VariableSpace
public void setParentVariableSpace(VariableSpace parent)
VariableSpace
setParentVariableSpace
in interface VariableSpace
parent
- The parent variable space to setpublic String getVariable(String variableName, String defaultValue)
VariableSpace
getVariable
in interface VariableSpace
variableName
- The name of the variabledefaultValue
- The default value in case the variable could not be
found
public String getVariable(String variableName)
VariableSpace
getVariable
in interface VariableSpace
variableName
- The name of the variable
public boolean getBooleanValueOfVariable(String variableName, boolean defaultValue)
VariableSpace
getBooleanValueOfVariable
in interface VariableSpace
variableName
- The variable to look up.defaultValue
- The default value to return.
static method ValueMeta.convertStringToBoolean()
public void initializeVariablesFrom(VariableSpace parent)
VariableSpace
initializeVariablesFrom
in interface VariableSpace
parent
- the parent to start from, or null if root.public String[] listVariables()
VariableSpace
listVariables
in interface VariableSpace
public void setVariable(String variableName, String variableValue)
VariableSpace
setVariable
in interface VariableSpace
variableName
- The name of the variable to setvariableValue
- The value of the variable to set. If the
variableValue is null, the variable is cleared
from the list.public void shareVariablesWith(VariableSpace space)
VariableSpace
shareVariablesWith
in interface VariableSpace
space
- Variable space to be shared.public void injectVariables(Map<String,String> prop)
VariableSpace
injectVariables
in interface VariableSpace
prop
- Properties object containing key-value pairs.public void pauseRunning()
public void resumeRunning()
public boolean isPreview()
public void setPreview(boolean preview)
preview
- the preview to setpublic Repository getRepository()
public void setRepository(Repository repository)
repository
- the repository to setpublic Map<String,List<StepPerformanceSnapShot>> getStepPerformanceSnapShots()
public void setStepPerformanceSnapShots(Map<String,List<StepPerformanceSnapShot>> stepPerformanceSnapShots)
stepPerformanceSnapShots
- the stepPerformanceSnapShots to setpublic List<TransListener> getTransListeners()
public void setTransListeners(List<TransListener> transListeners)
transListeners
- the transListeners to setpublic void addTransListener(TransListener transListener)
public void setTransStoppedListeners(List<TransStoppedListener> transStoppedListeners)
public List<TransStoppedListener> getTransStoppedListeners()
public void addTransStoppedListener(TransStoppedListener transStoppedListener)
public boolean isPaused()
public boolean isStopped()
public static void monitorRemoteTransformation(LogChannelInterface log, String carteObjectId, String transName, SlaveServer remoteSlaveServer)
public static void monitorRemoteTransformation(LogChannelInterface log, String carteObjectId, String transName, SlaveServer remoteSlaveServer, int sleepTimeSeconds)
public void addParameterDefinition(String key, String defValue, String description) throws DuplicateParamException
NamedParams
addParameterDefinition
in interface NamedParams
key
- Name of the parameter.defValue
- default value.description
- Description of the parameter.
DuplicateParamException
- Upon duplicate parameter definitionspublic String getParameterDefault(String key) throws UnknownParamException
NamedParams
getParameterDefault
in interface NamedParams
key
- Key to get value for.
UnknownParamException
- Parameter 'key' is unknown.public String getParameterDescription(String key) throws UnknownParamException
NamedParams
getParameterDescription
in interface NamedParams
key
- Key to get value for.
UnknownParamException
- Parameter 'key' is unknown.public String getParameterValue(String key) throws UnknownParamException
NamedParams
getParameterValue
in interface NamedParams
key
- Key to get value for.
UnknownParamException
- Parameter 'key' is unknown.public String[] listParameters()
NamedParams
listParameters
in interface NamedParams
public void setParameterValue(String key, String value) throws UnknownParamException
NamedParams
setParameterValue
in interface NamedParams
key
- key to set value ofvalue
- value to set it to.
UnknownParamException
- Parameter 'key' is unknown.public void eraseParameters()
NamedParams
eraseParameters
in interface NamedParams
public void clearParameters()
NamedParams
clearParameters
in interface NamedParams
public void activateParameters()
NamedParams
activateParameters
in interface NamedParams
public void copyParametersFrom(NamedParams params)
NamedParams
copyParametersFrom
in interface NamedParams
params
- the parameters to copy from.public Trans getParentTrans()
public void setParentTrans(Trans parentTrans)
parentTrans
- the parentTrans to setpublic String getMappingStepName()
public void setMappingStepName(String mappingStepName)
mappingStepName
- the name of the mapping step that created this transformationpublic void setSocketRepository(SocketRepository socketRepository)
public SocketRepository getSocketRepository()
public String getObjectName()
getObjectName
in interface LoggingObjectInterface
public String getObjectCopy()
getObjectCopy
in interface LoggingObjectInterface
public String getFilename()
getFilename
in interface LoggingObjectInterface
public String getLogChannelId()
getLogChannelId
in interface LoggingObjectInterface
public ObjectId getObjectId()
getObjectId
in interface LoggingObjectInterface
public ObjectRevision getObjectRevision()
getObjectRevision
in interface LoggingObjectInterface
public LoggingObjectType getObjectType()
getObjectType
in interface LoggingObjectInterface
public LoggingObjectInterface getParent()
getParent
in interface LoggingObjectInterface
public RepositoryDirectoryInterface getRepositoryDirectory()
getRepositoryDirectory
in interface LoggingObjectInterface
public LogLevel getLogLevel()
getLogLevel
in interface LoggingObjectInterface
public void setLogLevel(LogLevel logLevel)
public List<LoggingHierarchy> getLoggingHierarchy()
public Map<String,Trans> getActiveSubtransformations()
public String getContainerObjectId()
getContainerObjectId
in interface LoggingObjectInterface
public void setContainerObjectId(String containerObjectId)
containerObjectId
- the carteObjectId to setpublic Date getRegistrationDate()
getRegistrationDate
in interface LoggingObjectInterface
public void setServletPrintWriter(PrintWriter servletPrintWriter)
public PrintWriter getServletPrintWriter()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |