[jboss-cvs] JBossCache/src/org/jboss/cache/aop/collection ...

Ben Wang bwang at jboss.com
Tue Jan 2 02:19:05 EST 2007


  User: bwang   
  Date: 07/01/02 02:19:05

  Modified:    src/org/jboss/cache/aop/collection    Tag:
                        Branch_JBossCache_1_4_0 CachedSetImpl.java
                        CachedListImpl.java CachedMapImpl.java
  Log:
  JBCACHE-909 CacheLoader and Collection.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.15.2.1  +4 -13     JBossCache/src/org/jboss/cache/aop/collection/Attic/CachedSetImpl.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: CachedSetImpl.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/aop/collection/Attic/CachedSetImpl.java,v
  retrieving revision 1.15
  retrieving revision 1.15.2.1
  diff -u -b -r1.15 -r1.15.2.1
  --- CachedSetImpl.java	1 Jun 2006 03:56:44 -0000	1.15
  +++ CachedSetImpl.java	2 Jan 2007 07:19:05 -0000	1.15.2.1
  @@ -35,10 +35,10 @@
         this.interceptor_ = interceptor;
      }
   
  -   protected DataNode getNode()
  +   protected Set getNodeChildren()
      {
         try {
  -         return cache_._get(getFqn());
  +         return AopUtil.getNodeChildren(cache_, getFqn());
         } catch (Exception e) {
            throw new RuntimeException(e);
         }
  @@ -141,17 +141,8 @@
   
      private Collection keySet()
      {
  -      DataNode node = getNode();
  -
  -      if (node != null) {
  -         Map children = node.getChildren();
  -
  -         if (children != null) {
  -            return children.keySet();
  -         }
  -      }
  -
  -      return Collections.EMPTY_SET;
  +      Set children = getNodeChildren();
  +      return (children == null)? Collections.EMPTY_SET : children;
      }
   
      private class IteratorImpl implements Iterator
  
  
  
  1.16.2.2  +3 -8      JBossCache/src/org/jboss/cache/aop/collection/Attic/CachedListImpl.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: CachedListImpl.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/aop/collection/Attic/CachedListImpl.java,v
  retrieving revision 1.16.2.1
  retrieving revision 1.16.2.2
  diff -u -b -r1.16.2.1 -r1.16.2.2
  --- CachedListImpl.java	10 Oct 2006 08:11:21 -0000	1.16.2.1
  +++ CachedListImpl.java	2 Jan 2007 07:19:05 -0000	1.16.2.2
  @@ -40,10 +40,10 @@
      }
   
      // implementation of the java.util.List interface
  -   protected DataNode getNode()
  +   protected Set getNodeChildren()
      {
         try {
  -         return cache_._get(getFqn());
  +         return AopUtil.getNodeChildren(cache_, getFqn());
         } catch (Exception e) {
            throw new RuntimeException(e);
         }
  @@ -73,12 +73,7 @@
   
      public int size()
      {
  -      DataNode node = getNode();
  -      if(node == null) {
  -         return 0;
  -      }
  -
  -      Map children = node.getChildren();
  +      Set children = getNodeChildren();
         return children == null ? 0 : children.size();
      }
   
  
  
  
  1.15.2.2  +24 -18    JBossCache/src/org/jboss/cache/aop/collection/Attic/CachedMapImpl.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: CachedMapImpl.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/aop/collection/Attic/CachedMapImpl.java,v
  retrieving revision 1.15.2.1
  retrieving revision 1.15.2.2
  diff -u -b -r1.15.2.1 -r1.15.2.2
  --- CachedMapImpl.java	17 Sep 2006 07:55:48 -0000	1.15.2.1
  +++ CachedMapImpl.java	2 Jan 2007 07:19:05 -0000	1.15.2.2
  @@ -43,10 +43,21 @@
   
      // implementation of the java.util.Map interface
   
  +   /*
      protected DataNode getNode()
      {
         try {
  -         return cache_._get(getFqn());
  +         return AopUtil.get(cache_, getFqn());
  +      } catch (Exception e) {
  +         throw new RuntimeException(e);
  +      }
  +   }
  +   */
  +
  +   protected Set getNodeChildren()
  +   {
  +      try {
  +         return AopUtil.getNodeChildren(cache_, getFqn());
         } catch (Exception e) {
            throw new RuntimeException(e);
         }
  @@ -98,12 +109,7 @@
   
      public int size()
      {
  -      DataNode node = getNode();
  -      if(node == null) {
  -         return 0;
  -      }
  -
  -      Map children = node.getChildren();
  +      Set children = getNodeChildren();
         return children == null ? 0 : children.size();
      }
   
  @@ -114,10 +120,10 @@
   
      public boolean containsKey(Object object)
      {
  -      Map children = getNode().getChildren();
  +      Set children = getNodeChildren();
         if(object != null)               // if not null,
            object = object.toString();   // convert to internal form which is always string
  -      return children != null && children.containsKey(Null.toNullKeyObject(object));
  +      return children != null && children.contains(Null.toNullKeyObject(object));
      }
   
      public boolean containsValue(Object object)
  @@ -134,17 +140,17 @@
   
            public int size()
            {
  -            Map children = getNode().getChildren();
  +            Set children = getNodeChildren();
               return children == null ? 0 : children.size();
            }
   
            public Iterator iterator()
            {
  -            Map children = getNode().getChildren();
  +            Set children = getNodeChildren();
               final Iterator i =
                     children == null
                     ? Collections.EMPTY_LIST.iterator()
  -                  : children.keySet().iterator();
  +                  : children.iterator();
               return new Iterator()
               {
                  Object lastKey; // for remove
  @@ -177,7 +183,7 @@
   
            public int size()
            {
  -            Map children = getNode().getChildren();
  +            Set children = getNodeChildren();
               return children == null ? 0 : children.size();
            }
   
  @@ -187,11 +193,11 @@
   
            public Iterator iterator()
            {
  -            Map children = getNode().getChildren();
  +            Set children = getNodeChildren();
               final Iterator i =
                     children == null
                     ? Collections.EMPTY_LIST.iterator()
  -                  : children.keySet().iterator();
  +                  : children.iterator();
   
               return new Iterator()
               {
  @@ -235,17 +241,17 @@
   
            public int size()
            {
  -            Map children = getNode().getChildren();
  +            Set children = getNodeChildren();
               return children == null ? 0 : children.size();
            }
   
            public Iterator iterator()
            {
  -            Map children = getNode().getChildren();
  +            Set children = getNodeChildren();
               final Iterator i =
                     children == null
                     ? Collections.EMPTY_LIST.iterator()
  -                  : children.keySet().iterator();
  +                  : children.iterator();
   
               return new Iterator()
               {
  
  
  



More information about the jboss-cvs-commits mailing list