|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.universAAL.middleware.bus.msg.BusMessage
public class BusMessage
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.universAAL.middleware.brokers.message.BrokerMessage |
---|
BrokerMessage.BrokerMessageTypes |
Field Summary | |
---|---|
String |
brokerName
|
Constructor Summary | |
---|---|
BusMessage(MessageType type,
Object content,
AbstractBus creator)
Constructor - a message of particular type with particular content |
|
BusMessage(String message)
Constructor - parses the string passed as a parameter and creates a Message object. |
Method Summary | |
---|---|
void |
addReceiver(PeerCard pc)
|
void |
addReceivers(PeerCard[] receivers)
|
static BusMessage |
createP2PReply(String messageIDInReplyTo,
PeerCard receiver,
Object content,
AbstractBus creator)
Create a reply message to the message with the given ID, with the content and receiver passed as a parameter. |
BusMessage |
createReply(Object content)
Create reply message to this message, with the content passed as a parameter. |
static String |
createUniqueID()
generates a globally unique ID, based on a counter and some string that represents this JVM |
static Object |
deserializeAsContent(String s)
|
Object |
getContent()
|
String |
getContentAsString()
|
String |
getID()
|
long |
getIDAsLong()
|
String |
getInReplyTo()
Returns the ID of the message this message replies to. |
BrokerMessage.BrokerMessageTypes |
getMType()
|
PeerCard[] |
getReceivers()
|
PeerCard |
getSender()
|
MessageType |
getType()
|
boolean |
hasReceiver(PeerCard receiver)
|
String |
marshall(BrokerMessage message)
|
boolean |
receiverResidesOnDifferentPeer()
|
boolean |
senderResidesOnDifferentPeer()
|
boolean |
sentBySamePeerAs(PeerCard peer)
|
static void |
setMessageContentSerializer(MessageContentSerializer mcs)
|
void |
setReceiver(PeerCard receiver)
If the given peer is not null, removes any existing receiver and adds the given peer as the only receiver. |
void |
setReceivers(List<PeerCard> receivers)
|
void |
setSender(PeerCard sender)
|
static void |
setThisPeer(PeerCard peer)
|
String |
toString()
Serialize the message as string. |
static String |
trySerializationAsContent(Object o)
A safe wrapping for calling contentSerializer.serialize(o). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public String brokerName
Constructor Detail |
---|
public BusMessage(MessageType type, Object content, AbstractBus creator)
type
- content
- Content of the message, typically a Resource
.public BusMessage(String message)
message
- the string to parse (the serialization of a message object).Method Detail |
---|
public static String createUniqueID()
public static void setMessageContentSerializer(MessageContentSerializer mcs)
public static void setThisPeer(PeerCard peer)
public void setReceivers(List<PeerCard> receivers)
public static String trySerializationAsContent(Object o)
o
- - Object to serialize
public static Object deserializeAsContent(String s)
public void addReceiver(PeerCard pc)
public void addReceivers(PeerCard[] receivers)
public BusMessage createReply(Object content)
content
- the content of the created reply, typically a Resource
.
public static BusMessage createP2PReply(String messageIDInReplyTo, PeerCard receiver, Object content, AbstractBus creator)
messageIDInReplyTo
- ID of the message to which the returned message is a reply to.receiver
- the receiving peer.content
- Content of the message, typically a Resource
.
BusMessage
, or null if the parameters are invalid.public Object getContent()
public String getContentAsString()
public String getID()
public long getIDAsLong()
public String getInReplyTo()
public MessageType getType()
MessageType
public boolean receiverResidesOnDifferentPeer()
public boolean senderResidesOnDifferentPeer()
public boolean sentBySamePeerAs(PeerCard peer)
public void setReceiver(PeerCard receiver)
receiver
- public String toString()
toString
in interface BrokerMessage
toString
in class Object
public String marshall(BrokerMessage message)
public BrokerMessage.BrokerMessageTypes getMType()
getMType
in interface BrokerMessage
public PeerCard[] getReceivers()
getReceivers
in interface BrokerMessage
public boolean hasReceiver(PeerCard receiver)
public PeerCard getSender()
public void setSender(PeerCard sender)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |