org.objectweb.dream.queue
Class BasicPushPullKeyQueueImpl

java.lang.Object
  extended byorg.objectweb.dream.AbstractComponent
      extended byorg.objectweb.dream.queue.AbstractPushQueueImpl
          extended byorg.objectweb.dream.queue.BasicPushPullKeyQueueImpl
All Implemented Interfaces:
AttributeController, BindingController, LifeCycleController, Loggable, Pull, Push, PushPullKeyQueueAttributeController, PushQueueAttributeController, QueueAttributeController

public class BasicPushPullKeyQueueImpl
extends AbstractPushQueueImpl
implements Pull, PushPullKeyQueueAttributeController

Queue implementation delivering message using a key. Messages are stored in a hashtable. The key corresponding to a message is obtained by calling the getKey method on the Chunk whose name is specified as an initialization parameter.


Field Summary
static String KEY_CONTEXT
          The object used to retreive the key in the context map of the Pull.pull(java.util.Map)method.
 
Fields inherited from class org.objectweb.dream.queue.AbstractPushQueueImpl
maxCapacity, messageManagerItf, overflowPolicy, waitingList
 
Fields inherited from class org.objectweb.dream.AbstractComponent
bindingLogger, componentDesc, fcState, lifeCycleLogger, logger, weaveableC
 
Fields inherited from interface org.objectweb.dream.Pull
IN_PULL_ITF_NAME, OUT_PULL_ITF_NAME
 
Fields inherited from interface org.objectweb.dream.queue.PushPullKeyQueueAttributeController
EXCEPTION_MESSAGE_NOT_FOUND_POLICY, RETURN_NULL_MESSAGE_NOT_FOUND_POLICY
 
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_OVERFLOW_POLICY, EXCEPTION_OVERFLOW_POLICY
 
Fields inherited from interface org.objectweb.fractal.api.control.LifeCycleController
STARTED, STOPPED
 
Constructor Summary
BasicPushPullKeyQueueImpl()
           
 
Method Summary
 String getKeyName()
          Returns the name to which the key is mapped in the Pull context.
 String getMessageNotFoundPolicy()
          Returns the policy applied when a message cannot be found.
protected  Message handlePolicy(Object key)
          Handle "meesage not found" policy, returns null or throw a KeyNotFoundException.
 String[] listFc()
           
 Message pull(Map context)
           
 void push(Message message, Map context)
           
 void setKeyName(String name)
          Sets the name to which the key is mapped in the Pull context.
 void setMessageNotFoundPolicy(String policy)
          Sets the policy applied when a message cannot be found.
 
Methods inherited from class org.objectweb.dream.queue.AbstractPushQueueImpl
bindFc, getCurrentSize, getMaxCapacity, getOverflowPolicy, handleOverflow, setMaxCapacity, setOverflowPolicy
 
Methods inherited from class org.objectweb.dream.AbstractComponent
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

KEY_CONTEXT

public static final String KEY_CONTEXT
The object used to retreive the key in the context map of the Pull.pull(java.util.Map)method.

See Also:
Constant Field Values
Constructor Detail

BasicPushPullKeyQueueImpl

public BasicPushPullKeyQueueImpl()
Method Detail

push

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

pull

public Message pull(Map context)
             throws PullException
Specified by:
pull in interface Pull
Throws:
PullException
See Also:
Pull.pull(java.util.Map)

handlePolicy

protected Message handlePolicy(Object key)
                        throws KeyNotFoundException
Handle "meesage not found" policy, returns null or throw a KeyNotFoundException.

Parameters:
key - the not found key
Returns:
null
Throws:
KeyNotFoundException - if policy is PushPullKeyQueueAttributeController.EXCEPTION_MESSAGE_NOT_FOUND_POLICY.

getMessageNotFoundPolicy

public String getMessageNotFoundPolicy()
Description copied from interface: PushPullKeyQueueAttributeController
Returns the policy applied when a message cannot be found.

Specified by:
getMessageNotFoundPolicy in interface PushPullKeyQueueAttributeController
Returns:
the policy applied when a message cannot be found.
See Also:
PushPullKeyQueueAttributeController.getMessageNotFoundPolicy()

setMessageNotFoundPolicy

public void setMessageNotFoundPolicy(String policy)
Description copied from interface: PushPullKeyQueueAttributeController
Sets the policy applied when a message cannot be found.

Specified by:
setMessageNotFoundPolicy in interface PushPullKeyQueueAttributeController
Parameters:
policy - the policy applied when a message cannot be found.
See Also:
PushPullKeyQueueAttributeController.setMessageNotFoundPolicy(java.lang.String)

getKeyName

public String getKeyName()
Description copied from interface: PushPullKeyQueueAttributeController
Returns the name to which the key is mapped in the Pull context.

Specified by:
getKeyName in interface PushPullKeyQueueAttributeController
Returns:
the name to which the key is mapped in the Pull context.
See Also:
PushPullKeyQueueAttributeController.getKeyName()

setKeyName

public void setKeyName(String name)
Description copied from interface: PushPullKeyQueueAttributeController
Sets the name to which the key is mapped in the Pull context.

Specified by:
setKeyName in interface PushPullKeyQueueAttributeController
Parameters:
name - the name to which the key is mapped in the Pull context.
See Also:
PushPullKeyQueueAttributeController.setKeyName(java.lang.String)

listFc

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


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