djencks     2004/10/05 03:04:00

  Modified:    modules/core/src/java/org/openejb/entity/cmp
                        CMPInstanceContext.java
                        CMPInstanceContextFactory.java
  Log:

  Use TransactionContextManager rather than TransactionContext static methods.  Mostly 
fix GERONIMO-355. Progress on GERONIMO-347. This demonstrates the problems in 
GERONIMO-359 and GERONIMO-360 (there are now itest failures)
  
  Revision  Changes    Path
  1.13      +4 -3      
openejb/modules/core/src/java/org/openejb/entity/cmp/CMPInstanceContext.java
  
  Index: CMPInstanceContext.java
  ===================================================================
  RCS file: 
/home/projects/openejb/scm/openejb/modules/core/src/java/org/openejb/entity/cmp/CMPInstanceContext.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- CMPInstanceContext.java   20 Jul 2004 23:40:02 -0000      1.12
  +++ CMPInstanceContext.java   5 Oct 2004 07:04:00 -0000       1.13
  @@ -56,6 +56,7 @@
   import net.sf.cglib.proxy.MethodProxy;
   import org.apache.geronimo.core.service.Interceptor;
   import org.apache.geronimo.transaction.context.TransactionContext;
  +import org.apache.geronimo.transaction.context.TransactionContextManager;
   import org.openejb.dispatch.SystemMethodIndices;
   import org.openejb.entity.EntityInstanceContext;
   import org.openejb.proxy.EJBProxyFactory;
  @@ -79,8 +80,8 @@
       private CacheRow cacheRow;
       private TransactionContext transactionContext;
   
  -    public CMPInstanceContext(Object containerId, EJBProxyFactory proxyFactory, 
InstanceOperation[] itable, FaultHandler loadFault, IdentityTransform 
primaryKeyTransform, CMPInstanceContextFactory contextFactory, Interceptor 
lifecycleInterceptorChain, SystemMethodIndices systemMethodIndices, Set 
unshareableResources, Set applicationManagedSecurityResources, BasicTimerService 
timerService) throws Exception {
  -        super(containerId, proxyFactory, null, lifecycleInterceptorChain, 
systemMethodIndices, unshareableResources, applicationManagedSecurityResources, 
timerService);
  +    public CMPInstanceContext(Object containerId, EJBProxyFactory proxyFactory, 
InstanceOperation[] itable, FaultHandler loadFault, IdentityTransform 
primaryKeyTransform, CMPInstanceContextFactory contextFactory, Interceptor 
lifecycleInterceptorChain, SystemMethodIndices systemMethodIndices, Set 
unshareableResources, Set applicationManagedSecurityResources, 
TransactionContextManager transactionContextManager, BasicTimerService timerService) 
throws Exception {
  +        super(containerId, proxyFactory, null, lifecycleInterceptorChain, 
systemMethodIndices, unshareableResources, applicationManagedSecurityResources, 
transactionContextManager, timerService);
           this.itable = itable;
           this.loadFault = loadFault;
           this.primaryKeyTransform = primaryKeyTransform;
  
  
  
  1.13      +14 -17    
openejb/modules/core/src/java/org/openejb/entity/cmp/CMPInstanceContextFactory.java
  
  Index: CMPInstanceContextFactory.java
  ===================================================================
  RCS file: 
/home/projects/openejb/scm/openejb/modules/core/src/java/org/openejb/entity/cmp/CMPInstanceContextFactory.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- CMPInstanceContextFactory.java    20 Jul 2004 23:40:02 -0000      1.12
  +++ CMPInstanceContextFactory.java    5 Oct 2004 07:04:00 -0000       1.13
  @@ -47,7 +47,6 @@
    */
   package org.openejb.entity.cmp;
   
  -import java.io.InvalidClassException;
   import java.io.ObjectStreamException;
   import java.io.Serializable;
   import java.lang.reflect.Method;
  @@ -55,32 +54,29 @@
   import java.util.Iterator;
   import java.util.Map;
   import java.util.Set;
  -
   import javax.ejb.EntityBean;
   import javax.ejb.EntityContext;
   
  -import org.apache.geronimo.transaction.InstanceContext;
  -import org.apache.geronimo.core.service.Interceptor;
  -
   import net.sf.cglib.proxy.Callback;
   import net.sf.cglib.proxy.CallbackFilter;
   import net.sf.cglib.proxy.Enhancer;
   import net.sf.cglib.proxy.MethodInterceptor;
   import net.sf.cglib.proxy.NoOp;
   import net.sf.cglib.reflect.FastClass;
  +import org.apache.geronimo.core.service.Interceptor;
  +import org.apache.geronimo.transaction.InstanceContext;
  +import org.apache.geronimo.transaction.context.TransactionContextManager;
   import org.openejb.InstanceContextFactory;
  -import org.openejb.timer.BasicTimerService;
  +import org.openejb.dispatch.InterfaceMethodSignature;
   import org.openejb.dispatch.MethodHelper;
   import org.openejb.dispatch.MethodSignature;
  -import org.openejb.dispatch.InterfaceMethodSignature;
   import org.openejb.dispatch.SystemMethodIndices;
   import org.openejb.proxy.EJBProxyFactory;
  +import org.openejb.timer.BasicTimerService;
   import org.tranql.cache.FaultHandler;
   import org.tranql.identity.IdentityTransform;
   
   /**
  - *
  - *
    * @version $Revision$ $Date$
    */
   public class CMPInstanceContextFactory implements InstanceContextFactory, 
Serializable {
  @@ -96,9 +92,10 @@
       private transient EJBProxyFactory proxyFactory;
       private transient Interceptor systemChain;
       private transient SystemMethodIndices systemMethodIndices;
  +    private transient TransactionContextManager transactionContextManager;
       private transient BasicTimerService timerService;
   
  -    public CMPInstanceContextFactory(Object containerId, IdentityTransform 
primaryKeyTransform, FaultHandler loadFault, Class beanClass, Map imap, Set 
unshareableResources, Set applicationManagedSecurityResources) throws 
ClassNotFoundException {
  +    public CMPInstanceContextFactory(Object containerId, IdentityTransform 
primaryKeyTransform, FaultHandler loadFault, Class beanClass, Map imap, Set 
unshareableResources, Set applicationManagedSecurityResources) {
           this.containerId = containerId;
           this.primaryKeyTransform = primaryKeyTransform;
           this.loadFault = loadFault;
  @@ -139,6 +136,10 @@
           return systemMethodIndices;
       }
   
  +    public void setTransactionContextManager(TransactionContextManager 
transactionContextManager) {
  +        this.transactionContextManager = transactionContextManager;
  +    }
  +
       public void setTimerService(BasicTimerService timerService) {
           this.timerService = timerService;
       }
  @@ -147,7 +148,7 @@
           if (proxyFactory == null) {
               throw new IllegalStateException("ProxyFactory has not been set");
           }
  -        return new CMPInstanceContext(containerId, proxyFactory, itable, loadFault, 
primaryKeyTransform, this, systemChain, systemMethodIndices, unshareableResources, 
applicationManagedSecurityResources, timerService);
  +        return new CMPInstanceContext(containerId, proxyFactory, itable, loadFault, 
primaryKeyTransform, this, systemChain, systemMethodIndices, unshareableResources, 
applicationManagedSecurityResources, transactionContextManager, timerService);
       }
   
       public synchronized EntityBean createCMPBeanInstance(CMPInstanceContext 
instanceContext) {
  @@ -165,10 +166,6 @@
       };
   
       private Object readResolve() throws ObjectStreamException {
  -        try {
  -            return new CMPInstanceContextFactory(containerId, primaryKeyTransform, 
loadFault, beanClass, imap, unshareableResources, applicationManagedSecurityResources);
  -        } catch (ClassNotFoundException e) {
  -            throw (InvalidClassException) new InvalidClassException("Cound not load 
method argument class").initCause(e);
  -        }
  +        return new CMPInstanceContextFactory(containerId, primaryKeyTransform, 
loadFault, beanClass, imap, unshareableResources, applicationManagedSecurityResources);
       }
   }
  
  
  

Reply via email to