de.dfki.lt.hog
Class Registry

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

public class Registry
extends java.lang.Object

Registry provides methods to store and retrieve Modules in a central hashmap. This class is realised using a singelton pattern since there can only be exactly one instance of Registry. This class is the local registry in contrast to the (public) rmi registry.


Method Summary
static Registry getInstance()
          This controlls the access to the instance of Registry.
 java.util.HashMap getModuleNames()
          This returns the hash map that maps class names to module names.
 java.util.HashMap getModules()
          This returns the hash map that maps module names to the modules.
 void registerModule(Module aModule)
          This registers aModule using the name of the module as defined in the module as key.
 Module retrieveModuleViaClass(java.lang.String aModClass)
          This retrieves the Module that is an instance of the class with name aModClass.
 Module retrieveModuleViaName(java.lang.String aModName)
          This retrieves the Module stored under the module name aModName.
 void setModuleNames(java.util.HashMap aHashMap)
          This sets the module names.
 void unregisterModule(Module aModule)
          This unregisters aModule.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static Registry getInstance()
This controlls the access to the instance of Registry.

Returns:
the only existing instance of Registry

getModules

public java.util.HashMap getModules()
This returns the hash map that maps module names to the modules. Modules communicate with each other using these module names.

Returns:
the HashMap with modules

getModuleNames

public java.util.HashMap getModuleNames()
This returns the hash map that maps class names to module names. This is needed because the Launcher communicates with the Registry via class names.

Returns:
a HashMap with the module names

setModuleNames

public void setModuleNames(java.util.HashMap aHashMap)
This sets the module names.

Parameters:
aHashMap - a HashMap with the module names

registerModule

public void registerModule(Module aModule)
This registers aModule using the name of the module as defined in the module as key.

Parameters:
aModule - a Module

unregisterModule

public void unregisterModule(Module aModule)
This unregisters aModule.

Parameters:
aModule - a Module

retrieveModuleViaName

public Module retrieveModuleViaName(java.lang.String aModName)
                             throws NoSuchModuleException
This retrieves the Module stored under the module name aModName. This method is used by the Agents to retrieve modules from the registry.

Parameters:
aModName - a String that is used as key
Returns:
the Module stored under that name
Throws:
NoSuchModuleException - if requested module doesn't exist in the registry

retrieveModuleViaClass

public Module retrieveModuleViaClass(java.lang.String aModClass)
                              throws NoSuchModuleException
This retrieves the Module that is an instance of the class with name aModClass. This method is used by the Launcher to retrieve modules from the registry.

Parameters:
aModClass - a String with the class name
Returns:
the {link Module} that is an instance of this class.
Throws:
NoSuchModuleException - if requested module doesn't exist in the registry