org.objectweb.dream.message.manager
Class MessageManagerImpl

java.lang.Object
  extended byorg.objectweb.dream.AbstractComponent
      extended byorg.objectweb.dream.message.manager.MessageManagerImpl
All Implemented Interfaces:
AttributeController, BindingController, LifeCycleController, Loggable, MessageManager, MessageManagerAttributeController

public class MessageManagerImpl
extends AbstractComponent
implements MessageManager, MessageManagerAttributeController

Basic implementation of a message manager.


Field Summary
static String CHUNK_POOL_COLLECTION_ITF_NAME
          The name of the collection interface used to pool chunk instances
protected  Map chunkPoolItfs
           
static String EXTENSIBLE_MESSAGE_NC_POOL_OPT_ITF_NAME
          The name of the optional client interface used to pool ExtensibleMessageNCinstances.
static String EXTENSIBLE_MESSAGE_POOL_OPT_ITF_NAME
          The name of the optional client interface used to pool ExtensibleMessageinstances.
protected  ObjectPool extensibleMessageNCPoolOptItf
           
protected  ObjectPool extensibleMessagePoolOptItf
           
protected  List unknownChunkPools
           
 
Fields inherited from class org.objectweb.dream.AbstractComponent
bindingLogger, componentDesc, fcState, firstStart, lifeCycleLogger, logger, weaveableC
 
Fields inherited from interface org.objectweb.dream.message.manager.MessageManager
ITF_NAME
 
Fields inherited from interface org.objectweb.dream.message.manager.MessageManagerAttributeController
ITF_NAME
 
Fields inherited from interface org.objectweb.fractal.api.control.LifeCycleController
STARTED, STOPPED
 
Constructor Summary
MessageManagerImpl()
           
 
Method Summary
 void bindFc(String clientItfName, Object serverItf)
           
 Object createChunk(ChunkType type)
          Allocates and returns a chunk of the specified type.
protected  Chunk createChunkInstance(ChunkType chunkType)
           
protected  ExtensibleMessage createExtensibleMessage()
           
protected  ExtensibleMessageNC createExtensibleMessageNC()
           
 Message createMessage(MessageType type)
          Allocates and returns a message of the specified type.
 void deleteChunk(Object chunk)
          Deletes a chunk.
 void deleteMessage(Message message)
          Deletes a message.
 Object duplicateChunk(Object chunk, boolean clone)
          Duplicates a chunk.
 Message duplicateMessage(Message message, boolean clone)
          Duplicates a message.
 short getId()
          Returns the manager's id.
 short getMessageManagerId()
          Returns the message manager identifier.
 String[] listFc()
           
protected  void recycleChunkInstance(Chunk chunk)
           
 void setId(short id)
          Sets the manager's id.
 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

EXTENSIBLE_MESSAGE_POOL_OPT_ITF_NAME

public static final String EXTENSIBLE_MESSAGE_POOL_OPT_ITF_NAME
The name of the optional client interface used to pool ExtensibleMessageinstances.

See Also:
Constant Field Values

EXTENSIBLE_MESSAGE_NC_POOL_OPT_ITF_NAME

public static final String EXTENSIBLE_MESSAGE_NC_POOL_OPT_ITF_NAME
The name of the optional client interface used to pool ExtensibleMessageNCinstances.

See Also:
Constant Field Values

CHUNK_POOL_COLLECTION_ITF_NAME

public static final String CHUNK_POOL_COLLECTION_ITF_NAME
The name of the collection interface used to pool chunk instances

See Also:
Constant Field Values

extensibleMessagePoolOptItf

protected ObjectPool extensibleMessagePoolOptItf

extensibleMessageNCPoolOptItf

protected ObjectPool extensibleMessageNCPoolOptItf

chunkPoolItfs

protected Map chunkPoolItfs

unknownChunkPools

protected List unknownChunkPools
Constructor Detail

MessageManagerImpl

public MessageManagerImpl()
Method Detail

createMessage

public Message createMessage(MessageType type)
                      throws UnknownChunkTypeError
Description copied from interface: MessageManager
Allocates and returns a message of the specified type. Depending on the implementation, the returned message is extensible (see ExtensibleMessage) or not.

