|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectist.palcom.communication.CommunicationManager
public class CommunicationManager
This class is the base in the communication layer and handles communication with the media managers through a routing manager. It also handles reliable communication by using acknowledge and resend messages.
| Nested Class Summary | |
|---|---|
protected class |
CommunicationManager.BroadcastDistributor
Class for distributing publish (broadcasted) messages. |
class |
CommunicationManager.DistributorThread
Thread for receiving messages from the routing layer and distributing them to the correct listener by the use of selectors. |
protected class |
CommunicationManager.ReliableMessageHandler
Handles reliable messages |
protected class |
CommunicationManager.UnicastDistributor
Class for distributing (unicast) messages by selectors. |
| Field Summary | |
|---|---|
protected HgraphNode |
_node
|
| Fields inherited from interface ist.palcom.hgraph.IHgraphNode |
|---|
CHILD_NAME_CLASH, CIRCULARITY_CLASH, COMMAND_OR_NODE_MISSING, ERROR, HANDLER_MISSING, INVOKATOR_MISSING, LISTENER_MISSING, NODE_NOT_CHILD, PATH_MISSING, SIBLING_ALREADY_EXISTS, SIBLING_NONEXISTENT, SIBLING_REFERENCE_ALREADY_EXISTS, SIBLING_REFERENCE_NONEXISTENT, STATUS_OK, VALUE_ALREADY_EXISTS, VALUE_NOT_PRESENT |
| Constructor Summary | |
|---|---|
CommunicationManager(PalcomScheduler scheduler,
RoutingManager routingManager)
|
|
| Method Summary | |
|---|---|
void |
addErrorHandler(PalcomThread handler)
Subscribe to error events from all media managers. |
int |
addNodeChild(IHgraphNode node,
Path callerPath)
Adds a child to the node's private list of children. |
java.util.Iterator |
getChildIterator()
|
FuncFunc |
getFuncFunc()
|
java.lang.String |
getLocalDeviceCache()
Returns the device cache for this device. |
Selector |
getNewSelector()
Allocate a new selector and return it. |
java.lang.String |
getNodeName()
hgraph impl below |
IHgraphNode |
getNodeParent()
|
Path |
getPath()
|
SiblingFunc |
getSiblingFunc()
|
ValueFunc |
getValueFunc()
|
boolean |
hasChildNamed(java.lang.String name)
Checks whether the node has a child with a given name |
boolean |
isAncestorOf(IHgraphNode node)
Checks whether this node is an ancestor of the parameter node. |
void |
registerForHeartBeats(PalcomThread resourceManager)
Register as a listener for heartBeatEvents. |
int |
removeNodeChild(java.lang.String name,
Path callerPath)
Removes a child based on its name. |
boolean |
send(Message message,
DeviceID receiverDeviceID,
boolean reliable)
Send a message to a receiver at a given device and selector, with selector set. |
void |
sendBroadcast(Message message)
Send out a broadcast message, with required message header nodes inserted before. |
void |
sendHeartAttack()
Send a message saying that the device will close down |
void |
sendHeartBeat(boolean isHeartBeatAck)
Send a heartbeat message to all devices saying that this device is still active. |
boolean |
sendSingleShot(Message message,
DeviceID receiverDeviceID,
Selector receiverSelector,
Selector senderSelector,
boolean reliable)
Send a single-shot message to a given device. |
void |
setDiscoverySelector(Selector selector)
Set the discovery selector for this device. |
void |
setDistributorThreadAsListener()
Used for test purposes only. |
void |
setLocalDeviceCache(java.lang.String localDeviceCache)
Set the device cache information for the device. |
void |
setLocalDeviceID(DeviceID localDeviceID)
Set the device ID for this device. |
void |
setLocalDiscoveryVersion(java.lang.String discoveryVersion)
Set the discovery version for this device. |
void |
setLocalStatusFlag(byte statusFlag)
Set the status flag for this device. |
int |
setNodeName(java.lang.String name,
Path callerPath)
Sets the name of the node. |
int |
setNodeParent(IHgraphNode newParent,
Path callerPath)
Sets the parent of the HgraphNode. |
Selector |
startReceiving2(PalcomThread receiver)
Start receiving point-to-point messages. |
void |
startReceivingBroadcast(java.lang.String topic,
PalcomThread receiver)
Start receiving broadcast messages on topic topic. |
void |
startReceivingGroupcast(java.lang.String groupID,
PalcomThread receiver)
Start receiving groupcast messages on groupID groupID. |
void |
startReceivingRadiocast(DeviceID remoteDeviceID,
Selector remoteSelector,
PalcomThread receiver)
Start receiving radiocast messages from device with DeviceID remoteDeviceID and selector remoteSelector. |
void |
stop()
Stop the routing manager and all MediaManagers as well as the internal thread. |
void |
stopReceiving(PalcomThread receiver)
Stop receiving messages for a receiver. |
void |
stopReceiving(Selector selector)
Stop receiving messages at a selector. |
void |
stopReceivingBroadcast()
Stop receiving broadcast messages on all topics. |
void |
stopReceivingBroadcast(java.lang.String topic,
PalcomThread receiver)
Stop receiving messages on topic for a receiver. |
void |
stopReceivingGroupcast(java.lang.String groupID,
PalcomThread receiver)
Stop receiving messages from group on groupID for a receiver. |
void |
stopReceivingRadiocast(DeviceID remoteDeviceID,
Selector remoteSelector,
PalcomThread receiver)
Stop receiving radiocast messages on selector at device specified by remoteDeviceID. |
java.lang.String |
toXML()
|
java.lang.String |
toXMLFull()
|
java.lang.String |
toXMLFullRecursively()
|
java.lang.String |
toXMLRecursively()
|
void |
unregisterDevice(DeviceID deviceID)
Remove the device with ID deviceID from the list of registered devices. |
void |
updatePath()
Updates the path of the H-Graph node along with its offspring recursively. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected HgraphNode _node
| Constructor Detail |
|---|
public CommunicationManager(PalcomScheduler scheduler,
RoutingManager routingManager)
| Method Detail |
|---|
public void setDistributorThreadAsListener()
public void setLocalDeviceCache(java.lang.String localDeviceCache)
public java.lang.String getLocalDeviceCache()
public void setLocalDeviceID(DeviceID localDeviceID)
public void setLocalStatusFlag(byte statusFlag)
public void setLocalDiscoveryVersion(java.lang.String discoveryVersion)
public void setDiscoverySelector(Selector selector)
public boolean send(Message message,
DeviceID receiverDeviceID,
boolean reliable)
public boolean sendSingleShot(Message message,
DeviceID receiverDeviceID,
Selector receiverSelector,
Selector senderSelector,
boolean reliable)
message - The message, possibly with extra header nodes already set.receiverDeviceID - The ID of the device which to send the message.receiverSelector - The selector of the listening service.senderSelector - The selector of the sending service.public void sendBroadcast(Message message)
public void sendHeartAttack()
public Selector startReceiving2(PalcomThread receiver)
public void stop()
public Selector getNewSelector()
public void unregisterDevice(DeviceID deviceID)
public void sendHeartBeat(boolean isHeartBeatAck)
isHeartBeatAck - should the heartbeat be answered by other devices or not.public void registerForHeartBeats(PalcomThread resourceManager)
public void addErrorHandler(PalcomThread handler)
MALErrorEvent events.
Notice: Currently, only one error handler at a time is supported
public void startReceivingBroadcast(java.lang.String topic,
PalcomThread receiver)
public void startReceivingRadiocast(DeviceID remoteDeviceID,
Selector remoteSelector,
PalcomThread receiver)
public void startReceivingGroupcast(java.lang.String groupID,
PalcomThread receiver)
public void stopReceiving(Selector selector)
public void stopReceiving(PalcomThread receiver)
public void stopReceivingBroadcast(java.lang.String topic,
PalcomThread receiver)
public void stopReceivingGroupcast(java.lang.String groupID,
PalcomThread receiver)
public void stopReceivingRadiocast(DeviceID remoteDeviceID,
Selector remoteSelector,
PalcomThread receiver)
public void stopReceivingBroadcast()
public java.lang.String getNodeName()
getNodeName in interface IHgraphNode
public int setNodeName(java.lang.String name,
Path callerPath)
IHgraphNode
setNodeName in interface IHgraphNodename - The new name
public Path getPath()
getPath in interface IHgraphNodepublic void updatePath()
IHgraphNode
updatePath in interface IHgraphNodepublic boolean hasChildNamed(java.lang.String name)
IHgraphNode
hasChildNamed in interface IHgraphNodename - The name to check
public boolean isAncestorOf(IHgraphNode node)
IHgraphNode
isAncestorOf in interface IHgraphNode
public int removeNodeChild(java.lang.String name,
Path callerPath)
IHgraphNode
removeNodeChild in interface IHgraphNodename - The name of the child to be removed
public java.lang.String toXML()
toXML in interface IHgraphNodepublic java.lang.String toXMLFull()
toXMLFull in interface IHgraphNodepublic java.lang.String toXMLRecursively()
toXMLRecursively in interface IHgraphNodepublic java.lang.String toXMLFullRecursively()
toXMLFullRecursively in interface IHgraphNode
public int setNodeParent(IHgraphNode newParent,
Path callerPath)
IHgraphNode
setNodeParent in interface IHgraphNodenewParent - the new parent
public int addNodeChild(IHgraphNode node,
Path callerPath)
IHgraphNode
addNodeChild in interface IHgraphNodenode - The new child to be added
public SiblingFunc getSiblingFunc()
getSiblingFunc in interface IHgraphNodepublic ValueFunc getValueFunc()
getValueFunc in interface IHgraphNodepublic FuncFunc getFuncFunc()
getFuncFunc in interface IHgraphNodepublic IHgraphNode getNodeParent()
getNodeParent in interface IHgraphNodepublic java.util.Iterator getChildIterator()
getChildIterator in interface IHgraphNode
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||