de.dfki.lt.hog
Class Launcher

java.lang.Object
  extended by de.dfki.lt.hog.Launcher

public class Launcher
extends java.lang.Object

Laucher provides static methods that initialize and register all modules in the local registry and in the rmi registry. It also provides a method that starts the run method of a module in a thread.


Field Summary
protected static java.lang.String RMI_MODULE_PROP
          This is the property for the rmi module in the module config.
 
Method Summary
static void registerModule(Module aModule)
          This registers aModule in the local registry.
static Module registerModule(java.lang.String moduleClass, java.util.Properties configProps, java.lang.String rmiServer, java.lang.String rmiPort)
          This creates an instance of moduleClass using configProps and registers it in the local registry.
static java.rmi.Remote registerRmiModule(java.lang.String rmiModuleClass, java.util.Properties configProps, java.lang.String rmiServer, java.lang.String rmiPort)
          This creates an instance of rmiModuleClass using configProps and registers it in the rmi registry using rmiServer and rmiPort.
static void unregisterModule(java.lang.String moduleClass, java.lang.String rmiServer, java.lang.String rmiPort)
          This executes the shutdown method of the registered instance of moduleClass and unregisters it in the local registry and the rmi registry if necessary.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RMI_MODULE_PROP

protected static final java.lang.String RMI_MODULE_PROP
This is the property for the rmi module in the module config.

See Also:
Constant Field Values
Method Detail

registerModule

public static Module registerModule(java.lang.String moduleClass,
                                    java.util.Properties configProps,
                                    java.lang.String rmiServer,
                                    java.lang.String rmiPort)
                             throws InitializationException
This creates an instance of moduleClass using configProps and registers it in the local registry. We assume that each module has exactly one public constructor that takes a properties object as its only argument. If module registers in the rmi registry, use rmiServer and rmiPort.

Parameters:
moduleClass - a String with the class name of the module
configProps - a Properties object with config settings
rmiServer - a String with the rmi server
rmiPort - a String with the rmi port
Returns:
a Module that is the new instance of moduleClass
Throws:
InitializationException - if initialization fails

registerModule

public static void registerModule(Module aModule)
This registers aModule in the local registry.

Parameters:
aModule - the Module to register

registerRmiModule

public static java.rmi.Remote registerRmiModule(java.lang.String rmiModuleClass,
                                                java.util.Properties configProps,
                                                java.lang.String rmiServer,
                                                java.lang.String rmiPort)
                                         throws InitializationException
This creates an instance of rmiModuleClass using configProps and registers it in the rmi registry using rmiServer and rmiPort. We assume that each rmi module has exactly one public constructor that takes a Module as its only argument.

Parameters:
rmiModuleClass - a String with the class name of the module
configProps - a Properties object with config settings
rmiServer - a String with the rmi server
rmiPort - a String with the rmi port
Returns:
a Remote that is the new instance of rmiModuleClass or null if no rmi server/port is specified
Throws:
InitializationException - if initialization fails

unregisterModule

public static void unregisterModule(java.lang.String moduleClass,
                                    java.lang.String rmiServer,
                                    java.lang.String rmiPort)
                             throws ShutdownException
This executes the shutdown method of the registered instance of moduleClass and unregisters it in the local registry and the rmi registry if necessary.

Parameters:
moduleClass - a String with the class name of the module to shutdown
rmiServer - a String with the rmi server
rmiPort - a String with the rmi port
Throws:
ShutdownException - if shutdown fails