dain 2006/02/01 06:50:05
Modified: modules/core/src/java/org/openejb/entity/bmp
BMPCreateMethod.java BMPFinderMethod.java
BMPInstanceContext.java
BMPInstanceContextFactory.java BMPRemoveMethod.java
Added: modules/core/src/java/org/openejb/entity/bmp
BmpCreateMethod.java BmpFinderMethod.java
BmpInstanceContext.java
BmpInstanceContextFactory.java BmpRemoveMethod.java
DefaultBmpEjbContainer.java
Removed: modules/core/src/java/org/openejb/entity/bmp
BMPEntityInterceptorBuilder.java
Log:
Major refactor
Split container into an object to represent a deployed ejb and a set of
shared containers which process invocations
Introduced interface between CMP container and CMP engine
Revision Changes Path
1.6 +8 -10
openejb/modules/core/src/java/org/openejb/entity/bmp/BMPCreateMethod.java
Index: BMPCreateMethod.java
===================================================================
RCS file:
/home/projects/openejb/scm/openejb/modules/core/src/java/org/openejb/entity/bmp/BMPCreateMethod.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- BMPCreateMethod.java 21 Jun 2005 21:16:57 -0000 1.5
+++ BMPCreateMethod.java 1 Feb 2006 11:50:05 -0000 1.6
@@ -52,25 +52,23 @@
import java.lang.reflect.Method;
import javax.ejb.EntityBean;
-import org.apache.geronimo.core.service.InvocationResult;
-import org.apache.geronimo.core.service.SimpleInvocationResult;
-
import net.sf.cglib.reflect.FastClass;
+import org.apache.geronimo.core.service.InvocationResult;
import org.openejb.EJBInterfaceType;
-import org.openejb.EJBInvocation;
import org.openejb.EJBOperation;
-import org.openejb.timer.TimerState;
+import org.openejb.EjbInvocation;
import org.openejb.dispatch.MethodSignature;
import org.openejb.dispatch.VirtualOperation;
import org.openejb.entity.EntityInstanceContext;
import org.openejb.proxy.EJBProxyFactory;
+import org.openejb.timer.TimerState;
/**
*
*
* @version $Revision$ $Date$
*/
-public class BMPCreateMethod implements VirtualOperation, Serializable {
+public class BmpCreateMethod implements VirtualOperation, Serializable {
private final Class beanClass;
private final MethodSignature createSignature;
private final MethodSignature postCreateSignature;
@@ -79,7 +77,7 @@
private final transient int postCreateIndex;
- public BMPCreateMethod(
+ public BmpCreateMethod(
Class beanClass,
MethodSignature createSignature,
MethodSignature postCreateSignature) {
@@ -104,7 +102,7 @@
postCreateIndex = fastBeanClass.getIndex(postCreateMethod.getName(),
postCreateMethod.getParameterTypes());
}
- public InvocationResult execute(EJBInvocation invocation) throws
Throwable {
+ public InvocationResult execute(EjbInvocation invocation) throws
Throwable {
EntityInstanceContext ctx = (EntityInstanceContext)
invocation.getEJBInstanceContext();
EntityBean instance = (EntityBean) ctx.getInstance();
@@ -170,6 +168,6 @@
}
private Object readResolve() {
- return new BMPCreateMethod(beanClass, createSignature,
postCreateSignature);
+ return new BmpCreateMethod(beanClass, createSignature,
postCreateSignature);
}
}
1.5 +10 -13
openejb/modules/core/src/java/org/openejb/entity/bmp/BMPFinderMethod.java
Index: BMPFinderMethod.java
===================================================================
RCS file:
/home/projects/openejb/scm/openejb/modules/core/src/java/org/openejb/entity/bmp/BMPFinderMethod.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- BMPFinderMethod.java 21 Jun 2005 21:16:57 -0000 1.4
+++ BMPFinderMethod.java 1 Feb 2006 11:50:05 -0000 1.5
@@ -54,20 +54,17 @@
import java.util.Collection;
import java.util.Enumeration;
import java.util.Iterator;
-
import javax.ejb.EntityBean;
-import org.apache.geronimo.core.service.InvocationResult;
-import org.apache.geronimo.core.service.SimpleInvocationResult;
-
import net.sf.cglib.reflect.FastClass;
-import org.openejb.EJBInvocation;
+import org.apache.geronimo.core.service.InvocationResult;
+import org.openejb.EJBInstanceContext;
import org.openejb.EJBOperation;
-import org.openejb.timer.TimerState;
+import org.openejb.EjbInvocation;
import org.openejb.dispatch.MethodSignature;
import org.openejb.dispatch.VirtualOperation;
-import org.openejb.entity.EntityInstanceContext;
import org.openejb.proxy.EJBProxyFactory;
+import org.openejb.timer.TimerState;
import org.openejb.util.SerializableEnumeration;
/**
@@ -75,14 +72,14 @@
*
* @version $Revision$ $Date$
*/
-public class BMPFinderMethod implements VirtualOperation, Serializable {
+public class BmpFinderMethod implements VirtualOperation, Serializable {
private final Class beanClass;
private final MethodSignature finderSignature;
private transient FastClass fastClass;
private transient int finderIndex;
- public BMPFinderMethod(Class beanClass, MethodSignature finderSignature)
{
+ public BmpFinderMethod(Class beanClass, MethodSignature finderSignature)
{
this.beanClass = beanClass;
this.finderSignature = finderSignature;
@@ -95,8 +92,8 @@
finderIndex = fastClass.getIndex(javaMethod.getName(),
javaMethod.getParameterTypes());
}
- public InvocationResult execute(EJBInvocation invocation) throws
Throwable {
- EntityInstanceContext ctx = (EntityInstanceContext)
invocation.getEJBInstanceContext();
+ public InvocationResult execute(EjbInvocation invocation) throws
Throwable {
+ EJBInstanceContext ctx = invocation.getEJBInstanceContext();
EntityBean instance = (EntityBean) ctx.getInstance();
Object[] args = invocation.getArguments();
@@ -153,6 +150,6 @@
}
private Object readResolve() {
- return new BMPFinderMethod(beanClass, finderSignature);
+ return new BmpFinderMethod(beanClass, finderSignature);
}
}
1.10 +18 -11
openejb/modules/core/src/java/org/openejb/entity/bmp/BMPInstanceContext.java
Index: BMPInstanceContext.java
===================================================================
RCS file:
/home/projects/openejb/scm/openejb/modules/core/src/java/org/openejb/entity/bmp/BMPInstanceContext.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- BMPInstanceContext.java 25 Feb 2005 23:06:09 -0000 1.9
+++ BMPInstanceContext.java 1 Feb 2006 11:50:05 -0000 1.10
@@ -48,23 +48,30 @@
package org.openejb.entity.bmp;
import java.util.Set;
-
import javax.ejb.EntityBean;
-import org.apache.geronimo.core.service.Interceptor;
-import org.apache.geronimo.transaction.context.TransactionContextManager;
-import org.openejb.dispatch.SystemMethodIndices;
+import org.openejb.BmpEjbDeployment;
+import org.openejb.BmpEjbContainer;
import org.openejb.entity.EntityInstanceContext;
import org.openejb.proxy.EJBProxyFactory;
-import org.openejb.timer.BasicTimerService;
/**
- *
- *
* @version $Revision$ $Date$
*/
-public final class BMPInstanceContext extends EntityInstanceContext {
- public BMPInstanceContext(Object containerId, EJBProxyFactory
proxyFactory, EntityBean instance, Interceptor lifecycleInterceptorChain,
SystemMethodIndices systemMethodIndices, Set unshareableResources, Set
applicationManagedSecurityResources, TransactionContextManager
transactionContextManager, BasicTimerService timerService) throws Exception {
- super(containerId, proxyFactory, instance,
lifecycleInterceptorChain, systemMethodIndices, unshareableResources,
applicationManagedSecurityResources, transactionContextManager, timerService);
+public final class BmpInstanceContext extends EntityInstanceContext {
+ public BmpInstanceContext(BmpEjbDeployment bmpEjbDeployment,
+ BmpEjbContainer bmpEjbContainer,
+ EntityBean instance,
+ EJBProxyFactory proxyFactory,
+ Set unshareableResources,
+ Set applicationManagedSecurityResources) {
+
+ super(bmpEjbDeployment,
+ bmpEjbContainer,
+ instance,
+ proxyFactory,
+ unshareableResources,
+ applicationManagedSecurityResources
+ );
}
}
1.11 +24 -47
openejb/modules/core/src/java/org/openejb/entity/bmp/BMPInstanceContextFactory.java
Index: BMPInstanceContextFactory.java
===================================================================
RCS file:
/home/projects/openejb/scm/openejb/modules/core/src/java/org/openejb/entity/bmp/BMPInstanceContextFactory.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- BMPInstanceContextFactory.java 5 Oct 2004 07:04:00 -0000 1.10
+++ BMPInstanceContextFactory.java 1 Feb 2006 11:50:05 -0000 1.11
@@ -49,70 +49,47 @@
import java.io.Serializable;
import java.util.Set;
-
import javax.ejb.EntityBean;
-import javax.ejb.EntityContext;
-import org.apache.geronimo.core.service.Interceptor;
import org.apache.geronimo.transaction.InstanceContext;
-import org.apache.geronimo.transaction.context.TransactionContextManager;
+import org.openejb.BmpEjbDeployment;
import org.openejb.EJBInstanceFactory;
import org.openejb.EJBInstanceFactoryImpl;
import org.openejb.InstanceContextFactory;
-import org.openejb.timer.BasicTimerService;
-import org.openejb.dispatch.InterfaceMethodSignature;
-import org.openejb.dispatch.SystemMethodIndices;
+import org.openejb.BmpEjbContainer;
import org.openejb.proxy.EJBProxyFactory;
/**
- *
- *
* @version $Revision$ $Date$
*/
-public class BMPInstanceContextFactory implements InstanceContextFactory,
Serializable {
- private final Object containerId;
- private final EJBInstanceFactory factory;
+public class BmpInstanceContextFactory implements InstanceContextFactory,
Serializable {
+ private static final long serialVersionUID = 1309544723932462002L;
+ private final BmpEjbDeployment bmpEjbDeployment;
+ private final BmpEjbContainer bmpEjbContainer;
+ private final EJBInstanceFactory instanceFactory;
+ private final transient EJBProxyFactory proxyFactory;
private final Set unshareableResources;
private final Set applicationManagedSecurityResources;
- private transient EJBProxyFactory proxyFactory;
- private transient Interceptor systemChain;
- private transient SystemMethodIndices systemMethodIndices;
- private transient TransactionContextManager transactionContextManager;
- private transient BasicTimerService timerService;
-
- public BMPInstanceContextFactory(Object containerId, Class beanClass,
Set unshareableResources, Set applicationManagedSecurityResources) {
- this.containerId = containerId;
- this.factory = new EJBInstanceFactoryImpl(beanClass);
+ public BmpInstanceContextFactory(BmpEjbDeployment bmpEjbDeployment,
+ BmpEjbContainer bmpEjbContainer,
+ EJBProxyFactory proxyFactory,
+ Set unshareableResources,
+ Set applicationManagedSecurityResources) {
+ this.bmpEjbDeployment = bmpEjbDeployment;
+ this.bmpEjbContainer = bmpEjbContainer;
+ this.instanceFactory = new
EJBInstanceFactoryImpl(bmpEjbDeployment.getBeanClass());
+ this.proxyFactory = proxyFactory;
this.unshareableResources = unshareableResources;
this.applicationManagedSecurityResources =
applicationManagedSecurityResources;
}
- public void setProxyFactory(EJBProxyFactory proxyFactory) {
- this.proxyFactory = proxyFactory;
- }
-
- public void setSystemChain(Interceptor systemChain) {
- this.systemChain = systemChain;
- }
-
- public SystemMethodIndices setSignatures(InterfaceMethodSignature[]
signatures) {
- systemMethodIndices =
SystemMethodIndices.createSystemMethodIndices(signatures, "setEntityContext",
EntityContext.class.getName(), "unsetEntityContext");
- return systemMethodIndices;
- }
-
- public void setTransactionContextManager(TransactionContextManager
transactionContextManager) {
- this.transactionContextManager = transactionContextManager;
- }
-
- public void setTimerService(BasicTimerService timerService) {
- this.timerService = timerService;
- }
-
public InstanceContext newInstance() throws Exception {
- if (proxyFactory == null) {
- throw new IllegalStateException("ProxyFactory has not been set");
- }
- return new BMPInstanceContext(containerId, proxyFactory,
(EntityBean) factory.newInstance(), systemChain, systemMethodIndices,
unshareableResources, applicationManagedSecurityResources,
transactionContextManager, timerService);
+ return new BmpInstanceContext(bmpEjbDeployment,
+ bmpEjbContainer,
+ (EntityBean) instanceFactory.newInstance(),
+ proxyFactory,
+ unshareableResources,
+ applicationManagedSecurityResources);
}
}
1.5 +5 -5
openejb/modules/core/src/java/org/openejb/entity/bmp/BMPRemoveMethod.java
Index: BMPRemoveMethod.java
===================================================================
RCS file:
/home/projects/openejb/scm/openejb/modules/core/src/java/org/openejb/entity/bmp/BMPRemoveMethod.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- BMPRemoveMethod.java 14 Feb 2005 18:32:29 -0000 1.4
+++ BMPRemoveMethod.java 1 Feb 2006 11:50:05 -0000 1.5
@@ -54,7 +54,7 @@
import org.apache.geronimo.core.service.InvocationResult;
-import org.openejb.EJBInvocation;
+import org.openejb.EjbInvocation;
import org.openejb.EJBOperation;
import org.openejb.timer.TimerState;
import org.openejb.dispatch.AbstractMethodOperation;
@@ -66,12 +66,12 @@
*
* @version $Revision$ $Date$
*/
-public class BMPRemoveMethod extends AbstractMethodOperation {
- public BMPRemoveMethod(Class beanClass, MethodSignature signature) {
+public class BmpRemoveMethod extends AbstractMethodOperation {
+ public BmpRemoveMethod(Class beanClass, MethodSignature signature) {
super(beanClass, signature);
}
- public InvocationResult execute(EJBInvocation invocation) throws
Throwable {
+ public InvocationResult execute(EjbInvocation invocation) throws
Throwable {
InvocationResult result = invoke(invocation, EJBOperation.EJBREMOVE);
if (result.isNormal()) {
EntityInstanceContext ctx = (EntityInstanceContext)
invocation.getEJBInstanceContext();
1.1
openejb/modules/core/src/java/org/openejb/entity/bmp/BmpCreateMethod.java
Index: BmpCreateMethod.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 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.
*
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the OpenEJB Project. For more information
* please see <http://openejb.org/>.
*
* ====================================================================
*/
package org.openejb.entity.bmp;
import java.io.Serializable;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import javax.ejb.EntityBean;
import net.sf.cglib.reflect.FastClass;
import org.apache.geronimo.core.service.InvocationResult;
import org.openejb.EJBInterfaceType;
import org.openejb.EJBOperation;
import org.openejb.EjbInvocation;
import org.openejb.dispatch.MethodSignature;
import org.openejb.dispatch.VirtualOperation;
import org.openejb.entity.EntityInstanceContext;
import org.openejb.proxy.EJBProxyFactory;
import org.openejb.timer.TimerState;
/**
*
*
* @version $Revision: 1.1 $ $Date: 2006/02/01 11:50:05 $
*/
public class BmpCreateMethod implements VirtualOperation, Serializable {
private final Class beanClass;
private final MethodSignature createSignature;
private final MethodSignature postCreateSignature;
private final transient FastClass fastBeanClass;
private final transient int createIndex;
private final transient int postCreateIndex;
public BmpCreateMethod(
Class beanClass,
MethodSignature createSignature,
MethodSignature postCreateSignature) {
this.beanClass = beanClass;
this.createSignature = createSignature;
this.postCreateSignature = postCreateSignature;
fastBeanClass = FastClass.create(beanClass);
Method createMethod = createSignature.getMethod(beanClass);
if (createMethod == null) {
throw new IllegalArgumentException("Bean class does not implement
create method:" +
" beanClass=" + beanClass.getName() + " method=" +
createSignature);
}
createIndex = fastBeanClass.getIndex(createMethod.getName(),
createMethod.getParameterTypes());
Method postCreateMethod = postCreateSignature.getMethod(beanClass);
if (postCreateMethod == null) {
throw new IllegalArgumentException("Bean class does not implement
post create method:" +
" beanClass=" + beanClass.getName() + " method=" +
postCreateSignature);
}
postCreateIndex = fastBeanClass.getIndex(postCreateMethod.getName(),
postCreateMethod.getParameterTypes());
}
public InvocationResult execute(EjbInvocation invocation) throws
Throwable {
EntityInstanceContext ctx = (EntityInstanceContext)
invocation.getEJBInstanceContext();
EntityBean instance = (EntityBean) ctx.getInstance();
Object[] args = invocation.getArguments();
// call the create method
Object id;
boolean oldTimerMethodAvailable =
ctx.setTimerState(EJBOperation.EJBCREATE);
try {
ctx.setOperation(EJBOperation.EJBCREATE);
id = fastBeanClass.invoke(createIndex, instance, args);
} catch (InvocationTargetException ite) {
Throwable t = ite.getTargetException();
if (t instanceof Exception && t instanceof RuntimeException ==
false) {
// checked exception - which we simply include in the result
return invocation.createExceptionResult((Exception)t);
} else {
// unchecked Exception - just throw it to indicate an
abnormal completion
throw t;
}
} finally {
ctx.setOperation(EJBOperation.INACTIVE);
TimerState.setTimerState(oldTimerMethodAvailable);
}
// assign the context the new id
ctx.setId(id);
// associate the new BMP instance with the tx cache
ctx.setLoaded(true);
invocation.getTransactionContext().associate(ctx);
// call the post create method
try {
ctx.setOperation(EJBOperation.EJBPOSTCREATE);
ctx.setTimerState(EJBOperation.EJBPOSTCREATE);
fastBeanClass.invoke(postCreateIndex, instance, args);
} catch (InvocationTargetException ite) {
Throwable t = ite.getTargetException();
if (t instanceof Exception && t instanceof RuntimeException ==
false) {
// checked exception - which we simply include in the result
return invocation.createExceptionResult((Exception)t);
} else {
// unchecked Exception - just throw it to indicate an
abnormal completion
throw t;
}
} finally {
ctx.setOperation(EJBOperation.INACTIVE);
TimerState.setTimerState(oldTimerMethodAvailable);
}
EJBInterfaceType type = invocation.getType();
return invocation.createResult(getReference(type.isLocal(),
ctx.getProxyFactory(), id));
}
private Object getReference(boolean local, EJBProxyFactory proxyFactory,
Object id) {
if (local) {
return proxyFactory.getEJBLocalObject(id);
} else {
return proxyFactory.getEJBObject(id);
}
}
private Object readResolve() {
return new BmpCreateMethod(beanClass, createSignature,
postCreateSignature);
}
}
1.1
openejb/modules/core/src/java/org/openejb/entity/bmp/BmpFinderMethod.java
Index: BmpFinderMethod.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 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.
*
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the OpenEJB Project. For more information
* please see <http://openejb.org/>.
*
* ====================================================================
*/
package org.openejb.entity.bmp;
import java.io.Serializable;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Enumeration;
import java.util.Iterator;
import javax.ejb.EntityBean;
import net.sf.cglib.reflect.FastClass;
import org.apache.geronimo.core.service.InvocationResult;
import org.openejb.EJBInstanceContext;
import org.openejb.EJBOperation;
import org.openejb.EjbInvocation;
import org.openejb.dispatch.MethodSignature;
import org.openejb.dispatch.VirtualOperation;
import org.openejb.proxy.EJBProxyFactory;
import org.openejb.timer.TimerState;
import org.openejb.util.SerializableEnumeration;
/**
*
*
* @version $Revision: 1.1 $ $Date: 2006/02/01 11:50:05 $
*/
public class BmpFinderMethod implements VirtualOperation, Serializable {
private final Class beanClass;
private final MethodSignature finderSignature;
private transient FastClass fastClass;
private transient int finderIndex;
public BmpFinderMethod(Class beanClass, MethodSignature finderSignature) {
this.beanClass = beanClass;
this.finderSignature = finderSignature;
fastClass = FastClass.create(beanClass);
Method javaMethod = finderSignature.getMethod(beanClass);
if(javaMethod == null) {
throw new IllegalArgumentException("Bean class does not implement
finder method:" +
" beanClass=" + beanClass.getName() + " method=" +
finderSignature);
}
finderIndex = fastClass.getIndex(javaMethod.getName(),
javaMethod.getParameterTypes());
}
public InvocationResult execute(EjbInvocation invocation) throws
Throwable {
EJBInstanceContext ctx = invocation.getEJBInstanceContext();
EntityBean instance = (EntityBean) ctx.getInstance();
Object[] args = invocation.getArguments();
Object finderResult;
boolean oldTimerMethodAvailable =
ctx.setTimerState(EJBOperation.EJBFIND);
try {
ctx.setOperation(EJBOperation.EJBFIND);
finderResult = fastClass.invoke(finderIndex, instance, args);
} catch (InvocationTargetException ite) {
Throwable t = ite.getTargetException();
if (t instanceof Exception && t instanceof RuntimeException ==
false) {
// checked exception - which we simply include in the result
return invocation.createExceptionResult((Exception)t);
} else {
// unchecked Exception - just throw it to indicate an
abnormal completion
throw t;
}
} finally {
ctx.setOperation(EJBOperation.INACTIVE);
TimerState.setTimerState(oldTimerMethodAvailable);
}
boolean local = invocation.getType().isLocal();
EJBProxyFactory proxyFactory = ctx.getProxyFactory();
if (finderResult instanceof Enumeration) {
Enumeration e = (Enumeration) finderResult;
ArrayList values = new ArrayList();
while (e.hasMoreElements()) {
values.add(getReference(local, proxyFactory,
e.nextElement()));
}
return invocation.createResult(new
SerializableEnumeration(values.toArray()));
} else if (finderResult instanceof Collection) {
Collection c = (Collection) finderResult;
ArrayList result = new ArrayList(c.size());
for (Iterator i = c.iterator(); i.hasNext();) {
result.add(getReference(local, proxyFactory, i.next()));
}
return invocation.createResult(result);
} else {
return invocation.createResult(getReference(local, proxyFactory,
finderResult));
}
}
private Object getReference(boolean local, EJBProxyFactory proxyFactory,
Object id) {
if (id == null) {
// yes, finders can return null
return null;
} else if (local) {
return proxyFactory.getEJBLocalObject(id);
} else {
return proxyFactory.getEJBObject(id);
}
}
private Object readResolve() {
return new BmpFinderMethod(beanClass, finderSignature);
}
}
1.1
openejb/modules/core/src/java/org/openejb/entity/bmp/BmpInstanceContext.java
Index: BmpInstanceContext.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 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.
*
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the OpenEJB Project. For more information
* please see <http://openejb.org/>.
*
* ====================================================================
*/
package org.openejb.entity.bmp;
import java.util.Set;
import javax.ejb.EntityBean;
import org.openejb.BmpEjbDeployment;
import org.openejb.BmpEjbContainer;
import org.openejb.entity.EntityInstanceContext;
import org.openejb.proxy.EJBProxyFactory;
/**
* @version $Revision: 1.1 $ $Date: 2006/02/01 11:50:05 $
*/
public final class BmpInstanceContext extends EntityInstanceContext {
public BmpInstanceContext(BmpEjbDeployment bmpEjbDeployment,
BmpEjbContainer bmpEjbContainer,
EntityBean instance,
EJBProxyFactory proxyFactory,
Set unshareableResources,
Set applicationManagedSecurityResources) {
super(bmpEjbDeployment,
bmpEjbContainer,
instance,
proxyFactory,
unshareableResources,
applicationManagedSecurityResources
);
}
}
1.1
openejb/modules/core/src/java/org/openejb/entity/bmp/BmpInstanceContextFactory.java
Index: BmpInstanceContextFactory.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 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.
*
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the OpenEJB Project. For more information
* please see <http://openejb.org/>.
*
* ====================================================================
*/
package org.openejb.entity.bmp;
import java.io.Serializable;
import java.util.Set;
import javax.ejb.EntityBean;
import org.apache.geronimo.transaction.InstanceContext;
import org.openejb.BmpEjbDeployment;
import org.openejb.EJBInstanceFactory;
import org.openejb.EJBInstanceFactoryImpl;
import org.openejb.InstanceContextFactory;
import org.openejb.BmpEjbContainer;
import org.openejb.proxy.EJBProxyFactory;
/**
* @version $Revision: 1.1 $ $Date: 2006/02/01 11:50:05 $
*/
public class BmpInstanceContextFactory implements InstanceContextFactory,
Serializable {
private static final long serialVersionUID = 1309544723932462002L;
private final BmpEjbDeployment bmpEjbDeployment;
private final BmpEjbContainer bmpEjbContainer;
private final EJBInstanceFactory instanceFactory;
private final transient EJBProxyFactory proxyFactory;
private final Set unshareableResources;
private final Set applicationManagedSecurityResources;
public BmpInstanceContextFactory(BmpEjbDeployment bmpEjbDeployment,
BmpEjbContainer bmpEjbContainer,
EJBProxyFactory proxyFactory,
Set unshareableResources,
Set applicationManagedSecurityResources) {
this.bmpEjbDeployment = bmpEjbDeployment;
this.bmpEjbContainer = bmpEjbContainer;
this.instanceFactory = new
EJBInstanceFactoryImpl(bmpEjbDeployment.getBeanClass());
this.proxyFactory = proxyFactory;
this.unshareableResources = unshareableResources;
this.applicationManagedSecurityResources =
applicationManagedSecurityResources;
}
public InstanceContext newInstance() throws Exception {
return new BmpInstanceContext(bmpEjbDeployment,
bmpEjbContainer,
(EntityBean) instanceFactory.newInstance(),
proxyFactory,
unshareableResources,
applicationManagedSecurityResources);
}
}
1.1
openejb/modules/core/src/java/org/openejb/entity/bmp/BmpRemoveMethod.java
Index: BmpRemoveMethod.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 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.
*
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the OpenEJB Project. For more information
* please see <http://openejb.org/>.
*
* ====================================================================
*/
package org.openejb.entity.bmp;
import java.util.Collection;
import java.util.Iterator;
import javax.ejb.TimerService;
import javax.ejb.Timer;
import org.apache.geronimo.core.service.InvocationResult;
import org.openejb.EjbInvocation;
import org.openejb.EJBOperation;
import org.openejb.timer.TimerState;
import org.openejb.dispatch.AbstractMethodOperation;
import org.openejb.dispatch.MethodSignature;
import org.openejb.entity.EntityInstanceContext;
/**
* Virtual operation handling removal of an instance.
*
* @version $Revision: 1.1 $ $Date: 2006/02/01 11:50:05 $
*/
public class BmpRemoveMethod extends AbstractMethodOperation {
public BmpRemoveMethod(Class beanClass, MethodSignature signature) {
super(beanClass, signature);
}
public InvocationResult execute(EjbInvocation invocation) throws
Throwable {
InvocationResult result = invoke(invocation, EJBOperation.EJBREMOVE);
if (result.isNormal()) {
EntityInstanceContext ctx = (EntityInstanceContext)
invocation.getEJBInstanceContext();
//cancel timers
TimerService timerService = ctx.getTimerService();
if (timerService != null) {
boolean oldTimerMethodAvailable = TimerState.getTimerState();
TimerState.setTimerState(true);
ctx.setTimerServiceAvailable(true);
try {
Collection timers = timerService.getTimers();
for (Iterator iterator = timers.iterator();
iterator.hasNext();) {
Timer timer = (Timer) iterator.next();
timer.cancel();
}
} finally {
ctx.setTimerServiceAvailable(false);
TimerState.setTimerState(oldTimerMethodAvailable);
}
}
// clear id as we are no longer associated
ctx.setId(null);
}
return result;
}
}
1.1
openejb/modules/core/src/java/org/openejb/entity/bmp/DefaultBmpEjbContainer.java
Index: DefaultBmpEjbContainer.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 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.
*
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the OpenEJB Project. For more information
* please see <http://openejb.org/>.
*
* ====================================================================
*/
package org.openejb.entity.bmp;
import javax.ejb.EntityContext;
import javax.ejb.Timer;
import org.apache.geronimo.core.service.Interceptor;
import org.apache.geronimo.core.service.Invocation;
import org.apache.geronimo.core.service.InvocationResult;
import org.apache.geronimo.gbean.GBeanInfo;
import org.apache.geronimo.gbean.GBeanInfoBuilder;
import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
import org.apache.geronimo.timer.PersistentTimer;
import org.apache.geronimo.transaction.TrackedConnectionAssociator;
import org.apache.geronimo.transaction.context.TransactionContextManager;
import org.apache.geronimo.transaction.context.UserTransactionImpl;
import org.apache.geronimo.transaction.context.TransactionContext;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.openejb.dispatch.DispatchInterceptor;
import org.openejb.entity.EntityInstanceInterceptor;
import org.openejb.entity.EntityCallbackInterceptor;
import org.openejb.naming.ComponentContextInterceptor;
import org.openejb.security.EJBIdentityInterceptor;
import org.openejb.security.EjbRunAsInterceptor;
import org.openejb.security.EjbSecurityInterceptor;
import org.openejb.security.PolicyContextHandlerEJBInterceptor;
import org.openejb.transaction.TransactionContextInterceptor;
import org.openejb.BmpEjbContainer;
import org.openejb.ConnectionTrackingInterceptor;
import org.openejb.SystemExceptionInterceptor;
import org.openejb.EJBInstanceContext;
import org.openejb.EjbCallbackInvocation;
import org.openejb.CallbackMethod;
import org.openejb.ExtendedEjbDeployment;
import org.openejb.EjbInvocation;
import org.openejb.EjbInvocationImpl;
import org.openejb.EJBInterfaceType;
/**
* @version $Revision: 1.1 $ $Date: 2006/02/01 11:50:05 $
*/
public class DefaultBmpEjbContainer implements BmpEjbContainer {
private static final Log log =
LogFactory.getLog(DefaultBmpEjbContainer.class);
private final Interceptor invocationChain;
private final Interceptor callbackChain;
private final PersistentTimer transactedTimer;
private final PersistentTimer nontransactionalTimer;
private final TransactionContextManager transactionContextManager;
private final UserTransactionImpl userTransaction;
public DefaultBmpEjbContainer(
TransactionContextManager transactionContextManager,
TrackedConnectionAssociator trackedConnectionAssociator,
PersistentTimer transactionalTimer,
PersistentTimer nontransactionalTimer,
boolean securityEnabled,
boolean doAsCurrentCaller,
boolean useContextHandler) throws Exception {
this.transactionContextManager = transactionContextManager;
this.userTransaction = new
UserTransactionImpl(transactionContextManager, trackedConnectionAssociator);
this.transactedTimer = transactionalTimer;
this.nontransactionalTimer = nontransactionalTimer;
//
// build the normal invocation processing chain (built in reverse
order)
//
Interceptor invocationChain;
invocationChain = new DispatchInterceptor();
if (doAsCurrentCaller) {
invocationChain = new EJBIdentityInterceptor(invocationChain);
}
if (securityEnabled) {
invocationChain = new EjbSecurityInterceptor(invocationChain);
}
invocationChain = new EjbRunAsInterceptor(invocationChain);
if (useContextHandler) {
invocationChain = new
PolicyContextHandlerEJBInterceptor(invocationChain);
}
invocationChain = new ComponentContextInterceptor(invocationChain);
if (trackedConnectionAssociator != null) {
invocationChain = new
ConnectionTrackingInterceptor(invocationChain, trackedConnectionAssociator);
}
invocationChain = new EntityInstanceInterceptor(invocationChain);
invocationChain = new TransactionContextInterceptor(invocationChain,
transactionContextManager);
invocationChain = new SystemExceptionInterceptor(invocationChain);
this.invocationChain = invocationChain;
//
// Callback chain is used for ejb state change callbacks
//
Interceptor callbackChain = new EntityCallbackInterceptor();
if (doAsCurrentCaller) {
callbackChain = new EJBIdentityInterceptor(callbackChain);
}
callbackChain = new ComponentContextInterceptor(callbackChain);
this.callbackChain = callbackChain;
}
public TransactionContextManager getTransactionContextManager() {
return transactionContextManager;
}
public UserTransactionImpl getUserTransaction() {
return userTransaction;
}
public PersistentTimer getTransactedTimer() {
return transactedTimer;
}
public PersistentTimer getNontransactedTimer() {
return nontransactionalTimer;
}
public InvocationResult invoke(Invocation invocation) throws Throwable {
return invocationChain.invoke(invocation);
}
public void setContext(EJBInstanceContext instanceContext, EntityContext
entityContext) throws Throwable {
EjbCallbackInvocation invocation = new
EjbCallbackInvocation(CallbackMethod.SET_CONTEXT, instanceContext, new
Object[]{entityContext});
callbackChain.invoke(invocation);
}
public void unsetContext(EJBInstanceContext instanceContext) throws
Throwable {
EjbCallbackInvocation invocation = new
EjbCallbackInvocation(CallbackMethod.UNSET_CONTEXT, instanceContext);
callbackChain.invoke(invocation);
}
public void ejbActivate(EJBInstanceContext instanceContext) throws
Throwable {
EjbCallbackInvocation invocation = new
EjbCallbackInvocation(CallbackMethod.ACTIVATE, instanceContext);
callbackChain.invoke(invocation);
}
public void ejbPassivate(EJBInstanceContext instanceContext) throws
Throwable {
EjbCallbackInvocation invocation = new
EjbCallbackInvocation(CallbackMethod.PASSIVATE, instanceContext);
callbackChain.invoke(invocation);
}
public void load(EJBInstanceContext instanceContext, TransactionContext
transactionContext) throws Throwable {
EjbCallbackInvocation invocation = new
EjbCallbackInvocation(CallbackMethod.LOAD, instanceContext);
invocation.setTransactionContext(transactionContext);
callbackChain.invoke(invocation);
}
public void store(EJBInstanceContext instanceContext, TransactionContext
transactionContext) throws Throwable {
EjbCallbackInvocation invocation = new
EjbCallbackInvocation(CallbackMethod.STORE, instanceContext);
invocation.setTransactionContext(transactionContext);
callbackChain.invoke(invocation);
}
public void timeout(ExtendedEjbDeployment deployment, Object id, Timer
timer, int ejbTimeoutIndex) {
EjbInvocation invocation = new
EjbInvocationImpl(EJBInterfaceType.TIMEOUT, id, ejbTimeoutIndex, new Object[]
{timer});
invocation.setEjbDeployment(deployment);
// set the transaction context into the invocation object
TransactionContext transactionContext =
transactionContextManager.getContext();
if (transactionContext == null) {
throw new IllegalStateException("Transaction context has not been
set");
}
invocation.setTransactionContext(transactionContext);
Thread currentThread = Thread.currentThread();
ClassLoader oldClassLoader = currentThread.getContextClassLoader();
try {
currentThread.setContextClassLoader(deployment.getClassLoader());
invoke(invocation);
} catch (Throwable throwable) {
log.warn("Timer invocation failed", throwable);
} finally {
currentThread.setContextClassLoader(oldClassLoader);
}
}
public static final GBeanInfo GBEAN_INFO;
static {
GBeanInfoBuilder infoFactory =
GBeanInfoBuilder.createStatic(DefaultBmpEjbContainer.class, "BmpEjbContainer");
infoFactory.addReference("TransactionContextManager",
TransactionContextManager.class, NameFactory.TRANSACTION_CONTEXT_MANAGER);
infoFactory.addReference("TrackedConnectionAssociator",
TrackedConnectionAssociator.class, NameFactory.JCA_CONNECTION_TRACKER);
infoFactory.addReference("TransactedTimer", PersistentTimer.class,
NameFactory.GERONIMO_SERVICE);
infoFactory.addReference("NontransactedTimer", PersistentTimer.class,
NameFactory.GERONIMO_SERVICE);
infoFactory.addAttribute("securityEnabled", boolean.class, true);
infoFactory.addAttribute("doAsCurrentCaller", boolean.class, true);
infoFactory.addAttribute("useContextHandler", boolean.class, true);
infoFactory.setConstructor(new String[]{
"TransactionContextManager",
"TrackedConnectionAssociator",
"TransactedTimer",
"NontransactedTimer",
"securityEnabled",
"doAsCurrentCaller",
"useContextHandler"});
infoFactory.addInterface(BmpEjbContainer.class);
GBEAN_INFO = infoFactory.getBeanInfo();
}
public static GBeanInfo getGBeanInfo() {
return GBEAN_INFO;
}
}