|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.objectweb.dream.AbstractComponent
org.objectweb.dream.message.MessageManagerImpl
public class MessageManagerImpl
Basic message manager implementation.
Field Summary |
---|
Fields inherited from class org.objectweb.dream.AbstractComponent |
---|
bindingLogger, fcNeedAsyncStart, fcState, lifeCycleLogger, logger, weaveableC |
Fields inherited from interface org.objectweb.dream.message.MessageManager |
---|
ITF_NAME |
Fields inherited from interface org.objectweb.fractal.api.control.LifeCycleController |
---|
STARTED, STOPPED |
Constructor Summary | |
---|---|
MessageManagerImpl()
|
Method Summary | ||
---|---|---|
void |
addChunk(Message message,
String chunkName,
AbstractChunk chunk)
Adds a chunk in the given message. |
|
AbstractChunk |
addOrReplaceChunk(Message message,
String chunkName,
AbstractChunk chunk)
Adds a chunk in the given message. |
|
void |
addSubMessage(Message message,
Message subMessage)
Adds a sub message to a message. |
|
protected void |
checkNull(AbstractChunk chunk)
|
|
protected void |
checkNull(Message message)
|
|
protected void |
checkNull(String chunkName)
|
|
protected void |
checkOwner(AbstractChunk<?> chunk)
|
|
protected void |
checkOwner(Message message)
|
|
protected void |
checkSubMessage(Message message,
Message subMessage)
|
|
|
cloneChunk(T chunk)
Clones the given chunk. |
|
|
createChunk(ChunkFactoryReference<T> chunkFactory)
Creates a chunk using the chunk factory referenced by the given reference. |
|
protected
|
createChunkFactory(Class<T> chunkType)
|
|
Message |
createMessage()
Creates a new message and returns a reference to the newly created message. |
|
void |
deleteChunk(AbstractChunk<?> chunk)
Deletes the given chunk. |
|
void |
deleteMessage(Message message)
Delete the message referenced by the given reference. |
|
Message |
duplicateMessage(Message message,
boolean clone)
Duplicates a message. |
|
AbstractChunk |
getChunk(Message message,
String chunkName)
Returns the chunk in the given message with the given name. |
|
|
getChunkFactory(Class<T> chunkType)
Returns a reference to a chunk factory for the given chunk type. |
|
Iterator<String> |
getChunkNameIterator(Message message)
Returns an iterator over the chunk names of the given message. |
|
boolean |
getDoCheck()
Returns the doCheck attribute value. |
|
Iterator<Message> |
getSubMessageIterator(Message message)
Returns an iterator over sub messages of the given message. |
|
boolean |
isEmpty(Message message)
Returns true if the message is empty (ie. contains no chunk
and no sub message). |
|
String[] |
listFc()
|
|
protected void |
recycleMessageInstance(Message message)
|
|
AbstractChunk |
removeChunk(Message message,
String chunkName)
Removes a chunk from the given message. |
|
void |
removeSubMessage(Message message,
Message subMessage)
Removes a sub message from a message. |
|
void |
setDoCheck(boolean doCheck)
Sets the doCheck attribute value. |
Methods inherited from class org.objectweb.dream.AbstractComponent |
---|
beforeFirstStart, bindFc, bindFc, getFcNeedAsyncStart, getFcState, initComponent, lookupFc, prepareStopFc, setLogger, startFc, stopFc, unbindFc |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MessageManagerImpl()
Method Detail |
---|
public Message createMessage()
MessageManager
createMessage
in interface MessageManager
MessageManager.createMessage()
public void deleteMessage(Message message)
MessageManager
MessageManager.duplicateMessage(org.objectweb.dream.message.Message, boolean)
), this
operation releases the given reference. The message is effectively deleted
only if all its references have been released. In this case, chunks in the
message are removed and recycled, so as message instance.
deleteMessage
in interface MessageManager
message
- the reference of the message to delete.MessageManager.deleteMessage(Message)
public Message duplicateMessage(Message message, boolean clone)
MessageManager
MessageManager.deleteMessage(org.objectweb.dream.message.Message)
operation only deletes the
message when all the duplicated references have been released
duplicateMessage
in interface MessageManager
message
- the reference of the message to be duplicated.clone
- the duplication mode. false
for reference
duplication, true
for value duplication.
MessageManager.duplicateMessage(Message, boolean)
public <T extends AbstractChunk<T>> ChunkFactoryReference<T> getChunkFactory(Class<T> chunkType)
MessageManager
getChunkFactory
in interface MessageManager
T
- the chunk type.chunkType
- the class object of the required chunk type.
MessageManager.getChunkFactory(Class)
public <T extends AbstractChunk<T>> T createChunk(ChunkFactoryReference<T> chunkFactory)
MessageManager
createChunk
in interface MessageManager
T
- the chunk type.chunkFactory
- a chunk factory reference.
MessageManager.createChunk(ChunkFactoryReference)
public <T extends AbstractChunk<T>> T cloneChunk(T chunk)
MessageManager
cloneChunk
in interface MessageManager
T
- the type of the chunk to clone.chunk
- the chunk to clone.
MessageManager.cloneChunk(AbstractChunk)
public void deleteChunk(AbstractChunk<?> chunk)
MessageManager
deleteChunk
in interface MessageManager
chunk
- the chunk to delete.MessageManager.deleteChunk(AbstractChunk)
public boolean isEmpty(Message message)
MessageManager
true
if the message is empty (ie. contains no chunk
and no sub message).
isEmpty
in interface MessageManager
message
- the reference of a message
true
if the message is empty.MessageManager.isEmpty(Message)
public AbstractChunk getChunk(Message message, String chunkName)
MessageManager
getChunk
in interface MessageManager
message
- the reference of the messagechunkName
- the name of the chunk.
null
if no chunk can be found.MessageManager.getChunk(Message, String)
public void addChunk(Message message, String chunkName, AbstractChunk chunk)
MessageManager
ChunkAlreadyExistException
is thrown.
addChunk
in interface MessageManager
message
- the reference of the message in which the chunk will be
added.chunkName
- the name of the chunk.chunk
- the chunk to addMessageManager.addChunk(Message, String, AbstractChunk)
public AbstractChunk addOrReplaceChunk(Message message, String chunkName, AbstractChunk chunk)
MessageManager
addOrReplaceChunk
in interface MessageManager
message
- the reference of the message in which the message will be
added.chunkName
- the name of the chunk.chunk
- the chunk to add
null
.MessageManager.addOrReplaceChunk(Message, String, AbstractChunk)
public AbstractChunk removeChunk(Message message, String chunkName)
MessageManager
UnknownChunkException
is thrown.
removeChunk
in interface MessageManager
message
- the reference of the message from which the chunk will be
removed.chunkName
- the name of the chunk.
MessageManager.removeChunk(Message, String)
public Iterator<String> getChunkNameIterator(Message message)
MessageManager
getChunkNameIterator
in interface MessageManager
message
- a message reference.
MessageManager.getChunkNameIterator(Message)
public void addSubMessage(Message message, Message subMessage)
MessageManager
addSubMessage
in interface MessageManager
message
- the message where the sub message will be added.subMessage
- the sub message.MessageManager.addSubMessage(Message, Message)
public Iterator<Message> getSubMessageIterator(Message message)
MessageManager
getSubMessageIterator
in interface MessageManager
message
- a message reference.
MessageManager.getSubMessageIterator(Message)
public void removeSubMessage(Message message, Message subMessage)
MessageManager
removeSubMessage
in interface MessageManager
message
- the message from which the sub message will be removed.subMessage
- the sub message.MessageManager.removeSubMessage(Message, Message)
protected final void checkOwner(Message message)
protected final void checkOwner(AbstractChunk<?> chunk)
protected final void checkNull(String chunkName)
protected final void checkNull(AbstractChunk chunk)
protected final void checkNull(Message message)
protected final void checkSubMessage(Message message, Message subMessage)
protected <T extends AbstractChunk<T>> ChunkFactoryReference<T> createChunkFactory(Class<T> chunkType)
protected void recycleMessageInstance(Message message)
public void setDoCheck(boolean doCheck)
MessageManagerAttributeController
doCheck
attribute value. If true
,
additional (expensive) checks will be performed by the message manager.
This can be useful to detect bugs in a dream architecture. Default value is
false
.
setDoCheck
in interface MessageManagerAttributeController
doCheck
- the new doCheck
attribute value.MessageManagerAttributeController.setDoCheck(boolean)
public boolean getDoCheck()
MessageManagerAttributeController
doCheck
attribute value.
getDoCheck
in interface MessageManagerAttributeController
doCheck
attribute value.MessageManagerAttributeController.getDoCheck()
public String[] listFc()
listFc
in interface BindingController
BindingController.listFc()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |