jrun.sql
Class RemoteSQLProxy

java.lang.Object
  |
  +--jrun.sql.RemoteSQLProxy
All Implemented Interfaces:
java.lang.reflect.InvocationHandler

public class RemoteSQLProxy
extends java.lang.Object
implements java.lang.reflect.InvocationHandler

This InvocationHandler is instantiated by a DataSource ObjectFactory only when DataSources are accessed remotely, with no local JDB configuration.
The InvocationHandler maintains proxies for the following JDBC resources: DataSources, Connections, Statements, ResultSets, and their subclasses. When a method is invoked locally on one of the proxies, this handler -- and its RemoteSQLProxyDelegate inner class -- map identifiers from the proxy to RemoteSQLInvocation objects. It passes these invocation objects to a stateful session bean, the SQLInvokerBean, which is guaranteed to be deployed on the remote JRun server. That remote stateful session bean maintains weak references to true local JDBC resources, which are held on behalf of these local proxies.
This logic is very similar to that used by remote service invocations, and the pattern should be followed for passing remote references for any future non-remotable objects.

Author:
PS Neville

Field Summary
protected  SQLInvoker invoker
          Stateful Session Bean that translates invocations into local calls on its host
protected  javax.naming.Context namingContext
          The JNDI Context used to access the EJB that handles all of the remote work
static java.lang.String SQL_EJB_NAME
          The Global JNDI name of the internally-used EJB.
 
Constructor Summary
RemoteSQLProxy(java.lang.String objName, javax.naming.Context nameCtx)
           
 
Method Summary
 java.lang.Object invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)
          Entry point into remote SQL invocation logic.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

namingContext

protected javax.naming.Context namingContext
The JNDI Context used to access the EJB that handles all of the remote work

invoker

protected SQLInvoker invoker
Stateful Session Bean that translates invocations into local calls on its host

SQL_EJB_NAME

public static final java.lang.String SQL_EJB_NAME
The Global JNDI name of the internally-used EJB.
Constructor Detail

RemoteSQLProxy

public RemoteSQLProxy(java.lang.String objName,
                      javax.naming.Context nameCtx)
Method Detail

invoke

public java.lang.Object invoke(java.lang.Object proxy,
                               java.lang.reflect.Method method,
                               java.lang.Object[] args)
                        throws java.lang.Exception
Entry point into remote SQL invocation logic.
Specified by:
invoke in interface java.lang.reflect.InvocationHandler


Copyright � 2002 Macromedia Corporation. All Rights Reserved.