ch.epfl.lsr.apex
Class APEXEndpointAddress

java.lang.Object
  extended bych.epfl.lsr.apex.APEXEndpointAddress
All Implemented Interfaces:
Cloneable

public class APEXEndpointAddress
extends Object
implements Cloneable

The APEXEndpointAddress specifies a valid endpoint address including options for the corresponding address.

Author:
Marc Stoecklin

Constructor Summary
APEXEndpointAddress(String stringAddress)
          A new 'APEXEndpointAddress' parsed from a String.
APEXEndpointAddress(String stringAddress, APEXOption option)
          A new 'APEXEndpointAddress' parsed from a String containing one 'APEXOption'.
APEXEndpointAddress(String stringAddress, HashSet options)
          A new 'APEXEndpointAddress' parsed from a String containing a set of 'APEXOption s'.
 
Method Summary
 void addOption(APEXOption option)
          Adds an option to this endpoint address
 Object clone()
           
 boolean equals(Object o)
           
 String getApplication()
          Returns the application (subaddress) of the endpoint address
 String getDomain()
          Returns the domain of the endpoint address
 String getEndpointAddress()
          Returns to full endpoint address as a String
static APEXEndpointAddress getEndpointAddress(String sampleAddress)
          Static method to get an 'APEXEndpointAddress' from a sample String.
 String getGeneralEndpointAddress()
          Returns to general endpoint address (without subaddress) as a String.
 String getLocal()
          Returns the local part of the endpoint address
 String getRealDomain()
          Returns the domain of the endpoint address
 String getXMLOriginator()
           Returns an XML originator element according RFC3380.
 String getXMLOriginator(String indent)
           Returns an XML originator element according RFC3380 using a given indent, e.g. new String(" ") for two spaces indent.
 String getXMLRecipient()
           Returns an XML recipient element according RFC3380.
 String getXMLRecipient(String indent)
           Returns an XML recipient element according RFC3380 using a given indent, e.g. new String(" ") for two spaces indent.
 int hashCode()
           
 void setApplication(String application)
           If an endpoint formed by an endpoint name and a subaddress should be created, either the direct way aea = new APEXEndpointAddress("fred/appl=wb@example.com"); or aea = new APEXEndpointAddress("fred@example.com"); aea.setApplication("appl=wb"); can be used, e.g. if later the application should be set.
 String toString()
           
static String translateToRealAddress(String address)
          Translates a domain address to a real Internet addressed, either a domain name to be resolved or a domain literal (e.g. [10.1.1.1]) to an IP address.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

APEXEndpointAddress

public APEXEndpointAddress(String stringAddress)
                    throws APEXParsingException
A new 'APEXEndpointAddress' parsed from a String.

Parameters:
stringAddress - Endpoint address as a String
Throws:
APEXParsingException - thrown if the endpoint address is not valid

APEXEndpointAddress

public APEXEndpointAddress(String stringAddress,
                           HashSet options)
                    throws APEXParsingException
A new 'APEXEndpointAddress' parsed from a String containing a set of 'APEXOption s'.

Parameters:
stringAddress - Endpoint address as a String
options - A set of options which are applicable for this address
Throws:
APEXParsingException - thrown if the endpoint address is not valid

APEXEndpointAddress

public APEXEndpointAddress(String stringAddress,
                           APEXOption option)
                    throws APEXParsingException
A new 'APEXEndpointAddress' parsed from a String containing one 'APEXOption'.

Parameters:
stringAddress - Endpoint address as a String
option - An option applicable for this address
Throws:
APEXParsingException - thrown if the endpoint address is not valid
Method Detail

setApplication

public void setApplication(String application)

If an endpoint formed by an endpoint name and a subaddress should be created, either the direct way

  aea = new APEXEndpointAddress("fred/appl=wb@example.com");

or

  aea = new APEXEndpointAddress("fred@example.com"); aea.setApplication("appl=wb");

can be used, e.g. if later the application should be set.

Parameters:
application - Application to be set for this endpoint address

addOption

public void addOption(APEXOption option)
Adds an option to this endpoint address

Parameters:
option - The option to be added

getEndpointAddress

public String getEndpointAddress()
Returns to full endpoint address as a String

Returns:
The endpoint address

getGeneralEndpointAddress

public String getGeneralEndpointAddress()
Returns to general endpoint address (without subaddress) as a String.

Returns:
The general endpoint address (without subaddress)

getLocal

public String getLocal()
Returns the local part of the endpoint address

Returns:
The local part

getDomain

public String getDomain()
Returns the domain of the endpoint address

Returns:
The domain

getRealDomain

public String getRealDomain()
Returns the domain of the endpoint address

Returns:
The domain

translateToRealAddress

public static String translateToRealAddress(String address)
Translates a domain address to a real Internet addressed, either a domain name to be resolved or a domain literal (e.g. [10.1.1.1]) to an IP address.

Parameters:
address - The addresse to be translated
Returns:
The resulting real address

getApplication

public String getApplication()
Returns the application (subaddress) of the endpoint address

Returns:
The domain

getEndpointAddress

public static APEXEndpointAddress getEndpointAddress(String sampleAddress)
                                              throws APEXParsingException
Static method to get an 'APEXEndpointAddress' from a sample String.

Parameters:
sampleAddress - A sample endpoint address
Returns:
A valid 'APEXEndpointAddress'
Throws:
APEXParsingException - thrown if the sample address is not valid

getXMLRecipient

public String getXMLRecipient()

Returns an XML recipient element according RFC3380.

 
 

if any options are present, they take as well part of the XML element

Returns:
XML recipient element

getXMLOriginator

public String getXMLOriginator()

Returns an XML originator element according RFC3380.

 
 

if any options are present, they take as well part of the XML element

Returns:
XML originator element

getXMLRecipient

public String getXMLRecipient(String indent)

Returns an XML recipient element according RFC3380 using a given indent, e.g. new String(" ") for two spaces indent.

 
 

if any options are present, they take as well part of the XML element

Parameters:
indent - an indent, e.g. new String(" ") for two spaces indent
Returns:
XML recipient element

getXMLOriginator

public String getXMLOriginator(String indent)

Returns an XML originator element according RFC3380 using a given indent, e.g. new String(" ") for two spaces indent.

 
 

if any options are present, they take as well part of the XML element

Parameters:
indent - an indent, e.g. new String(" ") for two spaces indent
Returns:
XML originator element

clone

public Object clone()
             throws CloneNotSupportedException
Throws:
CloneNotSupportedException

equals

public boolean equals(Object o)

hashCode

public int hashCode()

toString

public String toString()