Specified by:
createMessage in interface MessageManager
Parameters:
type - the type of the message to be created.
Returns:
a message.
Throws:
UnknownChunkTypeError - if one of the chunk type in the message type is unknown by the manager (see MessageManager.createChunk(ChunkType)).
See Also:
MessageManager.createMessage(MessageType)

deleteMessage

public void deleteMessage(Message message)
Description copied from interface: MessageManager
Deletes a message. If the message has been duplicated (by reference), this operation releases the given reference. The message is effectively deleted only if all its references have been released.

Specified by:
deleteMessage in interface MessageManager
Parameters:
message - the message to be deleted.
See Also:
MessageManager.deleteMessage(Message)

duplicateMessage

public Message duplicateMessage(Message message,
                                boolean clone)
Description copied from interface: MessageManager
Duplicates a message. There are two kinds of duplication:

Specified by:
duplicateMessage in interface MessageManager
Parameters:
message - the message to be duplicated.
clone - the duplication mode. false for reference duplication, true for value duplication.
Returns:
the duplicated message.
See Also:
MessageManager.duplicateMessage(Message, boolean)

createChunk

public Object createChunk(ChunkType type)
                   throws UnknownChunkTypeError
Description copied from interface: MessageManager
Allocates and returns a chunk of the specified type. A given manager implementation knows only a restricted set of ChunkType, so if the requesed chunk type is unknown, a UnknownChunkTypeErroris thrown

Specified by:
createChunk in interface MessageManager
Parameters:
type - the type of the chunk to be created.
Returns:
a chunk.
Throws:
UnknownChunkTypeError - if the chunk type can not be resolved by the manager (cannot find implementation).
See Also:
MessageManager.createChunk(ChunkType)

deleteChunk

public void deleteChunk(Object chunk)
Description copied from interface: MessageManager
Deletes a chunk. If the chunk has been duplicated (by reference), this operation releases the given reference. The chunk is effectively deleted only if all its references have been released.

Specified by:
deleteChunk in interface MessageManager
Parameters:
chunk - the chunk to delete.
See Also:
MessageManager.deleteChunk(Object)

duplicateChunk

public Object duplicateChunk(Object chunk,
                             boolean clone)
Description copied from interface: MessageManager
Duplicates a chunk. As for messages, there are two kinds of duplications (see MessageManager.duplicateMessage(Message, boolean)).

Specified by:
duplicateChunk in interface MessageManager
Parameters:
chunk - the chunk to be duplicated.
clone - the duplication mode.
Returns:
the duplicated chunk.
See Also:
MessageManager.duplicateChunk(Object, boolean)

getMessageManagerId

public short getMessageManagerId()
Description copied from interface: MessageManager
Returns the message manager identifier.

Specified by:
getMessageManagerId in interface MessageManager
Returns:
the message manager identifier.
See Also:
MessageManager.getMessageManagerId()

getId

public short getId()
Description copied from interface: MessageManagerAttributeController
Returns the manager's id.

Specified by:
getId in interface MessageManagerAttributeController
Returns:
the manager's id.
See Also:
MessageManagerAttributeController.getId()

setId

public void setId(short id)
Description copied from interface: MessageManagerAttributeController
Sets the manager's id.

Specified by:
setId in interface MessageManagerAttributeController
Parameters:
id - the id to set.
See Also:
MessageManagerAttributeController.setId(short)

createExtensibleMessageNC

protected final ExtensibleMessageNC createExtensibleMessageNC()

createExtensibleMessage

protected final ExtensibleMessage createExtensibleMessage()

createChunkInstance

protected final Chunk createChunkInstance(ChunkType chunkType)

recycleChunkInstance

protected final void recycleChunkInstance(Chunk chunk)

bindFc

public void bindFc(String clientItfName,
                   Object serverItf)
            throws NoSuchInterfaceException,
                   IllegalBindingException,
                   IllegalLifeCycleException
Specified by:
bindFc in interface BindingController
Overrides:
bindFc in class AbstractComponent
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
Overrides:
unbindFc in class AbstractComponent
Throws:
NoSuchInterfaceException
IllegalBindingException
IllegalLifeCycleException
See Also:
BindingController.unbindFc(String)

listFc

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


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