Package weka.knowledgeflow.steps
Class SetVariables
java.lang.Object
weka.knowledgeflow.steps.BaseStep
weka.knowledgeflow.steps.SetVariables
- All Implemented Interfaces:
Serializable
,BaseStepExtender
,Step
@KFStep(name="SetVariables",
category="Flow",
toolTipText="Assign default values for static variables, if not already set, and for dynamic variables. Static variables are guaranteed to be available to all other steps at initialization as the Knowledge Flow makes sure that SetVariables is invoked first first. Dynamic variables can have their values set using the values of attributes from incoming instances. Dynamic variables are *not* guaranteed to be available to other steps in the flow - instead, they are intended for use by a directly connected \'Job\' step, which will execute a specified sub-flow for each \'variables\' data object received.",
iconPath="weka/gui/knowledgeflow/icons/SetVariables.gif")
public class SetVariables
extends BaseStep
Step that can be used to set the values of environment variables for the flow
being executed. Can be useful when testing flows that use environment
variables (that would typically have values set appropriately at runtime in a
production setting). This step is special in the sense the the Knowledge Flow
checks for it and invokes its stepInit() method (thus setting variables)
before initializing all other steps in the flow. It can also be used to set
'dynamic' variables based on the values of attributes in incoming instances.
Dynamic variables are not guaranteed to be available to other steps in the
same flow at runtime. Instead, they are meant to be used by a directly
connected (via 'variables' connection) 'Job' step, which will execute a
specified sub-flow for each 'variables' data object received.
- Version:
- $Revision: $
- Author:
- Mark Hall (mhall{[at]}pentaho{[dot]}com)
- See Also:
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturn the fully qualified name of a custom editor component (JComponent) to use for editing the properties of the step.Get a list of incoming connection types that this step can accept.Get a list of outgoing connection types that this step can produce.Get the variables to set (in internal representation)internalDynamicToMap
(String internalRep) internalToMap
(String internalRep) Convert a string in the internal static variable representation to a map of variables + valuesoutputStructureForConnectionType
(String connectionName) If possible, get the output structure for the named connection type as a header-only set of instances.void
processIncoming
(Data data) Process an incoming data payload (if the step accepts incoming connections)void
void
setVarsInternalRep
(String rep) Set the static variables to set (in internal representation)void
stepInit()
Initialize the step.Methods inherited from class weka.knowledgeflow.steps.BaseStep
environmentSubstitute, getDefaultSettings, getInteractiveViewers, getInteractiveViewersImpls, getName, getStepManager, globalInfo, isResourceIntensive, isStopRequested, outputStructureForConnectionType, setName, setStepIsResourceIntensive, setStepManager, setStepMustRunSingleThreaded, start, stepMustRunSingleThreaded, stop
-
Field Details
-
SEP1
Separators for internal variable specification- See Also:
-
SEP2
- See Also:
-
SEP3
- See Also:
-
-
Constructor Details
-
SetVariables
public SetVariables()
-
-
Method Details
-
setVarsInternalRep
Set the static variables to set (in internal representation)- Parameters:
rep
- the variables to set
-
getVarsInternalRep
Get the variables to set (in internal representation)- Returns:
- the variables to set
-
setDynamicVarsInternalRep
-
getDynamicVarsInternalRep
-
stepInit
Initialize the step.- Throws:
WekaException
- if a problem occurs during initialization
-
processIncoming
Description copied from class:BaseStep
Process an incoming data payload (if the step accepts incoming connections)- Specified by:
processIncoming
in interfaceBaseStepExtender
- Specified by:
processIncoming
in interfaceStep
- Overrides:
processIncoming
in classBaseStep
- Parameters:
data
- the payload to process- Throws:
WekaException
- if a problem occurs
-
getIncomingConnectionTypes
Get a list of incoming connection types that this step can accept. Ideally (and if appropriate), this should take into account the state of the step and any existing incoming connections. E.g. a step might be able to accept one (and only one) incoming batch data connection.- Returns:
- a list of incoming connections that this step can accept given its current state
-
getOutgoingConnectionTypes
Get a list of outgoing connection types that this step can produce. Ideally (and if appropriate), this should take into account the state of the step and the incoming connections. E.g. depending on what incoming connection is present, a step might be able to produce a trainingSet output, a testSet output or neither, but not both.- Returns:
- a list of outgoing connections that this step can produce
-
outputStructureForConnectionType
Description copied from class:BaseStep
If possible, get the output structure for the named connection type as a header-only set of instances. Can return null if the specified connection type is not representable as Instances or cannot be determined at present.- Specified by:
outputStructureForConnectionType
in interfaceStep
- Overrides:
outputStructureForConnectionType
in classBaseStep
- Parameters:
connectionName
- the name of the connection type to get the output structure for- Returns:
- the output structure as a header-only Instances object
- Throws:
WekaException
- if a problem occurs
-
getCustomEditorForStep
Return the fully qualified name of a custom editor component (JComponent) to use for editing the properties of the step. This method can return null, in which case the system will dynamically generate an editor using the GenericObjectEditor- Specified by:
getCustomEditorForStep
in interfaceStep
- Overrides:
getCustomEditorForStep
in classBaseStep
- Returns:
- the fully qualified name of a step editor component
-
internalDynamicToMap
-
internalToMap
Convert a string in the internal static variable representation to a map of variables + values- Parameters:
internalRep
- the variables in internal represenation- Returns:
- a map of variables + values
-