All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class ProtocolLayer.IPRouterRecvThread

Abstract.Connection
   |
   +----Abstract.ReceiverThread
           |
           +----BaseLayer.BRecvThread
                   |
                   +----KQMLLayer.KQMLRecvThread
                           |
                           +----RouterLayer.Router.RouterRecvThread
                                   |
                                   +----ProtocolLayer.IPRouterRecvThread

public class IPRouterRecvThread
extends RouterRecvThread
Extended from RouterRecvThread, this class handles SMTP and FTP proxy. This class is only for router. IPRouterClientAction will not use this class.


Variable Index

 o INTERNALSOCKETERROR
Error codes : Proxy server socket can not be created
 o MESSAGECONTENTERROR
Error codes : The content of KQML message is wrong
 o NOTSUPPORTEDPROTOCOL
Error codes : The protocol is not supported
 o PROTOCOLNOTSPECIFIED
Error codes : The protocol is not specified
 o SERVERADDRESSMISSING
Error codes : Server address(SMTP or FTP server) is not found
 o SERVICECLOSED
Error codes : The internet service is closed

Constructor Index

 o IPRouterRecvThread()
Default Constructor.
 o IPRouterRecvThread(Address, Address, ConnectionTable, String, Security, OffLineAgentTable)
Router receiver thread to send off-line agent's messages back to the senders with error.
 o IPRouterRecvThread(Address, int, Address, ConnectionTable, MessageBuffer, Security, String, Hashtable, OffLineAgentTable, Vector, ThreadGroup)
This constructor is called when an agent want to initialize a connection to the other agents, using Address
 o IPRouterRecvThread(Socket, int, Address, ConnectionTable, MessageBuffer, Security, String, Hashtable, OffLineAgentTable, Vector)
Constructor, to be called from the serverthread after accepting a connection.
 o IPRouterRecvThread(String)
Constructor with the Agent name.

Method Index

 o getEmailAddress(Address)
Get email address from Address object
 o processDefaultProtocol(KQMLmessage)
Processing default protocols : disconnect-agent, reserve-message, list-agent, request-address, and unregister-agent.
 o sendProtocolErrorMessage(int, KQMLmessage)
Send protocol error message occurs dusing transaction

SERVERADDRESSMISSING
INTERNALSOCKETERROR
MESSAGECONTENTERROR
SERVICECLOSED
PROTOCOLNOTSPECIFIED

Variables

 o SERVERADDRESSMISSING
 protected static final int SERVERADDRESSMISSING
Error codes : Server address(SMTP or FTP server) is not found

 o INTERNALSOCKETERROR
 protected static final int INTERNALSOCKETERROR
Error codes : Proxy server socket can not be created

 o NOTSUPPORTEDPROTOCOL
 protected static final int NOTSUPPORTEDPROTOCOL
Error codes : The protocol is not supported

 o MESSAGECONTENTERROR
 protected static final int MESSAGECONTENTERROR
Error codes : The content of KQML message is wrong

 o SERVICECLOSED
 protected static final int SERVICECLOSED
Error codes : The internet service is closed

 o PROTOCOLNOTSPECIFIED
 protected static final int PROTOCOLNOTSPECIFIED
Error codes : The protocol is not specified

Constructors

 o IPRouterRecvThread
 public IPRouterRecvThread()
Default Constructor.

 o IPRouterRecvThread
 public IPRouterRecvThread(String name)
Constructor with the Agent name. If you use this constructor, you should use set methods to set data members

Parameters:
name - Agent name
 o IPRouterRecvThread
 public IPRouterRecvThread(Socket client_socket,
                           int priority,
                           Address myaddress,
                           ConnectionTable connections,
                           MessageBuffer queue,
                           Security security,
                           String messageboxpath,
                           Hashtable reservedBook,
                           OffLineAgentTable offlinelist,
                           Vector disconnectlist) throws ConnectionException
Constructor, to be called from the serverthread after accepting a connection.

Parameters:
client_scoket - The socket for the remote client;
priority - The priority of the thread.
myaddress - My address to be sent to the Router to check security
connections - The connection table is passed as an argument.
queue - The Message Queue. Normally null. It will be created by this if null
security - The RouterSecurity
messageboxpath - The Message incoming box directory
reservedBook - The reservation table, passed from the RouterAction
offlinelist - The off line agent name list.
disconnectlist - The disconnected agent name list.
 o IPRouterRecvThread
 public IPRouterRecvThread(Address serveraddress,
                           int priority,
                           Address myaddress,
                           ConnectionTable connections,
                           MessageBuffer queue,
                           Security security,
                           String messageboxpath,
                           Hashtable reservedBook,
                           OffLineAgentTable offlinelist,
                           Vector disconnectlist,
                           ThreadGroup tg) throws ConnectionException
This constructor is called when an agent want to initialize a connection to the other agents, using Address

Parameters:
serveraddress - The Router address
priority - The priority of the thread.
myaddress - My address to be sent to the Router to check security
connections - The connection table is passed as an argument.
queue - The Message Queue. Normally null. It will be created by this if null
security - The RouterSecurity
messageboxpath - The Message incoming box directory
reservedBook - The reservation table, passed from the RouterAction
offlinelist - The off line agent name list.
disconnectlist - The disconnected agent name list.
tg - The thread group to which this receiver thread will be owned to
 o IPRouterRecvThread
 public IPRouterRecvThread(Address serveraddress,
                           Address myaddress,
                           ConnectionTable connections,
                           String messageboxpath,
                           Security security,
                           OffLineAgentTable offlinelist)
Router receiver thread to send off-line agent's messages back to the senders with error.

Parameters:
serveraddress - Router address
myaddress - Router address to be sent to the Router to check security
connections - The connection table is passed as an argument.
security - The RouterSecurity
messageboxpath - The Message incoming box directory
offlinelist - The off line agent name list.

Methods

 o processDefaultProtocol
 protected synchronized void processDefaultProtocol(KQMLmessage kqml)
Processing default protocols : disconnect-agent, reserve-message, list-agent, request-address, and unregister-agent. You need to extend this method if your router has extended capability other than message routing(e.g. to support another internet protocol such as SMTP, FTP,etc.)

Parameters:
kqml - Received KQML message
Overrides:
processDefaultProtocol in class RouterRecvThread
 o getEmailAddress
 public String getEmailAddress(Address addr)
Get email address from Address object

Parameters:
addr - Address
Returns:
null String("") if no email is specified. Email address(e.g. jhc@cdr.stanford.edu) if addr contains email address information.
 o sendProtocolErrorMessage
 public void sendProtocolErrorMessage(int code,
                                      KQMLmessage kqml)
Send protocol error message occurs dusing transaction

SERVERADDRESSMISSING
INTERNALSOCKETERROR
MESSAGECONTENTERROR
SERVICECLOSED
PROTOCOLNOTSPECIFIED

Parameters:
code - Code described above
kqml - KQML message modified to 'error' protocol

All Packages  Class Hierarchy  This Package  Previous  Next  Index