djencks     2005/09/12 22:31:44

  Modified:    modules/core/src/java/org/openejb/entity/cmp CMP1Bridge.java
                        CMPCreateMethod.java CMPFinder.java CMPGetter.java
                        CMPInstanceContext.java CMPRemoveMethod.java
                        CMPSelectMethod.java CMPSetter.java
                        InTxCacheInterceptor.java
  Log:

  GERONIMO-1005 abstract dependence of transaction on tranql
  
  Revision  Changes    Path
  1.2       +3 -3      
openejb/modules/core/src/java/org/openejb/entity/cmp/CMP1Bridge.java
  
  Index: CMP1Bridge.java
  ===================================================================
  RCS file: 
/home/projects/openejb/scm/openejb/modules/core/src/java/org/openejb/entity/cmp/CMP1Bridge.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CMP1Bridge.java   14 Oct 2004 16:31:07 -0000      1.1
  +++ CMP1Bridge.java   13 Sep 2005 02:31:44 -0000      1.2
  @@ -93,7 +93,7 @@
   
       public void loadCacheRow(CMPInstanceContext source, CacheRow 
destination) {
           EnterpriseBean entityBean = source.getInstance();
  -        InTxCache inTxCache = source.getTransactionContext().getInTxCache();
  +        InTxCache inTxCache = (InTxCache) 
source.getTransactionContext().getInTxCache();
           for (int i = 0; i < beanFields.length; i++) {
               Field beanField = beanFields[i];
               CMPFieldTransform fieldTransform = fieldTransforms[i];
  @@ -111,7 +111,7 @@
   
       public void loadEntityBean(CacheRow source, CMPInstanceContext 
destination) {
           EnterpriseBean entityBean = destination.getInstance();
  -        InTxCache inTxCache = 
destination.getTransactionContext().getInTxCache();
  +        InTxCache inTxCache = (InTxCache) 
destination.getTransactionContext().getInTxCache();
           for (int i = 0; i < beanFields.length; i++) {
               Field beanField = beanFields[i];
               CMPFieldTransform fieldTransform = fieldTransforms[i];
  
  
  
  1.16      +3 -3      
openejb/modules/core/src/java/org/openejb/entity/cmp/CMPCreateMethod.java
  
  Index: CMPCreateMethod.java
  ===================================================================
  RCS file: 
/home/projects/openejb/scm/openejb/modules/core/src/java/org/openejb/entity/cmp/CMPCreateMethod.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- CMPCreateMethod.java      7 Jul 2005 21:37:06 -0000       1.15
  +++ CMPCreateMethod.java      13 Sep 2005 02:31:44 -0000      1.16
  @@ -182,7 +182,7 @@
   
           // cache insert
           TransactionContext transactionContext = 
invocation.getTransactionContext();
  -        InTxCache cache = transactionContext.getInTxCache();
  +        InTxCache cache = (InTxCache) transactionContext.getInTxCache();
   
           try {
               if ( null != keyGenerator ) {
  @@ -198,7 +198,7 @@
               Object pk = primaryKeyTransform.getDomainIdentity(globalId);
               return invocation.createExceptionResult((Exception)new 
DuplicateKeyException("ID=" + pk));
           }
  -        
  +
           ctx.setCacheRow(cacheRow);
           ctx.setId(primaryKeyTransform.getDomainIdentity(globalId));
   
  
  
  
  1.15      +4 -4      
openejb/modules/core/src/java/org/openejb/entity/cmp/CMPFinder.java
  
  Index: CMPFinder.java
  ===================================================================
  RCS file: 
/home/projects/openejb/scm/openejb/modules/core/src/java/org/openejb/entity/cmp/CMPFinder.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- CMPFinder.java    5 Aug 2005 10:52:08 -0000       1.14
  +++ CMPFinder.java    13 Sep 2005 02:31:44 -0000      1.15
  @@ -68,7 +68,7 @@
       private final boolean flushCache;
       private final IdentityDefiner idDefiner;
       private final IdentityDefiner idInjector;
  -    
  +
       public CMPFinder(QueryCommand localCommand, QueryCommand remoteCommand, 
boolean flushCache, IdentityDefiner idDefiner, IdentityDefiner idInjector) {
           this.localCommand = localCommand;
           this.remoteCommand = remoteCommand;
  @@ -82,11 +82,11 @@
       }
   
       protected Object execute(EJBInvocation invocation, ResultHandler 
handler, Object ctx) throws QueryException {
  -        InTxCache cache = invocation.getTransactionContext().getInTxCache();
  +        InTxCache cache = (InTxCache) 
invocation.getTransactionContext().getInTxCache();
           if (flushCache) {
               cache.flush();
           }
  -        
  +
           QueryCommand command = getCommand(invocation);
           Row arguments = new Row(invocation.getArguments());
           PrefetchGroupHandler groupHandler = 
command.getQuery().getPrefetchGroupHandler();
  
  
  
  1.4       +2 -2      
openejb/modules/core/src/java/org/openejb/entity/cmp/CMPGetter.java
  
  Index: CMPGetter.java
  ===================================================================
  RCS file: 
/home/projects/openejb/scm/openejb/modules/core/src/java/org/openejb/entity/cmp/CMPGetter.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- CMPGetter.java    11 Apr 2004 05:55:25 -0000      1.3
  +++ CMPGetter.java    13 Sep 2005 02:31:44 -0000      1.4
  @@ -70,7 +70,7 @@
                   " fieldName=" + fieldName + ", args.length=" + args.length;
   
           CacheRow row = ctx.getCacheRow();
  -        InTxCache inTxCache = ctx.getTransactionContext().getInTxCache();
  +        InTxCache inTxCache = (InTxCache) 
ctx.getTransactionContext().getInTxCache();
           return field.get(inTxCache, row);
       }
   }
  
  
  
  1.17      +2 -2      
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.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- CMPInstanceContext.java   8 Jul 2005 23:14:14 -0000       1.16
  +++ CMPInstanceContext.java   13 Sep 2005 02:31:44 -0000      1.17
  @@ -138,7 +138,7 @@
   
               // locate the cache row for this instance
               GlobalIdentity globalId = 
primaryKeyTransform.getGlobalIdentity(id);
  -            InTxCache inTxCache = transactionContext.getInTxCache();
  +            InTxCache inTxCache = (InTxCache) 
transactionContext.getInTxCache();
               cacheRow = inTxCache.get(globalId);
   
               // if we don't already have the row execute the load fault 
handler
  
  
  
  1.10      +3 -3      
openejb/modules/core/src/java/org/openejb/entity/cmp/CMPRemoveMethod.java
  
  Index: CMPRemoveMethod.java
  ===================================================================
  RCS file: 
/home/projects/openejb/scm/openejb/modules/core/src/java/org/openejb/entity/cmp/CMPRemoveMethod.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- CMPRemoveMethod.java      20 Aug 2005 03:49:05 -0000      1.9
  +++ CMPRemoveMethod.java      13 Sep 2005 02:31:44 -0000      1.10
  @@ -106,7 +106,7 @@
                   }
               }
           }
  -        
  +
           cascadeOneDeleteFields = (CMPFieldTransform[]) 
cascadeOneDeleteFieldsList.toArray(new CMPFieldTransform[0]);
           cascadeManyDeleteFields = (CMPFieldTransform[]) 
cascadeManyDeleteFieldsList.toArray(new CMPFieldTransform[0]);
           cmrOneFields = (CMPFieldTransform[]) cmrOneFieldsList.toArray(new 
CMPFieldTransform[0]);
  @@ -136,7 +136,7 @@
                   }
               }
   
  -            InTxCache cache = 
