Project JXTA

net.jxta.endpoint
Class EndpointAddress

java.lang.Object
  extended bynet.jxta.endpoint.EndpointAddress

public class EndpointAddress
extends Object

Describes a destination to which JXTA messages may be sent. This may be:

An Endpoint Address is composed of four components: a protocol (also called a scheme), a protocol address (also called an authority), an optional service name and optional service parameter.

The Protocol

The Protocol Address

The Service Name (optional)

The Service Parameter (optional)

See Also:
EndpointService, MessageTransport, Messenger, PipeService

Constructor Summary
EndpointAddress()
          Deprecated. EndpointAddress works better if it is immutable.
EndpointAddress(byte[] bytes)
          Deprecated. There isn't really ever a good reason to use this since it has to assume the character encoding.
EndpointAddress(EndpointAddress base, String service, String serviceParam)
          Constructor which builds an endpoint address from a base address and replacement service and params
EndpointAddress(ID id, String service, String serviceParam)
          Constructor which builds an address from a standard jxta id and a service and param.
EndpointAddress(String address)
          Builds an Address from a string
EndpointAddress(String protocol, String address, String service, String serviceParam)
          Constructor which builds an address the four standard constituent parts.
EndpointAddress(URI address)
          Create an EndpointAddress whose value is initialized from the provided URI.
 
Method Summary
 Object clone()
          
 boolean equals(Object target)
          
 byte[] getBytes()
          Deprecated. There isn't really ever a good reason to use this since it has to assume the character encoding.
 String getProtocolAddress()
          Return a String that contains the protocol address contained in the EndpointAddress
 String getProtocolName()
          Return a String that contains the name of the protocol contained in the EndpointAddress
 String getServiceName()
          Return a String that contains the service name contained in the EndpointAddress
 String getServiceParameter()
          Return a String that contains the service parameter contained in the EndpointAddress
 int hashCode()
          
 void setProtocolAddress(String address)
          Deprecated. EndpointAddress works better if it is immutable.
 void setProtocolName(String name)
          Deprecated. EndpointAddress works better if it is immutable.
 void setServiceName(String name)
          Deprecated. EndpointAddress works better if it is immutable.
 void setServiceParameter(String param)
          Deprecated. EndpointAddress works better if it is immutable.
 String toString()
          
 URI toURI()
          Return a URI which represents the endpoint address.
static EndpointAddress unmodifiableEndpointAddress(EndpointAddress address)
          Returns an unmodifiable clone of the provided EndpointAddress.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EndpointAddress

public EndpointAddress()
Deprecated. EndpointAddress works better if it is immutable.

Builds an empty (invalid) Endpoint Address.


EndpointAddress

public EndpointAddress(String address)
Builds an Address from a string

Parameters:
address - the string representation of the address.

EndpointAddress

public EndpointAddress(URI address)
Create an EndpointAddress whose value is initialized from the provided URI.

Parameters:
address - the URI representation of the address.

EndpointAddress

public EndpointAddress(byte[] bytes)
Deprecated. There isn't really ever a good reason to use this since it has to assume the character encoding.

Constructor which builds an address from a byte array containing a UTF-8 string.

Parameters:
bytes - byte array containing a UTF-8 string of the endpoint address to be constructed.

EndpointAddress

public EndpointAddress(EndpointAddress base,
                       String service,
                       String serviceParam)
Constructor which builds an endpoint address from a base address and replacement service and params

Parameters:
base - The EndpointAddress on which the new EndpointAddress will be based
service - provides an alternate service for the new EndpointAddress.
serviceParam - provides and alternate service parameter for the new EndpointAddress

EndpointAddress

public EndpointAddress(String protocol,
                       String address,
                       String service,
                       String serviceParam)
Constructor which builds an address the four standard constituent parts.

Parameters:
address - Describes the destination entity of this address.
protocol - Describes the method of addressing used by the remainder of the endpoint address.
service - String containing the name of the destination service
serviceParam - String containing the service parameter

EndpointAddress

public EndpointAddress(ID id,
                       String service,
                       String serviceParam)
Constructor which builds an address from a standard jxta id and a service and param.

Parameters:
id - the ID which will be the destination of the endpoint address
service - String containing the name of the destination service
serviceParam - String containing the service parameter
Method Detail

unmodifiableEndpointAddress

public static EndpointAddress unmodifiableEndpointAddress(EndpointAddress address)
Returns an unmodifiable clone of the provided EndpointAddress.

Parameters:
address - the address to be cloned.
Returns:
the unmodifiable address clone.

clone

public Object clone()


equals

public boolean equals(Object target)


hashCode

public int hashCode()


toString

public String toString()


toURI

public URI toURI()
Return a URI which represents the endpoint address.

Returns:
a URI which represents the endpoint address.

getBytes

public byte[] getBytes()
Deprecated. There isn't really ever a good reason to use this since it has to assume the character encoding.

Get a byte array containing a UTF-8 representation of the address.

Returns:
a byte array containing the bytes of a UTF-8 representation of the endpoint address.

getProtocolName

public String getProtocolName()
Return a String that contains the name of the protocol contained in the EndpointAddress

Returns:
a String containing the protocol name

getProtocolAddress

public String getProtocolAddress()
Return a String that contains the protocol address contained in the EndpointAddress

Returns:
a String containing the protocol address

getServiceName

public String getServiceName()
Return a String that contains the service name contained in the EndpointAddress

Returns:
a String containing the service name

getServiceParameter

public String getServiceParameter()
Return a String that contains the service parameter contained in the EndpointAddress

Returns:
a String containing the protocol name

setProtocolName

public void setProtocolName(String name)
Deprecated. EndpointAddress works better if it is immutable.

Set the protocol name.

Parameters:
name - String containing the name of the protocol

setProtocolAddress

public void setProtocolAddress(String address)
Deprecated. EndpointAddress works better if it is immutable.

Set the protocol address.

Parameters:
address - String containing the peer address.

setServiceName

public void setServiceName(String name)
Deprecated. EndpointAddress works better if it is immutable.

Set the service name.

Parameters:
name - String containing the name of the destination service

setServiceParameter

public void setServiceParameter(String param)
Deprecated. EndpointAddress works better if it is immutable.

Set the service parameter

Parameters:
param - String containing the service parameter

JXTA J2SE