jade.core
Class ContainerID

java.lang.Object
  |
  +--jade.core.ContainerID
All Implemented Interfaces:
Concept, Location, java.io.Serializable, 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 transport address string.
 java.lang.String getID()
          Retrieve a string identifying the described container.
 java.lang.String getName()
          Retrieve the name of the described container.
 java.lang.String getProtocol()
          Retrieves the IMTP type used to reach the described container.
 int hashCode()
          Hash code operation, compliant with identity-by-name.
 void setAddress(java.lang.String a)
          Set the transport address string.
 void setName(java.lang.String n)
          Set the name of the described container.
 void setProtocol(java.lang.String p)
          Set the IMTP type 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 type used to reach the described container. Notice that presently this method does nothing, because only the default JADE IMTP is supported.

Parameters:
p - The name of the chosen IMTP.

getProtocol

public java.lang.String getProtocol()
Retrieves the IMTP type used to reach the described container. Notice that, since only the default JADE IMTP is supported, this method presently returns the DEFAULT_IMTP constant.

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

setAddress

public void setAddress(java.lang.String a)
Set the transport address string.

Parameters:
a - The string representation of the URL for the IMTP transport endpoint of the described container.

getAddress

public java.lang.String getAddress()
Retrieve the transport address string.

Specified by:
getAddress in interface Location
Returns:
The string representation of the URL for the IMTP transport endpoint of the described container. If no address string was set, null is returned.

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


JADE