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

Manik Surtani msurtani at jboss.com
Sat Dec 30 22:01:20 EST 2006


  User: msurtani
  Date: 06/12/30 22:01:20

  Modified:    src/org/jboss/cache     Node.java CacheImpl.java Cache.java
                        UnversionedNode.java
  Log:
  move api still WIP
  
  Revision  Changes    Path
  1.53      +0 -45     JBossCache/src/org/jboss/cache/Node.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: Node.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/Node.java,v
  retrieving revision 1.52
  retrieving revision 1.53
  diff -u -b -r1.52 -r1.53
  --- Node.java	30 Dec 2006 19:48:46 -0000	1.52
  +++ Node.java	31 Dec 2006 03:01:20 -0000	1.53
  @@ -151,51 +151,6 @@
      void clearData();
   
      /**
  -    * Moves a part of the cache to a different subtree.
  -    * <p/>
  -    * E.g.:
  -    * <p/>
  -    * assume a cache structure such as:
  -    * <p/>
  -    * <pre>
  -    *  /a/b/c
  -    *  /a/b/d
  -    *  /a/b/e
  -    * <p/>
  -    * <p/>
  -    *  Node n = cache.getChild("/a/b/c");
  -    * <p/>
  -    *  n.move(cache.getChild("/a/b/d"));
  -    * </pre>
  -    * <p/>
  -    * Will result in:
  -    * <pre>
  -    * <p/>
  -    * /a/b/d/c
  -    * /a/b/e
  -    * <p/>
  -    * </pre>
  -    * <p/>
  -    * and now
  -    * <p/>
  -    * <pre>
  -    * Node n2 = cache.getChild("/a/b/e");
  -    * n2.move(cache.getChild("/a"));
  -    * </pre>
  -    * <p/>
  -    * will result in:
  -    * <pre>
  -    * /a/b/d/c
  -    * /a/e
  -    * </pre>
  -    * No-op if called on a root node.
  -    *
  -    * @param newParent new location under which to attach the current node.
  -    * @throws NodeNotExistsException may throw one of these if the target node does not exist or if a different thread has moved this node elsewhere already.
  -    */
  -   void move(Node newParent) throws NodeNotExistsException;
  -
  -   /**
       * @param f {@link Fqn} relative to the current node of the child you are testing the existence of.
       * @return Returns true if the child node denoted by the {@link Fqn} passed in exists.
       */
  
  
  
  1.4       +4 -4      JBossCache/src/org/jboss/cache/CacheImpl.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: CacheImpl.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/CacheImpl.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -b -r1.3 -r1.4
  --- CacheImpl.java	31 Dec 2006 02:08:40 -0000	1.3
  +++ CacheImpl.java	31 Dec 2006 03:01:20 -0000	1.4
  @@ -98,7 +98,7 @@
    * @author <a href="mailto:manik at jboss.org">Manik Surtani (manik at jboss.org)</a>
    * @author Brian Stansberry
    * @author Daniel Huang (dhuang at jboss.org)
  - * @version $Id: CacheImpl.java,v 1.3 2006/12/31 02:08:40 msurtani Exp $
  + * @version $Id: CacheImpl.java,v 1.4 2006/12/31 03:01:20 msurtani Exp $
    *          <p/>
    * @see <a href="http://labs.jboss.com/portal/jbosscache/docs">JBossCache doc</a>
    */
  @@ -3143,10 +3143,10 @@
       *
       * @since 2.0.0
       */
  -   public void move(Fqn newParent, Fqn nodeToMove)
  +   public void move(Fqn nodeToMove, Fqn newParent)
      {
         // this needs to be passed up the interceptor chain
  -      MethodCall m = MethodCallFactory.create(MethodDeclarations.moveMethodLocal, newParent, nodeToMove);
  +      MethodCall m = MethodCallFactory.create(MethodDeclarations.moveMethodLocal, nodeToMove, newParent);
         invokeMethod(m);
      }
   
  @@ -3156,7 +3156,7 @@
       * @param newParentFqn
       * @param nodeToMoveFqn
       */
  -   public void _move(Fqn newParentFqn, Fqn nodeToMoveFqn)
  +   public void _move(Fqn nodeToMoveFqn, Fqn newParentFqn)
      {
         // the actual move algorithm.
         NodeSPI newParent = findNode(newParentFqn);
  
  
  
  1.17      +48 -0     JBossCache/src/org/jboss/cache/Cache.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: Cache.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/Cache.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -b -r1.16 -r1.17
  --- Cache.java	30 Dec 2006 17:49:54 -0000	1.16
  +++ Cache.java	31 Dec 2006 03:01:20 -0000	1.17
  @@ -211,4 +211,52 @@
       * @return a {@link List} of members in the cluster.  Null if running in local mode.
       */
      List<Address> getMembers();
  +
  +   /**
  +    * Moves a part of the cache to a different subtree.
  +    * <p/>
  +    * E.g.:
  +    * <p/>
  +    * assume a cache structure such as:
  +    * <p/>
  +    * <pre>
  +    *  /a/b/c
  +    *  /a/b/d
  +    *  /a/b/e
  +    * <p/>
  +    * <p/>
  +    *  Fqn f1 = Fqn.fromString("/a/b/c");
  +    *  Fqn f2 = Fqn.fromString("/a/b/d");
  +    * <p/>
  +    *  cache.move(f1, f2);
  +    * </pre>
  +    * <p/>
  +    * Will result in:
  +    * <pre>
  +    * <p/>
  +    * /a/b/d/c
  +    * /a/b/e
  +    * <p/>
  +    * </pre>
  +    * <p/>
  +    * and now
  +    * <p/>
  +    * <pre>
  +    *  Fqn f3 = Fqn.fromString("/a/b/e");
  +    *  Fqn f4 = Fqn.fromString("/a");
  +    *  cache.move(f3, f4);
  +    * </pre>
  +    * <p/>
  +    * will result in:
  +    * <pre>
  +    * /a/b/d/c
  +    * /a/e
  +    * </pre>
  +    * No-op if the node to be moved is the root node.
  +    *
  +    * @param nodeToMove the Fqn of the node to move.
  +    * @param newParent  new location under which to attach the node being moved.
  +    * @throws NodeNotExistsException may throw one of these if the target node does not exist or if a different thread has moved this node elsewhere already.
  +    */
  +   void move(Fqn nodeToMove, Fqn newParent) throws NodeNotExistsException;
   }
  
  
  
  1.3       +0 -11     JBossCache/src/org/jboss/cache/UnversionedNode.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: UnversionedNode.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/UnversionedNode.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -b -r1.2 -r1.3
  --- UnversionedNode.java	31 Dec 2006 02:08:41 -0000	1.2
  +++ UnversionedNode.java	31 Dec 2006 03:01:20 -0000	1.3
  @@ -597,17 +597,6 @@
         return ((CacheImpl) cache).exists(new Fqn(getFqn(), f));
      }
   
  -   public void move(Node newParent) throws NodeNotExistsException
  -   {
  -      if (log.isTraceEnabled())
  -      {
  -         log.trace(this.getFqn() + " move to " + newParent.getFqn());
  -      }
  -      // TODO
  -      // move must be added to Cache
  -      ((CacheImpl) cache).move(newParent.getFqn(), getFqn());
  -   }
  -
      public void putIfNull(Object k, Object v)
      {
         if (cache.get(getFqn(), k) == null)
  
  
  



More information about the jboss-cvs-commits mailing list