[jboss-cvs] JBossCache/src/org/jboss/cache ...
Manik Surtani
msurtani at jboss.com
Thu Jan 4 09:36:00 EST 2007
User: msurtani
Date: 07/01/04 09:36:00
Modified: src/org/jboss/cache Node.java CacheImpl.java
NodeSPI.java UnversionedNode.java
Log:
fixed stuff
Revision Changes Path
1.55 +8 -0 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.54
retrieving revision 1.55
diff -u -b -r1.54 -r1.55
--- Node.java 4 Jan 2007 05:35:39 -0000 1.54
+++ Node.java 4 Jan 2007 14:36:00 -0000 1.55
@@ -74,6 +74,14 @@
void removeChild(Fqn f);
/**
+ * Removes a child node specified by the given name.
+ *
+ * @param childName name of the child node, directly under the current node.
+ */
+ void removeChild(Object childName);
+
+
+ /**
* Returns the child node
*
* @param f {@link Fqn} of the child node
1.16 +3 -3 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.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- CacheImpl.java 4 Jan 2007 05:35:39 -0000 1.15
+++ CacheImpl.java 4 Jan 2007 14:36:00 -0000 1.16
@@ -99,7 +99,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.15 2007/01/04 05:35:39 msurtani Exp $
+ * @version $Id: CacheImpl.java,v 1.16 2007/01/04 14:36:00 msurtani Exp $
* <p/>
* @see <a href="http://labs.jboss.com/portal/jbosscache/docs">JBossCache doc</a>
*/
@@ -3172,7 +3172,7 @@
// now that we have the parent and target nodes:
// first correct the pointers at the pruning point
- oldParent.removeChildDirect(new Fqn(nodeName));
+ oldParent.removeChildDirect(nodeName);
newParent.addChild(nodeName, node);
// parent pointer is calculated on the fly using Fqns.
@@ -3850,7 +3850,7 @@
}
else
{
- n.getParent().removeChildDirect(n.getFqn());
+ n.getParent().removeChildDirect(n.getFqn().getLastElement());
}
}
else
1.9 +11 -0 JBossCache/src/org/jboss/cache/NodeSPI.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: NodeSPI.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/NodeSPI.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- NodeSPI.java 4 Jan 2007 05:35:39 -0000 1.8
+++ NodeSPI.java 4 Jan 2007 14:36:00 -0000 1.9
@@ -183,10 +183,21 @@
void removeChildDirect(Fqn fqn);
/**
+ * Functionally the same as {@link #removeChild(Object)} except that it operates directly on the node and bypasses the
+ * interceptor chain.
+ *
+ * @param childName of child.
+ * @see #removeChild(Object)
+ */
+ void removeChildDirect(Object childName);
+
+
+ /**
* Functionally the same as {@link #remove(Object)} except that it operates directly on the node and bypasses the
* interceptor chain.
*
* @param key to remove
+ * @return the old data contained under the key
* @see #remove(Object)
*/
Object removeDirect(Object key);
1.10 +14 -2 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.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- UnversionedNode.java 4 Jan 2007 05:35:39 -0000 1.9
+++ UnversionedNode.java 4 Jan 2007 14:36:00 -0000 1.10
@@ -233,6 +233,7 @@
public Map<Object, Object> getData()
{
+ if (cache == null) return Collections.emptyMap();
Map<Object, Object> dMap = new HashMap<Object, Object>();
for (Object k : cache.getKeys(getFqn()))
{
@@ -469,11 +470,21 @@
cache.removeNode(new Fqn(getFqn(), fqn));
}
+ public void removeChild(Object childName)
+ {
+ removeChild(new Fqn(getFqn(), childName));
+ }
+
+ public synchronized void removeChildDirect(Object childName)
+ {
+ children().remove(childName);
+ }
+
public synchronized void removeChildDirect(Fqn f)
{
- if (fqn.size() == 1)
+ if (f.size() == 1)
{
- children.remove(fqn.getLastElement());
+ removeChildDirect(f.getLastElement());
}
else
{
@@ -607,6 +618,7 @@
public Set<Node> getChildren()
{
+ if (cache == null) return Collections.emptySet();
Set<Node> children = new HashSet<Node>();
for (Object c : cache.getChildrenNames(getFqn()))
{
More information about the jboss-cvs-commits
mailing list