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: 4887 $
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 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 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.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
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
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.
 java.lang.String findSerializationType()
           
 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()
           
 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
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

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
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

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:

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()

getPort

public int getPort()

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()

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.