Package adams.flow
Class FlowSetupRunner
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.flow.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 Summary
Fields Modifier and Type Field Description protected Stringm_Homethe directory to use as the project's home directory.protected PlaceholderFilem_SetupFilethe control center setup.protected Stringm_SetupNamethe name of the setup to execute.-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description FlowSetupRunner()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddefineOptions()Adds options to the internal list of options.Stringexecute()Loads the control center setup and executes it, without waiting for it to finish.Stringexecute(boolean wait)Loads the control center setup and executes it.static FlowSetupRunnerforCommandLine(String cmdline)Instantiates the runner from the given commandline (i.e., classname and optional options).static FlowSetupRunnerforName(String classname, String[] options)Instantiates the runner with the given options.StringgetHome()Returns the directory to use as home directory instead of the automatically determined one.PlaceholderFilegetSetupFile()Returns the setup file to load the actor from.StringgetSetupName()Returns the name of the setup to execute.StringglobalInfo()Returns a string describing the object.StringhomeTipText()Returns the tip text for this property.static voidmain(String[] args)Runs the flow with the given options.static voidrunSetup(Class env, Class flow, String[] args)Runs the setup from commandline.voidsetHome(String value)Overrides the automatic detection of the project's home directory and uses the specified directory instead.voidsetSetupFile(PlaceholderFile value)Sets the setup file to load the actor from.voidsetSetupName(String value)Sets the name of the setup to execute.StringsetupFileTipText()Returns the tip text for this property.StringsetupNameTipText()Returns the tip text for this property.-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, initialize, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
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.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfoin interfaceGlobalInfoSupporter- Specified by:
globalInfoin classAbstractOptionHandler- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptionsin interfaceOptionHandler- Overrides:
defineOptionsin classAbstractOptionHandler
-
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:
setHomein interfaceHomeRelocator- 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:
getHomein interfaceHomeRelocator- 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 instantiateoptions- 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 useflow- the FlowControlCenterRunner class to executeargs- 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
-
-