org.pentaho.di.trans.steps.scriptvalues_mod
Class ScriptValuesModDummy

java.lang.Object
  extended by org.pentaho.di.trans.steps.scriptvalues_mod.ScriptValuesModDummy
All Implemented Interfaces:
HasLogChannelInterface, VariableSpace, StepInterface

public class ScriptValuesModDummy
extends Object
implements StepInterface

Dummy class used for test().


Constructor Summary
ScriptValuesModDummy(RowMetaInterface inputRowMeta, RowMetaInterface outputRowMeta)
           
 
Method Summary
 void addRowListener(RowListener rowListener)
          Add a rowlistener to the step allowing you to inspect (or manipulate, be careful) the rows coming in or exiting the step.
 void addStepListener(StepListener stepListener)
          Attach a step listener to be notified when a step arrives in a certain state.
 void batchComplete()
          Calling this method will alert the step that we finished passing a batch of records to the step.
 boolean canProcessOneRow()
          This method checks if the step is capable of processing at least one row.
 void cleanup()
          Call this method typically, after ALL the slave transformations in a clustered run have finished.
 void copyVariablesFrom(VariableSpace space)
          Copy the variables from another space, without initializing with the defaults.
 void dispose(StepMetaInterface sii, StepDataInterface sdi)
          Dispose of this step: close files, empty logs, etc.
 String environmentSubstitute(String aString)
          Substitute the string using the current variable space.
 String[] environmentSubstitute(String[] string)
          Replaces environment variables in an array of strings.
 boolean getBooleanValueOfVariable(String variableName, boolean defaultValue)
          This method returns a boolean for the new variable check boxes.
 int getCopy()
           
 long getErrors()
          Get the number of errors
 RowMetaInterface getInputRowMeta()
           
 List<RowSet> getInputRowSets()
           
 long getLinesInput()
           
 long getLinesOutput()
           
 long getLinesRead()
           
 long getLinesRejected()
           
 long getLinesUpdated()
           
 long getLinesWritten()
           
 LogChannelInterface getLogChannel()
           
 RowMetaInterface getOutputRowMeta()
           
 List<RowSet> getOutputRowSets()
           
 VariableSpace getParentVariableSpace()
          Get the parent of the variable space.
 String getPartitionID()
           
 long getProcessed()
           
 Map<String,ResultFile> getResultFiles()
           
 Object[] getRow()
           
 List<RowListener> getRowListeners()
           
 long getRuntime()
           
 BaseStepData.StepExecutionStatus getStatus()
           
 String getStepID()
           
 StepMeta getStepMeta()
           
 String getStepname()
          Get the name of the step.
 Trans getTrans()
           
 TransMeta getTransMeta()
           
 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.
 void identifyErrorOutput()
          To be used to flag an error output channel of a step prior to execution for performance reasons.
 boolean init(StepMetaInterface stepMetaInterface, StepDataInterface stepDataInterface)
          Initialize and do work where other steps need to wait for...
 void initBeforeStart()
          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(); !!!
 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 isAlive()
           
 boolean isIdle()
           
 boolean isMapping()
           
 boolean isPartitioned()
           
 boolean isPassingData()
           
 boolean isPaused()
           
 boolean isRunning()
           
 boolean isStopped()
           
 boolean isUsingThreadPriorityManagment()
           
 boolean isWaitingForData()
           
 String[] listVariables()
          List the variables (not the values) that are currently in the variable space.
 void markStart()
          Mark the start time of the step.
 void markStop()
          Mark the end time of the step.
 void pauseRunning()
          Pause a running step
 boolean processRow(StepMetaInterface smi, StepDataInterface sdi)
          Perform the equivalent of processing one row.
 void putRow(RowMetaInterface rowMeta, Object[] row)
          Put a row on the destination rowsets.
 void removeRowListener(RowListener rowListener)
          Remove a rowlistener from this step.
 void resumeRunning()
          Resume a running step
 int rowsetInputSize()
           
 int rowsetOutputSize()
           
 void run()
           
 void setErrors(long errors)
          Sets the number of errors
 void setLinesRejected(long linesRejected)
           
 void setOutputDone()
          Signal output done to destination steps
 void setParentVariableSpace(VariableSpace parent)
          Set the parent variable space
 void setPartitioned(boolean partitioned)
           
 void setPartitionID(String partitionID)
           
 void setPassingData(boolean passingData)
           
 void setRepartitioning(int partitioningMethod)
           
 void setRunning(boolean running)
          Flag the step as running or not
 void setStopped(boolean stopped)
           
 void setUsingThreadPriorityManagment(boolean usingThreadPriorityManagment)
           
 void setVariable(String variableName, String variableValue)
          Sets a variable in the Kettle Variables list.
 void setWaitingForData(boolean waitingForData)
           
 void shareVariablesWith(VariableSpace space)
          Share a variable space from another variable space.
 void start()
           
 void stopAll()
          Flags all rowsets as stopped/completed/finished.
 void stopRunning(StepMetaInterface stepMetaInterface, StepDataInterface stepDataInterface)
          Stop running operations...
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScriptValuesModDummy

