All Packages Class Hierarchy This Package Previous Next Index
Class Abstract.Address
Abstract.Address
- public class Address
Connection Address class.
The Address class abstracts necessary information for connection.
The core idea of the Address class is :
- Rather than hard-coding on the program, you can specify static connection
data on the file. When an agent is initialized, it will read the Address
file and construct AddressTable. The AddressTable can update connection data
dynamically if necessary.
You should specify at least one Address data if your agent is an
application(not an applet) like :
MyAgent,java.stanford.edu,1234,ServerThread,MyAgent Server
If your agent wants to communicate with other agent, you should add a line
OtherAgent,sort.aol.com,3456,ReceiverThread,(Sort Service Agent)
As you note, the connection data you specified in Address file is static data
in a sense that you should know the other agent name,host, port.
-
Address()
- Default Constructor
-
Address(String)
- Constructor by reading one line in the Address file
You can pass one line read from the Adress file which has the format
ID,Host,port,type,description
The 'description' field is optional.
-
Address(String, String, int, String, String)
- Constructor given agent name, host, port , type and description.
-
getDescription()
- Get Agent Description
-
getHost()
- Get Agent Host Name
-
getID()
- Get Agent Name
-
getPort()
- Get Agent Port
-
getType()
- Get an agent type(class name)
-
setDescription(String)
- Set description
-
setHost(String)
- Set Agent Internet host name
-
setID(String)
- Set Agent Name
-
setPort(int)
-
Set Agent Connection port
-
setType(String)
- Set type
-
toString()
-
toString override.
Address
public Address()
- Default Constructor
Address
public Address(String id,
String host,
int port,
String type,
String description)
- Constructor given agent name, host, port , type and description.
- Parameters:
- id - Name of the Agent
- host - Internet address of the agent(IP address is not supported)
- port - Port number
- type - Normally message-method
- description - String description of the Address. Within the description,
comma(',') is not allowed.
Address
public Address(String addrLine) throws ConnectionException
- Constructor by reading one line in the Address file
You can pass one line read from the Adress file which has the format
ID,Host,port,type,description
The 'description' field is optional.
- Parameters:
- addrLine - One line read from the Address file
- Throws: ConnectionException
- Occurs when the input parameter line is not
well formated
setID
public void setID(String id)
- Set Agent Name
- Parameters:
- id - Agent Name
- Returns:
- None
setHost
public void setHost(String host)
- Set Agent Internet host name
- Parameters:
- host - Host name
- Returns:
- None
setPort
public void setPort(int port)
- Set Agent Connection port
- Parameters:
- port - Port number
- Returns:
- None
setType
public void setType(String type)
- Set type
- Parameters:
- type - Agent type
setDescription
public void setDescription(String desc)
- Set description
- Parameters:
- desc - Description
getID
public String getID()
- Get Agent Name
- Returns:
- _id
getHost
public String getHost()
- Get Agent Host Name
- Returns:
- _host
getPort
public int getPort()
- Get Agent Port
- Returns:
- _port
getType
public String getType()
- Get an agent type(class name)
- Returns:
- _type of the Address
getDescription
public String getDescription()
- Get Agent Description
- Returns:
- _description
toString
public String toString()
- toString override. Comma separated string will be returned
- Returns:
- "id,host,port,type,description"
All Packages Class Hierarchy This Package Previous Next Index