|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--irssibot.core.ModuleHandler
Manages modules for IrssiBot. the modules can be loaded and added to
handler at startup (from config file) or dynamically from IRC
using core->loadModule().
All calls to modules are wrapped inside a tight try - catch in order to detect exceptions in the module and remove it in that case.
| Field Summary | |
private Core |
core
|
private static java.lang.String |
info
Component info string to be returned by toString() |
private java.util.Hashtable |
loadedModules
|
private AbstractModule[] |
moduleTable
|
private int |
numModules
|
| Constructor Summary | |
ModuleHandler(Core core)
Constructs. |
|
| Method Summary | |
boolean |
addModule(java.lang.String moduleClassName,
AbstractModule module)
Adds a module. |
boolean |
forwardMessage(IrcMessage message,
ServerConnection caller)
Forwards an IrcMessage to all registered modules. |
AbstractModule[] |
getModuleTable()
Returns the module table. |
private void |
handleModuleCrash(java.lang.Throwable t,
AbstractModule module)
Removes faulted module cleanly. |
private java.util.Properties |
loadModuleState(java.lang.String moduleClassName)
Loads state of a module from disk as a Properties object. |
private void |
reconstructTable()
for optimal access to modules, construct a table representation of the contents of the hash table and maintain the number of loaded modules in numModules |
boolean |
removeModule(java.lang.String moduleClassName)
Removes a module. |
void |
saveModuleState(AbstractModule module)
Saves module state to disk as a Properties object. |
java.lang.String |
toString()
Returns component info. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
private static java.lang.String info
private java.util.Hashtable loadedModules
private AbstractModule[] moduleTable
private int numModules
private Core core
| Constructor Detail |
public ModuleHandler(Core core)
core - reference to bot core| Method Detail |
public java.lang.String toString()
toString in class java.lang.Objectpublic AbstractModule[] getModuleTable()
private void handleModuleCrash(java.lang.Throwable t,
AbstractModule module)
t - cause to module faultmodule - the module error occurred in
public boolean forwardMessage(IrcMessage message,
ServerConnection caller)
message - the IrcMessage to forwardcaller - the ServerConnection the message came from
private void reconstructTable()
public boolean addModule(java.lang.String moduleClassName,
AbstractModule module)
throws java.lang.IllegalStateException
moduleClassName - Java class name of modulemodule - AbstractModule to add
java.lang.IllegalStateException - if module already loadedpublic boolean removeModule(java.lang.String moduleClassName)
moduleClassName - name o module to remove
private java.util.Properties loadModuleState(java.lang.String moduleClassName)
moduleClassName - the name of module class
public void saveModuleState(AbstractModule module)
module - module whose state to save
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||