org.objectweb.dream.queue
Class AbstractPushIncomingHandlerOverflowImpl

java.lang.Object
  extended byorg.objectweb.dream.AbstractComponent
      extended byorg.objectweb.dream.queue.AbstractPushIncomingHandlerOverflowImpl
All Implemented Interfaces:
AttributeController, BindingController, LifeCycleController, Loggable, Push, PushQueueAttributeController
Direct Known Subclasses:
PushIncomingHandlerOverflowImpl

public abstract class AbstractPushIncomingHandlerOverflowImpl
extends AbstractComponent
implements Push, PushQueueAttributeController

Abstract implementation of a Push incoming handler. It implements overflow policies as defined in PushQueueAttributeController. Moreover, it implements the push method: it checks for available space and then applies appropriate policy.

Push incoming handler developers can inherit this class. They must implement two methods:


Field Summary
protected static int BLOCK_OVERFLOW_POLICY_ID
           
protected  BufferAddFirstLast bufferAddFirstLastItf
           
protected  Buffer bufferItf
           
protected  BufferRemoveFirstLast bufferRemoveFirstLastItf
           
protected static int DROP_FIRST_OVERFLOW_POLICY_ID
           
protected static int DROP_LAST_OVERFLOW_POLICY_ID
           
protected static int DROP_PROCESSED_MESSAGE_OVERFLOW_POLICY_ID
           
protected static int DROP_QUEUE_MESSAGE_OVERFLOW_POLICY_ID
           
protected static int EXCEPTION_OVERFLOW_POLICY_ID
           
protected  MessageManager messageManagerItf
           
protected  String overflowPolicy
           
protected  short overflowPolicyId
           
 
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.dream.queue.PushQueueAttributeController
BLOCK_OVERFLOW_POLICY, DROP_FIRST_OVERFLOW_POLICY, DROP_LAST_OVERFLOW_POLICY, DROP_PROCESSED_MESSAGE_OVERFLOW_POLICY, DROP_QUEUE_MESSAGE_OVERFLOW_POLICY, EXCEPTION_OVERFLOW_POLICY
 
Fields inherited from interface org.objectweb.fractal.api.control.LifeCycleController
STARTED, STOPPED
 
Constructor Summary
AbstractPushIncomingHandlerOverflowImpl()
           
 
Method Summary
 void bindFc(String clientItfName, Object serverItf)
           
protected abstract  boolean canAdd(Message message)
          Checks whether the given message can be added into the buffer.
protected abstract  void doAdd(Message message)
          Adds a message to the buffer.
 String getOverflowPolicy()
          Returns the overflow policy.
 String[] listFc()
           
 void push(Message message, Map context)
           
 void setOverflowPolicy(String policy)
          Sets the overflow policy.
 
Methods inherited from class org.objectweb.dream.AbstractComponent
beforeFirstStart, getFcState, initComponent, lookupFc, setLogger, startFc, stopFc, unbindFc
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BLOCK_OVERFLOW_POLICY_ID

protected static final int BLOCK_OVERFLOW_POLICY_ID
See Also:
Constant Field Values

DROP_QUEUE_MESSAGE_OVERFLOW_POLICY_ID

protected static final int DROP_QUEUE_MESSAGE_OVERFLOW_POLICY_ID
See Also:
Constant Field Values

DROP_FIRST_OVERFLOW_POLICY_ID

protected static final int DROP_FIRST_OVERFLOW_POLICY_ID
See Also:
Constant Field Values

DROP_LAST_OVERFLOW_POLICY_ID

protected static final int DROP_LAST_OVERFLOW_POLICY_ID
See Also:
Constant Field Values

DROP_PROCESSED_MESSAGE_OVERFLOW_POLICY_ID

protected static final int DROP_PROCESSED_MESSAGE_OVERFLOW_POLICY_ID
See Also:
Constant Field Values

EXCEPTION_OVERFLOW_POLICY_ID

protected static final int EXCEPTION_OVERFLOW_POLICY_ID
See Also:
Constant Field Values

overflowPolicy

protected String overflowPolicy

overflowPolicyId

protected short overflowPolicyId

messageManagerItf

protected MessageManager messageManagerItf

bufferItf

protected Buffer bufferItf

bufferRemoveFirstLastItf

protected BufferRemoveFirstLast bufferRemoveFirstLastItf

bufferAddFirstLastItf

protected BufferAddFirstLast bufferAddFirstLastItf
Constructor Detail

AbstractPushIncomingHandlerOverflowImpl

public AbstractPushIncomingHandlerOverflowImpl()
Method Detail

push

public void push(Message message,
                 Map context)
          throws PushException
Specified by:
push in interface Push
Throws:
PushException
See Also:
Push.push(org.objectweb.dream.message.Message, java.util.Map)

canAdd

protected abstract boolean canAdd(Message message)
Checks whether the given message can be added into the buffer.

Parameters:
message - the message to be tested.
Returns:
true if the message can be added.

doAdd

protected abstract void doAdd(Message message)
                       throws InterruptedException
Adds a message to the buffer. This method should not check if there is enough available space provided it has already been done.

Parameters:
message - the message to be added.
Throws:
InterruptedException - if it is interrupted while removing the message.

getOverflowPolicy

public String getOverflowPolicy()
Description copied from interface: PushQueueAttributeController
Returns the overflow policy.

Specified by:
getOverflowPolicy in interface PushQueueAttributeController
Returns:
the overflow policy.
See Also:
PushQueueAttributeController.getOverflowPolicy()

setOverflowPolicy

public void setOverflowPolicy(String policy)
Description copied from interface: PushQueueAttributeController
Sets the overflow policy.

Specified by:
setOverflowPolicy in interface PushQueueAttributeController
Parameters:
policy - the overflow policy.
See Also:
PushQueueAttributeController.setOverflowPolicy(String)

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)

listFc

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


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