org.objectweb.dream.message
Class AbstractExtensibleMessage

java.lang.Object
  extended byorg.objectweb.dream.message.AbstractExtensibleMessage
All Implemented Interfaces:
EmptyStringArray, ExtensibleMessage, Message, MessageType, Serializable
Direct Known Subclasses:
BasicExtensibleMessage

public abstract class AbstractExtensibleMessage
extends Object
implements ExtensibleMessage, MessageType, EmptyStringArray, Serializable

Abstract implementation of the ExtensibleMessage interface. Methods managing sub messages are not implemented.

See Also:
Serialized Form

Field Summary
protected  String[] chunkNames
          The chunk names
protected  Hashtable chunks
          Contains (name, chunk object) pairs.
protected  Hashtable chunkTypes
          Contains (name, chunk type) pairs.
protected  short messageManagerId
          The id of the message manager that created this chunk.
 
Fields inherited from interface org.objectweb.dream.message.Message
EMPTY_MESSAGE_ARRAY
 
Fields inherited from interface org.objectweb.dream.message.MessageType
EMPTY_MESSAGE_TYPE_ARRAY
 
Fields inherited from interface org.objectweb.dream.util.EmptyStringArray
EMPTY_STRING_ARRAY
 
Constructor Summary
AbstractExtensibleMessage()
           
 
Method Summary
 void addChunk(String name, ChunkType chkType, Object chunk)
          Adds a chunk in this message.
 boolean decrementReferenceCounter()
          Decrements the reference counter of this component.
 Object getChunk(String name)
          Returns a chunk of this message, or null if this message doesn't have a chunk with the specified name.
 String[] getChunkNames()
          Returns an (eventually empty) array containing the chunk's names of messages of this type.
 Iterator getChunkNamesIterator()
          Returns an iterator over the chunk's names of messages of this type.
 ChunkType getChunkType(String name)
          Returns a chunk type of this message type from its name.
 short getMessageManagerId()
          Returns the id of the message manager that created this message.
 MessageType getMessageType()
          Returns the type of this message.
 void incrementReferenceCounter()
          Increments the reference counter of this component.
 boolean isEmpty()
          Returns true if this message type is empty (ie : does not contains any chunk types and any sub message types)
 void recycle()
          Recycles message instance.
 Object removeChunk(String name)
          Removes and returns the chunk with the specified name
 void setMessageManagerId(short id)
          Sets the id of the message manager that created this message.
 void transfertChunkStates(Message newInstance)
          Transferts the state of the message's chunks into the specified new instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.objectweb.dream.message.ExtensibleMessage
addSubMessage, removeSubMessage
 
Methods inherited from interface org.objectweb.dream.message.Message
getSubMessageIterator, getSubMessages
 
Methods inherited from interface org.objectweb.dream.message.MessageType
getSubMessageTypes, getSubMessageTypesIterator, isSubTypeOf
 

Field Detail

messageManagerId

protected transient short messageManagerId
The id of the message manager that created this chunk.


chunks

protected Hashtable chunks
Contains (name, chunk object) pairs.


chunkTypes

protected Hashtable chunkTypes
Contains (name, chunk type) pairs.


chunkNames

protected String[] chunkNames
The chunk names

Constructor Detail

AbstractExtensibleMessage

public AbstractExtensibleMessage()
Method Detail

getChunk

public Object getChunk(String name)
Description copied from interface: Message
Returns a chunk of this message, or null if this message doesn't have a chunk with the specified name.

Specified by:
getChunk in interface Message
Parameters:
name - the name of the chunk, as specified in the message type.
Returns:
a chunk of this message.
See Also:
Message.getChunk(String)

getMessageType

public MessageType getMessageType()
Description copied from interface: Message
Returns the type of this message.

Specified by:
getMessageType in interface Message
Returns:
the type of this message.
See Also:
Message.getMessageType()

transfertChunkStates

public void transfertChunkStates(Message newInstance)
Description copied from interface: Message
Transferts the state of the message's chunks into the specified new instance.

Note: the given new isntance contains all the chunks contained in this message.

Specified by:
transfertChunkStates in interface Message
Parameters:
newInstance - the new instance of message.
See Also:
Message.transfertChunkStates(Message)

getMessageManagerId

public short getMessageManagerId()
Description copied from interface: Message
Returns the id of the message manager that created this message.

Specified by:
getMessageManagerId in interface Message
Returns:
the id of the message manager that created this message.
See Also:
Message.getMessageManagerId()

setMessageManagerId

public void setMessageManagerId(short id)
Description copied from interface: Message
Sets the id of the message manager that created this message.

Specified by:
setMessageManagerId in interface Message
Parameters:
id - the id of the message manager that created this message.
See Also:
Message.setMessageManagerId(short)

recycle

public void recycle()
Description copied from interface: Message
Recycles message instance. Called by message manager when the message is deleted.

Specified by:
recycle in interface Message
See Also:
Message.recycle()

addChunk

public void addChunk(String name,
                     ChunkType chkType,
                     Object chunk)
              throws ChunkAlreadyExistException
Description copied from interface: ExtensibleMessage
Adds a chunk in this message.

Specified by:
addChunk in interface ExtensibleMessage
Parameters:
name - the name of the new chunk
chkType - the type of the new chunk
chunk - the chunk instance.
Throws:
ChunkAlreadyExistException - if this message has already a chunk with the same name
See Also:
ExtensibleMessage.addChunk(String, ChunkType, Object)

removeChunk

public Object removeChunk(String name)
Description copied from interface: ExtensibleMessage
Removes and returns the chunk with the specified name

Specified by:
removeChunk in interface ExtensibleMessage
Parameters:
name - the name of the chunk to remove
Returns:
the removed chunk or null if no chunk with the specified name can be found.
See Also:
ExtensibleMessage.removeChunk(String)

getChunkNames

public String[] getChunkNames()
Description copied from interface: MessageType
Returns an (eventually empty) array containing the chunk's names of messages of this type.

Specified by:
getChunkNames in interface MessageType
Returns:
an array containing the chunk's names of messages of this type.
See Also:
MessageType.getChunkNames()

getChunkNamesIterator

public Iterator getChunkNamesIterator()
Description copied from interface: MessageType
Returns an iterator over the chunk's names of messages of this type.

Specified by:
getChunkNamesIterator in interface MessageType
Returns:
an iterator over the chunk's names of messages of this type.
See Also:
MessageType.getChunkNamesIterator()

getChunkType

public ChunkType getChunkType(String name)
Description copied from interface: MessageType
Returns a chunk type of this message type from its name.

Specified by:
getChunkType in interface MessageType
Parameters:
name - the name of one of the chunk types returned by MessageType.getChunkNames().
Returns:
a chunk type of this message type from its name or null if no chunk with the specified name can be found.
See Also:
MessageType.getChunkType(String)

isEmpty

public boolean isEmpty()
Description copied from interface: MessageType
Returns true if this message type is empty (ie : does not contains any chunk types and any sub message types)

Specified by:
isEmpty in interface MessageType
Returns:
true if this message type is empty
See Also:
MessageType.isEmpty()

incrementReferenceCounter

public void incrementReferenceCounter()
Increments the reference counter of this component.


decrementReferenceCounter

public boolean decrementReferenceCounter()
Decrements the reference counter of this component.

Returns:
true if the reference counter is null.


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