invocation.getTransactionContext().getInTxCache();
  +            InTxCache cache = (InTxCache) 
invocation.getTransactionContext().getInTxCache();
               CacheRow cacheRow = ctx.getCacheRow();
   
               // get the entities to be deleted as part of a cascade delete
  
  
  
  1.6       +4 -4      
openejb/modules/core/src/java/org/openejb/entity/cmp/CMPSelectMethod.java
  
  Index: CMPSelectMethod.java
  ===================================================================
  RCS file: 
/home/projects/openejb/scm/openejb/modules/core/src/java/org/openejb/entity/cmp/CMPSelectMethod.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- CMPSelectMethod.java      5 Aug 2005 10:52:08 -0000       1.5
  +++ CMPSelectMethod.java      13 Sep 2005 02:31:44 -0000      1.6
  @@ -84,14 +84,14 @@
           this.flushCache = flushCache;
           this.idDefiner = idDefiner;
           this.idInjector = idInjector;
  -     
  +
           Query query = command.getQuery();
           resultAccessor = query.getResultAccessors()[0];
           groupHandler = query.getPrefetchGroupHandler();
       }
  -    
  +
       protected Object execute(CMPInstanceContext instCtx, ResultHandler 
handler, Object[] args, Object ctx) throws QueryException {
  -        InTxCache cache = instCtx.getTransactionContext().getInTxCache();
  +        InTxCache cache = (InTxCache) 
instCtx.getTransactionContext().getInTxCache();
           if (flushCache) {
               cache.flush();
           }
  
  
  
  1.4       +2 -2      
openejb/modules/core/src/java/org/openejb/entity/cmp/CMPSetter.java
  
  Index: CMPSetter.java
  ===================================================================
  RCS file: 
/home/projects/openejb/scm/openejb/modules/core/src/java/org/openejb/entity/cmp/CMPSetter.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- CMPSetter.java    11 Apr 2004 05:55:25 -0000      1.3
  +++ CMPSetter.java    13 Sep 2005 02:31:44 -0000      1.4
  @@ -70,7 +70,7 @@
                   " fieldName=" + fieldName + ", args.length=" + args.length;
   
           CacheRow row = ctx.getCacheRow();
  -        InTxCache inTxCache = ctx.getTransactionContext().getInTxCache();
  +        InTxCache inTxCache = (InTxCache) 
ctx.getTransactionContext().getInTxCache();
           field.set(inTxCache, row, args[0]);
           return null;
       }
  
  
  
  1.2       +15 -5     