public ScriptValuesModDummy(RowMetaInterface inputRowMeta,
                            RowMetaInterface outputRowMeta)
Method Detail

processRow

public boolean processRow(StepMetaInterface smi,
                          StepDataInterface sdi)
                   throws KettleException
Description copied from interface: StepInterface
Perform the equivalent of processing one row. Typically this means reading a row from input (getRow()) and passing a row to output (putRow)).

Specified by:
processRow in interface StepInterface
Parameters:
smi - The steps metadata to work with
sdi - 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:
KettleException

addRowListener

public void addRowListener(RowListener rowListener)
Description copied from interface: StepInterface
Add a rowlistener to the step allowing you to inspect (or manipulate, be careful) the rows coming in or exiting the step.

Specified by:
addRowListener in interface StepInterface
Parameters:
rowListener - the rowlistener to add

dispose

public void dispose(StepMetaInterface sii,
                    StepDataInterface sdi)
Description copied from interface: StepInterface
Dispose of this step: close files, empty logs, etc.

Specified by:
dispose in interface StepInterface
Parameters:
sii - The metadata to work with
sdi - The data to dispose of

getErrors

public long getErrors()
Description copied from interface: StepInterface
Get the number of errors

Specified by:
getErrors in interface StepInterface
Returns:
the number of errors

getInputRowSets

public List<RowSet> getInputRowSets()
Specified by:
getInputRowSets in interface StepInterface
Returns:
The list of active input rowsets for the step

getLinesInput

public long getLinesInput()
Specified by:
getLinesInput in interface StepInterface
Returns:
Returns the linesInput.

getLinesOutput

public long getLinesOutput()
Specified by:
getLinesOutput in interface StepInterface
Returns:
Returns the linesOutput.

getLinesRead

public long getLinesRead()
Specified by:
getLinesRead in interface StepInterface
Returns:
Returns the linesRead.

getLinesUpdated

public long getLinesUpdated()
Specified by:
getLinesUpdated in interface StepInterface
Returns:
Returns the linesUpdated.

getLinesWritten

public long getLinesWritten()
Specified by:
getLinesWritten in interface StepInterface
Returns:
Returns the linesWritten.

getLinesRejected

public long getLinesRejected()
Specified by:
getLinesRejected in interface StepInterface
Returns:
Returns the lines rejected by error handling.

getOutputRowSets

public List<RowSet> getOutputRowSets()
Specified by:
getOutputRowSets in interface StepInterface
Returns:
The list of active output rowsets for the step

getPartitionID

public String getPartitionID()
Specified by:
getPartitionID in interface StepInterface
Returns:
the steps partition ID

getRow

public Object[] getRow()
                throws KettleException
Specified by:
getRow in interface StepInterface
Returns:
a row from the source step(s).
Throws:
KettleException

getRowListeners

public List<RowListener> getRowListeners()
Specified by:
getRowListeners in interface StepInterface
Returns:
a list of the installed RowListeners

