All Packages Class Hierarchy This Package Previous Next Index
Class KQMLLayer.KQMLAgentAction
Abstract.AgentAction
|
+----BaseLayer.BAgentAction
|
+----KQMLLayer.KQMLAgentAction
- public abstract class KQMLAgentAction
- extends BAgentAction
Extension of BAgentAction, BaseLayer AgentAction class. This class
is still an abstract class for you to fill in Act(Object) and
processMessage(String,Object). The received message is KMQLmessage,
so your Act(Object) method will look like:
protected void Act(Object o) {
String msg = (String)o;
KQMLmessage kqml = new KQMLmessage(msg)
String perf = kqml.getValue("performative");
if(perf.equals(".......
....
}
Beta version support full KQML syntax suggested in 1993.
To be safe, use sendKQMLMessage(String) or sendMessage(KQML) rather than
sendMessage(String receiver,String msg).
- See Also:
- AgentAction, BAgentAction
-
KQMLAgentAction()
- Default constructor.
-
KQMLAgentAction(String)
- Constructor with Agent name.
-
KQMLAgentAction(String, MessageBuffer, AddressTable, ConnectionTable, Security)
- Constructor
-
KQMLAgentAction(String, MessageBuffer, AddressTable, ConnectionTable, Security, ThreadGroup)
- Constructor
-
KQMLAgentAction(ThreadGroup, String)
- Constructor with agent name and thread group.
-
createReceiverThread(String, int)
- Create receiver thread with AgentAction's name.
-
createReceiverThread(String, String, int)
- Create client receiver thread using name of the agent where you want to initiate
Connection.
-
createServerThread(String, int)
- Create KQMLServerThread using name of the agent.
-
sendKQMLMessag(String)
- Send KQMLmessage.
-
sendMessage(KQMLmessage)
- Send KQML object by converting to String
KQMLAgentAction
public KQMLAgentAction()
- Default constructor. You should perform member-wise initialization for all data
members - setAddressTable(AddressTable),setConnectionTable(ConnectionTable),
setDurationTime(int),setEndWith(char), setMessageQueue(MessageBuffer),
setSecurity(Security).
KQMLAgentAction
public KQMLAgentAction(String id)
- Constructor with Agent name. You should perform member-wise initialization for all data
members - setAddressTable(AddressTable),setConnectionTable(ConnectionTable),
setDurationTime(int),setEndWith(char), setMessageQueue(MessageBuffer),
setSecurity(Security).
- Parameters:
- id - Agent name
KQMLAgentAction
public KQMLAgentAction(ThreadGroup tg,
String id)
- Constructor with agent name and thread group. You should perform member-wise initialization for all data
members - setAddressTable(AddressTable),setConnectionTable(ConnectionTable),
setDurationTime(int),setEndWith(char), setMessageQueue(MessageBuffer),
setSecurity(Security).
- Parameters:
- tg - Thread group
- id - AgentAction(Thread) name
KQMLAgentAction
public KQMLAgentAction(String id,
MessageBuffer queue,
AddressTable addresses,
ConnectionTable connections,
Security security)
- Constructor
- Parameters:
- id - Agent name
- queue - MessageBuffer
- addresses - AddressTable
- connections - ConnectionTable
- security - Security which will be used both for ServerThread and ReceiverTherad
KQMLAgentAction
public KQMLAgentAction(String id,
MessageBuffer queue,
AddressTable addresses,
ConnectionTable connections,
Security security,
ThreadGroup tg)
- Constructor
- Parameters:
- id - Agent name
- queue - MessageBuffer
- addresses - AddressTable
- connections - ConnectionTable
- security - Security which will be used both for ServerThread and ReceiverTherad
- tg - Thread group
createServerThread
public ServerThread createServerThread(String id,
int priority)
- Create KQMLServerThread using name of the agent. Endwith character and duration time
will be set to those of the current AgentAction's data values.
Override this method if your connection type is different.
- Parameters:
- id - ServerThread name
- priority - Server thread priority
- Returns:
- ServerThread, generated. Null if exception occurs.
- Overrides:
- createServerThread in class BAgentAction
createReceiverThread
public synchronized ReceiverThread createReceiverThread(String serverid,
String myid,
int priority) throws ConnectionException
- Create client receiver thread using name of the agent where you want to initiate
Connection.
Override this method if your connection type is different.
- Parameters:
- serverid - agent name. This name is not my name. The name of the other
agent you want to connect
- myid - My (agent)name
- priority - Receiver thread priority
- Returns:
- ReceiverThread. null if error occurs.
- Overrides:
- createReceiverThread in class BAgentAction
createReceiverThread
public ReceiverThread createReceiverThread(String serverid,
int priority) throws ConnectionException
- Create receiver thread with AgentAction's name. When you use the method, the
AgentAction's thread name(the same as my name) should be set. If not, the receiver
thread name will be set as system selected.
- Parameters:
- serverid - Agent name to whom I want to connect
- priority - Priority of the ReceiverThread
- Returns:
- ReceiverThread, generated. Null if exception occurs
- Overrides:
- createReceiverThread in class BAgentAction
sendMessage
public void sendMessage(KQMLmessage kqml) throws ConnectionException
- Send KQML object by converting to String
- Parameters:
- kqml - KQMLmessage object
sendKQMLMessag
public void sendKQMLMessag(String KQMLstring) throws ParseException, ConnectionException
- Send KQMLmessage. Before it to be sent, parse error will be checked
and throw ParseException if not KQML syntax.
- Parameters:
- KQMLstring - KQML syntax message string
- Throws: ParseException,
- Abstract.ConnectionException
All Packages Class Hierarchy This Package Previous Next Index