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 Details

  • Constructor Details

    • SetVariables

      public SetVariables()
  • Method Details

    • setVarsInternalRep

      @ProgrammaticProperty public void setVarsInternalRep(String rep)
      Set the static variables to set (in internal representation)
      Parameters:
      rep - the variables to set
    • getVarsInternalRep

      public String getVarsInternalRep()
      Get the variables to set (in internal representation)
      Returns:
      the variables to set
    • setDynamicVarsInternalRep

      @ProgrammaticProperty public void setDynamicVarsInternalRep(String rep)
    • getDynamicVarsInternalRep

      public String getDynamicVarsInternalRep()
    • stepInit

      public void stepInit() throws WekaException
      Initialize the step.
      Throws:
      WekaException - if a problem occurs during initialization
    • processIncoming

      public void processIncoming(Data data) throws WekaException
      Description copied from class: BaseStep
      Process an incoming data payload (if the step accepts incoming connections)
      Specified by:
      processIncoming in interface BaseStepExtender
      Specified by:
      processIncoming in interface Step
      Overrides:
      processIncoming in class BaseStep
      Parameters:
      data - the payload to process
      Throws:
      WekaException - if a problem occurs
    • getIncomingConnectionTypes

      public List<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 List<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(String connectionName) throws WekaException
      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 interface Step
      Overrides:
      outputStructureForConnectionType in class BaseStep
      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 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:
      getCustomEditorForStep in interface Step
      Overrides:
      getCustomEditorForStep in class BaseStep
      Returns:
      the fully qualified name of a step editor component
    • internalDynamicToMap

      public static Map<String,List<String>> internalDynamicToMap(String internalRep)
    • internalToMap

      public static Map<String,String> internalToMap(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