dblevins 2004/04/06 15:11:58
Modified: modules/core/src/java/org/openejb/proxy
ContainerHandler.java EJBMethodInterceptor.java
Added: modules/core/src/java/org/openejb/proxy
ContainerReferenceHandler.java
Log:
Initial attempt at disconnected proxies. More work needed.
Revision Changes Path
1.4 +1 -26
openejb/modules/core/src/java/org/openejb/proxy/ContainerHandler.java
Index: ContainerHandler.java
===================================================================
RCS file:
/home/projects/openejb/scm/openejb/modules/core/src/java/org/openejb/proxy/ContainerHandler.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ContainerHandler.java 21 Mar 2004 21:26:35 -0000 1.3
+++ ContainerHandler.java 6 Apr 2004 19:11:58 -0000 1.4
@@ -62,29 +62,4 @@
return container.invoke(ejbInvocation);
}
-// /**
-// * Old-style invoke
-// * @param pk
-// * @param method
-// * @param args
-// * @return
-// * @throws Throwable
-// */
-// public Object invoke(Object pk, Method method, Object[] args)
-// throws Throwable {
-// try {
-// return container.invoke(method,args,pk);
-// } catch ( org.openejb.InvalidateReferenceException ire ) {
-// throw (ire.getRootCause() != null )? ire.getRootCause(): ire;
-// } catch ( org.openejb.ApplicationException ae ) {
-// throw (ae.getRootCause() != null )? ae.getRootCause(): ae;
-// } catch ( org.openejb.SystemException se ) {
-// Throwable exc = (se.getRootCause() != null )? se.getRootCause(): se;
-// throw new RemoteException("Container has suffered a SystemException",
exc);
-// } catch ( org.openejb.OpenEJBException oe ) {
-// Throwable exc = (oe.getRootCause() != null )? oe.getRootCause(): oe;
-// throw new RemoteException("Unknown Container
Exception",oe.getRootCause());
-// }
-// }
-
}
1.4 +8 -1
openejb/modules/core/src/java/org/openejb/proxy/EJBMethodInterceptor.java
Index: EJBMethodInterceptor.java
===================================================================
RCS file:
/home/projects/openejb/scm/openejb/modules/core/src/java/org/openejb/proxy/EJBMethodInterceptor.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- EJBMethodInterceptor.java 6 Apr 2004 18:41:47 -0000 1.3
+++ EJBMethodInterceptor.java 6 Apr 2004 19:11:58 -0000 1.4
@@ -53,10 +53,17 @@
this.operationMap = operationMap;
this.proxyFactory = proxyFactory;
- EJBInterceptor interceptor = new ContainerHandler(container);
+ EJBInterceptor interceptor;
+ if (container == null){
+ interceptor = new ContainerReferenceHandler(proxyInfo.getContainerID());
+ } else {
+ interceptor = new ContainerHandler(container);
+ }
+
if (!interfaceType.isLocal() || !skipCopy()) {
interceptor = new SerializationHanlder(interceptor);
}
+
next = interceptor;
}
1.1
openejb/modules/core/src/java/org/openejb/proxy/ContainerReferenceHandler.java
Index: ContainerReferenceHandler.java
===================================================================
/**
* Redistribution and use of this software and associated documentation
* ("Software"), with or without modification, are permitted provided
* that the following conditions are met:
*
* 1. Redistributions of source code must retain copyright
* statements and notices. Redistributions must also contain a
* copy of this document.
*
* 2. Redistributions in binary form must reproduce the
* above copyright notice, this list of conditions and the
* following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. The name "OpenEJB" must not be used to endorse or promote
* products derived from this Software without prior written
* permission of The OpenEJB Group. For written permission,
* please contact [EMAIL PROTECTED]
*
* 4. Products derived from this Software may not be called "OpenEJB"
* nor may "OpenEJB" appear in their names without prior written
* permission of The OpenEJB Group. OpenEJB is a registered
* trademark of The OpenEJB Group.
*
* 5. Due credit should be given to the OpenEJB Project
* (http://openejb.org/).
*
* THIS SOFTWARE IS PROVIDED BY THE OPENEJB GROUP AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE OPENEJB GROUP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Copyright 2001 (C) The OpenEJB Group. All Rights Reserved.
*
* $Id: ContainerReferenceHandler.java,v 1.1 2004/04/06 19:11:58 dblevins Exp $
*/
package org.openejb.proxy;
import org.apache.geronimo.core.service.InvocationResult;
import org.openejb.ContainerIndex;
import org.openejb.EJBContainer;
import org.openejb.EJBInvocation;
public class ContainerReferenceHandler implements EJBInterceptor {
private final Object containerId;
private EJBInterceptor next;
public ContainerReferenceHandler(Object containerId){
this.containerId = containerId;
}
public InvocationResult invoke(EJBInvocation ejbInvocation) throws Throwable{
if (next == null) {
EJBContainer container =
ContainerIndex.getInstance().getContainer((String)containerId);
if (container == null){
throw new IllegalStateException("The EJBContainer with the following
ID is not yet online: "+containerId);
}
next = new ContainerHandler(container);
}
return next.invoke(ejbInvocation);
}
}