|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--jade.lang.acl.ACLMessage
The class ACLMessage implements an ACL message compliant to the FIPA 97 specs.
All parameters are couples keyword: value.
All keywords are private final String.
All values can be set by using the methods set and can be read by using
the methods get.
Notice that the get methods never return null, rather they return an empty String.
The methods setContentObject() and
getContentObject() allow to send
serialized Java objects over the content of an ACLMessage.
These method are not FIPA compliant so their usage is not encouraged.
| Field Summary | |
static int |
ACCEPT_PROPOSAL
constant identifying the FIPA performative |
static int |
AGREE
constant identifying the FIPA performative |
static int |
CANCEL
constant identifying the FIPA performative |
static int |
CFP
constant identifying the FIPA performative |
static int |
CONFIRM
constant identifying the FIPA performative |
static int |
DISCONFIRM
constant identifying the FIPA performative |
static int |
FAILURE
constant identifying the FIPA performative |
static int |
INFORM
constant identifying the FIPA performative |
static int |
INFORM_IF
constant identifying the FIPA performative |
static int |
INFORM_REF
constant identifying the FIPA performative |
static int |
NOT_UNDERSTOOD
constant identifying the FIPA performative |
static int |
PROPAGATE
constant identifying the FIPA performative |
static int |
PROPOSE
constant identifying the FIPA performative |
static int |
PROXY
constant identifying the FIPA performative |
static int |
QUERY_IF
constant identifying the FIPA performative |
static int |
QUERY_REF
constant identifying the FIPA performative |
static int |
REFUSE
constant identifying the FIPA performative |
static int |
REJECT_PROPOSAL
constant identifying the FIPA performative |
static int |
REQUEST
constant identifying the FIPA performative |
static int |
REQUEST_WHEN
constant identifying the FIPA performative |
static int |
REQUEST_WHENEVER
constant identifying the FIPA performative |
static int |
SUBSCRIBE
constant identifying the FIPA performative |
static int |
UNKNOWN
constant identifying an unknown performative |
| Constructor Summary | |
ACLMessage()
Deprecated. Since every ACL Message must have a message type, you should use the new constructor which gets a message type as a parameter. To avoid problems, now this constructor silently sets the message type to not-understood. |
|
ACLMessage(int perf)
This constructor creates an ACL message object with the specified performative. |
|
ACLMessage(java.lang.String type)
Deprecated. It increases the probability of error when the passed String does not belong to the set of performatives supported by FIPA. This constructor creates an ACL message object with the specified type. To avoid problems, the constructor ACLMessage(int)
should be used instead. |
|
| Method Summary | |
void |
addReceiver(AID r)
Adds a value to :receiver slot. |
void |
addReplyTo(AID dest)
Adds a value to :reply-to slot. |
void |
addUserDefinedParameter(java.lang.String key,
java.lang.String value)
Add a new user defined parameter to this ACLMessage. |
void |
clearAllReceiver()
Removes all values from :receiver
slot. |
void |
clearAllReplyTo()
Removes all values from :reply_to
slot. |
java.lang.Object |
clone()
Clone an ACLMessage object. |
ACLMessage |
createReply()
create a new ACLMessage that is a reply to this message. |
static java.util.List |
getAllPerformatives()
Returns the list of the communicative acts. |
java.util.Iterator |
getAllReceiver()
Reads :receiver slot. |
java.util.Iterator |
getAllReplyTo()
Reads :reply_to slot. |
java.util.Properties |
getAllUserDefinedParameters()
get a clone of the data structure with all the user defined parameters |
java.lang.String |
getContent()
Reads :content slot. |
java.io.Serializable |
getContentObject()
This method returns the content of this ACLMessage after decoding according to Base64. |
java.lang.String |
getConversationId()
Reads :conversation-id slot. |
java.lang.String |
getEncoding()
Reads :encoding slot. |
Envelope |
getEnvelope()
Reads the envelope attached to this message, if any. |
java.lang.String |
getInReplyTo()
Reads :reply-to slot. |
static int |
getInteger(java.lang.String perf)
Returns the integer corresponding to the performative |
java.lang.String |
getLanguage()
Reads :language slot. |
java.lang.String |
getOntology()
Reads :ontology slot. |
int |
getPerformative()
return the integer representing the performative of this object |
static java.lang.String |
getPerformative(int perf)
Returns the string corresponding to the integer for the performative |
java.lang.String |
getProtocol()
Reads :protocol slot. |
java.lang.String |
getReplyBy()
Reads :reply-by slot. |
java.util.Date |
getReplyByDate()
Reads :reply-by slot. |
java.lang.String |
getReplyWith()
Reads :reply-with slot. |
AID |
getSender()
Reads :sender slot. |
java.lang.String |
getUserDefinedParameter(java.lang.String key)
Searches for the user defined parameter with the specified key. |
boolean |
removeReceiver(AID r)
Removes a value from :receiver
slot. |
boolean |
removeReplyTo(AID dest)
Removes a value from :reply_to
slot. |
boolean |
removeUserDefinedParameter(java.lang.String key)
Removes the key and its corresponding value from the list of user defined parameters in this ACLMessage. |
void |
reset()
Resets all the message slots. |
void |
setContent(java.lang.String content)
Writes the :content slot. |
void |
setContentObject(java.io.Serializable s)
This method sets the content of this ACLMessage to a Java object. |
void |
setConversationId(java.lang.String str)
Writes the :conversation-id slot. |
void |
setDefaultEnvelope()
Writes the message envelope for this message, using the :sender and :receiver message slots to
fill in the envelope. |
void |
setEncoding(java.lang.String str)
Writes the :encoding slot. |
void |
setEnvelope(Envelope e)
Attaches an envelope to this message. |
void |
setInReplyTo(java.lang.String reply)
Writes the :in-reply-to slot. |
void |
setLanguage(java.lang.String str)
Writes the :language slot. |
void |
setOntology(java.lang.String str)
Writes the :ontology slot. |
void |
setPerformative(int perf)
set the performative of this ACL message object to the passed constant. |
void |
setProtocol(java.lang.String str)
Writes the :protocol slot. |
void |
setReplyBy(java.lang.String str)
Writes the :reply-by slot. |
void |
setReplyByDate(java.util.Date date)
Writes the :reply-by slot. |
void |
setReplyWith(java.lang.String reply)
Writes the :reply-with slot. |
void |
setSender(AID s)
Writes the :sender slot. |
java.lang.String |
toString()
Convert an ACL message to its string representation. |
void |
toText(java.io.Writer w)
Writes an ACL message object on a stream as a character string. |
| Methods inherited from class java.lang.Object |
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
| Field Detail |
public static final int ACCEPT_PROPOSAL
public static final int AGREE
public static final int CANCEL
public static final int CFP
public static final int CONFIRM
public static final int DISCONFIRM
public static final int FAILURE
public static final int INFORM
public static final int INFORM_IF
public static final int INFORM_REF
public static final int NOT_UNDERSTOOD
public static final int PROPOSE
public static final int QUERY_IF
public static final int QUERY_REF
public static final int REFUSE
public static final int REJECT_PROPOSAL
public static final int REQUEST
public static final int REQUEST_WHEN
public static final int REQUEST_WHENEVER
public static final int SUBSCRIBE
public static final int PROXY
public static final int PROPAGATE
public static final int UNKNOWN
| Constructor Detail |
public ACLMessage()
not-understood.ACLMessage(String type)public ACLMessage(java.lang.String type)
ACLMessage(int)
should be used instead.type - The type of the communicative act represented by this
message.ACLMessage(int type)public ACLMessage(int perf)
not-understood.| Method Detail |
public static java.util.List getAllPerformatives()
public void setSender(AID s)
:sender slot. Warning: no
checks are made to validate the slot value.source - The new value for the slot.getSender()public void addReceiver(AID r)
:receiver slot. Warning:
no checks are made to validate the slot value.r - The value to add to the slot value set.public boolean removeReceiver(AID r)
:receiver
slot. Warning: no checks are made to validate the slot
value.r - The value to remove from the slot value set.public void clearAllReceiver()
:receiver
slot. Warning: no checks are made to validate the slot
value.public void addReplyTo(AID dest)
:reply-to slot. Warning:
no checks are made to validate the slot value.dest - The value to add to the slot value set.public boolean removeReplyTo(AID dest)
:reply_to
slot. Warning: no checks are made to validate the slot
value.dest - The value to remove from the slot value set.public void clearAllReplyTo()
:reply_to
slot. Warning: no checks are made to validate the slot
value.public void setPerformative(int perf)
INFORM, REQUEST, ... )
defined in this classpublic void setContent(java.lang.String content)
:content slot. Warning: no
checks are made to validate the slot value.
In order to transport serialized Java objects,
or arbitrary sequence of bytes (i.e. something different from
a Java String) over an ACL message, it is suggested to use
the method ACLMessage.setContentObject() instead.
content - The new value for the slot.getContent(),
setContentObject(Serializable s)
public void setContentObject(java.io.Serializable s)
throws java.io.IOException
ACLMessage msg = new ACLMessage(ACLMessage.INFORM);
Date d = new Date();
try{
msg.setContentObject(d);
}catch(IOException e){}
s - the object that will be used to set the content of the ACLMessage.
public java.io.Serializable getContentObject()
throws UnreadableException
ACLMessage msg = blockingReceive();
try{
Date d = (Date)msg.getContentObject();
}catch(UnreadableException e){}
public void setReplyWith(java.lang.String reply)
:reply-with slot. Warning: no
checks are made to validate the slot value.reply - The new value for the slot.getReplyWith()public void setInReplyTo(java.lang.String reply)
:in-reply-to slot. Warning: no
checks are made to validate the slot value.reply - The new value for the slot.getInReplyTo()public void setEncoding(java.lang.String str)
:encoding slot. Warning: no
checks are made to validate the slot value.str - The new value for the slot.getEncoding()public void setLanguage(java.lang.String str)
:language slot. Warning: no
checks are made to validate the slot value.str - The new value for the slot.getLanguage()public void setOntology(java.lang.String str)
:ontology slot. Warning: no
checks are made to validate the slot value.str - The new value for the slot.getOntology()public void setReplyBy(java.lang.String str)
:reply-by slot. Warning: no
checks are made to validate the slot value.str - The new value for the slot, as ISO8601 time.getReplyBy()public void setReplyByDate(java.util.Date date)
:reply-by slot. Warning: no
checks are made to validate the slot value.date - The new value for the slot.getReplyByDate()public void setProtocol(java.lang.String str)
:protocol slot. Warning: no
checks are made to validate the slot value.str - The new value for the slot.getProtocol()public void setConversationId(java.lang.String str)
:conversation-id slot. Warning: no
checks are made to validate the slot value.str - The new value for the slot.getConversationId()public java.util.Iterator getAllReceiver()
:receiver slot.Iterator containing the Agent IDs of the
receiver agents for this message.public java.util.Iterator getAllReplyTo()
:reply_to slot.Iterator containing the Agent IDs of the
reply_to agents for this message.public AID getSender()
:sender slot.:senderslot.setSender(AID).public static java.lang.String getPerformative(int perf)
public static int getInteger(java.lang.String perf)
public int getPerformative()
public java.lang.String getContent()
:content slot.
It is sometimes useful to transport serialized Java objects,
or arbitrary sequence of bytes (i.e. something different from
a Java String) over an ACL message. See
getContentObject().
:content slot.setContent(String),
getContentObject(),
ObjectInputStreampublic java.lang.String getReplyWith()
:reply-with slot.:reply-withslot.setReplyWith(String).public java.lang.String getInReplyTo()
:reply-to slot.:reply-toslot.setInReplyTo(String).public java.lang.String getEncoding()
:encoding slot.:encodingslot.setEncoding(String).public java.lang.String getLanguage()
:language slot.:languageslot.setLanguage(String).public java.lang.String getOntology()
:ontology slot.:ontologyslot.setOntology(String).public java.lang.String getReplyBy()
:reply-by slot.:reply-byslot, as a string.setReplyBy(String).public java.util.Date getReplyByDate()
:reply-by slot.:reply-byslot, as a
Date object.setReplyByDate(Date).public java.lang.String getProtocol()
:protocol slot.:protocolslot.setProtocol(String).public java.lang.String getConversationId()
:conversation-id slot.:conversation-idslot.setConversationId(String).
public void addUserDefinedParameter(java.lang.String key,
java.lang.String value)
key - the property key.value - the property valuepublic java.lang.String getUserDefinedParameter(java.lang.String key)
null if the parameter is not found.key - the parameter key.public java.util.Properties getAllUserDefinedParameters()
public boolean removeUserDefinedParameter(java.lang.String key)
key - the key that needs to be removedpublic void setEnvelope(Envelope e)
e - The Envelope object to attach to this
message.public void setDefaultEnvelope()
:sender and :receiver message slots to
fill in the envelope.public Envelope getEnvelope()
public void toText(java.io.Writer w)
ACLMessage object onto a character stream.w - A Writer object to write the message onto.public java.lang.Object clone()
ACLMessage object.ACLMessage object. The copy
must be casted back to ACLMessage type before being
used.public java.lang.String toString()
ACLMessage into a
character string.String representing this message.public void reset()
public ACLMessage createReply()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||