Class BaseStep

    • 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
      • 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
      • setStepMustRunSingleThreaded

        @ProgrammaticProperty
        public void setStepMustRunSingleThreaded​(boolean mustRunSingleThreaded)
        Set whether this step must run single threaded. I.e. on an executor service which has only one worker thread, thus effectively preventing more than one copy of the step executing at any one time.
        Parameters:
        mustRunSingleThreaded - true if the step must run single threaded
      • stepMustRunSingleThreaded

        public boolean stepMustRunSingleThreaded()
        Get whether this step must run single threaded. I.e. on an executor service which has only one worker thread, thus effectively preventing more than one copy of the step executing at any one time.
        Returns:
        true if the step must run single threaded
      • 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
      • outputStructureForConnectionType

        public Instances outputStructureForConnectionType​(java.lang.String connectionName,
                                                          Environment env)
                                                   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
        env - Environment variables
        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:
        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