dblevins    2005/08/26 17:28:34

  Modified:    modules/core/src/java/org/openejb/alt/containers/castor_cmp11
                        CastorCmpEntityTxPolicy.java
  Log:

  This code was checking for specific container implementation classes and 
altering it's
  building logic.  This is a point of weakness in the pluggable container 
concept and
  needs to be cleaned up beyond the fixes I've just made.
  
  Revision  Changes    Path
  1.3       +14 -3     
openejb1/modules/core/src/java/org/openejb/alt/containers/castor_cmp11/CastorCmpEntityTxPolicy.java
  
  Index: CastorCmpEntityTxPolicy.java
  ===================================================================
  RCS file: 
/home/projects/openejb/scm/openejb1/modules/core/src/java/org/openejb/alt/containers/castor_cmp11/CastorCmpEntityTxPolicy.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- CastorCmpEntityTxPolicy.java      8 Aug 2005 00:02:15 -0000       1.2
  +++ CastorCmpEntityTxPolicy.java      26 Aug 2005 21:28:34 -0000      1.3
  @@ -9,7 +9,9 @@
   import org.openejb.ApplicationException;
   import org.openejb.core.transaction.TransactionContext;
   import org.openejb.core.transaction.TransactionPolicy;
  +import org.openejb.core.transaction.TransactionContainer;
   import org.openejb.core.DeploymentInfo;
  +import org.openejb.core.RpcContainerWrapper;
   
   /**
    * Wraps the TxPolicies for EntityBeans beans with container-managed
  @@ -40,10 +42,19 @@
           this.policy     = policy;
           this.container  = policy.getContainer();
           this.policyType = policy.policyType;
  -        
  -        this.cmpContainer   = (CastorCMP11_EntityContainer)container;
  +
  +        this.cmpContainer = getCastorContainer(container);
           
           this.jdo_ForLocalTransaction  = cmpContainer.jdo_ForLocalTransaction;
  +    }
  +
  +    private CastorCMP11_EntityContainer 
getCastorContainer(TransactionContainer container) {
  +        if (container instanceof RpcContainerWrapper) {
  +            RpcContainerWrapper wrapper = (RpcContainerWrapper)container;
  +            return getCastorContainer((TransactionContainer) 
wrapper.getContainer());
  +        } else {
  +            return (CastorCMP11_EntityContainer)container;
  +        }
       }
   
       public void beforeInvoke(EnterpriseBean instance, TransactionContext 
context) throws org.openejb.SystemException, org.openejb.ApplicationException{
  
  
  

Reply via email to