org.miv.mbox.net
Class MBoxLocator

java.lang.Object
  extended by org.miv.mbox.net.MBoxLocator
All Implemented Interfaces:
Serializable

public class MBoxLocator
extends Object
implements Serializable

Address of a message box. An object locator is made of three parts:

Some object locators only identify hosts when the name is not set. This correspond to what is called the "hostId". An host id is made according to the pattern "//" + hostname + ":" + port.

Since:
20040624
Author:
Antoine Dutot
See Also:
Serialized Form

Field Summary
protected  String hostId
          Computed host id (Host and port without the name) to avoid recreating it.
protected  String hostname
          Host name of the URL.
protected  String name
          Identifier part of the URL.
protected  int port
          Port of the URL.
 
Constructor Summary
MBoxLocator(String locator_string)
          New locator created by cutting the given string into fields.
MBoxLocator(String hostname, int port)
          New locator according to the host name and port only.
MBoxLocator(String hostname, int port, String name)
          New locator according to the host name, port and message box name.
 
Method Summary
 String getHostId()
          String containing only the hostname and port under the form "//hostname:port".
 String getHostname()
          Host name part.
 String getName()
          Name of this locator.
 int getPort()
          Port of this locator.
 void setHostname(String hostname)
          Change the host name of this locator.
 void setName(String name)
          Change the message box name of this locator.
 void setPort(int port)
          Change the port of this locator.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

hostname

protected String hostname
Host name of the URL.


port

protected int port
Port of the URL.


name

protected String name
Identifier part of the URL.


hostId

protected String hostId
Computed host id (Host and port without the name) to avoid recreating it.

Constructor Detail

MBoxLocator

public MBoxLocator(String hostname,
                   int port)
New locator according to the host name and port only.

Parameters:
hostname - Computer name.
port - Network port number.

MBoxLocator

public MBoxLocator(String hostname,
                   int port,
                   String name)
New locator according to the host name, port and message box name.

Parameters:
hostname - Computer name.
port - Network port number.
name - Message box identifier.

MBoxLocator

public MBoxLocator(String locator_string)
            throws IllegalArgumentException
New locator created by cutting the given string into fields. The expected format can be one of:

Parameters:
locator_string - The string to cut in fields.
Throws:
IllegalArgumentException - If the string does not complies with the expected format.
Method Detail

getHostname

public String getHostname()
Host name part.

Returns:
the host name only.

getPort

public int getPort()
Port of this locator.

Returns:
the port only.

getName

public String getName()
Name of this locator.

Returns:
the message box name only.

getHostId

public String getHostId()
String containing only the hostname and port under the form "//hostname:port". Two objects on the same host will have the same host identifier.

Returns:
The host identifier.

toString

public String toString()
Overrides:
toString in class Object

setHostname

public void setHostname(String hostname)
Change the host name of this locator.

Parameters:
hostname - Hostname of this locator.

setPort

public void setPort(int port)
Change the port of this locator.

Parameters:
port - Port of this locator.

setName

public void setName(String name)
Change the message box name of this locator.

Parameters:
name - Name of this locator.


Copyright © 2011. All Rights Reserved.