org.objectweb.dream.queue
Class BufferImpl

java.lang.Object
  extended byorg.objectweb.dream.AbstractComponent
      extended byorg.objectweb.dream.queue.AbstractBufferImpl
          extended byorg.objectweb.dream.queue.BufferImpl
All Implemented Interfaces:
AttributeController, BindingController, Buffer, BufferAddFirstLast, BufferRemoveFirstLast, LifeCycleController, Loggable, QueueAttributeController

public class BufferImpl
extends AbstractBufferImpl

Basic implementation of the Buffer interface using a LinkedList. This buffer does not sort messages. They are added and removed in a FIFO order.

Indicators on available space, available messages, and stored messages are expressed as number of messages.

See Also:
Buffer, AbstractBufferImpl

Field Summary
 
Fields inherited from class org.objectweb.dream.queue.AbstractBufferImpl
availableMessagesIndicator, lock, maxCapacity, messageManagerItf, storedMessagesIndicator
 
Fields inherited from class org.objectweb.dream.AbstractComponent
bindingLogger, componentDesc, fcState, firstStart, lifeCycleLogger, logger, weaveableC
 
Fields inherited from interface org.objectweb.dream.queue.Buffer
ITF_NAME
 
Fields inherited from interface org.objectweb.dream.queue.BufferAddFirstLast
ITF_NAME
 
Fields inherited from interface org.objectweb.dream.queue.BufferRemoveFirstLast
ITF_NAME
 
Fields inherited from interface org.objectweb.fractal.api.control.LifeCycleController
STARTED, STOPPED
 
Constructor Summary
BufferImpl()
           
 
Method Summary
 void bindFc(String clientItfName, Object serverItf)
           
protected  boolean canAdd(Message message)
          Checks whether the given message can be added into the buffer.
protected  void doAdd(Message message)
          Adds a message to the buffer.
protected  void doAddFirst(Message message)
          Adds a message to the beginning of the buffer.
protected  void doAddLast(Message message)
          Adds a message to end of the buffer.
protected  Message doGet()
          Gets a message from the buffer.
protected  Message doGetFirst()
          Gets the first message from the buffer.
protected  Message doGetLast()
          Gets the last message from the buffer.
protected  Message doRemove()
          Removes a message from the buffer.
protected  Message doRemoveFirst()
          Removes the first message from the buffer.
protected  Message doRemoveLast()
          Removes the last message from the buffer.
protected  boolean hasAvailableMessage()
          Checks whether there is an available message.
 String[] listFc()
           
 
Methods inherited from class org.objectweb.dream.queue.AbstractBufferImpl
add, addFirst, addLast, availableMessagesIndicator, availableSpaceIndicator, get, getCurrentSize, getFirst, getLast, getMaxCapacity, incrementAvailableMessagesIndicator, incrementStoredMessagesIndicator, remove, removeFirst, removeLast, setMaxCapacity, storedMessagesIndicator
 
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
 

Constructor Detail

BufferImpl

public BufferImpl()
Method Detail

hasAvailableMessage

protected boolean hasAvailableMessage()
Description copied from class: AbstractBufferImpl
Checks whether there is an available message.

Specified by:
hasAvailableMessage in class AbstractBufferImpl
Returns:
true if there is an available message.
See Also:
AbstractBufferImpl.hasAvailableMessage()

canAdd

protected boolean canAdd(Message message)
Description copied from class: AbstractBufferImpl
Checks whether the given message can be added into the buffer.

Specified by:
canAdd in class AbstractBufferImpl
Parameters:
message - the message to be tested.
Returns:
true if the message can be added.
See Also:
AbstractBufferImpl.canAdd(org.objectweb.dream.message.Message)

doAdd

protected void doAdd(Message message)
Description copied from class: AbstractBufferImpl
Adds a message to the buffer. This method should not check if there is enough available space provided it has already been done in the AbstractBufferImpl.add(org.objectweb.dream.message.Message)method.

Specified by:
doAdd in class AbstractBufferImpl
Parameters:
message - the message to be added.
See Also:
AbstractBufferImpl.doAdd(org.objectweb.dream.message.Message)

doRemove

protected Message doRemove()
Description copied from class: AbstractBufferImpl
Removes a message from the buffer. This method should not check if there is a message available provided it has already been done in the AbstractBufferImpl.remove()method.

Specified by:
doRemove in class AbstractBufferImpl
Returns:
a message.
See Also:
AbstractBufferImpl.doRemove()

doGet

protected Message doGet()
Description copied from class: AbstractBufferImpl
Gets a message from the buffer. This method should not check if there is a message available provided it has already been done in the AbstractBufferImpl.remove() method.

Specified by:
doGet in class AbstractBufferImpl
Returns:
a message.
See Also:
AbstractBufferImpl.doGet()

doAddFirst

protected void doAddFirst(Message message)
Description copied from class: AbstractBufferImpl
Adds a message to the beginning of the buffer. This method should not check if there is enough available space provided it has already been done in the AbstractBufferImpl.add(org.objectweb.dream.message.Message)method.

Overrides:
doAddFirst in class AbstractBufferImpl
Parameters:
message - the message to be added.
See Also:
AbstractBufferImpl.doAddFirst(org.objectweb.dream.message.Message)

doAddLast

protected void doAddLast(Message message)
Description copied from class: AbstractBufferImpl
Adds a message to end of the buffer. This method should not check if there is enough available space provided it has already been done in the AbstractBufferImpl.add(org.objectweb.dream.message.Message)method.

Overrides:
doAddLast in class AbstractBufferImpl
Parameters:
message - the message to be added.
See Also:
AbstractBufferImpl.doAddLast(org.objectweb.dream.message.Message)

doGetFirst

protected Message doGetFirst()
Description copied from class: AbstractBufferImpl
Gets the first message from the buffer. This method should not check if there is a message available provided it has already been done in the AbstractBufferImpl.remove()method.

Overrides:
doGetFirst in class AbstractBufferImpl
Returns:
a message.
See Also:
AbstractBufferImpl.doGetFirst()

doGetLast

protected Message doGetLast()
Description copied from class: AbstractBufferImpl
Gets the last message from the buffer. This method should not check if there is a message available provided it has already been done in the AbstractBufferImpl.remove()method.

Overrides:
doGetLast in class AbstractBufferImpl
Returns:
a message.
See Also:
AbstractBufferImpl.doGetLast()

doRemoveFirst

protected Message doRemoveFirst()
Description copied from class: AbstractBufferImpl
Removes the first message from the buffer. This method should not check if there is a message available provided it has already been done in the AbstractBufferImpl.remove()method.

Overrides:
doRemoveFirst in class AbstractBufferImpl
Returns:
a message.
See Also:
AbstractBufferImpl.doRemoveFirst()

doRemoveLast

protected Message doRemoveLast()
Description copied from class: AbstractBufferImpl
Removes the last message from the buffer. This method should not check if there is a message available provided it has already been done in the AbstractBufferImpl.remove()method.

Overrides:
doRemoveLast in class AbstractBufferImpl
Returns:
a message.
See Also:
AbstractBufferImpl.doRemoveLast()

bindFc

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

listFc

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


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