Package jade.core

Class ContainerID

  • All Implemented Interfaces:
    Concept, Term, Location, Serializable, Serializable

    public class ContainerID
    extends 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 Detail

      • DEFAULT_IMTP

        public static final 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​(String n,
                           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​(String n)
        Set the name of the described container.
        Parameters:
        n - The name to give to the described container.
      • getName

        public 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​(String p)
        Set the IMTP protocol used to reach the described container.
        Parameters:
        p - The name of the chosen IMTP protocol.
      • getProtocol

        public 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​(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 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 String getPort()
      • setPort

        public void setPort​(String port)
      • getID

        public 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 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 Object
        Returns:
        The string representation of this container ID.
      • equals

        public boolean equals​(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 Object
        Parameters:
        obje - The right hand side of the equality operation, the left hand side being the current 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 Object
      • setMain

        public void setMain​(Boolean main)
      • getMain

        public Boolean getMain()