com.jproxy.proxy
Class Tunnel

java.lang.Object
  extended bycom.jproxy.proxy.Tunnel
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
CallbackTunnel, HTTPTunnel

public abstract class Tunnel
extends java.lang.Object
implements java.io.Serializable

Abstract class that is responsible for client-side data marshalling and client-side object distribution protocol implementation. It has helper-methods for object instantiation and getting existing instance. If stub for remote object has to be returned as result of method call then the instance of the class is created on tunneling server side, otherwise instance is created on the invoking client. The class also declares constants for Tunneling environment. Most of the constants may be used to customize tunneling for client needs.

See Also:
Serialized Form

Field Summary
static java.lang.String CALLBACK_INTERFACES
          The Callback Object could be ANY object that is instance of the class implementing either interface from the list.
static java.lang.String CALLBACK_ONE_WAY
           
static java.lang.String CALLBACK_PENDING_TIME
          A max pending time (mills) for client's polling request.
static java.lang.String CALLBACK_RECEIVER_TIMEOUT
           
static java.lang.String CALLBACK_RETURN_RESULT
           
static java.lang.String CALLBACK_TUNNEL_CLASS
          A class name of asynchronous tunnel.
static java.lang.String CALLBACK_VALIDATE_RECEIVER
           
static java.util.Hashtable callbackTunnels
          All callback tunnels hashed by URL String of Tunneling server.
static java.lang.String CLIENT_INVOCATION_INTERCEPTOR
           
static java.lang.String CONCURRENT_CALLBACKS
           
static java.lang.String DATASTACK_ENABLED
          A flag enabling remote call optimization.
static long defaultSessionId
           
static java.util.Properties env
          All tunnels hashed by URL String of Tunneling server
static java.lang.Class features
           
static java.lang.String HOST_URL
          A URL String of Tunneling server
static java.lang.String INITIAL_CONTEXT_FACTORY
          The classname of InitialContectFactory of remote JNDI
static java.lang.String INPROCESS_CALL_OPTIMIZATION_ENABLED
          Client-Server property.
static java.lang.String INVOCATOR_THREADING_ENABLED
           
static java.lang.String JAAS_CONFIGURATION_NAME
          A JAAS Configuration name.
static java.lang.String LOG_CLASS
          A class used as output for log information.
static java.lang.String LOG_LEVEL
          A verbosity level of loggin: one og folowing: FATAL,ERROR,WARNING,INFORMATION,DEBUG,NONE or abbreviation: F,E,W,I,D,N
static java.lang.String LOW_VERSION
          Client-Server read-only property.
static java.lang.String MAX_FAILOVER_ATTEMPTS
          A max number of failover invocation attepts
static java.lang.String NATIVE_EXCEPTIONS_ENABLED
           
static java.lang.String NETWORK_PERFORMANCE_THRESHOLD
           
static java.lang.String NONREMOTE_CLASSES
          A list of class names patterns.
static java.lang.String NONREMOTE_INTERFACES
          A list of interface names patterns.
static java.lang.String OBJECT_TTL
          A time-to-live of remote object in mills
static java.lang.String PROVIDER_URL
           
static java.lang.String REMOTE_CLASSES
          A list of class names.
static java.lang.String REMOTE_INTERFACES
          A list of interface names.
static java.lang.String SERVER_CLASSPATH
          A classpath used by javac compiler for dinamic stub generation
static java.lang.String SERVER_INVOCATION_INTERCEPTOR
           
static java.lang.String SOAP_INIT_ARGUMENTS
           
static java.lang.String SOAP_URL_FROM_WSDL
           
static java.lang.String SOCKET_TIMEOUT
          A socket timeout in mills.
static java.lang.String STUB_REUSE_ENABLED
           
static java.lang.String STUBGEN_CODEBASE_PATH_MAPPING
           
static java.lang.String STUBGEN_COMPILER_OPTIONS
          An options used by javac compiler for dinamic stub generation
static java.lang.String TIMEOUT_UPDATE_ENABLED
           
static java.lang.String TUNNEL_CLASS
          A class name of synchronous tunnel.
static java.lang.String TUNNEL_URL
          A tunneling URL.
static java.util.Hashtable tunnels
          All tunnels hashed by URL String of Tunneling server.
static java.lang.String USE_JPROXY_SSL_SOCKET_FACTORY
          A flag enabling JProxy SSLProxySocketFactory.
 java.lang.String version
           
static java.lang.String VERSION
          Client-Server read-only property.
 