getStepID

public String getStepID()
Specified by:
getStepID in interface StepInterface
Returns:
the type ID of the step...

getStepname

public String getStepname()
Description copied from interface: StepInterface
Get the name of the step.

Specified by:
getStepname in interface StepInterface
Returns:
the name of the step

init

public boolean init(StepMetaInterface stepMetaInterface,
                    StepDataInterface stepDataInterface)
Description copied from interface: StepInterface
Initialize and do work where other steps need to wait for...

Specified by:
init in interface StepInterface
Parameters:
stepMetaInterface - The metadata to work with
stepDataInterface - The data to initialize

isAlive

public boolean isAlive()

isPartitioned

public boolean isPartitioned()
Specified by:
isPartitioned in interface StepInterface
Returns:
true if the step is running partitioned

isStopped

public boolean isStopped()
Specified by:
isStopped in interface StepInterface
Returns:
True if the step is marked as stopped. Execution should stop immediate.

markStart

public void markStart()
Description copied from interface: StepInterface
Mark the start time of the step.

Specified by:
markStart in interface StepInterface

markStop

public void markStop()
Description copied from interface: StepInterface
Mark the end time of the step.

Specified by:
markStop in interface StepInterface

putRow

public void putRow(RowMetaInterface rowMeta,
                   Object[] row)
            throws KettleException
Description copied from interface: StepInterface
Put a row on the destination rowsets.

Specified by:
putRow in interface StepInterface
Parameters:
rowMeta - The row to send to the destinations steps
Throws:
KettleException

removeRowListener

public void removeRowListener(RowListener rowListener)
Description copied from interface: StepInterface
Remove a rowlistener from this step.

Specified by:
removeRowListener in interface StepInterface
Parameters:
rowListener - the rowlistener to remove

run

public void run()

setErrors

public void setErrors(long errors)
Description copied from interface: StepInterface
Sets the number of errors

Specified by:
setErrors in interface StepInterface
Parameters:
errors - the number of errors to set

setOutputDone

public void setOutputDone()
Description copied from interface: StepInterface
Signal output done to destination steps

Specified by:
setOutputDone in interface StepInterface

setPartitionID

public void setPartitionID(String partitionID)
Specified by:
setPartitionID in interface StepInterface
Parameters:
partitionID - the partitionID to set

start

public void start()

stopAll

public void stopAll()
Description copied from interface: StepInterface
Flags all rowsets as stopped/completed/finished.

Specified by:
stopAll in interface StepInterface

stopRunning

public void stopRunning(StepMetaInterface stepMetaInterface,
                        StepDataInterface stepDataInterface)
                 throws KettleException
Description copied from interface: StepInterface
Stop running operations...

Specified by:
stopRunning in interface StepInterface
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:
KettleException

cleanup

public void cleanup()
Description copied from interface: StepInterface
Call this method typically, after ALL the slave transformations in a clustered run have finished.

Specified by:
cleanup in interface StepInterface

pauseRunning

public void pauseRunning()
Description copied from interface: StepInterface
Pause a running step

Specified by:
pauseRunning in interface StepInterface

resumeRunning

public void resumeRunning()
Description copied from interface: StepInterface
Resume a running step

Specified by:
resumeRunning in interface StepInterface

copyVariablesFrom

public void copyVariablesFrom(VariableSpace space)
Description copied from interface: VariableSpace
Copy the variables from another space, without initializing with the defaults. This does not affect any parent relationship.

Specified by:
copyVariablesFrom in interface VariableSpace
Parameters:
space - the space to copy the variables from.

environmentSubstitute

public String environmentSubstitute(String aString)
Description copied from interface: VariableSpace
Substitute the string using the current variable space.

Specified by:
environmentSubstitute in interface VariableSpace
Parameters:
aString - The string to substitute.
Returns:
The substituted string.

environmentSubstitute

public String[] environmentSubstitute(String[] string)
Description copied from interface: VariableSpace
Replaces environment variables in an array of strings. See also: environmentSubstitute(String string)

