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

Manik Surtani msurtani at jboss.com
Mon Jan 15 11:19:09 EST 2007


  User: msurtani
  Date: 07/01/15 11:19:09

  Modified:    src/org/jboss/cache/buddyreplication  GravitateResult.java
  Log:
  * JBCACHE-752
  * Refactored GravitationResult
  * Updated CacheMarshaller200 to marshall GravitateResults and NodeData
  * Moved NodeData (and related objects) to o.j.c.marshall pkg
  
  Revision  Changes    Path
  1.6       +37 -59    JBossCache/src/org/jboss/cache/buddyreplication/GravitateResult.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: GravitateResult.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/buddyreplication/GravitateResult.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -b -r1.5 -r1.6
  --- GravitateResult.java	30 Dec 2006 19:48:45 -0000	1.5
  +++ GravitateResult.java	15 Jan 2007 16:19:09 -0000	1.6
  @@ -1,104 +1,82 @@
   package org.jboss.cache.buddyreplication;
   
   import org.jboss.cache.Fqn;
  -import org.jboss.cache.Node;
  +import org.jboss.cache.marshall.NodeData;
   
  -import java.util.ArrayList;
   import java.util.List;
   
  +/**
  + * A class that encapsulates the result of a data gravitation call, a part of the Buddy Replication framwork.  A GravitateResult
  + * contains 3 elements; a boolean indicating whether the gravitation request found any data at all, a List of {@link NodeData} objects
  + * containing the data to be gravitated, and an {@link Fqn} of the buddy backup region being gravitated.
  + *
  + * @since 2.0.0
  + */
   public class GravitateResult
   {
      private boolean dataFound;
   
  -   /**
  -    * Represents one <code>Node</code> in the subtree rooted
  -    * at <code>fqn</code>.
  -    */
  -   private List<Node> subtree;
  -
  -   private byte marshalledData[];
  +   private List<NodeData> nodeData;
   
  -   private Fqn buddyBackupRegion;
  +   private Fqn buddyBackupFqn;
   
  +   /**
  +    * Factory method that creates a GravitateResult indicating that no data has been found.
  +    *
  +    * @return GravitateResult encapsulating the fact that no data was found
  +    */
      public static GravitateResult noDataFound()
      {
  -      return new GravitateResult(false, null, null, null);
  +      return new GravitateResult(false, null, null);
      }
   
  -   public static GravitateResult subtreeResult(List<Node> subtree, Fqn fqn)
  -   {
  -      return new GravitateResult(true, subtree, null, fqn);
  -   }
  -
  -   public static GravitateResult marshalledResult(byte[] marshalledData, Fqn fqn)
  +   /**
  +    * Factory method that creates a GravitateResult with the data found and the backup fqn it was found in.
  +    *
  +    * @param nodeData data found
  +    * @param fqn      backup fqn the data was found in
  +    * @return GravitateResult encapsulating the above
  +    */
  +   public static GravitateResult subtreeResult(List<NodeData> nodeData, Fqn fqn)
      {
  -      return new GravitateResult(true, null, marshalledData, fqn);
  +      return new GravitateResult(true, nodeData, fqn);
      }
   
  -   private GravitateResult(boolean dataFound, List<Node> subtree, byte[] marshalledData, Fqn buddyBackupRegion)
  +   private GravitateResult(boolean dataFound, List<NodeData> nodeData, Fqn buddyBackupRegion)
      {
         this.dataFound = dataFound;
  -      this.subtree = subtree;
  -      this.marshalledData = marshalledData;
  -      this.buddyBackupRegion = buddyBackupRegion;
  +      this.nodeData = nodeData;
  +      this.buddyBackupFqn = buddyBackupRegion;
      }
   
      /**
  -    * @return the buddyBackupRegion
  +    * @return the buddyBackupFqn
       */
  -   public Fqn getBuddyBackupRegion()
  +   public Fqn getBuddyBackupFqn()
      {
  -      return buddyBackupRegion;
  +      return buddyBackupFqn;
      }
   
      /**
       * @return true if data was found
       */
  -   public boolean getDataFound()
  +   public boolean isDataFound()
      {
         return dataFound;
      }
   
      /**
  -    * @return the marshalledData
  -    */
  -   public byte[] getMarshalledData()
  -   {
  -      return marshalledData;
  -   }
  -
  -   /**
  -    * @return the subtree
  +    * @return the nodeData
       */
  -   public List<Node> getSubtree()
  +   public List<NodeData> getNodeData()
      {
  -      return subtree;
  +      return nodeData;
      }
   
      public String toString()
      {
         return "Result dataFound=" + dataFound +
  -              " subtree=" + subtree +
  -              " data=" + marshalledData +
  -              " fqn=" + buddyBackupRegion;
  -   }
  -
  -   /**
  -    * Converts the data to some weird format.
  -    */
  -   public List asList()
  -   {
  -      List l = new ArrayList();
  -      l.add(dataFound);
  -      if (dataFound)
  -      {
  -         if (marshalledData != null)
  -            l.add(marshalledData);
  -         else
  -            l.add(subtree);
  -         l.add(buddyBackupRegion);
  -      }
  -      return l;
  +              " nodeData=" + nodeData +
  +              " fqn=" + buddyBackupFqn;
      }
  -
   }
  
  
  



More information about the jboss-cvs-commits mailing list