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

Manik Surtani msurtani at jboss.com
Fri Sep 22 13:04:49 EDT 2006


  User: msurtani
  Date: 06/09/22 13:04:49

  Modified:    src/org/jboss/cache/loader  AbstractCacheLoader.java
  Log:
  Fixed move-related issues
  
  Revision  Changes    Path
  1.7       +25 -0     JBossCache/src/org/jboss/cache/loader/AbstractCacheLoader.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: AbstractCacheLoader.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/loader/AbstractCacheLoader.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -b -r1.6 -r1.7
  --- AbstractCacheLoader.java	22 Sep 2006 16:27:56 -0000	1.6
  +++ AbstractCacheLoader.java	22 Sep 2006 17:04:49 -0000	1.7
  @@ -209,8 +209,33 @@
               case REMOVE_NODE:
                  remove(m.getFqn());
                  break;
  +            case MOVE:
  +//                involve moving all children too,
  +               _move(m.getFqn(), m.getFqn2());
  +               break;
  +            default:
  +               throw new CacheException("Unknown modificatiobn " + m.getType());
            }
         }
      }
   
  +   private void _move(Fqn parent, Fqn node) throws Exception
  +   {
  +      Object name = node.getName();
  +      Fqn newFqn = new Fqn(parent, name);
  +
  +      // start deep.
  +      for (Object c : getChildrenNames(node))
  +      {
  +         _move(newFqn, new Fqn(node, c));
  +      }
  +      // get data for node.
  +      Map data = get(node);
  +      if (data != null) // if null, then the node never existed.  Don't bother removing?
  +      {
  +         remove(node);
  +         put(newFqn, data);
  +      }
  +   }
  +
   }
  
  
  



More information about the jboss-cvs-commits mailing list