Constructor Summary
Tunnel()
           
 
Method Summary
static Tunnel createCallbackTunnel(CallbackServer server)
           
 Marshalable createConstructRequest(long sessionId, java.lang.String className, java.lang.String[] interfaceNames, java.lang.Class[] argTypes, java.lang.Object[] args)
           
 Marshalable createDestructRequest(long sessionId, long objectId)
           
 Marshalable createInvokeRequest(long sessionId, long objectId, java.lang.reflect.Method method, java.lang.Object[] args)
           
 Marshalable createReferenceRequest(long sessionId, long objectId)
           
 Marshalable createSessionRequest(long[] sessionIds)
           
 Marshalable createStaticInvokeRequest(long sessionId, java.lang.String className, java.lang.String methodName, java.lang.Class[] argTypes, java.lang.Object[] args)
           
 Marshalable createStubRequest(long sessionId, java.lang.String[] interfaceNames)
           
static Tunnel createTunnel(java.lang.String serverUrlStr)
           
abstract  CallbackClient getCallbackClient()
           
 java.lang.Object[] getConstructorParameters()
           
static IEventListener getEventListener()
           
 java.lang.Object getInstance(long sessionId, long objectId)
          The helper method for getting existing instance of Tunneling object located on Tunneling server by given objectId
 java.lang.String getServerUrl()
           
 long getTimeout()
          The method returns communication timeout for tunnel (measured in milliseconds).
static void init()
           
abstract  java.lang.Object invoke(java.lang.Object data)
          The method sends marshaled data and unmurshal result for remote call.
 java.lang.Object invokeMethod(long objectId, java.lang.reflect.Method method, java.lang.Object[] args, boolean checkForCallbacks)
          The method delegates calls to Tunnel object.
 Marshalable invokeRequest(Marshalable data)
           
 java.lang.Object invokeStaticMethod(java.lang.String className, java.lang.String methodName, java.lang.Class[] argTypes, java.lang.Object[] args)
           
static java.lang.Object invokeStaticMethod(java.lang.String serverUrlStr, java.lang.String className, java.lang.String methodName, java.lang.Class[] argTypes, java.lang.Object[] args)
           
static void loadProperties()
           
 java.lang.Object newInstance(java.lang.String className, java.lang.String[] interfaceNames, java.lang.Class[] argTypes, java.lang.Object[] args)
          The helper method for creating new instance of Tunneling object on Tunneling server
static java.lang.Object newInstance(java.lang.String serverUrlStr, java.lang.String className, java.lang.String[] interfaceNames, java.lang.Class[] argTypes, java.lang.Object[] args)
           
 Tunnelizable newStub(long sessionId, java.lang.String[] interfaceNames)
          The helper method for creating new instance of Tunneling object on Tunneling server
 void removeInstance(long sessionId, Tunnelizable object)
           
static void setEventListener(IEventListener _eventListener)
           
 void setServerUrl(java.lang.String _serverUrlStr)
           
 void setTimeout(long _timeout)
          The method sets communication timeout for tunnel (measured in milliseconds).
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

env

public static transient java.util.Properties env
All tunnels hashed by URL String of Tunneling server


features

public static transient java.lang.Class features

defaultSessionId

public static transient long defaultSessionId

tunnels

public static java.util.Hashtable tunnels
All tunnels hashed by URL String of Tunneling server.


callbackTunnels

public static java.util.Hashtable callbackTunnels
All callback tunnels hashed by URL String of Tunneling server.


VERSION

public static final java.lang.String VERSION
Client-Server read-only property. JProxy Tunnel Version

See Also:
Constant Field Values

LOW_VERSION

public static final java.lang.String LOW_VERSION
Client-Server read-only property. JProxy Tunnel Version

See Also:
Constant Field Values

REMOTE_CLASSES

public static final java.lang.String REMOTE_CLASSES
A list of class names. If result of remote call is instance of one of folowing classes then jproxy creates remote stub for it.

See Also:
Constant Field Values

NONREMOTE_CLASSES

public static final java.lang.String NONREMOTE_CLASSES
A list of class names patterns. The classes with names starting with the patterns will not be remoted

See Also:
Constant Field Values

REMOTE_INTERFACES

public static final java.lang.String REMOTE_INTERFACES
A list of interface names. If result of remote call is instance of one of folowing classes then jproxy creates remote stub for it.

See Also:
Constant Field Values

NONREMOTE_INTERFACES

public static final java.lang.String NONREMOTE_INTERFACES
A list of interface names patterns. The classes with names starting with the patterns will not be remoted

See Also:
Constant Field Values

TUNNEL_CLASS

public static final java.lang.String TUNNEL_CLASS
A class name of synchronous tunnel. Default is HTTPTunnel.

See Also:
Constant Field Values

CALLBACK_TUNNEL_CLASS

public static final java.lang.String CALLBACK_TUNNEL_CLASS
A class name of asynchronous tunnel. Default is HttpCallbackTunnel.

See Also:
Constant Field Values

LOG_LEVEL

