|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.objectweb.dream.message.AbstractExtensibleMessage
Abstract implementation of the ExtensibleMessage
interface.
Methods managing sub messages are not implemented.
Field Summary | |
protected String[] |
chunkNames
The chunk names |
protected Map |
chunks
Contains (name, chunk object) pairs. |
protected Map |
chunkTypes
Contains (name, chunk type) pairs. |
protected short |
messageManagerId
The id of the message manager that created this chunk. |
protected short |
referenceCounter
The number of reference to this message. |
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 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. |
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 the message. |
boolean |
isEmpty()
Returns true if this message type is empty (ie : does not
contains any chunk types and any sub message types) |
protected void |
readChunksState(ObjectInput in)
|
void |
recycle()
Recycles the object. |
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. |
protected void |
writeChunksState(ObjectOutput out)
|
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, removeSubMessages |
Methods inherited from interface org.objectweb.dream.message.Message |
getSubMessageIterator, getSubMessages |
Methods inherited from interface org.objectweb.dream.message.MessageType |
getSubMessageTypes, getSubMessageTypesIterator, isSubTypeOf |
Methods inherited from interface java.io.Externalizable |
readExternal, writeExternal |
Field Detail |
protected transient short messageManagerId
protected transient short referenceCounter
protected Map chunks
protected Map chunkTypes
protected transient String[] chunkNames
Constructor Detail |
public AbstractExtensibleMessage()
Method Detail |
public Object getChunk(String name)
Message
null
if this message
doesn't have a chunk with the specified name.
getChunk
in interface Message
name
- the name of the chunk, as specified in the message type.
Message.getChunk(String)
public MessageType getMessageType()
Message
getMessageType
in interface Message
Message.getMessageType()
public void transfertChunkStates(Message newInstance)
Message
Note: the given new isntance contains all the chunks contained in this message.
transfertChunkStates
in interface Message
newInstance
- the new instance of message.Message.transfertChunkStates(Message)
public short getMessageManagerId()
Message
getMessageManagerId
in interface Message
Message.getMessageManagerId()
public void setMessageManagerId(short id)
Message
setMessageManagerId
in interface Message
id
- the id of the message manager that created this message.Message.setMessageManagerId(short)
public void recycle()
Recyclable
recycle
in interface Recyclable
Recyclable.recycle()
public void addChunk(String name, ChunkType chkType, Object chunk) throws ChunkAlreadyExistsException
ExtensibleMessage
addChunk
in interface ExtensibleMessage
name
- the name of the new chunkchkType
- the type of the new chunkchunk
- the chunk instance.
ChunkAlreadyExistsException
- if this message has already a chunk
with the same nameExtensibleMessage.addChunk(String, ChunkType, Object)
public Object removeChunk(String name)
ExtensibleMessage
removeChunk
in interface ExtensibleMessage
name
- the name of the chunk to remove
null
if no chunk with the
specified name can be found.ExtensibleMessage.removeChunk(String)
public String[] getChunkNames()
MessageType
getChunkNames
in interface MessageType
MessageType.getChunkNames()
public Iterator getChunkNamesIterator()
MessageType
getChunkNamesIterator
in interface MessageType
MessageType.getChunkNamesIterator()
public ChunkType getChunkType(String name)
MessageType
getChunkType
in interface MessageType
name
- the name of one of the chunk types returned by
MessageType.getChunkNames()
.
null
if no chunk with the specified name can be
found.MessageType.getChunkType(String)
public boolean isEmpty()
MessageType
true
if this message type is empty (ie : does not
contains any chunk types and any sub message types)
isEmpty
in interface MessageType
true
if this message type is emptyMessageType.isEmpty()
public void incrementReferenceCounter()
MessageReferenceCounter
incrementReferenceCounter
in interface MessageReferenceCounter
MessageReferenceCounter.incrementReferenceCounter()
public boolean decrementReferenceCounter()
MessageReferenceCounter
decrementReferenceCounter
in interface MessageReferenceCounter
true
if the reference counter is null.MessageReferenceCounter.decrementReferenceCounter()
protected void readChunksState(ObjectInput in) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
protected void writeChunksState(ObjectOutput out) throws IOException
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |