org.iges.anagram
Interface Module

All Known Implementing Classes:
AbstractModule, AnagramServlet, Log, Server

public interface Module

The fundamental software component in the Anagram framework.

The Anagram server is a hierarchical collection of modules that communicate with each other and exchange various temporary objects in order to handle servlet requests. Each module encapsulates a portion of the server's functionality.

Modules are distinct from other Anagram classes in that they:

  • have an ID, and a complete name based on their parents in the module hierarchy
  • support a standard initialization and configuration interface
  • are provided with a reference to to the top-level module (the Server object) and thus can access all other public modules in the hierarchy
  • must be threadsafe (with the exception of the init() and configure() methods)

  • Method Summary
     void configure(Setting setting)
              Configures the module according to the settings provided.
     java.lang.String getModuleID()
              Returns an ID for this module.
     java.lang.String getModuleName()
              Returns the complete name of the module, including parents.
     void init(Server server, Module parent)
              Initializes the module.
     

    Method Detail

    getModuleName

    public java.lang.String getModuleName()
    Returns the complete name of the module, including parents. The syntax is: complete_name : [parents] module_id
    parents : [parents] parent '/'
    The complete module name is used as an identifier in log messages.


    getModuleID

    public java.lang.String getModuleID()
    Returns an ID for this module. This ID should be a legal XML tag name. It has two uses: as a tag name in the server's configuration file, and as the final element of the complete module name.


    init

    public void init(Server server,
                     Module parent)
    Initializes the module.

    This method should copy the server and parent references provided to internal fields, so that the module has access to the rest of the module hierarchy, and then call the init() method of any sub-modules. It can also be used to perform any one-time initialization that requires access to other modules.

    This method will only be called once, immediately after the module is created, and before it is configured for the first time. Thus it does not need to be thread-safe.


    configure

    public void configure(Setting setting)
                   throws ConfigException
    Configures the module according to the settings provided.

    This method is guaranteed to be called at least once before any requests are sent to the module. The server supports dynamic reconfiguration, and thus this method may be called any number of times during the life of the module. However, it is guaranteed that this method will never be called while a servlet request is being processed. Thus it does not need to be thread-safe.

    If this module contains other modules, it is responsible for configuring them using the appropriate sub-settings. Each module should receive the sub-setting that matches its module ID, so that the XML tags in the configuration file match up with the module names in the log file.

    Throws:
    ConfigException - If the module is unable to operate using the settings provided. This will halt the server's operation, and thus should only be thrown if there is no reasonable default that can be used in place of a missing or invalid setting.