org.objectweb.dream.message
Class AggregateMessageImpl

java.lang.Object
  extended byorg.objectweb.dream.message.AggregateMessageImpl
All Implemented Interfaces:
ExtensibleMessage, Message, MessageReferenceCounter, Recyclable

public class AggregateMessageImpl
extends Object
implements ExtensibleMessage, MessageReferenceCounter

Extensible message implementation specialized for aggregate message (ie. message containing only sub messages).


Field Summary
 
Fields inherited from interface org.objectweb.dream.message.Message
EMPTY_MESSAGE_ARRAY
 
Constructor Summary
AggregateMessageImpl()
           
 
Method Summary
 void addChunk(String name, ChunkType chkType, Object chunk)
          Throws a UnsupportedOperationException.
 void addSubMessage(Message message)
          Adds a sub message in this message.
 boolean decrementReferenceCounter()
          Decrements the reference counter of this message.
 Object getChunk(String name)
          Returns a chunk of this message, or null if this message doesn't have a chunk with the specified name.
 short getMessageManagerId()
          Returns the id of the message manager that created this message.
 MessageType getMessageType()
          Throws a UnsupportedOperationException.
 Iterator getSubMessageIterator()
          Returns an Iterator that iterate over the sub messages of this message.
 Message[] getSubMessages()
          Returns an (eventually empty) array containing the sub messages of this message.
 void incrementReferenceCounter()
          Increments the reference counter of the message.
 void recycle()
          Recycles the object.
 Object removeChunk(String name)
          Always return null.
 boolean removeSubMessage(Message message)
          Removes the specified sub message.
 void removeSubMessages()
          Removes every sub messages of this message.
 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
 

Constructor Detail

AggregateMessageImpl

public AggregateMessageImpl()
Method Detail

addChunk

public void addChunk(String name,
                     ChunkType chkType,
                     Object chunk)
              throws ChunkAlreadyExistsException
Throws a UnsupportedOperationException.

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:
ChunkAlreadyExistsException - if this message has already a chunk with the same name
See Also:
ExtensibleMessage.addChunk(String, ChunkType, Object)

removeChunk

public Object removeChunk(String name)
Always return null.

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)

addSubMessage

public void addSubMessage(Message message)
Description copied from interface: ExtensibleMessage
Adds a sub message in this message.

Specified by:
addSubMessage in interface ExtensibleMessage
Parameters:
message - the message to add.
See Also:
ExtensibleMessage.addSubMessage(Message)

removeSubMessage

public boolean removeSubMessage(Message message)
Description copied from interface: ExtensibleMessage
Removes the specified sub message.

Specified by:
removeSubMessage in interface ExtensibleMessage
Parameters:
message - the message to be removed.
Returns:
true if the message has been removed, false otherwise.
See Also:
ExtensibleMessage.removeSubMessage(Message)

removeSubMessages

public void removeSubMessages()
Description copied from interface: ExtensibleMessage
Removes every sub messages of this message.

Specified by:
removeSubMessages in interface ExtensibleMessage
See Also:
ExtensibleMessage.removeSubMessages()

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)

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)

getSubMessageIterator

public Iterator getSubMessageIterator()
Description copied from interface: Message
Returns an Iterator that iterate over the sub messages of this message.

Specified by:
getSubMessageIterator in interface Message
Returns:
an iterator on the sub messages.
See Also:
Message.getSubMessageIterator()

getSubMessages

public Message[] getSubMessages()
Description copied from interface: Message
Returns an (eventually empty) array containing the sub messages of this message.

Specified by:
getSubMessages in interface Message
Returns:
an array containing the sub messages of this message.
See Also:
Message.getSubMessages()

getMessageType

public MessageType getMessageType()
Throws a UnsupportedOperationException.

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)

recycle

public void recycle()
Description copied from interface: Recyclable
Recycles the object. This consists in reseting all the fields of the object.

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

incrementReferenceCounter

public void incrementReferenceCounter()
Description copied from interface: MessageReferenceCounter
Increments the reference counter of the message.

Specified by:
incrementReferenceCounter in interface MessageReferenceCounter
See Also:
MessageReferenceCounter.incrementReferenceCounter()

decrementReferenceCounter

public boolean decrementReferenceCounter()
Description copied from interface: MessageReferenceCounter
Decrements the reference counter of this message.

Specified by:
decrementReferenceCounter in interface MessageReferenceCounter
Returns:
true if the reference counter is null.
See Also:
MessageReferenceCounter.decrementReferenceCounter()


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