weka.knowledgeflow.steps

## Class BaseStep

- java.lang.Object
- - weka.knowledgeflow.steps.BaseStep

- All Implemented Interfaces:
    java.io.Serializable, BaseStepExtender, Step
  Direct Known Subclasses:
    Appender, BaseSimpleDataVisualizer, Block, BoundaryPlotter, ClassAssigner, ClassifierPerformanceEvaluator, ClassValuePicker, ClustererPerformanceEvaluator, CrossValidationFoldMaker, DataGrid, DataVisualizer, Dummy, FlowByExpression, ImageSaver, ImageViewer, IncrementalClassifierEvaluator, InstanceStreamToBatchMaker, Join, MakeResourceIntensive, MemoryBasedDataSource, ModelPerformanceChart, Note, PredictionAppender, SerializedModelSaver, SetVariables, Sorter, StripChart, SubstringLabeler, SubstringReplacer, TestSetMaker, TextSaver, TextViewer, TrainingSetMaker, TrainTestSplitMaker, WekaAlgorithmWrapper

      public abstract class BaseStep
      extends java.lang.Object
      implements Step, BaseStepExtender, java.io.Serializable

  Base class for implementations of Step to use. Provides handy functions that automatically setup the step's name and "about" info, provide access to the step's StepManager and for resolving environment variables.
  Version:
    $Revision: $
  Author:
    Mark Hall (mhall{[at]}pentaho{[dot]}com)
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `BaseStep()` Constructor

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `environmentSubstitute(java.lang.String source)` Substitute the values of environment variables in the given string
    `java.lang.String` | `getCustomEditorForStep()` Return the fully qualified name of a custom editor component (JComponent) to use for editing the properties of the step.
    `Defaults` | `getDefaultSettings()` Get default settings for the step (if any).
    `java.util.Map<java.lang.String,java.lang.String>` | `getInteractiveViewers()` When running in a graphical execution environment a step can make one or more popup Viewer components available.
    `java.util.Map<java.lang.String,StepInteractiveViewer>` | `getInteractiveViewersImpls()` An alternative to getStepInteractiveViewers that returns a Map of instantiated StepInteractiveViewer objects.
    `java.lang.String` | `getName()` Get the name of this step
    `StepManager` | `getStepManager()` Get the step manager for this step
    `java.lang.String` | `globalInfo()` Attempt to get default "about" information for this step by grabbing the toolTip from the KFStep annotation.
    `boolean` | `isResourceIntensive()` Get whether this step is resource intensive (cpu/memory) or not.
    `boolean` | `isStopRequested()` Convenience method that calls `StepManager.isStopRequested()`
    `Instances` | `outputStructureForConnectionType(java.lang.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` | `setName(java.lang.String name)` Set the name of this step
    `void` | `setStepIsResourceIntensive(boolean isResourceIntensive)` Set whether this step is resource intensive (cpu/memory) or not.
    `void` | `setStepManager(StepManager manager)` Set the step manager for this step
    `void` | `start()` Start processing.
    `void` | `stop()` Request that processing be stopped.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface weka.knowledgeflow.steps.Step

      `getIncomingConnectionTypes, getOutgoingConnectionTypes, stepInit`

    - ### Methods inherited from interface weka.knowledgeflow.steps.BaseStepExtender

      `getIncomingConnectionTypes, getOutgoingConnectionTypes, stepInit`

