jade.core
Class ContainerID

java.lang.Object
  |
  +--jade.core.ContainerID
All Implemented Interfaces:
Concept, Location, Serializable, java.io.Serializable, Term

public class ContainerID
extends java.lang.Object
implements Location

A class identifying an aget container in the JADE platform. This class is a simple descriptor of JADE containers, holding their name and a few other data about them.

Author:
Giovanni Rimassa - Universita' di Parma
See Also:
Serialized Form

Field Summary
static java.lang.String DEFAULT_IMTP
          String constant identifying the JADE default Internal Message Transport Protocol, connecting different containers within the same JADE platform.
 
Constructor Summary
ContainerID()
          The default costructor builds an uninitialized container ID.
ContainerID(java.lang.String n, jade.mtp.TransportAddress a)
          Build a container ID with the given container name and transport address.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Equality operation over container IDs.
 java.lang.String getAddress()
          Retrieve the IP address of the host, the described container is running on.
 java.lang.String getID()
          Retrieve a string identifying the described container.
 java.lang.Boolean getMain()
           
 java.lang.String getName()
          Retrieve the name of the described container.
 java.lang.String getPort()
           
 java.lang.String getProtocol()
          Retrieves the IMTP protocol used to reach the described container.
 int hashCode()
          Hash code operation, compliant with identity-by-name.
 void setAddress(java.lang.String a)
          Set the IP address (as a string) of the host, the described container is running on.
 void setMain(java.lang.Boolean main)
           
 void setName(java.lang.String n)
          Set the name of the described container.
 void setPort(java.lang.String port)
           
 void setProtocol(java.lang.String p)
          Set the IMTP protocol used to reach the described container.
 java.lang.String toString()
          Retrieve a string representation for this container ID.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_IMTP

public static final java.lang.String DEFAULT_IMTP
String constant identifying the JADE default Internal Message Transport Protocol, connecting different containers within the same JADE platform.

See Also:
Constant Field Values
Constructor Detail

ContainerID

public ContainerID()
The default costructor builds an uninitialized container ID.


ContainerID

public ContainerID(java.lang.String n,
                   jade.mtp.TransportAddress a)
Build a container ID with the given container name and transport address.

Parameters:
n - The name of the described container.
a - The network address of the node where the described container is deployed.
Method Detail

setName

public void setName(java.lang.String n)
Set the name of the described container.

Parameters:
n - The name to give to the described container.

getName

public java.lang.String getName()
Retrieve the name of the described container.

Specified by:
getName in interface Location
Returns:
The container name if one is set, or null otherwise.

setProtocol

public void setProtocol(java.lang.String p)
Set the IMTP protocol used to reach the described container.

Parameters:
p - The name of the chosen IMTP protocol.

getProtocol

public java.lang.String getProtocol()
Retrieves the IMTP protocol used to reach the described container.

Specified by:
getProtocol in interface Location
Returns:
The name of the IMTP protocol used in the described container.

setAddress

public void setAddress(java.lang.String a)
Set the IP address (as a string) of the host, the described container is running on.

Parameters:
a - The string representation of the IP address of the host, the described container is running on.

getAddress

public java.lang.String getAddress()
Retrieve the IP address of the host, the described container is running on.

Specified by:
getAddress in interface Location
Returns:
The string representation of the IP address of the host, the described container is running on.

getPort

public java.lang.String getPort()

setPort

public void setPort(java.lang.String port)

getID

public java.lang.String getID()
Retrieve a string identifying the described container. The string is composed by the container name, the @ symbol and the transport URL string.

Specified by:
getID in interface Location
Returns:
The ID string for the described container.

toString

public java.lang.String toString()
Retrieve a string representation for this container ID. The string returned is the ID string of the described container.

Overrides:
toString in class java.lang.Object
Returns:
The string representation of this container ID.

equals

public boolean equals(java.lang.Object obj)
Equality operation over container IDs. Two ContainerID objects are considered equal if and only if their name is the same (a case insensitive string comparison is used.

Overrides:
equals in class java.lang.Object
Returns:
If the obj parameter is an instance of ContainerID class and has the same name (case insensitively) as the current object, then true is returned. Otherwise, this method returns false.

hashCode

public int hashCode()
Hash code operation, compliant with identity-by-name. This method returns an hash code for a container ID, so that two container IDs with the same name (case insensitively) have the same hash code.

Overrides:
hashCode in class java.lang.Object

setMain

public void setMain(java.lang.Boolean main)

getMain

public java.lang.Boolean getMain()


JADE