|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.iges.anagram.AbstractModule
Provides default implementations of most of the Module interface, plus some convenience methods for logging and throwing exceptions.
The only methods that remain to be implemented by subclasses are getModuleID() and configure(Setting setting).
Field Summary | |
protected Log |
log
Reference to the log module |
protected java.lang.String |
moduleName
Complete name of this module, including parents |
protected Module |
parent
Parent of this module |
protected Server |
server
Reference to the top-level module |
Constructor Summary | |
AbstractModule()
|
Method Summary | |
protected void |
configModule(Module module,
Setting parent)
Convenience method - extracts the appropriate sub-setting from the parent setting, and uses it to configure the module given |
abstract void |
configure(Setting setting)
Configures the module according to the settings provided. |
protected boolean |
debug()
Convenience method - returns true if debugging output is enabled for this module. |
protected void |
debug(java.lang.String msg)
Convenience method - sends a debug message to the logger |
protected void |
error(java.lang.String msg)
Convenience method - sends an error message to the logger |
protected void |
fail(java.lang.String msg)
Convenience method - equivalent to throwing a ModuleException |
protected void |
fail(java.lang.String clientMsg,
java.lang.String serverMsg)
Convenience method - equivalent to throwing a ModuleException |
protected void |
fail(java.lang.String msg,
java.lang.Throwable cause)
Convenience method - equivalent to throwing a ModuleException |
abstract java.lang.String |
getModuleID()
Returns an ID for this module. |
java.lang.String |
getModuleName()
Returns the full name of this module, including parent modules |
protected void |
info(java.lang.String msg)
Convenience method - sends an info message to the logger |
void |
init(Server server,
Module parent)
Saves references to the server, log module, and parent module, and constructs the complete module name. |
java.lang.String |
toString()
Shuts down the module. |
protected boolean |
verbose()
Convenience method - returns true if verbose output is enabled for this module. |
protected void |
verbose(java.lang.String msg)
Convenience method - sends a verbose message to the logger |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected Module parent
protected java.lang.String moduleName
protected Server server
protected Log log
Constructor Detail |
public AbstractModule()
Method Detail |
public java.lang.String getModuleName()
getModuleName
in interface Module
public abstract java.lang.String getModuleID()
Module
getModuleID
in interface Module
public abstract void configure(Setting setting) throws ConfigException
configure
in interface Module
SettingException
- if invalid settings are provided;
if this module has previously been configured, and does not support
dynamic reconfiguration; or if the destroy() method has already been
called
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.protected void configModule(Module module, Setting parent) throws ConfigException
module
- Module to be configured
ConfigException
public void init(Server server, Module parent)
init
in interface Module
protected final boolean debug()
protected final boolean verbose()
protected final void debug(java.lang.String msg)
protected final void verbose(java.lang.String msg)
protected final void info(java.lang.String msg)
protected final void error(java.lang.String msg)
protected final void fail(java.lang.String msg) throws ModuleException
ModuleException
protected final void fail(java.lang.String msg, java.lang.Throwable cause) throws ModuleException
ModuleException
protected final void fail(java.lang.String clientMsg, java.lang.String serverMsg) throws ModuleException
ModuleException
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |