Package weka.knowledgeflow.steps
Class SetVariables
- java.lang.Object
-
- weka.knowledgeflow.steps.BaseStep
-
- weka.knowledgeflow.steps.SetVariables
-
- All Implemented Interfaces:
java.io.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:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SetVariables()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetCustomEditorForStep()Return the fully qualified name of a custom editor component (JComponent) to use for editing the properties of the step.java.lang.StringgetDynamicVarsInternalRep()java.util.List<java.lang.String>getIncomingConnectionTypes()Get a list of incoming connection types that this step can accept.java.util.List<java.lang.String>getOutgoingConnectionTypes()Get a list of outgoing connection types that this step can produce.java.lang.StringgetVarsInternalRep()Get the variables to set (in internal representation)static java.util.Map<java.lang.String,java.util.List<java.lang.String>>internalDynamicToMap(java.lang.String internalRep)static java.util.Map<java.lang.String,java.lang.String>internalToMap(java.lang.String internalRep)Convert a string in the internal static variable representation to a map of variables + valuesInstancesoutputStructureForConnectionType(java.lang.String connectionName)If possible, get the output structure for the named connection type as a header-only set of instances.voidprocessIncoming(Data data)Process an incoming data payload (if the step accepts incoming connections)voidsetDynamicVarsInternalRep(java.lang.String rep)voidsetVarsInternalRep(java.lang.String rep)Set the static variables to set (in internal representation)voidstepInit()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 Detail
-
SEP1
public static final java.lang.String SEP1
Separators for internal variable specification- See Also:
- Constant Field Values
-
SEP2
public static final java.lang.String SEP2
- See Also:
- Constant Field Values
-
SEP3
public static final java.lang.String SEP3
- See Also:
- Constant Field Values
-
-
Method Detail
-
setVarsInternalRep
@ProgrammaticProperty public void setVarsInternalRep(java.lang.String rep)
Set the static variables to set (in internal representation)- Parameters:
rep- the variables to set
-
getVarsInternalRep
public java.lang.String getVarsInternalRep()
Get the variables to set (in internal representation)- Returns:
- the variables to set
-
setDynamicVarsInternalRep
@ProgrammaticProperty public void setDynamicVarsInternalRep(java.lang.String rep)
-
getDynamicVarsInternalRep
public java.lang.String getDynamicVarsInternalRep()
-
stepInit
public void stepInit() throws WekaExceptionInitialize the step.- Throws:
WekaException- if a problem occurs during initialization
-
processIncoming
public void processIncoming(Data data) throws WekaException
Description copied from class:BaseStepProcess an incoming data payload (if the step accepts incoming connections)- Specified by:
processIncomingin interfaceBaseStepExtender- Specified by:
processIncomingin interfaceStep- Overrides:
processIncomingin classBaseStep- Parameters:
data- the payload to process- Throws:
WekaException- if a problem occurs
-
getIncomingConnectionTypes
public java.util.List<java.lang.String> 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
public java.util.List<java.lang.String> 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
public Instances outputStructureForConnectionType(java.lang.String connectionName) throws WekaException
Description copied from class:BaseStepIf 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:
outputStructureForConnectionTypein interfaceStep- Overrides:
outputStructureForConnectionTypein 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
public java.lang.String 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:
getCustomEditorForStepin interfaceStep- Overrides:
getCustomEditorForStepin classBaseStep- Returns:
- the fully qualified name of a step editor component
-
internalDynamicToMap
public static java.util.Map<java.lang.String,java.util.List<java.lang.String>> internalDynamicToMap(java.lang.String internalRep)
-
internalToMap
public static java.util.Map<java.lang.String,java.lang.String> internalToMap(java.lang.String internalRep)
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
-
-