Specified by:
environmentSubstitute in interface VariableSpace
Parameters:
string - The array of strings that wants its variables to be replaced.
Returns:
the array with the environment variables replaced.

getBooleanValueOfVariable

public boolean getBooleanValueOfVariable(String variableName,
                                         boolean defaultValue)
Description copied from interface: VariableSpace
This method returns a boolean for the new variable check boxes. If the variable name is not set or the variable name is not specified, this method simply returns the default value. If not, it convert the variable value to a boolean. "Y", "YES" and "TRUE" all convert to true. (case insensitive)

Specified by:
getBooleanValueOfVariable in interface VariableSpace
Parameters:
variableName - The variable to look up.
defaultValue - The default value to return.
Returns:
See Also:
static method ValueMeta.convertStringToBoolean()

getParentVariableSpace

public VariableSpace getParentVariableSpace()
Description copied from interface: VariableSpace
Get the parent of the variable space.

Specified by:
getParentVariableSpace in interface VariableSpace
Returns:
the parent.

setParentVariableSpace

public void setParentVariableSpace(VariableSpace parent)
Description copied from interface: VariableSpace
Set the parent variable space

Specified by:
setParentVariableSpace in interface VariableSpace
Parameters:
parent - The parent variable space to set

getVariable

public String getVariable(String variableName,
                          String defaultValue)
Description copied from interface: VariableSpace
Get the value of a variable with a default in case the variable is not found.

Specified by:
getVariable in interface VariableSpace
Parameters:
variableName - The name of the variable
defaultValue - The default value in case the variable could not be found
Returns:
the String value of a variable

getVariable

public String getVariable(String variableName)
Description copied from interface: VariableSpace
Get the value of a variable.

Specified by:
getVariable in interface VariableSpace
Parameters:
variableName - The name of the variable
Returns:
the String value of a variable or null in case the variable could not be found.

initializeVariablesFrom

public void initializeVariablesFrom(VariableSpace parent)
Description copied from interface: VariableSpace
Initialize variable space using the defaults, copy over the variables from the parent (using copyVariablesFrom()), after this the "injected" variables should be inserted (injectVariables()). The parent is set as parent variable space.

Specified by:
initializeVariablesFrom in interface VariableSpace
Parameters:
parent - the parent to start from, or null if root.

injectVariables

public void injectVariables(Map<String,String> prop)
Description copied from interface: VariableSpace
Inject variables. The behaviour should be that the properties object will be stored and at the time the VariableSpace is initialized (or upon calling this method if the space is already initialized). After injecting the link of the properties object should be removed.

Specified by:
injectVariables in interface VariableSpace
Parameters:
prop - Properties object containing key-value pairs.

listVariables

public String[] listVariables()
Description copied from interface: VariableSpace
List the variables (not the values) that are currently in the variable space.

Specified by:
listVariables in interface VariableSpace
Returns:
Array of String variable names.

setVariable

public void setVariable(String variableName,
                        String variableValue)
Description copied from interface: VariableSpace
Sets a variable in the Kettle Variables list.

Specified by:
setVariable in interface VariableSpace
Parameters:
variableName - The name of the variable to set
variableValue - The value of the variable to set. If the variableValue is null, the variable is cleared from the list.

shareVariablesWith

public void shareVariablesWith(VariableSpace space)
Description copied from interface: VariableSpace
Share a variable space from another variable space. This means that the object should take over the space used as argument.

Specified by:
shareVariablesWith in interface VariableSpace
Parameters:
space - Variable space to be shared.

getInputRowMeta

public RowMetaInterface getInputRowMeta()

getOutputRowMeta

public RowMetaInterface getOutputRowMeta()

initBeforeStart

public void initBeforeStart()
                     throws KettleStepException
Description copied from interface: StepInterface
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(); !!!

Specified by:
initBeforeStart in interface StepInterface
Throws:
KettleStepException - In case there is an error

setLinesRejected