- - ### Constructor Detail

    - #### BaseStep

          public BaseStep()

      Constructor

  - ### Method Detail

    - #### globalInfo

          public java.lang.String globalInfo()

      Attempt to get default "about" information for this step by grabbing the toolTip from the KFStep annotation.
      Returns:
        a default "about" info string if this step uses the KFStep annotation and null otherwise. Subclasses should override to provide more comprehensive about info

    - #### getStepManager

          @NotPersistable
          public StepManager getStepManager()

      Get the step manager for this step
      Specified by:
        `getStepManager` in interface `Step`
      Returns:
        the step manager for this step

    - #### setStepManager

          public void setStepManager(StepManager manager)

      Set the step manager for this step
      Specified by:
        `setStepManager` in interface `Step`
      Parameters:
        `manager` - the step manager to use

    - #### setStepIsResourceIntensive

          @ProgrammaticProperty
          public void setStepIsResourceIntensive(boolean isResourceIntensive)

      Set whether this step is resource intensive (cpu/memory) or not. This affects which executor service is used to execute the step's processing.
      Parameters:
        `isResourceIntensive` - true if this step is resource intensive.

    - #### isResourceIntensive

          public boolean isResourceIntensive()

      Get whether this step is resource intensive (cpu/memory) or not.
      Returns:
        true if this step is resource intensive

    - #### getName

          public java.lang.String getName()

      Get the name of this step
      Specified by:
        `getName` in interface `Step`
      Returns:
        the name of this step

    - #### setName

          @ProgrammaticProperty
          public void setName(java.lang.String name)

      Set the name of this step
      Specified by:
        `setName` in interface `Step`
      Parameters:
        `name` - the name for this step

    - #### start

          public void start()
                     throws WekaException

      Start processing. Subclasses should override this method if they can act as a start point in a flow.
      Specified by:
        `start` in interface `BaseStepExtender`
      Specified by:
        `start` in interface `Step`
      Throws:
        `WekaException` - if a problem occurs

    - #### stop

          public void stop()

      Request that processing be stopped. Subclasses should call `isStopRequested()` periodically to see if they should stop processing.
      Specified by:
        `stop` in interface `Step`

    - #### outputStructureForConnectionType

          public Instances outputStructureForConnectionType(java.lang.String connectionName)
                                                     throws WekaException

      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`
      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

    - #### processIncoming

          public void processIncoming(Data data)
                               throws WekaException

      Process an incoming data payload (if the step accepts incoming connections)
      Specified by:
        `processIncoming` in interface `BaseStepExtender`
      Specified by:
        `processIncoming` in interface `Step`
      Parameters:
        `data` - the payload to process
      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:
        `getCustomEditorForStep` in interface `Step`
      Returns:
        the fully qualified name of a step editor component

    - #### getInteractiveViewers

          public java.util.Map<java.lang.String,java.lang.String> getInteractiveViewers()

      When running in a graphical execution environment a step can make one or more popup Viewer components available. These might be used to display results, graphics etc. Returning null indicates that the step has no such additional graphical views. The map returned by this method should be keyed by action name (e.g. "View results"), and values should be fully qualified names of the corresponding StepInteractiveView implementation. Furthermore, the contents of this map can (and should) be dependent on whether a particular viewer should be made available - i.e. if execution hasn't occurred yet, or if a particular incoming connection type is not present, then it might not be possible to view certain results. Viewers can implement StepInteractiveView directly (in which case they need to extends JPanel), or extends the AbstractInteractiveViewer class. The later extends JPanel, uses a BorderLayout, provides a "Close" button and a method to add additional buttons.
      Specified by:
        `getInteractiveViewers` in interface `Step`
      Returns:
        a map of viewer component names, or null if this step has no graphical views

    - #### getInteractiveViewersImpls

          public java.util.Map<java.lang.String,StepInteractiveViewer> getInteractiveViewersImpls()

      An alternative to getStepInteractiveViewers that returns a Map of instantiated StepInteractiveViewer objects. Generally, getInteractiveViewers() is the preferred mechanism to specify any interactive viewers, as it does not require Steps to import and instantiate GUI classes. However, in some cases it might be unavoidable (e.g. Groovy script compilation involves custom classloaders), in these cases this method can be used instead.
      Specified by:
        `getInteractiveViewersImpls` in interface `Step`
      Returns:
        a map of instantiated instances of StepInteractiveViewers

    - #### getDefaultSettings

          public Defaults getDefaultSettings()

      Get default settings for the step (if any). Returning null indicates that the step has no user-editable defaults.
      Specified by:
        `getDefaultSettings` in interface `Step`
      Returns:
        the default settings

    - #### isStopRequested

          public boolean isStopRequested()

      Convenience method that calls `StepManager.isStopRequested()`
      Returns:
        true if the execution environment has requested processing to stop

    - #### environmentSubstitute

          public java.lang.String environmentSubstitute(java.lang.String source)

      Substitute the values of environment variables in the given string
      Parameters:
        `source` - the source string to substitute in
      Returns:
        the source string with all known environment variables resolved