Package adams.flow

Class FlowSetupRunner

  • All Implemented Interfaces:
    Destroyable, GlobalInfoSupporter, LoggingLevelHandler, LoggingSupporter, OptionHandler, SizeOfHandler, HomeRelocator, Serializable

    public class FlowSetupRunner
    extends AbstractOptionHandler
    implements HomeRelocator
    Runs a flow control center setup from commandline.

    Valid options are:

    -D <int> (property: debugLevel)
        The greater the number the more additional info the scheme may output to 
        the console (0 = off).
        default: 0
        minimum: 0
     
    -home <java.lang.String> (property: home)
        The directory to use as the project's home directory, overriding the automatically 
        determined one.
        default: 
     
    -setup <adams.core.io.PlaceholderFile> (property: setupFile)
        The setup file to load and execute.
        default: ${CWD}
     
    -name <java.lang.String> (property: setupName)
        The name of the setup to execute.
        default: 
     
    Version:
    $Revision$
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • m_SetupFile

        protected PlaceholderFile m_SetupFile
        the control center setup.
      • m_SetupName

        protected String m_SetupName
        the name of the setup to execute.
      • m_Home

        protected String m_Home
        the directory to use as the project's home directory.
    • Constructor Detail

      • FlowSetupRunner

        public FlowSetupRunner()
    • Method Detail

      • setHome

        public void setHome​(String value)
        Overrides the automatic detection of the project's home directory and uses the specified directory instead. No placeholders allowed, should be absolute.
        Specified by:
        setHome in interface HomeRelocator
        Parameters:
        value - the directory to use
      • getHome

        public String getHome()
        Returns the directory to use as home directory instead of the automatically determined one.
        Specified by:
        getHome in interface HomeRelocator
        Returns:
        the directory to use
      • homeTipText

        public String homeTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setSetupFile

        public void setSetupFile​(PlaceholderFile value)
        Sets the setup file to load the actor from.
        Parameters:
        value - the file
      • getSetupFile

        public PlaceholderFile getSetupFile()
        Returns the setup file to load the actor from.
        Returns:
        the file
      • setupFileTipText

        public String setupFileTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setSetupName

        public void setSetupName​(String value)
        Sets the name of the setup to execute.
        Parameters:
        value - the name
      • getSetupName

        public String getSetupName()
        Returns the name of the setup to execute.
        Returns:
        the name
      • setupNameTipText

        public String setupNameTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • execute

        public String execute()
        Loads the control center setup and executes it, without waiting for it to finish.
        Returns:
        the error if one occurred, otherwise null (= everything OK)
      • execute

        public String execute​(boolean wait)
        Loads the control center setup and executes it.
        Parameters:
        wait - whether to wait for the execution to finish
        Returns:
        the error if one occurred, otherwise null (= everything OK)
      • forName

        public static FlowSetupRunner forName​(String classname,
                                              String[] options)
        Instantiates the runner with the given options.
        Parameters:
        classname - the classname of the runner to instantiate
        options - the options for the runner
        Returns:
        the instantiated runner or null if an error occurred
      • forCommandLine

        public static FlowSetupRunner forCommandLine​(String cmdline)
        Instantiates the runner from the given commandline (i.e., classname and optional options).
        Parameters:
        cmdline - the classname (and optional options) of the runner to instantiate
        Returns:
        the instantiated runner or null if an error occurred
      • runSetup

        public static void runSetup​(Class env,
                                    Class flow,
                                    String[] args)
        Runs the setup from commandline.
        Parameters:
        env - the environment class to use
        flow - the FlowControlCenterRunner class to execute
        args - the commandline arguments, use -help to display all
      • main

        public static void main​(String[] args)
        Runs the flow with the given options. Use "-help" to see all options.
        Parameters:
        args - the options to use