Class ScriptDummy
- java.lang.Object
-
- org.pentaho.di.trans.steps.script.ScriptDummy
-
- All Implemented Interfaces:
HasLogChannelInterface,org.pentaho.di.core.variables.VariableSpace,StepInterface
public class ScriptDummy extends Object implements StepInterface
Dummy class used for test().
-
-
Constructor Summary
Constructors Constructor Description ScriptDummy(org.pentaho.di.core.row.RowMetaInterface inputRowMeta, org.pentaho.di.core.row.RowMetaInterface outputRowMeta)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddRowListener(RowListener rowListener)Add a rowlistener to the step allowing you to inspect (or manipulate, be careful) the rows coming in or exiting the step.voidaddStepListener(StepListener stepListener)Attach a step listener to be notified when a step arrives in a certain state.voidbatchComplete()Calling this method will alert the step that we finished passing a batch of records to the step.booleancanProcessOneRow()This method checks if the step is capable of processing at least one row.voidcleanup()Call this method typically, after ALL the slave transformations in a clustered run have finished.voidcopyVariablesFrom(org.pentaho.di.core.variables.VariableSpace space)voiddispose(StepMetaInterface sii, StepDataInterface sdi)Dispose of this step: close files, empty logs, etc.StringenvironmentSubstitute(String aString)String[]environmentSubstitute(String[] string)StringfieldSubstitute(String aString, org.pentaho.di.core.row.RowMetaInterface rowMeta, Object[] rowData)booleangetBooleanValueOfVariable(String variableName, boolean defaultValue)intgetCopy()intgetCurrentInputRowSetNr()intgetCurrentOutputRowSetNr()longgetErrors()Get the number of errorsorg.pentaho.di.core.row.RowMetaInterfacegetInputRowMeta()List<org.pentaho.di.core.RowSet>getInputRowSets()longgetLinesInput()longgetLinesOutput()longgetLinesRead()longgetLinesRejected()longgetLinesUpdated()longgetLinesWritten()org.pentaho.di.core.logging.LogChannelInterfacegetLogChannel()org.pentaho.metastore.api.IMetaStoregetMetaStore()org.pentaho.di.core.row.RowMetaInterfacegetOutputRowMeta()List<org.pentaho.di.core.RowSet>getOutputRowSets()org.pentaho.di.core.variables.VariableSpacegetParentVariableSpace()StringgetPartitionID()longgetProcessed()RepositorygetRepository()Map<String,org.pentaho.di.core.ResultFile>getResultFiles()Object[]getRow()List<RowListener>getRowListeners()longgetRuntime()BaseStepData.StepExecutionStatusgetStatus()StringgetStepID()StepMetagetStepMeta()StringgetStepname()Get the name of the step.TransgetTrans()StringgetVariable(String variableName)StringgetVariable(String variableName, String defaultValue)voididentifyErrorOutput()To be used to flag an error output channel of a step prior to execution for performance reasons.booleaninit(StepMetaInterface stepMetaInterface, StepDataInterface stepDataInterface)Initialize and do work where other steps need to wait for...voidinitBeforeStart()This method is executed by Trans right before the threads start and right after initialization.
!!! A plugin implementing this method should make sure to also call super.initBeforeStart(); !!!voidinitializeVariablesFrom(org.pentaho.di.core.variables.VariableSpace parent)voidinjectVariables(Map<String,String> prop)booleanisAlive()booleanisIdle()booleanisMapping()booleanisPartitioned()booleanisPassingData()booleanisPaused()booleanisRunning()booleanisStopped()booleanisUsingThreadPriorityManagment()booleanisWaitingForData()String[]listVariables()voidmarkStart()Mark the start time of the step.voidmarkStop()Mark the end time of the step.voidpauseRunning()Pause a running stepbooleanprocessRow(StepMetaInterface smi, StepDataInterface sdi)Perform the equivalent of processing one row.voidputRow(org.pentaho.di.core.row.RowMetaInterface rowMeta, Object[] row)Put a row on the destination rowsets.voidremoveRowListener(RowListener rowListener)Remove a rowlistener from this step.voidresumeRunning()Resume a running stepintrowsetInputSize()introwsetOutputSize()voidrun()voidsetCurrentInputRowSetNr(int index)voidsetCurrentOutputRowSetNr(int index)voidsetErrors(long errors)Sets the number of errorsvoidsetLinesRejected(long linesRejected)voidsetMetaStore(org.pentaho.metastore.api.IMetaStore metaStore)Pass along the metastore to use when loading external elements at runtime.voidsetOutputDone()Signal output done to destination stepsvoidsetParentVariableSpace(org.pentaho.di.core.variables.VariableSpace parent)voidsetPartitioned(boolean partitioned)voidsetPartitionID(String partitionID)voidsetPassingData(boolean passingData)voidsetRepartitioning(int partitioningMethod)voidsetRepository(Repository repository)voidsetRunning(boolean running)Flag the step as running or notvoidsetSafeStopped(boolean stopped)voidsetStopped(boolean stopped)voidsetUsingThreadPriorityManagment(boolean usingThreadPriorityManagment)voidsetVariable(String variableName, String variableValue)voidsetWaitingForData(boolean waitingForData)voidshareVariablesWith(org.pentaho.di.core.variables.VariableSpace space)voidstart()voidstopAll()Flags all rowsets as stopped/completed/finished.voidstopRunning(StepMetaInterface stepMetaInterface, StepDataInterface stepDataInterface)Stop running operations...-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.pentaho.di.trans.step.StepInterface
addRowSetToInputRowSets, addRowSetToOutputRowSets, isSafeStopped, subStatuses
-
-
-
-
Method Detail
-
processRow
public boolean processRow(StepMetaInterface smi, StepDataInterface sdi) throws org.pentaho.di.core.exception.KettleException
Description copied from interface:StepInterfacePerform the equivalent of processing one row. Typically this means reading a row from input (getRow()) and passing a row to output (putRow)).- Specified by:
processRowin interfaceStepInterface- Parameters:
smi- The steps metadata to work withsdi- The steps temporary working data to work with (database connections, result sets, caches, temporary variables, etc.)- Returns:
- false if no more rows can be processed or an error occurred.
- Throws:
org.pentaho.di.core.exception.KettleException
-
addRowListener
public void addRowListener(RowListener rowListener)
Description copied from interface:StepInterfaceAdd a rowlistener to the step allowing you to inspect (or manipulate, be careful) the rows coming in or exiting the step.- Specified by:
addRowListenerin interfaceStepInterface- Parameters:
rowListener- the rowlistener to add
-
dispose
public void dispose(StepMetaInterface sii, StepDataInterface sdi)
Description copied from interface:StepInterfaceDispose of this step: close files, empty logs, etc.- Specified by:
disposein interfaceStepInterface- Parameters:
sii- The metadata to work withsdi- The data to dispose of
-
getErrors
public long getErrors()
Description copied from interface:StepInterfaceGet the number of errors- Specified by:
getErrorsin interfaceStepInterface- Returns:
- the number of errors
-
getInputRowSets
public List<org.pentaho.di.core.RowSet> getInputRowSets()
- Specified by:
getInputRowSetsin interfaceStepInterface- Returns:
- The list of active input rowsets for the step
-
getLinesInput
public long getLinesInput()
- Specified by:
getLinesInputin interfaceStepInterface- Returns:
- Returns the linesInput.
-
getLinesOutput
public long getLinesOutput()
- Specified by:
getLinesOutputin interfaceStepInterface- Returns:
- Returns the linesOutput.
-
getLinesRead
public long getLinesRead()
- Specified by:
getLinesReadin interfaceStepInterface- Returns:
- Returns the linesRead.
-
getLinesUpdated
public long getLinesUpdated()
- Specified by:
getLinesUpdatedin interfaceStepInterface- Returns:
- Returns the linesUpdated.
-
getLinesWritten
public long getLinesWritten()
- Specified by:
getLinesWrittenin interfaceStepInterface- Returns:
- Returns the linesWritten.
-
getLinesRejected
public long getLinesRejected()
- Specified by:
getLinesRejectedin interfaceStepInterface- Returns:
- Returns the lines rejected by error handling.
-
getOutputRowSets
public List<org.pentaho.di.core.RowSet> getOutputRowSets()
- Specified by:
getOutputRowSetsin interfaceStepInterface- Returns:
- The list of active output rowsets for the step
-
getPartitionID
public String getPartitionID()
- Specified by:
getPartitionIDin interfaceStepInterface- Returns:
- the steps partition ID
-
getRow
public Object[] getRow() throws org.pentaho.di.core.exception.KettleException
- Specified by:
getRowin interfaceStepInterface- Returns:
- a row from the source step(s).
- Throws:
org.pentaho.di.core.exception.KettleException
-
getRowListeners
public List<RowListener> getRowListeners()
- Specified by:
getRowListenersin interfaceStepInterface- Returns:
- a list of the installed RowListeners
-
getStepID
public String getStepID()
- Specified by:
getStepIDin interfaceStepInterface- Returns:
- the type ID of the step...
-
getStepname
public String getStepname()
Description copied from interface:StepInterfaceGet the name of the step.- Specified by:
getStepnamein interfaceStepInterface- Returns:
- the name of the step
-
init
public boolean init(StepMetaInterface stepMetaInterface, StepDataInterface stepDataInterface)
Description copied from interface:StepInterfaceInitialize and do work where other steps need to wait for...- Specified by:
initin interfaceStepInterface- Parameters:
stepMetaInterface- The metadata to work withstepDataInterface- The data to initialize
-
isAlive
public boolean isAlive()
-
isPartitioned
public boolean isPartitioned()
- Specified by:
isPartitionedin interfaceStepInterface- Returns:
- true if the step is running partitioned
-
isStopped
public boolean isStopped()
- Specified by:
isStoppedin interfaceStepInterface- Returns:
- True if the step is marked as stopped. Execution should stop immediate.
-
markStart
public void markStart()
Description copied from interface:StepInterfaceMark the start time of the step.- Specified by:
markStartin interfaceStepInterface
-
markStop
public void markStop()
Description copied from interface:StepInterfaceMark the end time of the step.- Specified by:
markStopin interfaceStepInterface
-
putRow
public void putRow(org.pentaho.di.core.row.RowMetaInterface rowMeta, Object[] row) throws org.pentaho.di.core.exception.KettleExceptionDescription copied from interface:StepInterfacePut a row on the destination rowsets.- Specified by:
putRowin interfaceStepInterface- Parameters:
rowMeta- The row to send to the destinations steps- Throws:
org.pentaho.di.core.exception.KettleException
-
removeRowListener
public void removeRowListener(RowListener rowListener)
Description copied from interface:StepInterfaceRemove a rowlistener from this step.- Specified by:
removeRowListenerin interfaceStepInterface- Parameters:
rowListener- the rowlistener to remove
-
run
public void run()
-
setErrors
public void setErrors(long errors)
Description copied from interface:StepInterfaceSets the number of errors- Specified by:
setErrorsin interfaceStepInterface- Parameters:
errors- the number of errors to set
-
setOutputDone
public void setOutputDone()
Description copied from interface:StepInterfaceSignal output done to destination steps- Specified by:
setOutputDonein interfaceStepInterface
-
setPartitionID
public void setPartitionID(String partitionID)
- Specified by:
setPartitionIDin interfaceStepInterface- Parameters:
partitionID- the partitionID to set
-
start
public void start()
-
stopAll
public void stopAll()
Description copied from interface:StepInterfaceFlags all rowsets as stopped/completed/finished.- Specified by:
stopAllin interfaceStepInterface
-
stopRunning
public void stopRunning(StepMetaInterface stepMetaInterface, StepDataInterface stepDataInterface) throws org.pentaho.di.core.exception.KettleException
Description copied from interface:StepInterfaceStop running operations...- Specified by:
stopRunningin interfaceStepInterface- Parameters:
stepMetaInterface- The metadata that might be needed by the step to stop running.stepDataInterface- The interface to the step data containing the connections, resultsets, open files, etc.- Throws:
org.pentaho.di.core.exception.KettleException
-
cleanup
public void cleanup()
Description copied from interface:StepInterfaceCall this method typically, after ALL the slave transformations in a clustered run have finished.- Specified by:
cleanupin interfaceStepInterface
-
pauseRunning
public void pauseRunning()
Description copied from interface:StepInterfacePause a running step- Specified by:
pauseRunningin interfaceStepInterface
-
resumeRunning
public void resumeRunning()
Description copied from interface:StepInterfaceResume a running step- Specified by:
resumeRunningin interfaceStepInterface
-
copyVariablesFrom
public void copyVariablesFrom(org.pentaho.di.core.variables.VariableSpace space)
- Specified by:
copyVariablesFromin interfaceorg.pentaho.di.core.variables.VariableSpace
-
environmentSubstitute
public String environmentSubstitute(String aString)
- Specified by:
environmentSubstitutein interfaceorg.pentaho.di.core.variables.VariableSpace
-
environmentSubstitute
public String[] environmentSubstitute(String[] string)
- Specified by:
environmentSubstitutein interfaceorg.pentaho.di.core.variables.VariableSpace
-
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
-
getBooleanValueOfVariable
public boolean getBooleanValueOfVariable(String variableName, boolean defaultValue)
- Specified by:
getBooleanValueOfVariablein interfaceorg.pentaho.di.core.variables.VariableSpace
-
getParentVariableSpace
public org.pentaho.di.core.variables.VariableSpace getParentVariableSpace()
- Specified by:
getParentVariableSpacein interfaceorg.pentaho.di.core.variables.VariableSpace
-
setParentVariableSpace
public void setParentVariableSpace(org.pentaho.di.core.variables.VariableSpace parent)
- Specified by:
setParentVariableSpacein interfaceorg.pentaho.di.core.variables.VariableSpace
-
getVariable
public String getVariable(String variableName, String defaultValue)
- Specified by:
getVariablein interfaceorg.pentaho.di.core.variables.VariableSpace
-
getVariable
public String getVariable(String variableName)
- Specified by:
getVariablein interfaceorg.pentaho.di.core.variables.VariableSpace
-
initializeVariablesFrom
public void initializeVariablesFrom(org.pentaho.di.core.variables.VariableSpace parent)
- Specified by:
initializeVariablesFromin interfaceorg.pentaho.di.core.variables.VariableSpace
-
injectVariables
public void injectVariables(Map<String,String> prop)
- Specified by:
injectVariablesin interfaceorg.pentaho.di.core.variables.VariableSpace
-
listVariables
public String[] listVariables()
- Specified by:
listVariablesin interfaceorg.pentaho.di.core.variables.VariableSpace
-
setVariable
public void setVariable(String variableName, String variableValue)
- Specified by:
setVariablein interfaceorg.pentaho.di.core.variables.VariableSpace
-
shareVariablesWith
public void shareVariablesWith(org.pentaho.di.core.variables.VariableSpace space)
- Specified by:
shareVariablesWithin interfaceorg.pentaho.di.core.variables.VariableSpace
-
getInputRowMeta
public org.pentaho.di.core.row.RowMetaInterface getInputRowMeta()
-
getOutputRowMeta
public org.pentaho.di.core.row.RowMetaInterface getOutputRowMeta()
-
initBeforeStart
public void initBeforeStart() throws org.pentaho.di.core.exception.KettleStepExceptionDescription copied from interface:StepInterfaceThis method is executed by Trans right before the threads start and right after initialization.
!!! A plugin implementing this method should make sure to also call super.initBeforeStart(); !!!- Specified by:
initBeforeStartin interfaceStepInterface- Throws:
org.pentaho.di.core.exception.KettleStepException- In case there is an error
-
setLinesRejected
public void setLinesRejected(long linesRejected)
- Specified by:
setLinesRejectedin interfaceStepInterface- Parameters:
linesRejected- steps the lines rejected by error handling.
-
getCopy
public int getCopy()
- Specified by:
getCopyin interfaceStepInterface- Returns:
- The steps copy number (default 0)
-
addStepListener
public void addStepListener(StepListener stepListener)
Description copied from interface:StepInterfaceAttach a step listener to be notified when a step arrives in a certain state. (finished)- Specified by:
addStepListenerin interfaceStepInterface- Parameters:
stepListener- The listener to add to the step
-
isMapping
public boolean isMapping()
- Specified by:
isMappingin interfaceStepInterface- Returns:
- true if the thread is a special mapping step
-
getStepMeta
public StepMeta getStepMeta()
- Specified by:
getStepMetain interfaceStepInterface- Returns:
- The metadata for this step
-
getTrans
public Trans getTrans()
- Specified by:
getTransin interfaceStepInterface- Returns:
- the transformation that is executing this step
-
getLogChannel
public org.pentaho.di.core.logging.LogChannelInterface getLogChannel()
- Specified by:
getLogChannelin interfaceHasLogChannelInterface- Specified by:
getLogChannelin interfaceStepInterface- Returns:
- the logging channel for this step
-
isUsingThreadPriorityManagment
public boolean isUsingThreadPriorityManagment()
- Specified by:
isUsingThreadPriorityManagmentin interfaceStepInterface- Returns:
- true if we are actively managing priorities of step threads
-
setUsingThreadPriorityManagment
public void setUsingThreadPriorityManagment(boolean usingThreadPriorityManagment)
- Specified by:
setUsingThreadPriorityManagmentin interfaceStepInterface- Parameters:
usingThreadPriorityManagment- set to true to actively manage priorities of step threads
-
isRunning
public boolean isRunning()
- Specified by:
isRunningin interfaceStepInterface- Returns:
- true if the step is running after having been initialized
-
setRunning
public void setRunning(boolean running)
Description copied from interface:StepInterfaceFlag the step as running or not- Specified by:
setRunningin interfaceStepInterface- Parameters:
running- the running flag to set
-
setStopped
public void setStopped(boolean stopped)
- Specified by:
setStoppedin interfaceStepInterface- Parameters:
stopped- true if the step needs to be stopped
-
setSafeStopped
public void setSafeStopped(boolean stopped)
- Specified by:
setSafeStoppedin interfaceStepInterface- Parameters:
stopped- true if the step needs to be safe stopped
-
rowsetInputSize
public int rowsetInputSize()
- Specified by:
rowsetInputSizein interfaceStepInterface- Returns:
- The total amount of rows in the input buffers
-
rowsetOutputSize
public int rowsetOutputSize()
- Specified by:
rowsetOutputSizein interfaceStepInterface- Returns:
- The total amount of rows in the output buffers
-
getProcessed
public long getProcessed()
- Specified by:
getProcessedin interfaceStepInterface- Returns:
- The number of "processed" lines of a step. Well, a representable metric for that anyway.
-
getResultFiles
public Map<String,org.pentaho.di.core.ResultFile> getResultFiles()
- Specified by:
getResultFilesin interfaceStepInterface- Returns:
- The result files for this step
-
getRuntime
public long getRuntime()
- Specified by:
getRuntimein interfaceStepInterface- Returns:
- The number of ms that this step has been running
-
getStatus
public BaseStepData.StepExecutionStatus getStatus()
- Specified by:
getStatusin interfaceStepInterface- Returns:
- the description as in
StepDataInterface
-
isPaused
public boolean isPaused()
- Specified by:
isPausedin interfaceStepInterface- Returns:
- True if the step is paused
-
identifyErrorOutput
public void identifyErrorOutput()
Description copied from interface:StepInterfaceTo be used to flag an error output channel of a step prior to execution for performance reasons.- Specified by:
identifyErrorOutputin interfaceStepInterface
-
setPartitioned
public void setPartitioned(boolean partitioned)
- Specified by:
setPartitionedin interfaceStepInterface- Parameters:
partitioned- true if this step is partitioned
-
setRepartitioning
public void setRepartitioning(int partitioningMethod)
- Specified by:
setRepartitioningin interfaceStepInterface- Parameters:
partitioningMethod- The repartitioning method
-
canProcessOneRow
public boolean canProcessOneRow()
Description copied from interface:StepInterfaceThis method checks if the step is capable of processing at least one row.For example, if a step has no input records but needs at least one to function, it will return false.
- Specified by:
canProcessOneRowin interfaceStepInterface- Returns:
- true if the step can process a row.
-
isWaitingForData
public boolean isWaitingForData()
-
setWaitingForData
public void setWaitingForData(boolean waitingForData)
-
isIdle
public boolean isIdle()
-
isPassingData
public boolean isPassingData()
-
setPassingData
public void setPassingData(boolean passingData)
-
batchComplete
public void batchComplete() throws org.pentaho.di.core.exception.KettleExceptionDescription copied from interface:StepInterfaceCalling this method will alert the step that we finished passing a batch of records to the step. Specifically for steps like "Sort Rows" it means that the buffered rows can be sorted and passed on.- Specified by:
batchCompletein interfaceStepInterface- Throws:
org.pentaho.di.core.exception.KettleException- In case an error occurs during the processing of the batch of rows.
-
setMetaStore
public void setMetaStore(org.pentaho.metastore.api.IMetaStore metaStore)
Description copied from interface:StepInterfacePass along the metastore to use when loading external elements at runtime.- Specified by:
setMetaStorein interfaceStepInterface- Parameters:
metaStore- The metastore to use
-
getMetaStore
public org.pentaho.metastore.api.IMetaStore getMetaStore()
- Specified by:
getMetaStorein interfaceStepInterface- Returns:
- The metastore that the step uses to load external elements from.
-
setRepository
public void setRepository(Repository repository)
- Specified by:
setRepositoryin interfaceStepInterface- Parameters:
repository- The repository used by the step to load and reference Kettle objects with at runtime
-
getRepository
public Repository getRepository()
- Specified by:
getRepositoryin interfaceStepInterface- Returns:
- The repository used by the step to load and reference Kettle objects with at runtime
-
getCurrentInputRowSetNr
public int getCurrentInputRowSetNr()
- Specified by:
getCurrentInputRowSetNrin interfaceStepInterface- Returns:
- the index of the active (current) input row set
-
setCurrentOutputRowSetNr
public void setCurrentOutputRowSetNr(int index)
- Specified by:
setCurrentOutputRowSetNrin interfaceStepInterface- Parameters:
index- Sets the index of the active (current) output row set to use.
-
getCurrentOutputRowSetNr
public int getCurrentOutputRowSetNr()
- Specified by:
getCurrentOutputRowSetNrin interfaceStepInterface- Returns:
- the index of the active (current) output row set
-
setCurrentInputRowSetNr
public void setCurrentInputRowSetNr(int index)
- Specified by:
setCurrentInputRowSetNrin interfaceStepInterface- Parameters:
index- Sets the index of the active (current) input row set to use.
-
-