public void setLinesRejected(long linesRejected)
Specified by:
setLinesRejected in interface StepInterface
Parameters:
linesRejected - steps the lines rejected by error handling.

getCopy

public int getCopy()
Specified by:
getCopy in interface StepInterface
Returns:
The steps copy number (default 0)

addStepListener

public void addStepListener(StepListener stepListener)
Description copied from interface: StepInterface
Attach a step listener to be notified when a step arrives in a certain state. (finished)

Specified by:
addStepListener in interface StepInterface
Parameters:
stepListener - The listener to add to the step

isMapping

public boolean isMapping()
Specified by:
isMapping in interface StepInterface
Returns:
true if the thread is a special mapping step

getStepMeta

public StepMeta getStepMeta()
Specified by:
getStepMeta in interface StepInterface
Returns:
The metadata for this step

getTrans

public Trans getTrans()
Specified by:
getTrans in interface StepInterface
Returns:
the transformation that is executing this step

getTransMeta

public TransMeta getTransMeta()

getLogChannel

public LogChannelInterface getLogChannel()
Specified by:
getLogChannel in interface HasLogChannelInterface
Specified by:
getLogChannel in interface StepInterface
Returns:
the logging channel for this step

isRunning

public boolean isRunning()
Specified by:
isRunning in interface StepInterface
Returns:
true if the step is running after having been initialized

isUsingThreadPriorityManagment

public boolean isUsingThreadPriorityManagment()
Specified by:
isUsingThreadPriorityManagment in interface StepInterface
Returns:
true if we are actively managing priorities of step threads

setUsingThreadPriorityManagment

public void setUsingThreadPriorityManagment(boolean usingThreadPriorityManagment)
Specified by:
setUsingThreadPriorityManagment in interface StepInterface
Parameters:
usingThreadPriorityManagment - set to true to actively manage priorities of step threads

setRunning

public void setRunning(boolean running)
Description copied from interface: StepInterface
Flag the step as running or not

Specified by:
setRunning in interface StepInterface
Parameters:
running - the running flag to set

setStopped

public void setStopped(boolean stopped)
Specified by:
setStopped in interface StepInterface
Parameters:
stopped - true if the step needs to be stopped

rowsetInputSize

public int rowsetInputSize()
Specified by:
rowsetInputSize in interface StepInterface
Returns:
The total amount of rows in the input buffers

rowsetOutputSize

public int rowsetOutputSize()
Specified by:
rowsetOutputSize in interface StepInterface
Returns:
The total amount of rows in the output buffers

getProcessed

public long getProcessed()
Specified by:
getProcessed in interface StepInterface
Returns:
The number of "processed" lines of a step. Well, a representable metric for that anyway.

getResultFiles

public Map<String,ResultFile> getResultFiles()
Specified by:
getResultFiles in interface StepInterface
Returns:
The result files for this step

getRuntime

public long getRuntime()
Specified by:
getRuntime in interface StepInterface
Returns:
The number of ms that this step has been running

getStatus

public BaseStepData.StepExecutionStatus getStatus()
Specified by:
getStatus in interface StepInterface
Returns:
the description as in StepDataInterface

isPaused

public boolean isPaused()
Specified by:
isPaused in interface StepInterface
Returns:
True if the step is paused

identifyErrorOutput

public void identifyErrorOutput()
Description copied from interface: StepInterface
To be used to flag an error output channel of a step prior to execution for performance reasons.

Specified by:
identifyErrorOutput in interface StepInterface

setPartitioned

public void setPartitioned(boolean partitioned)
Specified by:
setPartitioned in interface StepInterface
Parameters:
partitioned - true if this step is partitioned

setRepartitioning

public void setRepartitioning(int partitioningMethod)
Specified by:
setRepartitioning in interface StepInterface

canProcessOneRow

public boolean canProcessOneRow()
Description copied from interface: StepInterface
This 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:
canProcessOneRow in interface StepInterface
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 KettleException
Description copied from interface: StepInterface
Calling 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:
batchComplete in interface StepInterface
Throws:
KettleException - In case an error occurs during the processing of the batch of rows.