things.thinger.service.httptool.stock
Class ActionManager_Stock

java.lang.Object
  extended by things.thinger.service.httptool.ActionManager
      extended by things.thinger.service.httptool.stock.ActionManager_Stock

public class ActionManager_Stock
extends ActionManager

This is a stock implementation of the action manager.

This will cache a local commander for general use by the actions. For this to work, the service has to have command and response channels set in the local properties, like this (or similar):

        kb.core.service.httptoolservice.local.command_channel=kb.core.service.localcommandservice
        kb.core.service.httptoolservice.local.response_channel=kb.core.service.httptoolservice

Internally, the names are uppercase. Externally, the names are not case sensitive.

Version:
1.0

Version History

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

Field Summary
 
Fields inherited from class things.thinger.service.httptool.ActionManager
si
 
Constructor Summary
ActionManager_Stock()
           
 
Method Summary
 void addMapping(java.lang.String actionName, java.lang.String actionClassName)
          Add a mapping.
static LocalCommander getCommander()
          Get the local commander.
 java.lang.String getMainName()
          Get the main action.
protected  void init_chain()
          The initialization chain.
protected  Action load(java.lang.String actionName)
          Load an action by name.
 
Methods inherited from class things.thinger.service.httptool.ActionManager
get, init
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ActionManager_Stock

public ActionManager_Stock()
Method Detail

getCommander

public static LocalCommander getCommander()
Get the local commander. This assumes it will have been init'd already. Maybe I need to make it check here too. This can be accessed statically by all the action implementations. LocalCommander is currently synchronized, so it can be a big, fat bottleneck.

Returns:
the commander.

addMapping

public void addMapping(java.lang.String actionName,
                       java.lang.String actionClassName)
                throws java.lang.Throwable
Add a mapping. This is so people can use the stock and add their own mappings too.

Parameters:
actionName - The name of the action.
actionClassName - The action class name.
Throws:
java.lang.Throwable - if either parameter is null.

getMainName

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

Specified by:
getMainName in class ActionManager
Returns:
the name of the main action.
Throws:
ThingsException - for any problem.

load

protected 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.

Specified by:
load in class ActionManager
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 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.

It is synchronized because we can't let anyone else muddle with myCommander.

Specified by:
init_chain in class ActionManager
Throws:
ThingsException - for any problem.


Things.