| |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
This class represents the notion of a Conversation which is comprised of several Message's, the order of which follow a certain protocol (e.g. FIPA-Request). The methods it provides allow retrieval of information about the conversation, as well as validation of the protocol the conversation is following. This class cannot be instantiated directly, the static method getConversation() should be used to obtain a Conversation instance which will follow the required protocol. Protocol definitions are defined in concrete sub-classes, which map from protocol name to class name as such:
The class name is relative to the package in which this object resides. The sub-class must also define a public static Object[] called __protocol which contains details of the protocol to be followed. The list should contain a list of tuples which follow this format:
{ String performative [, Object conv_state], Integer participant [, Object[] sub_nodes] }
The performative is the type of message recieved at that part of the protocol,
the conv_state is the conversation state when that performative is recieved (one of
NO_AGENT_ACTION_REQ or AGENT_ACTION_REQ, and if none is given CONVERSATION_END is assumed).
The
participant number identifies which participant in the conversation should be sending
that message (the numbers used should be consistent throughout the messages according
to the protocol requirements). The sub_nodes array can contain a list of the same
format to define what messages should be expected after the one defined by the current
list has been received (hence the whole protocol can be defined recursively).
Inner Class Summary | |
public static class | ConversationImpl.ConversationProtocol Class to contain information about the protocol to be used. |
(package private) class | ConversationImpl.MessageDetails Class to contain information about a message |
Field Summary | |
(package private) Object | _serialised Helps to indicate if this is a deserialised object |
final static int | AGENT_ACTION_REQ Conversation requires Agent interaction |
final static int | CONVERSATION_END Conversation has ended |
final static int | NO_AGENT_ACTION_REQ Conversation requires no Agent interaction |
final static int | WAIT_BEFORE_END Wait for response before ending conversation |
Method Summary | |
(package private) synchronized void | addMessage(Message msg) Method to add a message to the conversation - sets conversation state to updated as well. |
synchronized Object | clone() Clone method to make duplicates of this Conversation object |
(package private) synchronized ConversationImpl | cloneAndResetUpdate() Creates a copy of this Conversation object, and sets the update state to false |
ACL | getACL(int index) Pass-back the latest message in this conversation |
static ConversationImpl | getConversation(String protocol, String agent_name) Method to dynamically load a Conversation instance which follows the given protocol and belongs to the given Agent |
static ConversationImpl | getConversation(String protocol, AgentID agent_name) Method to dynamically load a Conversation instance which follows the given protocol and belongs to the given Agent |
String | getConversationID() Gets the conversation ID of the conversation |
Envelope | getEnvelope(int index) Get the Envelope of the latest message received |
ACL | getFilledInACL() Method to produce a filled in ACL - e.g. |
int | getLatestMessageIndex() Pass back the index of the latest message in the conversation |
List | getNextMessages() Method to discover what types of messages can be sent next |
List | getNextPerformatives() Method to discover what performatives are allowed next in the protocol. |
String | getObjectID() Method to get unique identifier of this DatabaseObject |
String | getProtocol() Method to get the protocol this Conversation is following |
String | getSender(int index) Gets the sender of the message at the specified index |
AgentID | getSenderAID(int index) Gets the sender of the message at the specified index |
synchronized int | getState() Method to retrieve the state of the conversation (e.g. |
long | getTimeOut() Method to get the time at which the last message will time out |
long | getTimeStamp(int index) Method to retrieve the time stamp of a given message |
(package private) synchronized boolean | isUpdated() Checks if the conversation has been updated. |
static void | main(String[] args) Used for testing. |
(package private) synchronized void | removeReferences() Sets all references to null to aid garbage collection - ONLY USE WHEN OBJECT HAS BEEN FINISHED WITH! |
(package private) synchronized void | resetUpdate() Resets the update flag to false. |
(package private) void | setConversationID(String conv_id) Sets the conversation ID of the Conversation - should only be called directly after creation of a Conversation object from the ConversationManagerImpl |
static void | testAddMessages(String protocol, String[] data, boolean cont) |
static void | testAddMessages(ConversationImpl conv, String[] data, boolean cont) |
static ConversationImpl | testPopulate(ACLMessage acl, String protocol) Returns a Conversation object populated with the passed ACLMessage. |
String | toString() Overrides default toString() |
Field Detail |
Object _serialised
public final static int AGENT_ACTION_REQ
public final static int CONVERSATION_END
public final static int NO_AGENT_ACTION_REQ
public final static int WAIT_BEFORE_END
Method Detail |
synchronized void addMessage(Message msg)
throws fipaos.agent.conversation.ProtocolErrorException,
fipaos.agent.conversation.InvalidConversationIDException,
fipaos.agent.conversation.ConversationFinishedException
public synchronized Object clone()
synchronized ConversationImpl cloneAndResetUpdate()
public ACL getACL(int index)
public static ConversationImpl getConversation(String protocol, String agent_name)
throws fipaos.agent.conversation.UnknownProtocolException,
fipaos.parser.ParserException
public static ConversationImpl getConversation(String protocol, AgentID agent_name)
throws fipaos.agent.conversation.UnknownProtocolException
public String getConversationID()
public Envelope getEnvelope(int index)
public ACL getFilledInACL()
public int getLatestMessageIndex()
public List getNextMessages()
public List getNextPerformatives()
public String getObjectID()
public String getProtocol()
public String getSender(int index)
public AgentID getSenderAID(int index)
public synchronized int getState()
public long getTimeOut()
public long getTimeStamp(int index)
synchronized boolean isUpdated()
public static void main(String[] args)
throws java.lang.Throwable
synchronized void removeReferences()
synchronized void resetUpdate()
void setConversationID(String conv_id)
public static void testAddMessages(String protocol, String[] data, boolean cont)
throws java.lang.Throwable
public static void testAddMessages(ConversationImpl conv, String[] data, boolean cont)
public static ConversationImpl testPopulate(ACLMessage acl, String protocol)
public String toString()
Association Links |
to Class fipaos.agent.conversation.standard.ConversationImpl.ConversationProtocol
to Class fipaos.agent.conversation.standard.ConversationImpl.ConversationProtocol
to Class java.util.List
to Class fipaos.ont.fipa.fipaman.AgentID
to Class java.lang.String
to Class fipaos.ont.fipa.fipaman.AgentID
to Class java.lang.String
to Class java.lang.String
| |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |