com.ls.lars.communication
Class ServiceMessage
java.lang.Object
|
+--com.ls.lars.communication.Message
|
+--com.ls.lars.communication.ServiceMessage
- All Implemented Interfaces:
- Cloneable, Comparable, Serializable
- Direct Known Subclasses:
- ServiceBroadcastMessage, ServiceSingleMessage
- public abstract class ServiceMessage
- extends Message
Message object for the communication between the agents.
Note, that the Message object is not synchronized!
Standard for naming message services:
- a message service is written in lower case
- if a service consists of multiple words, they are separated by an underscore ("_"), e.g. "set_constants"
This standard is needed for automatic registration of "interpret"-methods in agents.
- Version:
- $Revision: 1.3 $
- Author:
- Last modified by $Author: ODrugan $
- See Also:
- Serialized Form
Fields inherited from class com.ls.lars.communication.Message |
ADDRESS_CONFIG, ADDRESS_LARS_INTERNAL, EXPIRE_HOPS_DEFAULT, MESSAGE_TYPE_GROUP, MESSAGE_TYPE_MULTICAST, MESSAGE_TYPE_SERVICE_BROADCAST, MESSAGE_TYPE_SERVICE_SINGLE, MESSAGE_TYPE_SINGLE, PRIORITY_HIGH, PRIORITY_LOW, PRIORITY_NORMAL, PRIORITY_SYSTEM, PRIORITY_TEXT_HIGH, PRIORITY_TEXT_LOW, PRIORITY_TEXT_NORMAL, SERVICE_UNKNOWN, TAG_CONTENT, TAG_CURRENT_HOPS, TAG_EXPIRE_HOPS, TAG_FORWARDED_BY, TAG_IN_REPLY_TO, TAG_MESSAGE, TAG_PRIORITY, TAG_QUALITY_OF_SERVICE, TAG_REPLY_COUNTER, TAG_REPLY_WITH, TAG_SENDER, TAG_SENT_TIME, TAG_SERVICE, TAG_TYPE |
Constructor Summary |
ServiceMessage(String service,
Object content)
sets all fields of a service message including the content object |
Method Summary |
String |
getPlatform()
returns the name of the platform where the service shall be accessed |
protected Map |
inheritorToMap()
returns a map containing the ServiceMessage specific fields (type) |
void |
setPlatform(String platform)
sets the name of the platform where the service shall be accessed |
Methods inherited from class com.ls.lars.communication.Message |
clone, compareTo, createMessage, createReply, getContent, getCurrentHops, getExpireHops, getForwardedBy, getInReplyTo, getPriority, getQualityOfService, getReplyWith, getSender, getSentTime, getService, hasInvalidSender, hop, increasePriority, inheritorToString, isExpired, isSent, setExpireHops, setInReplyTo, setPriority, setPriority, setQualityOfService, setQualityOfService, setReplyWith, setSystemPriority, toMap, toString, toStringWithContent |
TAG_PLATFORM
public static final String TAG_PLATFORM
- string that represent the "platform"
ServiceMessage
public ServiceMessage(String service,
Object content)
throws InvalidArgumentException
- sets all fields of a service message including the content object
- Parameters:
service
- service of the messagecontent
- content of the message as a hash- Throws:
InvalidArgumentException
- if given service is null or empty or contains only whitespace characters
or if given content is null
setPlatform
public final void setPlatform(String platform)
throws ProgrammingException
- sets the name of the platform where the service shall be accessed
- Parameters:
platform
- name of the platform where this service message shall be interpreted
(a null value will be interpreted as local platform at routing time)- Throws:
ProgrammingException
- If this message was already sent
getPlatform
public final String getPlatform()
- returns the name of the platform where the service shall be accessed
- Returns:
- name of this platform (null is allowed and will be interpreted as local platform at routing time)
inheritorToMap
protected Map inheritorToMap()
- returns a map containing the ServiceMessage specific fields (type)
- Overrides:
inheritorToMap
in class Message
- Returns:
- ServiceMessage specific fields as a Map