public static final java.lang.String LOG_LEVEL
A verbosity level of loggin: one og folowing: FATAL,ERROR,WARNING,INFORMATION,DEBUG,NONE or abbreviation: F,E,W,I,D,N

See Also:
Constant Field Values

LOG_CLASS

public static final java.lang.String LOG_CLASS
A class used as output for log information. It inherited from PrintStream It the property not specifyed then System.out is used.

See Also:
Constant Field Values

TUNNEL_URL

public static final java.lang.String TUNNEL_URL
A tunneling URL. The context is used to construct complete URL to access servlet. Default is http://localhost/proxyservlet/servlet/proxyservlet

See Also:
Constant Field Values

SERVER_INVOCATION_INTERCEPTOR

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

CLIENT_INVOCATION_INTERCEPTOR

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

OBJECT_TTL

public static final java.lang.String OBJECT_TTL
A time-to-live of remote object in mills

See Also:
Constant Field Values

SOCKET_TIMEOUT

public static final java.lang.String SOCKET_TIMEOUT
A socket timeout in mills. 0 - infinit

See Also:
Constant Field Values

CALLBACK_PENDING_TIME

public static final java.lang.String CALLBACK_PENDING_TIME
A max pending time (mills) for client's polling request. If CallbackServer does not have any callback requests then during the time client polling call will be blocked.

See Also:
Constant Field Values

CALLBACK_VALIDATE_RECEIVER

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

CALLBACK_RECEIVER_TIMEOUT

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

CALLBACK_RETURN_RESULT

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

CALLBACK_ONE_WAY

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

MAX_FAILOVER_ATTEMPTS

public static final java.lang.String MAX_FAILOVER_ATTEMPTS
A max number of failover invocation attepts

See Also:
Constant Field Values

USE_JPROXY_SSL_SOCKET_FACTORY

public static final java.lang.String USE_JPROXY_SSL_SOCKET_FACTORY
A flag enabling JProxy SSLProxySocketFactory.

See Also:
Constant Field Values

DATASTACK_ENABLED

public static final java.lang.String DATASTACK_ENABLED
A flag enabling remote call optimization. During this optimization, all calls that return void are sent as one request to the server.

See Also:
Constant Field Values

SERVER_CLASSPATH

public static final java.lang.String SERVER_CLASSPATH
A classpath used by javac compiler for dinamic stub generation

See Also:
Constant Field Values

STUBGEN_COMPILER_OPTIONS

public static final java.lang.String STUBGEN_COMPILER_OPTIONS
An options used by javac compiler for dinamic stub generation

See Also:
Constant Field Values

JAAS_CONFIGURATION_NAME

public static final java.lang.String JAAS_CONFIGURATION_NAME
A JAAS Configuration name. Default value is "other". For JBoss must be "client-login".

See Also:
Constant Field Values

HOST_URL

public static final java.lang.String HOST_URL
A URL String of Tunneling server

See Also:
Constant Field Values

INITIAL_CONTEXT_FACTORY

public static final java.lang.String INITIAL_CONTEXT_FACTORY
The classname of InitialContectFactory of remote JNDI

See Also:
Constant Field Values

PROVIDER_URL

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

INVOCATOR_THREADING_ENABLED

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

NETWORK_PERFORMANCE_THRESHOLD

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

NATIVE_EXCEPTIONS_ENABLED

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

STUB_REUSE_ENABLED

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

TIMEOUT_UPDATE_ENABLED

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

CALLBACK_INTERFACES

public static final java.lang.String CALLBACK_INTERFACES
The Callback Object could be ANY object that is instance of the class implementing either interface from the list.

See Also:
Constant Field Values

STUBGEN_CODEBASE_PATH_MAPPING

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

SOAP_INIT_ARGUMENTS

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

SOAP_URL_FROM_WSDL

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

CONCURRENT_CALLBACKS

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

INPROCESS_CALL_OPTIMIZATION_ENABLED

public static final java.lang.String INPROCESS_CALL_OPTIMIZATION_ENABLED
Client-Server property. Default value - "false" If set to "true" then if client and server are running in same process, JProxy will pass remote objects directly without remote communication (and serialization). If set to "false" it increases performance. For using with Axis the property must be set to "false" beacause Axis doesnot recognize inprocess calls.

See Also:
Constant Field Values

version

public java.lang.String version
Constructor Detail

Tunnel

public Tunnel()
Method Detail

init

public static void init()

loadProperties

public static void loadProperties()

createCallbackTunnel

public static Tunnel createCallbackTunnel(CallbackServer server)

createTunnel

public static Tunnel createTunnel(java.lang.String serverUrlStr)

invoke

public abstract java.lang.Object invoke(java.lang.Object data)
                                 throws java.lang.Throwable
The method sends marshaled data and unmurshal result for remote call. The method is executed on the client.

Parameters:
data - Data object
Throws:
TunnelException
java.lang.Throwable

