org.freecompany.brimstone.main
Interface Runner
public
interface
Runner
Exposes a basic control interface for applications running under the
Brimstone main. The methods exposed allow for basic
lifecycle management, allowing for starting, stopping, and restaring
the application.
Method Summary |
void | restart()
Indicates the main that after the application thread terminates it should be restarted. |
void | setArguments(String[] arguments)
Provides arguments to be passed to the specified static run method. |
void | setClass(String clazz)
Sets the class name that the main will load as the entry point to the application.
|
void | setMethod(String method)
Sets the method name used to start the application. |
void | setParent(ClassLoader parent)
Sets the ClassLoader this main should use as the parent of the ClassLoader that will be built
from the provided path. |
void | setPath(String path)
Comma-separated list of URL strings that the main will use to look up the Class and
java.lang.reflect.Method instances used to load and run the wrapped application. |
void | start()
Starts the application as described by the three attributes above.
|
public void restart()
Indicates the main that after the application thread terminates it should be restarted. Any
changes made to the path, class or method will be used when restarting the application. This
method is useful for updating an application either by overwriting the JAR file or by setting
up a new path before exiting.
public void setArguments(String[] arguments)
Provides arguments to be passed to the specified static run method. The default is to not provide any
arguments when the main is invoked programmatically. If the main is being invoked through its main
method then the default is to provide all the arguments supplied to the main that do not match known
optins in the main itself.
Parameters: arguments arguments for the main method.
public void setClass(String clazz)
Sets the class name that the main will load as the entry point to the application.
Parameters: clazz class name of the main application.
public void setMethod(String method)
Sets the method name used to start the application. This method must be a static method on the
Class loaded by name from the
clazz
attribute.
Parameters: method name to invoke when starting the application.
public void setParent(ClassLoader parent)
Sets the ClassLoader this main should use as the parent of the ClassLoader that will be built
from the provided path. This defaults to the classloader of the main implementation itself
and if it is overridden applications executed through this main may not to resolve and use
this management interface.
Parameters: parent the ClassLoader to be used as the parent of the application ClassLoader.
public void setPath(String path)
Comma-separated list of URL strings that the main will use to look up the Class and
java.lang.reflect.Method instances used to load and run the wrapped application. This set of
locations will also serve as the runtime classpath for the loaded application.
Parameters: path a list of urls to load from.
public void start()
Starts the application as described by the three attributes above.
Throws: ClassNotFoundException if the specified class can not be found. NoSuchMethodException the specified method is not a static method on the given class. IllegalAccessException the provided class or method cannot be accessed from this application. URISyntaxException if a MalformedURLException IOException