[jboss-cvs] JBossCache/src-50/org/jboss/cache/pojo/interceptors/dynamic ...

Ben Wang bwang at jboss.com
Thu Jul 13 11:56:12 EDT 2006


  User: bwang   
  Date: 06/07/13 11:56:12

  Modified:    src-50/org/jboss/cache/pojo/interceptors/dynamic    
                        CacheFieldInterceptor.java
                        CachedListInterceptor.java
                        CachedMapInterceptor.java CachedSetInterceptor.java
  Log:
  Refctoring and moved some classes to impl dir.
  
  Revision  Changes    Path
  1.4       +17 -14    JBossCache/src-50/org/jboss/cache/pojo/interceptors/dynamic/CacheFieldInterceptor.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: CacheFieldInterceptor.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src-50/org/jboss/cache/pojo/interceptors/dynamic/CacheFieldInterceptor.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -b -r1.3 -r1.4
  --- CacheFieldInterceptor.java	12 Jul 2006 13:28:25 -0000	1.3
  +++ CacheFieldInterceptor.java	13 Jul 2006 15:56:12 -0000	1.4
  @@ -23,7 +23,8 @@
   import org.jboss.cache.pojo.PojoTreeCache;
   import org.jboss.cache.pojo.CachedType;
   import org.jboss.cache.pojo.PojoReference;
  -import org.jboss.cache.pojo.InternalDelegate;
  +import org.jboss.cache.pojo.impl.PojoCacheImpl;
  +import org.jboss.cache.pojo.impl.InternalConstant;
   
   import java.lang.reflect.Field;
   import java.util.Iterator;
  @@ -36,16 +37,18 @@
   
   public class CacheFieldInterceptor implements BaseInterceptor
   {
  -   private static final Log log_ = LogFactory.getLog(CacheFieldInterceptor.class);
  +   private final Log log_ = LogFactory.getLog(CacheFieldInterceptor.class);
      private PojoTreeCache cache;
  +   private PojoCacheImpl pCache;
      private CachedType type;
      private Fqn fqn;
      private String name;
      private PojoReference pojoReference;
   
  -   public CacheFieldInterceptor(PojoTreeCache cache, Fqn fqn, CachedType type)
  +   public CacheFieldInterceptor(PojoCacheImpl pCache, Fqn fqn, CachedType type)
      {
  -      this.cache = cache;
  +      this.pCache = pCache;
  +      cache = (PojoTreeCache)this.pCache.getCache();
         this.fqn = fqn;
         this.type = type;
      }
  @@ -111,8 +114,8 @@
            Field field = fieldInvocation.getField();
   
            // Only if this field is replicatable. static, transient and final are not.
  -         CachedType fieldType = cache.getCachedType(field.getType());
  -         CachedType parentType = cache.getCachedType(field.getDeclaringClass());
  +         CachedType fieldType = pCache.getCachedType(field.getType());
  +         CachedType parentType = pCache.getCachedType(field.getDeclaringClass());
            if (!isNonReplicatable(field, advisor, parentType))
            {
               Object value = ((FieldWriteInvocation) fieldInvocation).getValue();
  @@ -122,7 +125,7 @@
               } else
               {
                  //cache.putObject(((Fqn)fqn.clone()).add(field.getName()), value);
  -               cache.putObject(new Fqn(fqn, field.getName()), value);
  +               pCache.putObject(new Fqn(fqn, field.getName()), value);
               }
            }
   
  @@ -134,8 +137,8 @@
            Advisor advisor = fieldInvocation.getAdvisor();
   
            // Only if this field is replicatable
  -         CachedType fieldType = cache.getCachedType(field.getType());
  -         CachedType parentType = cache.getCachedType(field.getDeclaringClass());
  +         CachedType fieldType = pCache.getCachedType(field.getType());
  +         CachedType parentType = pCache.getCachedType(field.getDeclaringClass());
            if (!isNonReplicatable(field, advisor, parentType))
            {
               Object result;
  @@ -145,7 +148,7 @@
               } else
               {
                  //result = cache.getObject(((Fqn)fqn.clone()).add(field.getName()));
  -               result = cache.getObject(new Fqn(fqn, field.getName()));
  +               result = pCache.getObject(new Fqn(fqn, field.getName()));
               }
   
               // if result is null, we need to make sure the in-memory reference is null
  @@ -166,7 +169,7 @@
                        log_.trace("invoke(): DataNode on fqn: " + fqn + " has obviously been evicted. Will need to reconstruct it");
                     }
   
  -                  cache.putObject(fqn, value);
  +                  pCache.putObject(fqn, value);
                  }
               }
            }
  @@ -210,7 +213,7 @@
      private boolean isPojoDetached(Invocation invocation)
      {
         boolean detached = false;
  -      if (!cache.exists(fqn, InternalDelegate.CLASS_INTERNAL))
  +      if (!cache.exists(fqn, InternalConstant.CLASS_INTERNAL))
         {
            detached = true;
            Object obj = invocation.getTargetObject();
  @@ -247,7 +250,7 @@
         for (Iterator i = type.getFields().iterator(); i.hasNext();)
         {
            Field field = (Field) (((FieldPersistentReference) i.next())).get();
  -         CachedType fieldType = cache.getCachedType(field.getType());
  +         CachedType fieldType = pCache.getCachedType(field.getType());
            Object value = null;
            if (fieldType.isImmediate())
            {
  @@ -256,7 +259,7 @@
            {
               //		value = removeObject(fqn+TreeCache.SEPARATOR+field.getName());
               //value = cache.getObject(((Fqn)fqn.clone()).add(field.getName()));
  -            value = cache.getObject(new Fqn(fqn, field.getName()));
  +            value = pCache.getObject(new Fqn(fqn, field.getName()));
            }
            //	    System.out.println("Setting field " + field.getName() + "[" + field.getDeclaringClass() + "] of "+ target.getClass() + " to " + value);
            field.set(target, value);
  
  
  
  1.2       +2 -2      JBossCache/src-50/org/jboss/cache/pojo/interceptors/dynamic/CachedListInterceptor.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: CachedListInterceptor.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src-50/org/jboss/cache/pojo/interceptors/dynamic/CachedListInterceptor.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- CachedListInterceptor.java	7 Jul 2006 10:26:04 -0000	1.1
  +++ CachedListInterceptor.java	13 Jul 2006 15:56:12 -0000	1.2
  @@ -7,7 +7,7 @@
   package org.jboss.cache.pojo.interceptors.dynamic;
   
   import org.jboss.cache.Fqn;
  -import org.jboss.cache.pojo.PojoTreeCache;
  +import org.jboss.cache.pojo.impl.PojoCacheImpl;
   import org.jboss.cache.pojo.collection.CollectionInterceptorUtil;
   import org.jboss.cache.pojo.collection.CachedListImpl;
   import org.jboss.aop.advice.Interceptor;
  @@ -38,7 +38,7 @@
      // Whichever is used now.
      private List current_;
   
  -   public CachedListInterceptor(PojoTreeCache cache, Fqn fqn, Class clazz, List obj)
  +   public CachedListInterceptor(PojoCacheImpl cache, Fqn fqn, Class clazz, List obj)
      {
         this.fqn_ = fqn;
         methodMap_ = CollectionInterceptorUtil.getMethodMap(clazz);
  
  
  
  1.2       +2 -2      JBossCache/src-50/org/jboss/cache/pojo/interceptors/dynamic/CachedMapInterceptor.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: CachedMapInterceptor.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src-50/org/jboss/cache/pojo/interceptors/dynamic/CachedMapInterceptor.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- CachedMapInterceptor.java	7 Jul 2006 10:26:04 -0000	1.1
  +++ CachedMapInterceptor.java	13 Jul 2006 15:56:12 -0000	1.2
  @@ -7,7 +7,7 @@
   package org.jboss.cache.pojo.interceptors.dynamic;
   
   import org.jboss.cache.Fqn;
  -import org.jboss.cache.pojo.PojoTreeCache;
  +import org.jboss.cache.pojo.impl.PojoCacheImpl;
   import org.jboss.cache.pojo.collection.CollectionInterceptorUtil;
   import org.jboss.cache.pojo.collection.CachedMapImpl;
   import org.jboss.aop.advice.Interceptor;
  @@ -33,7 +33,7 @@
      private Map inMemImpl_;
      private Map current_;
   
  -   public CachedMapInterceptor(PojoTreeCache cache, Fqn fqn, Class clazz, Map obj)
  +   public CachedMapInterceptor(PojoCacheImpl cache, Fqn fqn, Class clazz, Map obj)
      {
         this.fqn_ = fqn;
         methodMap_ = CollectionInterceptorUtil.getMethodMap(clazz);
  
  
  
  1.2       +2 -2      JBossCache/src-50/org/jboss/cache/pojo/interceptors/dynamic/CachedSetInterceptor.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: CachedSetInterceptor.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src-50/org/jboss/cache/pojo/interceptors/dynamic/CachedSetInterceptor.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- CachedSetInterceptor.java	7 Jul 2006 10:26:04 -0000	1.1
  +++ CachedSetInterceptor.java	13 Jul 2006 15:56:12 -0000	1.2
  @@ -7,7 +7,7 @@
   package org.jboss.cache.pojo.interceptors.dynamic;
   
   import org.jboss.cache.Fqn;
  -import org.jboss.cache.pojo.PojoTreeCache;
  +import org.jboss.cache.pojo.impl.PojoCacheImpl;
   import org.jboss.cache.pojo.collection.CollectionInterceptorUtil;
   import org.jboss.cache.pojo.collection.CachedSetImpl;
   import org.jboss.aop.advice.Interceptor;
  @@ -34,7 +34,7 @@
      private Set current_;
      private Set inMemImpl_;
   
  -   public CachedSetInterceptor(PojoTreeCache cache, Fqn fqn, Class clazz, Set obj)
  +   public CachedSetInterceptor(PojoCacheImpl cache, Fqn fqn, Class clazz, Set obj)
      {
         this.fqn_ = fqn;
         methodMap_ = CollectionInterceptorUtil.getMethodMap(clazz);
  
  
  



More information about the jboss-cvs-commits mailing list