openejb/modules/core/src/java/org/openejb/entity/cmp/InTxCacheInterceptor.java
  
  Index: InTxCacheInterceptor.java
  ===================================================================
  RCS file: 
/home/projects/openejb/scm/openejb/modules/core/src/java/org/openejb/entity/cmp/InTxCacheInterceptor.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- InTxCacheInterceptor.java 7 Nov 2004 08:04:27 -0000       1.1
  +++ InTxCacheInterceptor.java 13 Sep 2005 02:31:44 -0000      1.2
  @@ -51,13 +51,15 @@
   import org.apache.geronimo.core.service.Invocation;
   import org.apache.geronimo.core.service.InvocationResult;
   import org.apache.geronimo.transaction.context.TransactionContext;
  +import org.apache.geronimo.transaction.context.Flushable;
   import org.openejb.EJBInvocation;
   import org.tranql.cache.CacheFlushStrategyFactory;
   import org.tranql.cache.InTxCache;
  +import org.tranql.cache.CacheFlushStrategy;
   
   /**
  - * This interceptor defines, if required, the InTxCache of the 
  - * TransactionContext bound to the intercepted EJBInvocation. A 
  + * This interceptor defines, if required, the InTxCache of the
  + * TransactionContext bound to the intercepted EJBInvocation. A
    * CacheFlushStrategyFactory is used to create the CacheFlushStrategy to be
    * used under the cover of the defined InTxCache.
    *
  @@ -76,9 +78,17 @@
           EJBInvocation ejbInvocation = (EJBInvocation) invocation;
           TransactionContext transactionContext = 
ejbInvocation.getTransactionContext();
           if ( null == transactionContext.getInTxCache() ) {
  -            transactionContext.setInTxCache(new 
InTxCache(strategyFactory.createCacheFlushStrategy()));
  +            transactionContext.setInTxCache(new 
GeronimoInTxCache(strategyFactory.createCacheFlushStrategy()));
           }
  -        
  +
           return next.invoke(invocation);
  +    }
  +
  +    public static class GeronimoInTxCache extends InTxCache implements 
Flushable {
  +
  +        public GeronimoInTxCache(CacheFlushStrategy flushStrategy) {
  +            super(flushStrategy);
  +        }
  +
       }
   }
  
  
  

Reply via email to