org.objectweb.dream.router
Class AbstractRouterKeyBasedImpl

java.lang.Object
  extended byorg.objectweb.dream.AbstractComponent
      extended byorg.objectweb.dream.router.AbstractRouterImpl
          extended byorg.objectweb.dream.router.AbstractRouterKeyBasedImpl
All Implemented Interfaces:
BindingController, LifeCycleController, Loggable, Push

public abstract class AbstractRouterKeyBasedImpl
extends AbstractRouterImpl

Abstract implementation of a key-based Push/Push router. A key-based Push/Push router associates each of its outputs (except the default one) to a key. These mappings (key,outputs) are stored in the outPushRouteTable Map. The key corresponding to an incoming message is retrieved using the abstract getOutputKey(Message)method.
The outPushRouteTable Map is intended to be built by the initRouteTable()method. To avoid unnecessary building of the outPushRouteTable Map, the initRouteTable()should test the initialized boolean which is set to false each time the router is bound to a new output.


Field Summary
protected  Map outPushRouteTable
          Route table that associates keys with Push output interfaces.
 
Fields inherited from class org.objectweb.dream.router.AbstractRouterImpl
DEFAULT_OUT_PUSH_ITF_NAME, defaultOutPushItf, initialized, messageManagerItf, outPushMap
 
Fields inherited from class org.objectweb.dream.AbstractComponent
bindingLogger, componentDesc, fcState, firstStart, lifeCycleLogger, logger, weaveableC
 
Fields inherited from interface org.objectweb.dream.Push
IN_PUSH_ITF_NAME, OUT_PUSH_ITF_NAME
 
Fields inherited from interface org.objectweb.fractal.api.control.LifeCycleController
STARTED, STOPPED
 
Constructor Summary
AbstractRouterKeyBasedImpl()
          Constructor.
 
Method Summary
protected  Push getOutput(Message message, Map context)
           
protected abstract  Object getOutputKey(Message message)
          Returns the key associated with the output on which the specified message must be routed.
protected  void initRouteTable()
          This method initializes the outPushRouteTable route table.
 
Methods inherited from class org.objectweb.dream.router.AbstractRouterImpl
bindFc, listFc, push, unbindFc
 
Methods inherited from class org.objectweb.dream.AbstractComponent
beforeFirstStart, getFcState, initComponent, lookupFc, setLogger, startFc, stopFc
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

outPushRouteTable

protected Map outPushRouteTable
Route table that associates keys with Push output interfaces.

Constructor Detail

AbstractRouterKeyBasedImpl

public AbstractRouterKeyBasedImpl()
Constructor.

Method Detail

getOutput

protected Push getOutput(Message message,
                         Map context)
                  throws PushException
Specified by:
getOutput in class AbstractRouterImpl
Throws:
PushException
See Also:
AbstractRouterImpl.getOutput(org.objectweb.dream.message.Message, java.util.Map)

getOutputKey

protected abstract Object getOutputKey(Message message)
Returns the key associated with the output on which the specified message must be routed.

Parameters:
message - the message that must be routed.
Returns:
the key associated with the output on which the specified message must be routed.

initRouteTable

protected void initRouteTable()
                       throws PushException
This method initializes the outPushRouteTable route table. It is called by the getOutput method. To avoid unnecessary route table, this method should test the initialized boolean which is set to false each time the router is bound to a new output.

Throws:
PushException


Copyright © 2003, 2004 - INRIA Rhone-Alpes - All Rights Reserved.