org.objectweb.dream.router
Class AbstractRouterImpl

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

public abstract class AbstractRouterImpl
extends AbstractComponent
implements Push

Abstract implementation of a basic Push/Push router. A Push/Push router routes messages received on its Push input to one of its Push outputs. A Push/Push router has also a defaultOutPushItf that can be bound to route messages for which no routes are found.
Outputs are stored in the outPushMap Map. The output corresponding to an incoming message is retrieved using the abstract getOutput(Message, Map)method. To avoid unnecessary building of routes the getOutput(Message, Map)can test the boolean initialized which is set to false each time the router is bound to a new output.


Field Summary
static String DEFAULT_OUT_PUSH_ITF_NAME
          The name of the default Pushclient interface.
protected  Push defaultOutPushItf
          Default Push interface to be used if no Push interface can be found in outPushTable.
protected  boolean initialized
          true if the route table is initialized.
protected  MessageManager messageManagerItf
          the message manager client interface of this component
protected  Map outPushMap
          Map of out-push interfaces binded to this router
 
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
AbstractRouterImpl()
          Default contructor
 
Method Summary
 void bindFc(String clientItfName, Object serverItf)
           
protected abstract  Push getOutput(Message message, Map context)
           
 String[] listFc()
           
 void push(Message message, Map context)
          Sends the incoming message to one of the router's output.
 void unbindFc(String clientItfName)
           
 
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

outPushMap

protected Map outPushMap
Map of out-push interfaces binded to this router


DEFAULT_OUT_PUSH_ITF_NAME

public static final String DEFAULT_OUT_PUSH_ITF_NAME
The name of the default Pushclient interface.

See Also:
Constant Field Values

defaultOutPushItf

protected Push defaultOutPushItf
Default Push interface to be used if no Push interface can be found in outPushTable.


messageManagerItf

protected MessageManager messageManagerItf
the message manager client interface of this component


initialized

protected boolean initialized
true if the route table is initialized.

Constructor Detail

AbstractRouterImpl

public AbstractRouterImpl()
Default contructor

Method Detail

getOutput

protected abstract Push getOutput(Message message,
                                  Map context)
                           throws PushException
Throws:
PushException

push

public void push(Message message,
                 Map context)
          throws PushException
Sends the incoming message to one of the router's output. The appropriate output is retrieved using the getOutput(Message, Map)method. If this method returns null, the defaultOutPushItf is used if it is bound.

Specified by:
push in interface Push
Parameters:
message - the pushed message
context - a context propagated to the selected route.
Throws:
PushException - if no route can be found, or thown by client push.
See Also:
Push.push(Message, Map)

listFc

public String[] listFc()
Specified by:
listFc in interface BindingController
See Also:
BindingController.listFc()

bindFc

public void bindFc(String clientItfName,
                   Object serverItf)
            throws NoSuchInterfaceException,
                   IllegalBindingException,
                   IllegalLifeCycleException
Specified by:
bindFc in interface BindingController
Throws:
NoSuchInterfaceException
IllegalBindingException
IllegalLifeCycleException
See Also:
BindingController.bindFc(String, Object)

unbindFc

public void unbindFc(String clientItfName)
              throws NoSuchInterfaceException,
                     IllegalBindingException,
                     IllegalLifeCycleException
Specified by:
unbindFc in interface BindingController
Throws:
NoSuchInterfaceException
IllegalBindingException
IllegalLifeCycleException
See Also:
BindingController.unbindFc(String)


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