[jbosscache-commits] JBoss Cache SVN: r6031 - in core/trunk/src/main/java/org/jboss/cache: mvcc and 1 other directory.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Wed Jun 25 09:29:24 EDT 2008


Author: manik.surtani at jboss.com
Date: 2008-06-25 09:29:24 -0400 (Wed, 25 Jun 2008)
New Revision: 6031

Added:
   core/trunk/src/main/java/org/jboss/cache/mvcc/
   core/trunk/src/main/java/org/jboss/cache/mvcc/InternalNode.java
Modified:
   core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java
Log:
Added an InternalNode interface to UnversionedNode
Added new constructor for UnversionedNode to aid unit testing

Modified: core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java	2008-06-25 13:25:40 UTC (rev 6030)
+++ core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java	2008-06-25 13:29:24 UTC (rev 6031)
@@ -14,6 +14,7 @@
 import org.jboss.cache.lock.IdentityLock;
 import org.jboss.cache.lock.LockStrategyFactory;
 import org.jboss.cache.marshall.MarshalledValue;
+import org.jboss.cache.mvcc.InternalNode;
 import org.jboss.cache.optimistic.DataVersion;
 import org.jboss.cache.transaction.GlobalTransaction;
 
@@ -32,7 +33,7 @@
  * @since 2.0.0
  */
 @SuppressWarnings("unchecked")
-public class UnversionedNode<K, V> extends AbstractNode<K, V>
+public class UnversionedNode<K, V> extends AbstractNode<K, V> implements InternalNode<K, V>
 {
    /**
     * Debug log.
@@ -70,8 +71,16 @@
    }
 
    /**
+    * Constructs a new node a given Fqn
+    */
+   public UnversionedNode(Fqn fqn)
+   {
+      this.fqn = fqn;
+      initFlags();
+   }
+
+   /**
     * Constructs a new node with a name, etc.
-    *
     */
    protected UnversionedNode(Object childName, Fqn fqn, Map data, CacheSPI cache)
    {
@@ -722,6 +731,19 @@
       setFlag(LOCK_FOR_CHILD_INSERT_REMOVE, lockForChildInsertRemove);
    }
 
+   public InternalNode clone()
+   {
+      try
+      {
+         return (InternalNode) super.clone();
+      }
+      catch (CloneNotSupportedException e)
+      {
+         // do nothing
+         return null;
+      }
+   }
+
    public void setInternalState(Map state)
    {
       // don't bother doing anything here

Added: core/trunk/src/main/java/org/jboss/cache/mvcc/InternalNode.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/mvcc/InternalNode.java	                        (rev 0)
+++ core/trunk/src/main/java/org/jboss/cache/mvcc/InternalNode.java	2008-06-25 13:29:24 UTC (rev 6031)
@@ -0,0 +1,119 @@
+package org.jboss.cache.mvcc;
+
+import org.jboss.cache.CacheSPI;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.Node;
+import org.jboss.cache.NodeSPI;
+import org.jboss.cache.lock.NodeLock;
+import org.jboss.cache.optimistic.DataVersion;
+import org.jboss.cache.transaction.GlobalTransaction;
+
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * // TODO Document this
+ *
+ * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
+ * @since 3.0
+ */
+public interface InternalNode<K, V>
+{
+   NodeSPI getParent();
+
+   CacheSPI getCache();
+
+   boolean isChildrenLoaded();
+
+   void setChildrenLoaded(boolean flag);
+
+   Object getDirect(Object key);
+
+   Map getDataDirect();
+
+   Object putDirect(Object key, Object value);
+
+   NodeSPI getOrCreateChild(Object child_name, GlobalTransaction gtx, boolean notify);
+
+   Object removeDirect(Object key);
+
+   void addChildDirect(NodeSPI child);
+
+   NodeSPI addChildDirect(Fqn f);
+
+   NodeSPI addChildDirect(Fqn f, boolean notify);
+
+   NodeSPI addChildDirect(Object o, boolean notify);
+
+   void clearDataDirect();
+
+   NodeSPI getChildDirect(Fqn fqn);
+
+   Set<Object> getChildrenNamesDirect();
+
+   Set<Object> getKeysDirect();
+
+   boolean removeChildDirect(Object childName);
+
+   boolean removeChildDirect(Fqn f);
+
+   Map<Object, Node<K, V>> getChildrenMapDirect();
+
+   void setChildrenMapDirect(Map<Object, Node<K, V>> children);
+
+   void putAllDirect(Map data);
+
+   void removeChildrenDirect();
+
+   void setVersion(DataVersion version);
+
+   DataVersion getVersion();
+
+   Fqn getFqn();
+
+   void setFqn(Fqn fqn);
+
+   NodeSPI getChildDirect(Object childName);
+
+   Set<NodeSPI> getChildrenDirect();
+
+   boolean hasChildrenDirect();
+
+   Set<NodeSPI> getChildrenDirect(boolean includeMarkedForRemoval);
+
+   boolean isDataLoaded();
+
+   void setDataLoaded(boolean dataLoaded);
+
+   boolean isValid();
+
+   void setValid(boolean valid, boolean recursive);
+
+   boolean isLockForChildInsertRemove();
+
+   void setLockForChildInsertRemove(boolean lockForChildInsertRemove);
+
+   void setInternalState(Map state);
+
+   Map getInternalState(boolean onlyInternalState);
+
+   void releaseObjectReferences(boolean recursive);
+
+   boolean isDeleted();
+
+   void markAsDeleted(boolean marker);
+
+   void markAsDeleted(boolean marker, boolean recursive);
+
+   void setResident(boolean resident);
+
+   boolean isResident();
+
+   InternalNode clone();
+
+   NodeLock getLock();
+
+   void addChild(Object nodeName, Node<K, V> nodeToAdd);
+
+   void printDetails(StringBuffer sb, int indent);
+}




More information about the jbosscache-commits mailing list