getCallbackClient

public abstract CallbackClient getCallbackClient()
                                          throws java.lang.Throwable
Throws:
java.lang.Throwable

getConstructorParameters

public java.lang.Object[] getConstructorParameters()

getServerUrl

public java.lang.String getServerUrl()

setServerUrl

public void setServerUrl(java.lang.String _serverUrlStr)

createStubRequest

public Marshalable createStubRequest(long sessionId,
                                     java.lang.String[] interfaceNames)

createConstructRequest

public Marshalable createConstructRequest(long sessionId,
                                          java.lang.String className,
                                          java.lang.String[] interfaceNames,
                                          java.lang.Class[] argTypes,
                                          java.lang.Object[] args)

createStaticInvokeRequest

public Marshalable createStaticInvokeRequest(long sessionId,
                                             java.lang.String className,
                                             java.lang.String methodName,
                                             java.lang.Class[] argTypes,
                                             java.lang.Object[] args)

createInvokeRequest

public Marshalable createInvokeRequest(long sessionId,
                                       long objectId,
                                       java.lang.reflect.Method method,
                                       java.lang.Object[] args)

createReferenceRequest

public Marshalable createReferenceRequest(long sessionId,
                                          long objectId)

createDestructRequest

public Marshalable createDestructRequest(long sessionId,
                                         long objectId)

createSessionRequest

public Marshalable createSessionRequest(long[] sessionIds)

removeInstance

public void removeInstance(long sessionId,
                           Tunnelizable object)
                    throws java.lang.Throwable
Throws:
java.lang.Throwable

invokeRequest

public Marshalable invokeRequest(Marshalable data)
                          throws java.lang.Throwable
Throws:
java.lang.Throwable

newStub

public Tunnelizable newStub(long sessionId,
                            java.lang.String[] interfaceNames)
                     throws java.lang.Throwable
The helper method for creating new instance of Tunneling object on Tunneling server

Throws:
TunnelException
java.lang.Throwable

newInstance

public java.lang.Object newInstance(java.lang.String className,
                                    java.lang.String[] interfaceNames,
                                    java.lang.Class[] argTypes,
                                    java.lang.Object[] args)
                             throws java.lang.Throwable
The helper method for creating new instance of Tunneling object on Tunneling server

Parameters:
className -
args - arguments for constructor
Throws:
TunnelException
java.lang.Throwable

invokeStaticMethod

public java.lang.Object invokeStaticMethod(java.lang.String className,
                                           java.lang.String methodName,
                                           java.lang.Class[] argTypes,
                                           java.lang.Object[] args)
                                    throws java.lang.Throwable
Throws:
java.lang.Throwable

invokeMethod

public java.lang.Object invokeMethod(long objectId,
                                     java.lang.reflect.Method method,
                                     java.lang.Object[] args,
                                     boolean checkForCallbacks)
                              throws java.lang.Throwable
The method delegates calls to Tunnel object. The method supports packaging requests with DataStack. It also recognizes Callbacks and creates for them proxies stubs.

Parameters:
method - reflected method of the proxy
args - arguments for method call
Throws:
java.lang.Throwable

getInstance

public java.lang.Object getInstance(long sessionId,
                                    long objectId)
                             throws java.lang.Throwable
The helper method for getting existing instance of Tunneling object located on Tunneling server by given objectId

Parameters:
objectId -
Throws:
TunnelException
java.lang.Throwable

getTimeout

public long getTimeout()
The method returns communication timeout for tunnel (measured in milliseconds). The timeout is maximum delay for response from remote object. The default timeout for all instances of Tunnel is set in static property SOCKET_TIMEOUT in Tunnel class and also may be changed. A timeout value can be customized by calling setTimeout(timeout).


setTimeout

public void setTimeout(long _timeout)
The method sets communication timeout for tunnel (measured in milliseconds). The timeout is maximum delay for response from remote object. The default timeout for all instances of Tunnel is set in static property TIMEOUT in Tunnel class and also may be changed. A timeout value can be obtained from setTimeout(timeout) method.


newInstance

public static java.lang.Object newInstance(java.lang.String serverUrlStr,
                                           java.lang.String className,
                                           java.lang.String[] interfaceNames,
                                           java.lang.Class[] argTypes,
                                           java.lang.Object[] args)

invokeStaticMethod

public static java.lang.Object invokeStaticMethod(java.lang.String serverUrlStr,
                                                  java.lang.String className,
                                                  java.lang.String methodName,
                                                  java.lang.Class[] argTypes,
                                                  java.lang.Object[] args)
                                           throws java.lang.Throwable
Throws:
java.lang.Throwable

setEventListener

public static void setEventListener(IEventListener _eventListener)

getEventListener

public static IEventListener getEventListener()


Copyright © JProxy LLC. All Rights Reserved.