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) {

}
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

Constructor Index

 o KQMLAgentAction()
Default constructor.
 o KQMLAgentAction(String)
Constructor with Agent name.
 o KQMLAgentAction(String, MessageBuffer, AddressTable, ConnectionTable, Security)
Constructor
 o KQMLAgentAction(String, MessageBuffer, AddressTable, ConnectionTable, Security, ThreadGroup)
Constructor
 o KQMLAgentAction(ThreadGroup, String)
Constructor with agent name and thread group.

Method Index

 o createReceiverThread(String, int)
Create receiver thread with AgentAction's name.
 o createReceiverThread(String, String, int)
Create client receiver thread using name of the agent where you want to initiate Connection.
 o createServerThread(String, int)
Create KQMLServerThread using name of the agent.
 o sendKQMLMessag(String)
Send KQMLmessage.
 o sendMessage(KQMLmessage)
Send KQML object by converting to String

Constructors

 o 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).

 o 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
 o 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
 o 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
 o 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

Methods

 o 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
 o 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
 o 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
 o sendMessage
 public void sendMessage(KQMLmessage kqml) throws ConnectionException
Send KQML object by converting to String

Parameters:
kqml - KQMLmessage object
 o 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