All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class KQMLLayer.KQMLRecvThread

Abstract.Connection
   |
   +----Abstract.ReceiverThread
           |
           +----BaseLayer.BRecvThread
                   |
                   +----KQMLLayer.KQMLRecvThread

public class KQMLRecvThread
extends BRecvThread
To support complete KQML parsing


Constructor Index

 o KQMLRecvThread()
 o KQMLRecvThread(Address, int, Address, ConnectionTable, MessageBuffer, Security, ThreadGroup)
This constructor is called when an agent want to initialize a connection to the other agents, using Address.
 o KQMLRecvThread(Socket, int, Address, ConnectionTable, MessageBuffer, Security)
Constructor, to be called from the serverthread after accepting a connection.
 o KQMLRecvThread(String)
Create ReceiverThread with specific thread name
 o KQMLRecvThread(String, String, int, Address, ConnectionTable, MessageBuffer, int, ThreadGroup)
This constructor is called when an agent want to initialize a connection to the other agents, using host name and port.
 o KQMLRecvThread(ThreadGroup, String)
Create ReceiverThread with specific thread name and Thread group.

Method Index

 o findEndLocation(char[], int, int)
This is the only difference between BRecvThread and KQMLRecvThread.

Constructors

 o KQMLRecvThread
 public KQMLRecvThread()
 o KQMLRecvThread
 public KQMLRecvThread(String name)
Create ReceiverThread with specific thread name

Parameters:
name - Agent name
 o KQMLRecvThread
 public KQMLRecvThread(ThreadGroup tg,
                       String name)
Create ReceiverThread with specific thread name and Thread group. Passing thread group is essential when you will create the receiver thread for an applet because of security issue.

Parameters:
tg - Thread group to which this thread will be owned to
name - Agent name
 o KQMLRecvThread
 public KQMLRecvThread(Socket client_socket,
                       int priority,
                       Address address,
                       ConnectionTable connections,
                       MessageBuffer queue,
                       Security security) throws ConnectionException
Constructor, to be called from the serverthread after accepting a connection. Note default endWith is '\004'. You can change endWith character by setEndWith(char) method. Note that the timer will not be set. To set timer, use setDurationTime(int minutes) method. Do not use this thread when you want to initiate(conect) to other server. If you use this constructor the role will be set as a server. If there is a special reason you should use this constructor even if your agent role is a server, use setRole(false) method to set the role as a client.

Parameters:
client_scoket - The socket for the remote client;
priority - the priority of the thread.
address - My address.
connections - the connection table is passed as an argument.
queue - the Message Queue.
security - Security for checking this connection security
Throws: ConnectionException
if error occurs
 o KQMLRecvThread
 public KQMLRecvThread(String serverid,
                       String host,
                       int priority,
                       Address myaddress,
                       ConnectionTable connections,
                       MessageBuffer queue,
                       int port,
                       ThreadGroup tg) throws ConnectionException
This constructor is called when an agent want to initialize a connection to the other agents, using host name and port. This constructor is will be useful if you do not want to use any security check._security data member will be set as null. Do not use this constructor if you want security check.

Parameters:
serverid - Agent name to shich the this receiver thread will connect
host - the name of the remote host.
priority - the priority of the thread.
connections - the connection table is passed as an argument.
queue - the Message Queue.
port - the port of the remote host.
tg - Thread group to which this thread will be owned to. Necessary to evade applet security.
Throws: ConnectionException
if error occurs
 o KQMLRecvThread
 public KQMLRecvThread(Address serveraddress,
                       int priority,
                       Address myaddress,
                       ConnectionTable connections,
                       MessageBuffer queue,
                       Security security,
                       ThreadGroup tg) throws ConnectionException
This constructor is called when an agent want to initialize a connection to the other agents, using Address. Use this constructor if you want security check.

Parameters:
serveraddress - The address of the remote host.
priority - The priority of the thread.
myaddress - My addres
connections - the connection table is passed as an argument.
queue - the Message Queue.
security - The security object
Throws: ConnectionException
if error occurs

Methods

 o findEndLocation
 protected int findEndLocation(char buffer[],
                               int startPosition,
                               int maxLen)
This is the only difference between BRecvThread and KQMLRecvThread. Since KQML may contains arbitrary ascii with double quotes or #digit, _endWith character may be contained. Skip fixed number of #digit and double quotes.

Overrides:
findEndLocation in class BRecvThread

All Packages  Class Hierarchy  This Package  Previous  Next  Index