com.agentfactory.common.util
Class Configuration

java.lang.Object
  extended by com.agentfactory.common.util.Configuration

public final class Configuration
extends java.lang.Object

This class is used to specify the configuration of the parser. It implements the singleton pattern, thus allowing only a single instance to be created per virtual machine. Currently supports two modes of use:

The accepted syntax for resource-based configuration is: [type1] package.Class1 package.Class2 ... package.ClassN [type2] package.Class1 package.Class2 ... {visitor-type} package.Visitor1 package.Visitor2 Empty lines are ignored and type names are used to delimit handlers.


Method Summary
 void addFlagProcessor(FlagProcessor flag)
          Add a flag processor to the configuration
 void addHandler(java.lang.String type, Handler handler)
          Add a handler to the configuration
 void addPreProcessor(PreProcessor pre)
          Add a visitor to the configuration
 void addVisitor(Visitor visitor)
          Add a visitor to the configuration
 java.util.List<FlagProcessor> getFlagProcessors()
          Get the set of flag processor for a given type
 java.util.List<Handler> getHandlers(java.lang.String type)
          Get the set of handlers for a given type
static Configuration getInstance()
          Creates a new default (empty) configuration.
static Configuration getInstance(java.lang.String resource)
          Creates a resource based configuration
 java.util.List<PreProcessor> getPreProcessors()
          Get the set of visitors for a given type
 java.lang.String getSetting(java.lang.String name)
          Accessor that returns a setting that was specified in the configuration.
 java.util.List<Visitor> getVisitors()
          Get the set of visitors for a given type
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static Configuration getInstance()
Creates a new default (empty) configuration.


getInstance

public static Configuration getInstance(java.lang.String resource)
Creates a resource based configuration

Parameters:
resource - the uri of the resource

addHandler

public void addHandler(java.lang.String type,
                       Handler handler)
Add a handler to the configuration

Parameters:
type - the type of handler
handler - the handler object

getHandlers

public java.util.List<Handler> getHandlers(java.lang.String type)
Get the set of handlers for a given type

Parameters:
type - the type of handler required
Returns:
the list of parameteres (null indicated no parameters of that type).

addVisitor

public void addVisitor(Visitor visitor)
Add a visitor to the configuration

Parameters:
visitor - the visitor object

getVisitors

public java.util.List<Visitor> getVisitors()
Get the set of visitors for a given type

Returns:
the list of parameteres (null indicated no parameters of that type).

addPreProcessor

public void addPreProcessor(PreProcessor pre)
Add a visitor to the configuration

Parameters:
pre - the preprocessor object

getPreProcessors

public java.util.List<PreProcessor> getPreProcessors()
Get the set of visitors for a given type

Returns:
the list of parameteres (null indicated no parameters of that type).

getSetting

public java.lang.String getSetting(java.lang.String name)
Accessor that returns a setting that was specified in the configuration.

Parameters:
name - the name of the setting
Returns:
a string containing the value corresponding to the named setting.

addFlagProcessor

public void addFlagProcessor(FlagProcessor flag)
Add a flag processor to the configuration

Parameters:
flag - the flag processor object

getFlagProcessors

public java.util.List<FlagProcessor> getFlagProcessors()
Get the set of flag processor for a given type

Returns:
the list of parameteres (null indicated no parameters of that type).