com.reticular.agentBuilder.agent.perception
Class AgentInfo

java.lang.Object
  |
  +--com.reticular.agentBuilder.agent.perception.AgentInfo
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public class AgentInfo
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

Class for storing the common agent information used to initialize communications.

See Also:
Serialized Form

Constructor Summary
AgentInfo()
          It initializes the _commInfoArray and sets the IP address to the CURRENT_IP_ADDRESS.
AgentInfo(java.lang.String agentName, java.lang.String IPAddress, CommInfo commInfo)
          Constructor for the abstract AgentInfo object, to be invoked from the constructors of the subclasses.
AgentInfo(java.lang.String agentName, java.lang.String IPAddress, CommInfo[] commInfoArray, java.security.KeyPair keyPair)
          Constructor for the abstract AgentInfo object, to be invoked from the constructors of the subclasses.
AgentInfo(java.lang.String agentName, java.lang.String IPAddress, CommInfo commInfo, java.security.KeyPair keyPair)
          Constructor for the abstract AgentInfo object, to be invoked from the constructors of the subclasses.
 
Method Summary
 java.lang.Object clone()
          THE KEYPAIR CLONING IS NOT IMPLEMENTED.
 boolean equals(java.lang.Object other)
          Returns true if *this* AgentInfo object and the input other AgentInfo object have the same name, IP Address, comm type, and port number.
 java.lang.String getAgentName()
          Deprecated. Use getName instead.
 CommInfo[] getCommInfoArray()
          Get the comm type of the actual agent info object.
 CorbaCommInfo getCorbaCommInfo()
          Convenience routine for the interface.
 ESpeakCommInfo getESpeakCommInfo()
          Convenience routine for the interface.
 java.lang.String getIPAddress()
          Get the current IP address.
 java.security.KeyPair getKeyPair()
          Get the current key pair.
 java.lang.String getName()
          Get the agent name.
 CommInfo getPrimaryCommInfo()
          Returns the primary CommInfo object for this AgentInfo object.
 java.lang.String getPrimaryCommType()
          Returns the primary comm type for this agent info object.
 RmiCommInfo getRmiCommInfo()
          Convenience routine for the interface.
 SocketCommInfo getSocketCommInfo()
          Convenience routine for the interface.
 void setAgentName(java.lang.String agentName)
          Deprecated. Use setName method instead.
 void setCommInfoArray(CommInfo[] commInfoArray)
          Set the CommInfo array in this AgentInfo object.
 void setCorbaCommInfo(CorbaCommInfo info)
          Convenience routine for the interface.
 void setESpeakCommInfo(ESpeakCommInfo info)
          Convenience routine for the interface.
 void setIPAddress(java.lang.String IPAddress)
          Set the IP address to the input string.
 void setKeyPair(java.security.KeyPair keyPair)
          Set the key pair to the input key pair.
 void setName(java.lang.String agentName)
          Set the agent name to the input string.
 void setPrimaryCommInfo(CommInfo newCommInfo)
          Sets the primary CommInfo object for this AgentInfo object.
 void setRmiCommInfo(RmiCommInfo info)
          Convenience routine for the interface.
 void setSocketCommInfo(SocketCommInfo info)
          Convenience routine for the interface.
 java.lang.String toBNFString()
          Makes a string from the name, address, and all comm-infos for the agent.
 java.lang.String toString()
          Returns a string representation of this object.
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AgentInfo

public AgentInfo()
It initializes the _commInfoArray and sets the IP address to the CURRENT_IP_ADDRESS.

AgentInfo

public AgentInfo(java.lang.String agentName,
                 java.lang.String IPAddress,
                 CommInfo[] commInfoArray,
                 java.security.KeyPair keyPair)
Constructor for the abstract AgentInfo object, to be invoked from the constructors of the subclasses.
Parameters:
agentName - - String
IPAddress - - String, can be either the host name, e.g., "quincy.reticular.com", or the address string, e.g., "199.106.0.6".
commInfoArray - - CommInfo[]
keyPair - - KeyPair

AgentInfo

public AgentInfo(java.lang.String agentName,
                 java.lang.String IPAddress,
                 CommInfo commInfo,
                 java.security.KeyPair keyPair)
Constructor for the abstract AgentInfo object, to be invoked from the constructors of the subclasses.
Parameters:
agentName - - String
IPAddress - - String, can be either the host name, e.g., "quincy.reticular.com", or the address string, e.g., "199.106.0.6".
commInfo - - a single CommInfo object
keyPair - - KeyPair

AgentInfo

public AgentInfo(java.lang.String agentName,
                 java.lang.String IPAddress,
                 CommInfo commInfo)
Constructor for the abstract AgentInfo object, to be invoked from the constructors of the subclasses.
Parameters:
agentName - - String
IPAddress - - String, can be either the host name, e.g., "quincy.reticular.com", or the address string, e.g., "199.106.0.6".
commInfo - - a single CommInfo object
Method Detail

equals

