things.thinger.service.httptool
Class ActionManager

java.lang.Object
  extended by things.thinger.service.httptool.ActionManager
Direct Known Subclasses:
ActionManager_Stock

public abstract class ActionManager
extends java.lang.Object

The action manager handles all mapping actions to classes.

Version:
1.0

Version History

EPG - Initial - 17 NOV 07
 
Author:
Erich P. Gatejen

Field Summary
protected  SystemInterface si
          The system interface.
 
Constructor Summary
ActionManager()
          Constructor.
 
Method Summary
 Action get(java.lang.String actionName)
          Get an action implementation.
abstract  java.lang.String getMainName()
          Get the main action.
protected abstract  void init_chain()
          The initialization chain.
 void init(SystemInterface si)
          Initialize the manager.
protected abstract  Action load(java.lang.String actionName)
          Load an action by name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

si

protected SystemInterface si
The system interface. It will be set by the system before get is ever called.

Constructor Detail

ActionManager

public ActionManager()
Constructor.

Method Detail

getMainName

public abstract java.lang.String getMainName()
                                      throws ThingsException
Get the main action. Consider this the index.html of the system.

Returns:
the name of the main action.
Throws:
ThingsException - for any problem.

load

protected abstract Action load(java.lang.String actionName)
                        throws java.lang.Throwable
Load an action by name. This will not come from the cache. Use get() if you want the cache. Most user applications should use get() instead.

Parameters:
actionName - the name of the action.
Returns:
the action or null if it could not be found.
Throws:
java.lang.Throwable - for any problem (except for it not being found). This is usually fatal.

init_chain

protected abstract void init_chain()
                            throws ThingsException
The initialization chain. This will be called when the system inits the manager. It gives the base class a chance to init. The si (SystemInterface) will be set and usable. The system may call this more than once. If it does, the state should be reset and the initialization done again.

Throws:
ThingsException - for any problem.

init

public void init(SystemInterface si)
          throws ThingsException
Initialize the manager. This will be called by the system, so there is no need to do it yourself.

Throws:
ThingsException - by the init_chain if applicable. The base will never throw it.

get

public Action get(java.lang.String actionName)
           throws java.lang.Throwable
Get an action implementation. It will get it from the cache. If it isn't in the cache, it'll load it. They are not pooled right now. It will return null if it could not be found.

Parameters:
actionName - the name of the action.
Returns:
The action implementation or null if it wasn't found.
Throws:
java.lang.Throwable


Things.