All Packages Class Hierarchy This Package Previous Next Index
Class ProtocolLayer.IPThread
Abstract.Connection
|
+----Abstract.ReceiverThread
|
+----BaseLayer.BRecvThread
|
+----ProtocolLayer.IPThread
- public abstract class IPThread
- extends BRecvThread
Abstract class for diverse internet protocol implementations such as
FTP, SMTP,HTTP,POP3, etc.
Design concept :
For data transfer through internet, Server information, client information and actual
data will be necessary. Those three different types of information are stored to
_serverAddress, _myAddress and _cmdList data members.
Server information(service id,host name, port no) will be abstracted in _serverAddress
data member(Address object).
Client information(user name, password, email address, etc) will be abstract in _myAddress
data member(Address object).
Data transfer based on one time connection, not a consistent socket connection.
This means that when IPThread is created, it will be disconnected after it finishes
data transfer to or from the server.
Separate login and logout process from IPThread object. '_security' data member will take a
role to connect and to disconnect from the server.
Passing a set of command to perform data transfer automatically. Run() method will
perform the command list. Command will be store or retrieve file, email, etc.
This class is a subclass of BRecvThread. You can use getOneMessage() and writeMsg(String)
methods to receive/send string from/to the server.
What should do to implement new protocol?
Subclass IPThread and fill in abstract methods - processCommands(). Override connect() and
disconnect() method if necessary.
Subclass Security and fill in abstract methods - processClientLogin(),processClientLogout()
processServerLogin() and isValidAgent() methods. Normally you will not need to implement
processServerLogin() and isValidAgent() methods.
-
IPThread()
- Default Constructor.
-
IPThread(Address, int, Address, Security, ThreadGroup)
- This constructor is called when an agent want to initialize a connection
to the other agents, using Address.
-
IPThread(String)
- Create ReceiverThread with specific thread name
-
IPThread(ThreadGroup, String)
- Create ReceiverThread with specific thread name and Thread group.
-
connect()
- You should use security object to satisfy connection protocol
-
disconnect()
- You should use security object to satisfy connection protocol
-
getAgentAction()
- Get agent action
-
getCommandList()
- Get command list
-
processCommands()
- Process command list.
-
run()
- Override run() method to provide virtual abstract method for processing commands
You needs not to override this method.
-
setAgentAction(IPRouterClientAction)
- Set agent action
-
setCommandList(Vector)
- Set command list otherwise default command list provided
-
useProxy(boolean)
- Set use proxy if an applet case
IPThread
public IPThread()
- Default Constructor.
IPThread
public IPThread(String name)
- Create ReceiverThread with specific thread name
- Parameters:
- name - Agent name
IPThread
public IPThread(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
IPThread
public IPThread(Address serveraddress,
int priority,
Address myaddress,
Security security,
ThreadGroup tg) throws ConnectionException
- This constructor is called when an agent want to initialize a connection
to the other agents, using Address. 'security' object will be used to
satisfy connection protocol to server. Specific client information such as
user name,password,email address,etc can be added to myaddress object as
necessary.
- 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
setAgentAction
public void setAgentAction(IPRouterClientAction action)
- Set agent action
- Parameters:
- action - IPRouterClientAction object
getAgentAction
public IPRouterClientAction getAgentAction()
- Get agent action
- Returns:
- IPRouterClientAction object
setCommandList
public void setCommandList(Vector cmdlist)
- Set command list otherwise default command list provided
- Parameters:
- cmdlist - Command list vector
getCommandList
public Vector getCommandList()
- Get command list
- Returns:
- Command list
useProxy
public void useProxy(boolean yes)
- Set use proxy if an applet case
- Parameters:
- yes - True if use proxy
run
public void run()
- Override run() method to provide virtual abstract method for processing commands
You needs not to override this method.
- Overrides:
- run in class BRecvThread
processCommands
protected abstract void processCommands()
- Process command list. This is actual, main data transfer processing.
You should implement this method for a specific protocol.
connect
public void connect() throws ConnectionException
- You should use security object to satisfy connection protocol
disconnect
public void disconnect()
- You should use security object to satisfy connection protocol
All Packages Class Hierarchy This Package Previous Next Index