org.jboss.remoting
Class InvokerLocator

java.lang.Object
  extended by org.jboss.remoting.InvokerLocator
All Implemented Interfaces:
java.io.Serializable

public class InvokerLocator
extends java.lang.Object
implements java.io.Serializable

InvokerLocator is an object that indentifies a specific Invoker on the network, via a unique locator URI. The locator URI is in the format:

protocol://host[:port][/path[?param=value¶m2=value2]]

For example, a http based locator might be:

http://192.168.10.1:8081

An example Socket based locator might be:

socket://192.168.10.1:9999

An example RMI based locator might be:

rmi://localhost

NOTE: If no hostname is given (e.g., "socket://:5555"), then the hostname will automatically be resolved to the outside IP address of the local machine. If the given hostname is 0.0.0.0 and the system property "jboss.bind.address" is set, then the hostname will be replaced by the value associated with 'jboss.bind.address".

Version:
$Revision: 4993 $
Author:
Jeff Haynie, Tom Elrod
See Also:
Serialized Form

Field Summary
static java.lang.String ANY
          Indicates should address binding to all network interfaces (i.e.
static java.lang.String BIND_BY_HOST
          Public key to use when want to specify that locator look up local address by IP or host name.
static java.lang.String BYVALUE
          Constant to define the param name to be used when defining if marshalling should be by value, which means will be using local client invoker with cloning of payload value.
static java.lang.String CLIENT_LEASE
          Constant to define if client should try to automatically establish a lease with the server.
static java.lang.String CLIENT_LEASE_PERIOD
          Constant to define what the client lease period should be in the case that server side leasing is turned on.
static java.lang.String CONNECT_HOMES_KEY
          Parameter key used for specifying multiple homes to connect to.
protected  java.util.ArrayList connectHomes
           
static java.lang.String DATATYPE
          Constant to define the param name to be used when defining the data type.
static java.lang.String DATATYPE_CASED
           
static java.lang.String DEFAULT_CONNECT_PORT
          Parameter key used for specifying default connecting port for multihome InvokerLocator.
static java.lang.String DEFAULT_PORT
          Parameter key used for specifying default server bind port for multihme InvokerLocator.
static java.lang.String FORCE_REMOTE
          Constant to define the param name to be used when defining if marshalling should use remote client invoker instead of using local client invoker (even though both client and server invokers are within same JVM).
protected  java.util.ArrayList homes
           
static java.lang.String HOMES_KEY
          Parameter key used for specifying multiple binding homes.
protected  java.lang.String host
           
static java.lang.String LEGACY_PARSING
          Constant to define if InvokerLocator should use the old (ad hoc) parsing algorithm instead of the new, URI based, parsing algorithm.
protected static java.lang.Boolean legacyParsingFlag
           
static java.lang.String LOADER_PORT
          Constant to define what port the marshalling loader port resides on.
protected static org.jboss.logging.Logger log
           
static java.lang.String MARSHALLER
          Constant to define the param name to be used when defining the marshaller fully qualified classname
static java.lang.String MULTIHOME
          Serves as placeholder in host position when multiple hosts are given in the query part by way of the parameter "hosts".
protected  java.util.Map parameters
           
protected  java.lang.String path
           
protected  int port
           
protected  java.lang.String protocol
           
protected  java.lang.String query
           
static java.lang.String SERIALIZATIONTYPE
          Constant to define the param name to be used when defining the serialization type.
static java.lang.String SERIALIZATIONTYPE_CASED
           
static java.lang.String UNMARSHALLER
          Constant to define the param name to be used when defining the unmarshaller fully qualified classname
 
Constructor Summary
InvokerLocator(java.lang.String uri)
          Constructs the object used to identify a remoting server via simple uri format string (e.g.
InvokerLocator(java.lang.String protocol, java.lang.String host, int port, java.lang.String path, java.util.Map parameters)
          Constructs the object used to identify a remoting server.
 
Method Summary
static java.lang.String convertHomesListToString(java.util.List homes)
           
protected static java.lang.String decodePercent(java.lang.String s)
           
protected static java.lang.String encodePercent(java.lang.String s)
           
 boolean equals(java.lang.Object obj)
          Compares to see if Object passed is of type InvokerLocator and it's internal locator uri hashcode is same as this one.
static void extractHomes(java.lang.String homeList, java.util.List list, int defaultPort)
           
 java.lang.String findSerializationType()
           
 java.lang.String getActualHost()
           
 int getActualPort()
           
 java.util.List getConnectHomeList()
           
 java.lang.String getConnectHomes()
           
 Home getHomeInUse()
           
 java.util.List getHomeList()
           
 java.lang.String getHomes()
           
 java.lang.String getHost()
           
 java.lang.String getLocatorURI()
          return the locator URI, in the format:
 java.lang.String getOriginalURI()
          Gets the original uri passed to constructor (if there was one).
 java.util.Map getParameters()
           
 java.lang.String getPath()
           
 int getPort()
           
 java.lang.String getProtocol()
           
static boolean getUseLegacyParsing()
           
 int hashCode()
           
protected  boolean intersects(java.util.Collection c1, java.util.Collection c2)
           
 boolean isCompatibleWith(InvokerLocator other)
           
 boolean isMultihome()
           
 boolean isSameEndpoint(InvokerLocator compareMe)
          Compares to see if InvokerLocator passed represents the same physical remoting server endpoint as this one.
 ClientInvoker narrow()
          narrow this invoker to a specific RemoteClientInvoker instance
protected  void rebuildLocatorURI()
           
 void setConnectHomeList(java.util.List connectHomes)
           
 void setHomeInUse(Home homeInUse)
           
 void setHomeList(java.util.List homes)
           
static void setUseLegacyParsing(boolean flag)
           
 java.lang.String toString()
           
static InvokerLocator validateLocator(InvokerLocator locator)
          InvokerLocator leaves address 0.0.0.0 unchanged.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

log

protected static org.jboss.logging.Logger log

legacyParsingFlag

protected static java.lang.Boolean legacyParsingFlag

protocol

protected java.lang.String protocol

host

protected java.lang.String host

connectHomes

protected java.util.ArrayList connectHomes

homes

protected java.util.ArrayList homes

port

protected int port

path

protected java.lang.String path

query

protected java.lang.String query

parameters

protected java.util.Map parameters

ANY

public static final java.lang.String ANY
Indicates should address binding to all network interfaces (i.e. 0.0.0.0)

See Also:
Constant Field Values

BIND_BY_HOST

public static final java.lang.String BIND_BY_HOST
Public key to use when want to specify that locator look up local address by IP or host name.

See Also:
Constant Field Values

DATATYPE

public static final java.lang.String DATATYPE
Constant to define the param name to be used when defining the data type.

See Also:
Constant Field Values

DATATYPE_CASED

public static final java.lang.String DATATYPE_CASED
See Also:
Constant Field Values

SERIALIZATIONTYPE

public static final java.lang.String SERIALIZATIONTYPE
Constant to define the param name to be used when defining the serialization type.

See Also:
Constant Field Values

SERIALIZATIONTYPE_CASED

public static final java.lang.String SERIALIZATIONTYPE_CASED
See Also:
Constant Field Values

MARSHALLER

public static final java.lang.String MARSHALLER
Constant to define the param name to be used when defining the marshaller fully qualified classname

See Also:
Constant Field Values

UNMARSHALLER

public static final java.lang.String UNMARSHALLER
Constant to define the param name to be used when defining the unmarshaller fully qualified classname

See Also:
Constant Field Values

LOADER_PORT

public static final java.lang.String LOADER_PORT
Constant to define what port the marshalling loader port resides on.

See Also:
Constant Field Values

BYVALUE

public static final java.lang.String BYVALUE
Constant to define the param name to be used when defining if marshalling should be by value, which means will be using local client invoker with cloning of payload value.

See Also:
Constant Field Values

FORCE_REMOTE

public static final java.lang.String FORCE_REMOTE
Constant to define the param name to be used when defining if marshalling should use remote client invoker instead of using local client invoker (even though both client and server invokers are within same JVM).

See Also:
Constant Field Values

CLIENT_LEASE

public static final java.lang.String CLIENT_LEASE
Constant to define if client should try to automatically establish a lease with the server. Value for this parameter key should be either 'true' or 'false'.

See Also:
Constant Field Values

CLIENT_LEASE_PERIOD

public static final java.lang.String CLIENT_LEASE_PERIOD
Constant to define what the client lease period should be in the case that server side leasing is turned on. Value for this parameter key should be the number of milliseconds to wait before each client lease renewal and must be greater than zero in order to be recognized.

See Also:
Constant Field Values

LEGACY_PARSING

public static final java.lang.String LEGACY_PARSING
Constant to define if InvokerLocator should use the old (ad hoc) parsing algorithm instead of the new, URI based, parsing algorithm.

See Also:
Constant Field Values

MULTIHOME

public static final java.lang.String MULTIHOME
Serves as placeholder in host position when multiple hosts are given in the query part by way of the parameter "hosts". E.g.

socket://multihome:8888/?hosts=host1.jboss.org:host2.jboss.org

See Also:
Constant Field Values

CONNECT_HOMES_KEY

public static final java.lang.String CONNECT_HOMES_KEY
Parameter key used for specifying multiple homes to connect to. E.g.

socket://multihome/?connecthomes=host1.jboss.org:7777!host2.jboss.org:8888

See Also:
Constant Field Values

HOMES_KEY

public static final java.lang.String HOMES_KEY
Parameter key used for specifying multiple binding homes. E.g.

socket://multihome/?homes=a.org:66!b.org:77&homes=c.org:88!d.org:99

See Also:
Constant Field Values

DEFAULT_CONNECT_PORT

public static final java.lang.String DEFAULT_CONNECT_PORT
Parameter key used for specifying default connecting port for multihome InvokerLocator.

See Also:
Constant Field Values

DEFAULT_PORT

public static final java.lang.String DEFAULT_PORT
Parameter key used for specifying default server bind port for multihme InvokerLocator.

See Also:
Constant Field Values
Constructor Detail

InvokerLocator

public InvokerLocator(java.lang.String uri)
               throws java.net.MalformedURLException
Constructs the object used to identify a remoting server via simple uri format string (e.g. socket://myhost:7000). Note: the uri passed may not always be the one returned via call to getLocatorURI() as may need to change if port not specified, host is 0.0.0.0, etc. If need original uri that is passed to this constructor, need to call getOriginalURI().

Parameters:
uri -
Throws:
java.net.MalformedURLException

InvokerLocator

public InvokerLocator(java.lang.String protocol,
                      java.lang.String host,
                      int port,
                      java.lang.String path,
                      java.util.Map parameters)
Constructs the object used to identify a remoting server.

Parameters:
protocol -
host -
port -
path -
parameters -
Method Detail

getUseLegacyParsing

public static boolean getUseLegacyParsing()

setUseLegacyParsing

public static void setUseLegacyParsing(boolean flag)

validateLocator

public static InvokerLocator validateLocator(InvokerLocator locator)
                                      throws java.net.MalformedURLException
InvokerLocator leaves address 0.0.0.0 unchanged. Once serverBindAddress has been extracted from the InvokerLocator, it is necessary to transform 0.0.0.0 into an address that contacted over the network. See JBREM-687.

Throws:
java.net.MalformedURLException

extractHomes

public static void extractHomes(java.lang.String homeList,
                                java.util.List list,
                                int defaultPort)

convertHomesListToString

public static java.lang.String convertHomesListToString(java.util.List homes)

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Compares to see if Object passed is of type InvokerLocator and it's internal locator uri hashcode is same as this one. Note, this means is testing to see if not only the host, protocol, and port are the same, but the path and parameters as well. Therefore 'socket://localhost:9000' and 'socket://localhost:9000/foobar' would NOT be considered equal.

Overrides:
equals in class java.lang.Object
Parameters:
obj -
Returns:

isSameEndpoint

public boolean isSameEndpoint(InvokerLocator compareMe)
Compares to see if InvokerLocator passed represents the same physical remoting server endpoint as this one. Unlike the equals() method, this just tests to see if protocol, host, and port are the same and ignores the path and parameters.

Parameters:
compareMe -
Returns:

isCompatibleWith

public boolean isCompatibleWith(InvokerLocator other)

getLocatorURI

public java.lang.String getLocatorURI()
return the locator URI, in the format:

protocol://host[:port][/path[?param=value¶m2=value2]] Note, this may not be the same as the original uri passed as parameter to the constructor.

Returns:

getProtocol

public java.lang.String getProtocol()

getHost

public java.lang.String getHost()

getActualHost

public java.lang.String getActualHost()

isMultihome

public boolean isMultihome()

getConnectHomes

public java.lang.String getConnectHomes()

getConnectHomeList

public java.util.List getConnectHomeList()

setConnectHomeList

public void setConnectHomeList(java.util.List connectHomes)

getHomeInUse

public Home getHomeInUse()

setHomeInUse

public void setHomeInUse(Home homeInUse)

getHomes

public java.lang.String getHomes()

getHomeList

public java.util.List getHomeList()

setHomeList

public void setHomeList(java.util.List homes)

getPort

public int getPort()

getActualPort

public int getActualPort()

getPath

public java.lang.String getPath()

getParameters

public java.util.Map getParameters()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getOriginalURI

public java.lang.String getOriginalURI()
Gets the original uri passed to constructor (if there was one).

Returns:

narrow

public ClientInvoker narrow()
                     throws java.lang.Exception
narrow this invoker to a specific RemoteClientInvoker instance

Returns:
Throws:
java.lang.Exception

findSerializationType

public java.lang.String findSerializationType()

intersects

protected boolean intersects(java.util.Collection c1,
                             java.util.Collection c2)

rebuildLocatorURI

protected void rebuildLocatorURI()

encodePercent

protected static java.lang.String encodePercent(java.lang.String s)

decodePercent

protected static java.lang.String decodePercent(java.lang.String s)


Copyright ? 1998-2005 JBoss Inc . All Rights Reserved.