public boolean equals(java.lang.Object other)
Returns true if *this* AgentInfo object and the input other AgentInfo object have the same name, IP Address, comm type, and port number. NOTE: this will need to be improved later. There could be a mismatch because thisAddress == harding.reticular.com and otherAddress is the numerical address, e.g., 199.106.0.6. Also, we may need to compare secondary comm types (?).
Overrides:
equals in class java.lang.Object
Parameters:
other - - Object, will be another AgentInfo object
Returns:
boolean

toString

public java.lang.String toString()
Returns a string representation of this object.
Overrides:
toString in class java.lang.Object
Returns:
String

toBNFString

public java.lang.String toBNFString()
Makes a string from the name, address, and all comm-infos for the agent.
Returns:
String

getName

public java.lang.String getName()
Get the agent name.
Returns:
String

setName

public void setName(java.lang.String agentName)
Set the agent name to the input string.
Parameters:
agentName - - String

getAgentName

public java.lang.String getAgentName()
Deprecated. Use getName instead.

Get the agent name.
Returns:
String

setAgentName

public void setAgentName(java.lang.String agentName)
Deprecated. Use setName method instead.

Set the agent name to the input string.
Parameters:
agentName - - String
Returns:
void

getIPAddress

public java.lang.String getIPAddress()
Get the current IP address. This may be a host name, such as quincy.reticular.com, or an address such as 199.106.0.6.
Returns:
String

setIPAddress

public void setIPAddress(java.lang.String IPAddress)
Set the IP address to the input string. This may be a host name, such as quincy.reticular.com, or an address such as 199.106.0.6. You may also use the the "CURRENT_IP_ADDRESS" defined in the Constants.java file to set the IP address to be the local host.
Parameters:
IPAddress - - String

getPrimaryCommType

public java.lang.String getPrimaryCommType()
Returns the primary comm type for this agent info object. This is the comm type stored in the first slot of the commInfoArray. The possible values for the comm type are the keywords defined in CommInfo, e.g., RMI_COMM_TYPE = "RMI". Returns "None" if there is no primary comm type.
Returns:
String

getPrimaryCommInfo

public CommInfo getPrimaryCommInfo()
Returns the primary CommInfo object for this AgentInfo object. This is the CommInfo object stored in the first slot of the commInfoArray. Returns null if first slot in the commInfoArray is null.
Returns:
CommInfo

setPrimaryCommInfo

public void setPrimaryCommInfo(CommInfo newCommInfo)
Sets the primary CommInfo object for this AgentInfo object.
Parameters:
newCommInfo - - CommInfo

setCommInfoArray

public void setCommInfoArray(CommInfo[] commInfoArray)
Set the CommInfo array in this AgentInfo object. Method signals an error if the input array is null or of different length than the existing _commInfoArray, which always has NUMBER_OF_COMM_TYPES slots.
Parameters:
CommInfo[] -  

getCommInfoArray

public CommInfo[] getCommInfoArray()
Get the comm type of the actual agent info object.
Returns:
CommInfo[]

setRmiCommInfo

public void setRmiCommInfo(RmiCommInfo info)
Convenience routine for the interface. Sets the RmiCommInfo into the array. If one exists it replaces it.
Parameters:
RmiCommInfo -  

getRmiCommInfo

public RmiCommInfo getRmiCommInfo()
Convenience routine for the interface. Finds (if possible) the RmiCommInfo and returns it. Null if there isn't one.
Returns:
RmiCommInfo

setSocketCommInfo

public void setSocketCommInfo(SocketCommInfo info)
Convenience routine for the interface. Sets the SocketCommInfo into the array. If one exists it replaces it.
Parameters:
SocketCommInfo -  

getSocketCommInfo

public SocketCommInfo getSocketCommInfo()
Convenience routine for the interface. Finds (if possible) the SocketCommInfo and returns it. Null if there isn't one.
Returns:
SocketCommInfo

setCorbaCommInfo

public void setCorbaCommInfo(CorbaCommInfo info)
Convenience routine for the interface. Sets the SocketCommInfo into the array. If one exists it replaces it.
Parameters:
ESpeakCommInfo -  

getCorbaCommInfo

public CorbaCommInfo getCorbaCommInfo()
Convenience routine for the interface. Finds (if possible) the SocketCommInfo and returns it. Null if there isn't one.
Returns:
ESpeakCommInfo

setESpeakCommInfo

public void setESpeakCommInfo(ESpeakCommInfo info)
Convenience routine for the interface. Sets the SocketCommInfo into the array. If one exists it replaces it.
Parameters:
ESpeakCommInfo -  

getESpeakCommInfo

public ESpeakCommInfo getESpeakCommInfo()
Convenience routine for the interface. Finds (if possible) the SocketCommInfo and returns it. Null if there isn't one.
Returns:
ESpeakCommInfo

getKeyPair

public java.security.KeyPair getKeyPair()
Get the current key pair.
Returns:
KeyPair

setKeyPair

public void setKeyPair(java.security.KeyPair keyPair)
Set the key pair to the input key pair.
Parameters:
keyPair - - KeyPair

clone

public java.lang.Object clone()
THE KEYPAIR CLONING IS NOT IMPLEMENTED.
Calls the super.clone() from lang.obj and catches the exceptions.
Overrides:
clone in class java.lang.Object
Returns:
Object