jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r793613 [6/8] - in /jackrabbit/sandbox/JCR-1456: ./ jackrabbit-core/ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/ jackrabbit-core/src/main/java/org/apache/jackra...
Date Mon, 13 Jul 2009 15:56:03 GMT
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SessionItemStateManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SessionItemStateManager.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SessionItemStateManager.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SessionItemStateManager.java Mon Jul 13 15:55:55 2009
@@ -16,13 +16,25 @@
  */
 package org.apache.jackrabbit.core.state;
 
+import java.io.PrintStream;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.jcr.InvalidItemStateException;
+import javax.jcr.ItemNotFoundException;
+import javax.jcr.ReferentialIntegrityException;
+import javax.jcr.RepositoryException;
+
 import org.apache.commons.collections.iterators.IteratorChain;
 import org.apache.jackrabbit.core.CachingHierarchyManager;
 import org.apache.jackrabbit.core.HierarchyManager;
-import org.apache.jackrabbit.core.ItemId;
-import org.apache.jackrabbit.core.NodeId;
-import org.apache.jackrabbit.core.PropertyId;
 import org.apache.jackrabbit.core.ZombieHierarchyManager;
+import org.apache.jackrabbit.core.id.ItemId;
+import org.apache.jackrabbit.core.id.NodeId;
+import org.apache.jackrabbit.core.id.PropertyId;
 import org.apache.jackrabbit.core.nodetype.NodeDef;
 import org.apache.jackrabbit.core.nodetype.NodeTypeRegistry;
 import org.apache.jackrabbit.core.util.Dumpable;
@@ -30,17 +42,6 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.jcr.InvalidItemStateException;
-import javax.jcr.ItemNotFoundException;
-import javax.jcr.ReferentialIntegrityException;
-import javax.jcr.RepositoryException;
-import java.io.PrintStream;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-
 /**
  * Item state manager that handles both transient and persistent items.
  */
@@ -204,7 +205,7 @@
     /**
      * {@inheritDoc}
      */
-    public NodeReferences getNodeReferences(NodeReferencesId id)
+    public NodeReferences getNodeReferences(NodeId id)
             throws NoSuchItemStateException, ItemStateException {
 
         return stateMgr.getNodeReferences(id);
@@ -213,7 +214,7 @@
     /**
      * {@inheritDoc}
      */
-    public boolean hasNodeReferences(NodeReferencesId id) {
+    public boolean hasNodeReferences(NodeId id) {
         return stateMgr.hasNodeReferences(id);
     }
 
@@ -995,7 +996,7 @@
         /**
          * {@inheritDoc}
          */
-        public NodeReferences getNodeReferences(NodeReferencesId id)
+        public NodeReferences getNodeReferences(NodeId id)
                 throws NoSuchItemStateException, ItemStateException {
             // n/a
             throw new ItemStateException("getNodeReferences() not implemented");
@@ -1004,7 +1005,7 @@
         /**
          * {@inheritDoc}
          */
-        public boolean hasNodeReferences(NodeReferencesId id) {
+        public boolean hasNodeReferences(NodeId id) {
             // n/a
             return false;
         }

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java Mon Jul 13 15:55:55 2009
@@ -18,7 +18,6 @@
 
 import java.io.PrintStream;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
 
@@ -28,11 +27,11 @@
 import javax.jcr.nodetype.ConstraintViolationException;
 import javax.jcr.nodetype.NoSuchNodeTypeException;
 
-import org.apache.jackrabbit.core.ItemId;
-import org.apache.jackrabbit.core.NodeId;
-import org.apache.jackrabbit.core.PropertyId;
 import org.apache.jackrabbit.core.RepositoryImpl;
 import org.apache.jackrabbit.core.cluster.UpdateEventChannel;
+import org.apache.jackrabbit.core.id.ItemId;
+import org.apache.jackrabbit.core.id.NodeId;
+import org.apache.jackrabbit.core.id.PropertyId;
 import org.apache.jackrabbit.core.nodetype.EffectiveNodeType;
 import org.apache.jackrabbit.core.nodetype.NodeDef;
 import org.apache.jackrabbit.core.nodetype.NodeDefId;
@@ -49,7 +48,6 @@
 import org.apache.jackrabbit.core.virtual.VirtualItemStateProvider;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.commons.name.NameConstants;
-import org.apache.jackrabbit.uuid.UUID;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -315,13 +313,13 @@
     /**
      * {@inheritDoc}
      */
-    public NodeReferences getNodeReferences(NodeReferencesId id)
+    public NodeReferences getNodeReferences(NodeId id)
             throws NoSuchItemStateException, ItemStateException {
-        ISMLocking.ReadLock readLock = acquireReadLock(id.getTargetId());
+        ISMLocking.ReadLock readLock = acquireReadLock(id);
         try {
             // check persistence manager
             try {
-                return persistMgr.load(id);
+                return persistMgr.loadReferencesTo(id);
             } catch (NoSuchItemStateException e) {
                 // ignore
             }
@@ -345,17 +343,17 @@
     /**
      * {@inheritDoc}
      */
-    public boolean hasNodeReferences(NodeReferencesId id) {
+    public boolean hasNodeReferences(NodeId id) {
         ISMLocking.ReadLock readLock;
         try {
-            readLock = acquireReadLock(id.getTargetId());
+            readLock = acquireReadLock(id);
         } catch (ItemStateException e) {
             return false;
         }
         try {
             // check persistence manager
             try {
-                if (persistMgr.exists(id)) {
+                if (persistMgr.existsReferencesTo(id)) {
                     return true;
                 }
             } catch (ItemStateException e) {
@@ -596,8 +594,7 @@
                  * respective shared item and add the shared items to a
                  * new change log.
                  */
-                for (Iterator<ItemState> iter = local.modifiedStates(); iter.hasNext();) {
-                    ItemState state = iter.next();
+                for (ItemState state : local.modifiedStates()) {
                     state.connect(getItemState(state.getId()));
                     if (state.isStale()) {
                         boolean merged = false;
@@ -653,8 +650,7 @@
 
                     shared.modified(state.getOverlayedState());
                 }
-                for (Iterator<ItemState> iter = local.deletedStates(); iter.hasNext();) {
-                    ItemState state = iter.next();
+                for (ItemState state : local.deletedStates()) {
                     state.connect(getItemState(state.getId()));
                     if (state.isStale()) {
                         String msg = state.getId() + " has been modified externally";
@@ -663,18 +659,16 @@
                     }
                     shared.deleted(state.getOverlayedState());
                 }
-                for (Iterator<ItemState> iter = local.addedStates(); iter.hasNext();) {
-                    ItemState state = iter.next();
+                for (ItemState state : local.addedStates()) {
                     state.connect(createInstance(state));
                     shared.added(state.getOverlayedState());
                 }
 
                 // filter out virtual node references for later processing
                 // (see comment above)
-                for (Iterator<NodeReferences> iter = local.modifiedRefs(); iter.hasNext();) {
-                    NodeReferences refs = iter.next();
+                for (NodeReferences refs : local.modifiedRefs()) {
                     boolean virtual = false;
-                    NodeId id = refs.getId().getTargetId();
+                    NodeId id = refs.getTargetId();
                     for (int i = 0; i < virtualProviders.length; i++) {
                         if (virtualProviders[i].hasItemState(id)) {
                             ChangeLog virtualRefs = virtualNodeReferences[i];
@@ -741,13 +735,14 @@
 
             ISMLocking.ReadLock readLock = null;
             try {
-                /* Let the shared item listeners know about the change */
-                shared.persisted();
-
                 // downgrade to read lock
                 readLock = writeLock.downgrade();
                 writeLock = null;
 
+                // Let the shared item listeners know about the change
+                // JCR-2171: This must happen after downgrading the lock!
+                shared.persisted();
+
                 /* notify virtual providers about node references */
                 for (int i = 0; i < virtualNodeReferences.length; i++) {
                     ChangeLog virtualRefs = virtualNodeReferences[i];
@@ -791,24 +786,21 @@
 
                 local.disconnect();
 
-                for (Iterator<ItemState> iter = shared.modifiedStates(); iter.hasNext();) {
-                    ItemState state = iter.next();
+                for (ItemState state : shared.modifiedStates()) {
                     try {
                         state.copy(loadItemState(state.getId()), false);
                     } catch (ItemStateException e) {
                         state.discard();
                     }
                 }
-                for (Iterator<ItemState> iter = shared.deletedStates(); iter.hasNext();) {
-                    ItemState state = iter.next();
+                for (ItemState state : shared.deletedStates()) {
                     try {
                         state.copy(loadItemState(state.getId()), false);
                     } catch (ItemStateException e) {
                         state.discard();
                     }
                 }
-                for (Iterator<ItemState> iter = shared.addedStates(); iter.hasNext();) {
-                    ItemState state = iter.next();
+                for (ItemState state : shared.addedStates()) {
                     state.discard();
                 }
             } finally {
@@ -877,8 +869,7 @@
          */
         private void updateReferences() throws ItemStateException {
             // process added REFERENCE properties
-            for (Iterator<ItemState> i = local.addedStates(); i.hasNext();) {
-                ItemState state = i.next();
+            for (ItemState state : local.addedStates()) {
                 if (!state.isNode()) {
                     // remove refs from the target which have been added externally (JCR-2138)
                     if (hasItemState(state.getId())) {
@@ -890,8 +881,7 @@
             }
 
             // process modified REFERENCE properties
-            for (Iterator<ItemState> i = local.modifiedStates(); i.hasNext();) {
-                ItemState state = i.next();
+            for (ItemState state : local.modifiedStates()) {
                 if (!state.isNode()) {
                     // remove old references from the target
                     removeReferences(getItemState(state.getId()));
@@ -901,8 +891,8 @@
             }
 
             // process removed REFERENCE properties
-            for (Iterator<ItemState> i = local.deletedStates(); i.hasNext();) {
-                removeReferences(i.next());
+            for (ItemState state : local.deletedStates()) {
+                removeReferences(state);
             }
         }
 
@@ -911,23 +901,22 @@
             if (property.getType() == PropertyType.REFERENCE) {
                 InternalValue[] values = property.getValues();
                 for (int i = 0; values != null && i < values.length; i++) {
-                    addReference(property.getPropertyId(), values[i].getUUID());
+                    addReference(property.getPropertyId(), values[i].getNodeId());
                 }
             }
         }
 
-        private void addReference(PropertyId id, UUID uuid)
+        private void addReference(PropertyId id, NodeId target)
                 throws ItemStateException {
-            NodeReferencesId refsId = new NodeReferencesId(uuid);
             if (virtualProvider == null
-                    || !virtualProvider.hasNodeReferences(refsId)) {
+                    || !virtualProvider.hasNodeReferences(target)) {
                 // get or create the references instance
-                NodeReferences refs = local.get(refsId);
+                NodeReferences refs = local.getReferencesTo(target);
                 if (refs == null) {
-                    if (hasNodeReferences(refsId)) {
-                        refs = getNodeReferences(refsId);
+                    if (hasNodeReferences(target)) {
+                        refs = getNodeReferences(target);
                     } else {
-                        refs = new NodeReferences(refsId);
+                        refs = new NodeReferences(target);
                     }
                 }
                 // add reference
@@ -945,22 +934,21 @@
                     InternalValue[] values = property.getValues();
                     for (int i = 0; values != null && i < values.length; i++) {
                         removeReference(
-                                property.getPropertyId(), values[i].getUUID());
+                                property.getPropertyId(), values[i].getNodeId());
                     }
                 }
             }
         }
 
-        private void removeReference(PropertyId id, UUID uuid)
+        private void removeReference(PropertyId id, NodeId target)
                 throws ItemStateException {
-            NodeReferencesId refsId = new NodeReferencesId(uuid);
             if (virtualProvider == null
-                    || !virtualProvider.hasNodeReferences(refsId)) {
+                    || !virtualProvider.hasNodeReferences(target)) {
                 // either get node references from change log or load from
                 // persistence manager
-                NodeReferences refs = local.get(refsId);
-                if (refs == null && hasNodeReferences(refsId)) {
-                    refs = getNodeReferences(refsId);
+                NodeReferences refs = local.getReferencesTo(target);
+                if (refs == null && hasNodeReferences(target)) {
+                    refs = getNodeReferences(target);
                 }
                 if (refs != null) {
                     // remove reference
@@ -988,25 +976,24 @@
                 throws ReferentialIntegrityException, ItemStateException {
 
             // check whether removed referenceable nodes are still being referenced
-            for (Iterator<ItemState> iter = local.deletedStates(); iter.hasNext();) {
-                ItemState state = iter.next();
+            for (ItemState state : local.deletedStates()) {
                 if (state.isNode()) {
                     NodeState node = (NodeState) state;
                     if (isReferenceable(node)) {
-                        NodeReferencesId refsId = new NodeReferencesId(node.getNodeId());
+                        NodeId targetId = node.getNodeId();
                         // either get node references from change log or
                         // load from persistence manager
-                        NodeReferences refs = local.get(refsId);
+                        NodeReferences refs = local.getReferencesTo(targetId);
                         if (refs == null) {
-                            if (!hasNodeReferences(refsId)) {
+                            if (!hasNodeReferences(targetId)) {
                                 continue;
                             }
-                            refs = getNodeReferences(refsId);
+                            refs = getNodeReferences(targetId);
                         }
                         // in some versioning operations (such as restore) a node
                         // may actually be deleted and then again added with the
                         // same UUID, i.e. the node is still referenceable.
-                        if (refs.hasReferences() && !local.has(node.getNodeId())) {
+                        if (refs.hasReferences() && !local.has(targetId)) {
                             String msg = node.getNodeId()
                                     + ": the node cannot be removed because it is still being referenced.";
                             log.debug(msg);
@@ -1017,13 +1004,12 @@
             }
 
             // check whether targets of modified node references exist
-            for (Iterator<NodeReferences> iter = local.modifiedRefs(); iter.hasNext();) {
-                NodeReferences refs = iter.next();
-                NodeId id = refs.getTargetId();
+            for (NodeReferences refs : local.modifiedRefs()) {
                 // no need to check existence of target if there are no references
                 if (refs.hasReferences()) {
                     // please note:
                     // virtual providers are indirectly checked via 'hasItemState()'
+                    NodeId id = refs.getTargetId();
                     if (!local.has(id) && !hasItemState(id)) {
                         String msg = "Target node " + id
                                 + " of REFERENCE property does not exist";
@@ -1176,9 +1162,7 @@
         // Build a copy of the external change log, consisting of shared
         // states we have in our cache. Inform listeners about this
         // change.
-        Iterator<ItemState> modifiedStates = external.modifiedStates();
-        while (modifiedStates.hasNext()) {
-            ItemState state = modifiedStates.next();
+        for (ItemState state : external.modifiedStates()) {
             state = cache.retrieve(state.getId());
             if (state != null) {
                 try {
@@ -1198,9 +1182,7 @@
                 }
             }
         }
-        Iterator<ItemState> deletedStates = external.deletedStates();
-        while (deletedStates.hasNext()) {
-            ItemState state = deletedStates.next();
+        for (ItemState state : external.deletedStates()) {
             state = cache.retrieve(state.getId());
             if (state != null) {
                 shared.deleted(state);

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/StateChangeDispatcher.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/StateChangeDispatcher.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/StateChangeDispatcher.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/StateChangeDispatcher.java Mon Jul 13 15:55:55 2009
@@ -17,7 +17,7 @@
 package org.apache.jackrabbit.core.state;
 
 import EDU.oswego.cs.dl.util.concurrent.CopyOnWriteArrayList;
-import org.apache.jackrabbit.core.NodeId;
+import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.spi.Name;
 
 import java.lang.ref.Reference;

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/UpdatableItemStateManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/UpdatableItemStateManager.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/UpdatableItemStateManager.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/UpdatableItemStateManager.java Mon Jul 13 15:55:55 2009
@@ -17,7 +17,7 @@
 package org.apache.jackrabbit.core.state;
 
 import org.apache.jackrabbit.spi.Name;
-import org.apache.jackrabbit.core.NodeId;
+import org.apache.jackrabbit.core.id.NodeId;
 
 import javax.jcr.ReferentialIntegrityException;
 

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/XAItemStateManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/XAItemStateManager.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/XAItemStateManager.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/XAItemStateManager.java Mon Jul 13 15:55:55 2009
@@ -16,28 +16,28 @@
  */
 package org.apache.jackrabbit.core.state;
 
-import org.apache.jackrabbit.core.ItemId;
-import org.apache.jackrabbit.core.TransactionException;
-import org.apache.jackrabbit.core.TransactionContext;
+import java.util.Collections;
+import java.util.IdentityHashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.jcr.PropertyType;
+import javax.jcr.ReferentialIntegrityException;
+
+import org.apache.commons.collections.Predicate;
+import org.apache.commons.collections.iterators.FilterIterator;
 import org.apache.jackrabbit.core.InternalXAResource;
-import org.apache.jackrabbit.core.PropertyId;
+import org.apache.jackrabbit.core.TransactionContext;
+import org.apache.jackrabbit.core.TransactionException;
+import org.apache.jackrabbit.core.id.ItemId;
+import org.apache.jackrabbit.core.id.NodeId;
+import org.apache.jackrabbit.core.id.PropertyId;
 import org.apache.jackrabbit.core.observation.EventStateCollectionFactory;
 import org.apache.jackrabbit.core.value.InternalValue;
 import org.apache.jackrabbit.core.virtual.VirtualItemStateProvider;
-import org.apache.jackrabbit.uuid.UUID;
-import org.apache.commons.collections.iterators.FilterIterator;
-import org.apache.commons.collections.Predicate;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.jcr.ReferentialIntegrityException;
-import javax.jcr.PropertyType;
-
-import java.util.Iterator;
-import java.util.Map;
-import java.util.IdentityHashMap;
-import java.util.Collections;
-
 /**
  * Extension to <code>LocalItemStateManager</code> that remembers changes on
  * multiple save() requests and commits them only when an associated transaction
@@ -310,7 +310,7 @@
      * check the transactional change log. Fallback is always the call to
      * the base class.
      */
-    public NodeReferences getNodeReferences(NodeReferencesId id)
+    public NodeReferences getNodeReferences(NodeId id)
             throws NoSuchItemStateException, ItemStateException {
 
         if (virtualProvider != null && virtualProvider.hasNodeReferences(id)) {
@@ -327,7 +327,7 @@
      * check the transactional change log. Fallback is always the call to
      * the base class.
      */
-    public boolean hasNodeReferences(NodeReferencesId id) {
+    public boolean hasNodeReferences(NodeId id) {
         if (virtualProvider != null && virtualProvider.hasNodeReferences(id)) {
             return true;
         }
@@ -365,7 +365,7 @@
      * @throws ItemStateException if an error occurs while reading from the
      *                            underlying shared item state manager.
      */
-    private NodeReferences getReferences(NodeReferencesId id)
+    private NodeReferences getReferences(NodeId id)
             throws ItemStateException {
         NodeReferences refs;
         try {
@@ -376,34 +376,28 @@
         // apply changes from change log
         ChangeLog changes = getChangeLog();
         if (changes != null) {
-            UUID uuid = id.getTargetId().getUUID();
             // check removed reference properties
-            for (Iterator it = filterReferenceProperties(changes.deletedStates());
-                 it.hasNext(); ) {
-                PropertyState prop = (PropertyState) it.next();
+            for (PropertyState prop : filterReferenceProperties(changes.deletedStates())) {
                 InternalValue[] values = prop.getValues();
                 for (int i = 0; i < values.length; i++) {
-                    if (values[i].getUUID().equals(uuid)) {
+                    if (values[i].getNodeId().equals(id)) {
                         refs.removeReference(prop.getPropertyId());
                         break;
                     }
                 }
             }
             // check added reference properties
-            for (Iterator it = filterReferenceProperties(changes.addedStates());
-                 it.hasNext(); ) {
-                PropertyState prop = (PropertyState) it.next();
+            for (PropertyState prop : filterReferenceProperties(changes.addedStates())) {
                 InternalValue[] values = prop.getValues();
                 for (int i = 0; i < values.length; i++) {
-                    if (values[i].getUUID().equals(uuid)) {
+                    if (values[i].getNodeId().equals(id)) {
                         refs.addReference(prop.getPropertyId());
                         break;
                     }
                 }
             }
             // check modified properties
-            for (Iterator it = changes.modifiedStates(); it.hasNext(); ) {
-                ItemState state = (ItemState) it.next();
+            for (ItemState state : changes.modifiedStates()) {
                 if (state.isNode()) {
                     continue;
                 }
@@ -413,7 +407,7 @@
                         // remove if one of the old values references the node
                         InternalValue[] values = old.getValues();
                         for (int i = 0; i < values.length; i++) {
-                            if (values[i].getUUID().equals(uuid)) {
+                            if (values[i].getNodeId().equals(id)) {
                                 refs.removeReference(old.getPropertyId());
                                 break;
                             }
@@ -428,7 +422,7 @@
                     // add if modified value references node
                     InternalValue[] values = prop.getValues();
                     for (int i = 0; i < values.length; i++) {
-                        if (values[i].getUUID().equals(uuid)) {
+                        if (values[i].getNodeId().equals(id)) {
                             refs.addReference(prop.getPropertyId());
                             break;
                         }
@@ -446,17 +440,24 @@
      * @param itemStates item state source iterator.
      * @return iterator over reference property states.
      */
-    private Iterator filterReferenceProperties(Iterator itemStates) {
-        return new FilterIterator(itemStates, new Predicate() {
-            public boolean evaluate(Object object) {
-                ItemState state = (ItemState) object;
-                if (!state.isNode()) {
-                    PropertyState prop = (PropertyState) state;
-                    return prop.getType() == PropertyType.REFERENCE;
-                }
-                return false;
+    private Iterable<PropertyState> filterReferenceProperties(
+            final Iterable<ItemState> itemStates) {
+        return new Iterable<PropertyState>() {
+            @SuppressWarnings("unchecked")
+            public Iterator<PropertyState> iterator() {
+                return (Iterator<PropertyState>) new FilterIterator(
+                        itemStates.iterator(), new Predicate() {
+                    public boolean evaluate(Object object) {
+                        ItemState state = (ItemState) object;
+                        if (!state.isNode()) {
+                            PropertyState prop = (PropertyState) state;
+                            return prop.getType() == PropertyType.REFERENCE;
+                        }
+                        return false;
+                    }
+                });
             }
-        });
+        };
     }
 
     /**
@@ -468,23 +469,20 @@
     private void updateVirtualReferences(ChangeLog changes) throws ItemStateException {
         ChangeLog references = new ChangeLog();
 
-        for (Iterator iter = changes.addedStates(); iter.hasNext();) {
-            ItemState state = (ItemState) iter.next();
+        for (ItemState state : changes.addedStates()) {
             if (!state.isNode()) {
                 PropertyState prop = (PropertyState) state;
                 if (prop.getType() == PropertyType.REFERENCE) {
                     InternalValue[] vals = prop.getValues();
                     for (int i = 0; vals != null && i < vals.length; i++) {
-                        UUID uuid = vals[i].getUUID();
-                        NodeReferencesId refsId = new NodeReferencesId(uuid);
                         addVirtualReference(
-                                references, prop.getPropertyId(), refsId);
+                                references, prop.getPropertyId(),
+                                vals[i].getNodeId());
                     }
                 }
             }
         }
-        for (Iterator iter = changes.modifiedStates(); iter.hasNext();) {
-            ItemState state = (ItemState) iter.next();
+        for (ItemState state : changes.modifiedStates()) {
             if (!state.isNode()) {
                 PropertyState newProp = (PropertyState) state;
                 PropertyState oldProp =
@@ -492,34 +490,30 @@
                 if (oldProp.getType() == PropertyType.REFERENCE) {
                     InternalValue[] vals = oldProp.getValues();
                     for (int i = 0; vals != null && i < vals.length; i++) {
-                        UUID uuid = vals[i].getUUID();
-                        NodeReferencesId refsId = new NodeReferencesId(uuid);
                         removeVirtualReference(
-                                references, oldProp.getPropertyId(), refsId);
+                                references, oldProp.getPropertyId(),
+                                vals[i].getNodeId());
                     }
                 }
                 if (newProp.getType() == PropertyType.REFERENCE) {
                     InternalValue[] vals = newProp.getValues();
                     for (int i = 0; vals != null && i < vals.length; i++) {
-                        UUID uuid = vals[i].getUUID();
-                        NodeReferencesId refsId = new NodeReferencesId(uuid);
                         addVirtualReference(
-                                references, newProp.getPropertyId(), refsId);
+                                references, newProp.getPropertyId(),
+                                vals[i].getNodeId());
                     }
                 }
             }
         }
-        for (Iterator iter = changes.deletedStates(); iter.hasNext();) {
-            ItemState state = (ItemState) iter.next();
+        for (ItemState state : changes.deletedStates()) {
             if (!state.isNode()) {
                 PropertyState prop = (PropertyState) state;
                 if (prop.getType() == PropertyType.REFERENCE) {
                     InternalValue[] vals = prop.getValues();
                     for (int i = 0; vals != null && i < vals.length; i++) {
-                        UUID uuid = vals[i].getUUID();
-                        NodeReferencesId refsId = new NodeReferencesId(uuid);
                         removeVirtualReference(
-                                references, prop.getPropertyId(), refsId);
+                                references, prop.getPropertyId(),
+                                vals[i].getNodeId());
                     }
                 }
             }
@@ -533,18 +527,18 @@
      * Ignored if <code>refsId.getTargetId()</code> does not denote a
      * virtual node.
      * @param sourceId property id
-     * @param refsId node references id
+     * @param targetId target node id
      */
     private void addVirtualReference(
-            ChangeLog references, PropertyId sourceId, NodeReferencesId refsId)
+            ChangeLog references, PropertyId sourceId, NodeId targetId)
             throws NoSuchItemStateException, ItemStateException {
 
-        NodeReferences refs = references.get(refsId);
+        NodeReferences refs = references.getReferencesTo(targetId);
         if (refs == null) {
-            refs = virtualProvider.getNodeReferences(refsId);
+            refs = virtualProvider.getNodeReferences(targetId);
         }
-        if (refs == null && virtualProvider.hasItemState(refsId.getTargetId())) {
-            refs = new NodeReferences(refsId);
+        if (refs == null && virtualProvider.hasItemState(targetId)) {
+            refs = new NodeReferences(targetId);
         }
         if (refs != null) {
             refs.addReference(sourceId);
@@ -557,18 +551,18 @@
      * Ignored if <code>refsId.getTargetId()</code> does not denote a
      * virtual node.
      * @param sourceId property id
-     * @param refsId node references id
+     * @param targetId target node id
      */
     private void removeVirtualReference(
-            ChangeLog references, PropertyId sourceId, NodeReferencesId refsId)
+            ChangeLog references, PropertyId sourceId, NodeId targetId)
             throws NoSuchItemStateException, ItemStateException {
 
-        NodeReferences refs = references.get(refsId);
+        NodeReferences refs = references.getReferencesTo(targetId);
         if (refs == null) {
-            refs = virtualProvider.getNodeReferences(refsId);
+            refs = virtualProvider.getNodeReferences(targetId);
         }
-        if (refs == null && virtualProvider.hasItemState(refsId.getTargetId())) {
-            refs = new NodeReferences(refsId);
+        if (refs == null && virtualProvider.hasItemState(targetId)) {
+            refs = new NodeReferences(targetId);
         }
         if (refs != null) {
             refs.removeReference(sourceId);

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/util/ReferenceChangeTracker.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/util/ReferenceChangeTracker.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/util/ReferenceChangeTracker.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/util/ReferenceChangeTracker.java Mon Jul 13 15:55:55 2009
@@ -16,51 +16,48 @@
  */
 package org.apache.jackrabbit.core.util;
 
-import org.apache.jackrabbit.uuid.UUID;
+import org.apache.jackrabbit.core.id.NodeId;
 
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.Map;
 
 /**
- * Simple helper class that can be used to keep track of uuid mappings
- * (e.g. if the uuid of an imported or copied node is mapped to a new uuid)
+ * Simple helper class that can be used to keep track of node id mappings
+ * (e.g. if the id of an imported or copied node is mapped to a new id)
  * and processed (e.g. imported or copied) reference properties that might
- * need correcting depending on the uuid mappings.
+ * need correcting depending on the id mappings.
  */
 public class ReferenceChangeTracker {
+
     /**
-     * mapping <original uuid> to <new uuid> of mix:referenceable nodes
+     * mapping from original id to new id of mix:referenceable nodes
      */
-    private final HashMap<UUID, UUID> uuidMap = new HashMap<UUID, UUID>();
+    private final Map<NodeId, NodeId> idMap = new HashMap<NodeId, NodeId>();
+
     /**
      * list of processed reference properties that might need correcting
      */
     private final ArrayList<Object> references = new ArrayList<Object>();
 
     /**
-     * Creates a new instance.
-     */
-    public ReferenceChangeTracker() {
-    }
-
-    /**
      * Resets all internal state.
      */
     public void clear() {
-        uuidMap.clear();
+        idMap.clear();
         references.clear();
     }
 
     /**
-     * Store the given uuid mapping for later lookup using
-     * <code>{@link #getMappedUUID(UUID)}</code>.
+     * Store the given id mapping for later lookup using
+     * <code>{@link #getMappedId(NodeId)}</code>.
      *
-     * @param oldUUID old uuid
-     * @param newUUID new uuid
+     * @param oldId old node id
+     * @param newId new node id
      */
-    public void mappedUUID(UUID oldUUID, UUID newUUID) {
-        uuidMap.put(oldUUID, newUUID);
+    public void mappedId(NodeId oldId, NodeId newId) {
+        idMap.put(oldId, newId);
     }
 
     /**
@@ -74,15 +71,15 @@
     }
 
     /**
-     * Returns the new UUID to which <code>oldUUID</code> has been mapped
+     * Returns the new node id to which <code>oldId</code> has been mapped
      * or <code>null</code> if no such mapping exists.
      *
-     * @param oldUUID old uuid
-     * @return mapped new uuid or <code>null</code> if no such mapping exists
-     * @see #mappedUUID(UUID, UUID)
+     * @param oldId old node id
+     * @return mapped new id or <code>null</code> if no such mapping exists
+     * @see #mappedId(NodeId, NodeId)
      */
-    public UUID getMappedUUID(UUID oldUUID) {
-        return uuidMap.get(oldUUID);
+    public NodeId getMappedId(NodeId oldId) {
+        return idMap.get(oldId);
     }
 
     /**

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/value/InternalValue.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/value/InternalValue.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/value/InternalValue.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/value/InternalValue.java Mon Jul 13 15:55:55 2009
@@ -36,6 +36,7 @@
 import org.apache.jackrabbit.core.data.DataStore;
 import org.apache.jackrabbit.core.data.DataStoreException;
 import org.apache.jackrabbit.core.fs.FileSystemResource;
+import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.Path;
 import org.apache.jackrabbit.spi.QValue;
@@ -48,7 +49,6 @@
 import org.apache.jackrabbit.spi.commons.value.AbstractQValueFactory;
 import org.apache.jackrabbit.spi.commons.value.QValueValue;
 import org.apache.jackrabbit.util.ISO8601;
-import org.apache.jackrabbit.uuid.UUID;
 
 /**
  * <code>InternalValue</code> represents the internal format of a property value.
@@ -67,7 +67,7 @@
  * <tr>URI<td></td><td>URI</td></tr>
  * <tr>DECIMAL<td></td><td>BigDecimal</td></tr>
  * <tr>BINARY<td></td><td>BLOBFileValue</td></tr>
- * <tr>REFERENCE<td></td><td>UUID</td></tr>
+ * <tr>REFERENCE<td></td><td>{@link NodeId}</td></tr>
  * </table>
  * </pre>
  */
@@ -146,9 +146,9 @@
             case PropertyType.LONG:
                 return create(value.getLong());
             case PropertyType.REFERENCE:
-                return create(new UUID(value.getString()));
+                return create(new NodeId(value.getString()));
             case PropertyType.WEAKREFERENCE:
-                return create(new UUID(value.getString()), true);
+                return create(new NodeId(value.getString()), true);
             case PropertyType.URI:
                 try {
                     return create(new URI(value.getString()));
@@ -212,9 +212,9 @@
             case PropertyType.LONG:
                 return new InternalValue(value.getLong());
             case PropertyType.REFERENCE:
-                return create(new UUID(value.getString()));
+                return create(new NodeId(value.getString()));
             case PropertyType.WEAKREFERENCE:
-                return create(new UUID(value.getString()), true);
+                return create(new NodeId(value.getString()), true);
             case PropertyType.URI:
                 return new InternalValue(value.getURI());
             case PropertyType.NAME:
@@ -389,7 +389,7 @@
      * @param value
      * @return the created value
      */
-    public static InternalValue create(UUID value) {
+    public static InternalValue create(NodeId value) {
         return create(value, false);
     }
 
@@ -398,7 +398,7 @@
      * @param weak
      * @return the created value
      */
-    public static InternalValue create(UUID value, boolean weak) {
+    public static InternalValue create(NodeId value, boolean weak) {
         return new InternalValue(value, weak);
     }
 
@@ -409,9 +409,9 @@
         return (BLOBFileValue) val;
     }
 
-    public UUID getUUID() {
+    public NodeId getNodeId() {
         assert val != null && (type == PropertyType.REFERENCE || type == PropertyType.WEAKREFERENCE);
-        return (UUID) val;
+        return (NodeId) val;
     }
 
     public Calendar getDate() {
@@ -476,9 +476,9 @@
             case PropertyType.DECIMAL:
                 return create(new BigDecimal(s));
             case PropertyType.REFERENCE:
-                return create(new UUID(s));
+                return create(new NodeId(s));
             case PropertyType.WEAKREFERENCE:
-                return create(new UUID(s), true);
+                return create(new NodeId(s), true);
             case PropertyType.PATH:
                 return create(PathFactoryImpl.getInstance().create(s));
             case PropertyType.NAME:
@@ -552,7 +552,7 @@
         super(value);
     }
 
-    private InternalValue(UUID value, boolean weak) {
+    private InternalValue(NodeId value, boolean weak) {
         super(value, weak ? PropertyType.WEAKREFERENCE : PropertyType.REFERENCE);
     }
 

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/value/InternalValueFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/value/InternalValueFactory.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/value/InternalValueFactory.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/value/InternalValueFactory.java Mon Jul 13 15:55:55 2009
@@ -17,6 +17,7 @@
 package org.apache.jackrabbit.core.value;
 
 import org.apache.jackrabbit.core.data.DataStore;
+import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.Path;
 import org.apache.jackrabbit.spi.QValue;
@@ -25,7 +26,6 @@
 import org.apache.jackrabbit.spi.commons.name.PathFactoryImpl;
 import org.apache.jackrabbit.spi.commons.value.AbstractQValueFactory;
 import org.apache.jackrabbit.util.ISO8601;
-import org.apache.jackrabbit.uuid.UUID;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -93,9 +93,9 @@
                 case PropertyType.URI:
                     return InternalValue.create(URI.create(value));
                 case PropertyType.REFERENCE:
-                    return InternalValue.create(new UUID(value));
+                    return InternalValue.create(new NodeId(value));
                 case PropertyType.WEAKREFERENCE:
-                    return InternalValue.create(new UUID(value), true);
+                    return InternalValue.create(new NodeId(value), true);
                 case PropertyType.BINARY:
                     return InternalValue.create(value.getBytes("UTF-8"));
                 // default: invalid type specified -> see below.

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/AbstractVersionManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/AbstractVersionManager.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/AbstractVersionManager.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/AbstractVersionManager.java Mon Jul 13 15:55:55 2009
@@ -23,7 +23,7 @@
 import javax.jcr.Value;
 import javax.jcr.version.VersionException;
 
-import org.apache.jackrabbit.core.NodeId;
+import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.core.NodeImpl;
 import org.apache.jackrabbit.core.nodetype.NodeTypeRegistry;
 import org.apache.jackrabbit.core.state.DefaultISMLocking;
@@ -32,12 +32,10 @@
 import org.apache.jackrabbit.core.state.ItemStateException;
 import org.apache.jackrabbit.core.state.LocalItemStateManager;
 import org.apache.jackrabbit.core.state.NodeReferences;
-import org.apache.jackrabbit.core.state.NodeReferencesId;
 import org.apache.jackrabbit.core.state.NodeState;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.commons.name.NameConstants;
 import org.apache.jackrabbit.spi.commons.name.NameFactoryImpl;
-import org.apache.jackrabbit.uuid.UUID;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -125,7 +123,7 @@
             throws RepositoryException {
         ReadLock lock = acquireReadLock();
         try {
-            String uuid = id.getUUID().toString();
+            String uuid = id.toString();
             Name name = getName(uuid);
 
             NodeStateEx parent = getParentNode(historyRoot, uuid, null);
@@ -276,7 +274,7 @@
 
         ReadLock lock = acquireReadLock();
         try {
-            String uuid = node.getNodeId().getUUID().toString();
+            String uuid = node.getNodeId().toString();
             Name name = getName(uuid);
 
             NodeStateEx parent = getParentNode(historyRoot, uuid, null);
@@ -379,7 +377,7 @@
         WriteOperation operation = startWriteOperation();
         try {
             // create deep path
-            String uuid = node.getNodeId().getUUID().toString();
+            String uuid = node.getNodeId().toString();
             NodeStateEx parent = getParentNode(historyRoot, uuid, NameConstants.REP_VERSIONSTORAGE);
             Name name = getName(uuid);
             if (parent.hasNode(name)) {
@@ -417,7 +415,7 @@
         WriteOperation operation = startWriteOperation();
         try {
             // create deep path
-            NodeId activityId = new NodeId(UUID.randomUUID());
+            NodeId activityId = new NodeId();
             NodeStateEx parent = getParentNode(activitiesRoot, activityId.toString(), NameConstants.REP_ACTIVITIES);
             Name name = getName(activityId.toString());
 
@@ -449,9 +447,8 @@
         try {
             // check if the activity has any references in the workspaces
             NodeId nodeId = activity.getId();
-            NodeReferencesId refId = new NodeReferencesId(nodeId);
-            if (stateMgr.hasNodeReferences(refId)) {
-                NodeReferences refs = stateMgr.getNodeReferences(refId);
+            if (stateMgr.hasNodeReferences(nodeId)) {
+                NodeReferences refs = stateMgr.getNodeReferences(nodeId);
                 if (refs.hasReferences()) {
                     throw new ReferentialIntegrityException("Unable to delete activity. still referenced.");
                 }
@@ -546,7 +543,7 @@
 
             // check for jcr:activity
             if (node.hasProperty(NameConstants.JCR_ACTIVITY)) {
-                NodeId actId = new NodeId(node.getProperty(NameConstants.JCR_ACTIVITY).internalGetValue().getUUID());
+                NodeId actId = node.getProperty(NameConstants.JCR_ACTIVITY).internalGetValue().getNodeId();
                 InternalActivityImpl act = (InternalActivityImpl) getItem(actId);
                 act.addVersion(v);
             }

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalActivity.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalActivity.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalActivity.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalActivity.java Mon Jul 13 15:55:55 2009
@@ -16,12 +16,11 @@
  */
 package org.apache.jackrabbit.core.version;
 
-import java.util.Collection;
 import java.util.Map;
 
 import javax.jcr.RepositoryException;
 
-import org.apache.jackrabbit.core.NodeId;
+import org.apache.jackrabbit.core.id.NodeId;
 
 /**
  * This interface defines the internal activity.

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalActivityImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalActivityImpl.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalActivityImpl.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalActivityImpl.java Mon Jul 13 15:55:55 2009
@@ -26,11 +26,10 @@
 import javax.jcr.PropertyType;
 import javax.jcr.RepositoryException;
 
-import org.apache.jackrabbit.core.NodeId;
+import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.core.value.InternalValue;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.commons.name.NameConstants;
-import org.apache.jackrabbit.uuid.UUID;
 
 /**
  * Implements a internal representation of an activity node.
@@ -103,9 +102,9 @@
             InternalValue[] vs = node.getPropertyValues(NameConstants.REP_VERSIONS);
             versions = new InternalValue[vs.length+1];
             System.arraycopy(vs, 0, versions, 0, vs.length);
-            versions[vs.length] = InternalValue.create(v.getId().getUUID());
+            versions[vs.length] = InternalValue.create(v.getId());
         } else {
-            versions = new InternalValue[]{InternalValue.create(v.getId().getUUID())};
+            versions = new InternalValue[]{InternalValue.create(v.getId())};
         }
         node.setPropertyValues(NameConstants.REP_VERSIONS, PropertyType.REFERENCE, versions);
         node.store();
@@ -119,9 +118,9 @@
     public void removeVersion(InternalVersionImpl v) throws RepositoryException {
         List<InternalValue> versions = new LinkedList<InternalValue>();
         if (node.hasProperty(NameConstants.REP_VERSIONS)) {
-            UUID vUUID = v.getId().getUUID();
+            NodeId vId = v.getId();
             for (InternalValue ref: node.getPropertyValues(NameConstants.REP_VERSIONS)) {
-                if (!ref.getUUID().equals(vUUID)) {
+                if (!vId.equals(ref.getNodeId())) {
                     versions.add(ref);
                 }
             }
@@ -142,8 +141,7 @@
         if (node.hasProperty(NameConstants.REP_VERSIONS)) {
             InternalVersion best = null;
             for (InternalValue ref: node.getPropertyValues(NameConstants.REP_VERSIONS)) {
-                NodeId versionId = new NodeId(ref.getUUID());
-                InternalVersion v = history.getVersion(versionId);
+                InternalVersion v = history.getVersion(ref.getNodeId());
                 if (v != null) {
                     // currently we assume that the last version is the best
                     best = v;
@@ -162,10 +160,7 @@
         Map<NodeId, InternalVersion> changeset = new HashMap<NodeId, InternalVersion>();
         if (node.hasProperty(NameConstants.REP_VERSIONS)) {
             for (InternalValue ref: node.getPropertyValues(NameConstants.REP_VERSIONS)) {
-                // currently we rely on the fact that the latest version is
-                // also the last in the references
-                NodeId versionId = new NodeId(ref.getUUID());
-                InternalVersion v = vMgr.getVersion(versionId);
+                InternalVersion v = vMgr.getVersion(ref.getNodeId());
                 changeset.put(v.getVersionHistory().getId(), v);
             }
         }

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenNode.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenNode.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenNode.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenNode.java Mon Jul 13 15:55:55 2009
@@ -16,9 +16,9 @@
  */
 package org.apache.jackrabbit.core.version;
 
+import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.core.state.PropertyState;
 import org.apache.jackrabbit.spi.Name;
-import org.apache.jackrabbit.uuid.UUID;
 
 import javax.jcr.version.VersionException;
 
@@ -46,11 +46,11 @@
     PropertyState[] getFrozenProperties();
 
     /**
-     * Returns the frozen UUID.
+     * Returns the frozen node id.
      *
-     * @return the frozen uuid.
+     * @return the frozen id
      */
-    UUID getFrozenUUID();
+    NodeId getFrozenId();
 
     /**
      * Returns the name of frozen primary type.
@@ -68,10 +68,10 @@
 
     /**
      * Checks if this frozen node has the frozen version history
-     * @param uuid
+     * @param id
      * @return <code>true</code> if this node has the history;
      *         <code>false</code> otherwise.
      */
-    boolean hasFrozenHistory(UUID uuid);
+    boolean hasFrozenHistory(NodeId id);
 
 }

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenNodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenNodeImpl.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenNodeImpl.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenNodeImpl.java Mon Jul 13 15:55:55 2009
@@ -18,14 +18,13 @@
 
 import org.apache.jackrabbit.core.NodeImpl;
 import org.apache.jackrabbit.core.PropertyImpl;
-import org.apache.jackrabbit.core.NodeId;
+import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.core.nodetype.NodeTypeImpl;
 import org.apache.jackrabbit.core.state.ItemStateException;
 import org.apache.jackrabbit.core.state.PropertyState;
 import org.apache.jackrabbit.core.state.ChildNodeEntry;
 import org.apache.jackrabbit.core.value.InternalValue;
 import org.apache.jackrabbit.spi.Name;
-import org.apache.jackrabbit.uuid.UUID;
 import org.apache.jackrabbit.spi.commons.name.NameConstants;
 
 import javax.jcr.NodeIterator;
@@ -36,7 +35,6 @@
 import javax.jcr.version.OnParentVersionAction;
 import javax.jcr.version.VersionException;
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
 
 /**
@@ -72,9 +70,9 @@
     private InternalFreeze[] frozenNodes = null;
 
     /**
-     * the frozen uuid of the original node
+     * the frozen id of the original node
      */
-    private UUID frozenUUID = null;
+    private NodeId frozenUUID = null;
 
     /**
      * the frozen primary type of the orginal node
@@ -104,10 +102,9 @@
         } catch (ItemStateException e) {
             throw new RepositoryException(e);
         }
-        List propList = new ArrayList();
+        List<PropertyState> propList = new ArrayList<PropertyState>();
 
-        for (int i = 0; i < props.length; i++) {
-            PropertyState prop = props[i];
+        for (PropertyState prop : props) {
             if (prop.getName().equals(NameConstants.JCR_FROZENUUID)) {
                 // special property
                 InternalValue value =
@@ -117,9 +114,9 @@
                 // we do not automatically upgrade old content, we need to be
                 // ready to handle both types of values here.
                 if (value.getType() == PropertyType.STRING) {
-                    frozenUUID = UUID.fromString(value.getString());
+                    frozenUUID = new NodeId(value.getString());
                 } else {
-                    frozenUUID = value.getUUID();
+                    frozenUUID = value.getNodeId();
                 }
             } else if (prop.getName().equals(NameConstants.JCR_FROZENPRIMARYTYPE)) {
                 // special property
@@ -176,13 +173,11 @@
         if (frozenNodes == null) {
             try {
                 // maybe add iterator?
-                List entries = node.getState().getChildNodeEntries();
+                List<ChildNodeEntry> entries =
+                    node.getState().getChildNodeEntries();
                 frozenNodes = new InternalFreeze[entries.size()];
-                Iterator iter = entries.iterator();
                 int i = 0;
-                while (iter.hasNext()) {
-                    ChildNodeEntry entry =
-                            (ChildNodeEntry) iter.next();
+                for (ChildNodeEntry entry : entries) {
                     frozenNodes[i++] = (InternalFreeze) vMgr.getItem(entry.getId());
                 }
             } catch (RepositoryException e) {
@@ -195,9 +190,8 @@
     /**
      * {@inheritDoc}
      */
-    public boolean hasFrozenHistory(UUID uuid) {
+    public boolean hasFrozenHistory(NodeId id) {
         try {
-            NodeId id = new NodeId(uuid);
             InternalFreeze[] frozen = getFrozenChildNodes();
             for (int i = 0; i < frozen.length; i++) {
                 if (frozen[i] instanceof InternalFrozenVersionHistory
@@ -222,7 +216,7 @@
     /**
      * {@inheritDoc}
      */
-    public UUID getFrozenUUID() {
+    public NodeId getFrozenId() {
         return frozenUUID;
     }
 
@@ -281,7 +275,7 @@
 
         // initialize the internal properties
         node.setPropertyValue(NameConstants.JCR_FROZENUUID,
-                InternalValue.create(src.internalGetUUID().toString()));
+                InternalValue.create(src.getNodeId().toString()));
         node.setPropertyValue(NameConstants.JCR_FROZENPRIMARYTYPE,
                 InternalValue.create(((NodeTypeImpl) src.getPrimaryNodeType()).getQName()));
         if (src.hasProperty(NameConstants.JCR_MIXINTYPES)) {
@@ -335,8 +329,9 @@
                 if (child.isNodeType(NameConstants.MIX_SIMPLE_VERSIONABLE)) {
                     // create frozen versionable child
                     NodeStateEx newChild = node.addNode(child.getQName(), NameConstants.NT_VERSIONEDCHILD, null, false);
-                    newChild.setPropertyValue(NameConstants.JCR_CHILDVERSIONHISTORY,
-                            InternalValue.create(new UUID(child.getVersionHistory().getUUID())));
+                    newChild.setPropertyValue(
+                            NameConstants.JCR_CHILDVERSIONHISTORY,
+                            InternalValue.create(new NodeId(child.getVersionHistory().getUUID())));
                     /*
                         newChild.setPropertyValue(JCR_BASEVERSION,
                                 InternalValue.create(child.getBaseVersion().getUUID()));

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenVHImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenVHImpl.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenVHImpl.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenVHImpl.java Mon Jul 13 15:55:55 2009
@@ -17,7 +17,7 @@
 package org.apache.jackrabbit.core.version;
 
 import org.apache.jackrabbit.spi.Name;
-import org.apache.jackrabbit.core.NodeId;
+import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.spi.commons.name.NameConstants;
 
 import javax.jcr.RepositoryException;
@@ -58,7 +58,7 @@
      * {@inheritDoc}
      */
     public NodeId getVersionHistoryId() {
-        return new NodeId(node.getPropertyValue(NameConstants.JCR_CHILDVERSIONHISTORY).getUUID());
+        return node.getPropertyValue(NameConstants.JCR_CHILDVERSIONHISTORY).getNodeId();
     }
 
     /**
@@ -77,7 +77,7 @@
      * {@inheritDoc}
      */
     public NodeId getBaseVersionId() {
-        return new NodeId(node.getPropertyValue(NameConstants.JCR_BASEVERSION).getUUID());
+        return node.getPropertyValue(NameConstants.JCR_BASEVERSION).getNodeId();
     }
 
     /**

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenVersionHistory.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenVersionHistory.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenVersionHistory.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenVersionHistory.java Mon Jul 13 15:55:55 2009
@@ -16,7 +16,7 @@
  */
 package org.apache.jackrabbit.core.version;
 
-import org.apache.jackrabbit.core.NodeId;
+import org.apache.jackrabbit.core.id.NodeId;
 
 import javax.jcr.version.VersionException;
 

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersion.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersion.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersion.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersion.java Mon Jul 13 15:55:55 2009
@@ -17,7 +17,7 @@
 package org.apache.jackrabbit.core.version;
 
 import org.apache.jackrabbit.spi.Name;
-import org.apache.jackrabbit.core.NodeId;
+import org.apache.jackrabbit.core.id.NodeId;
 import javax.jcr.version.Version;
 
 import java.util.Calendar;

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionHistory.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionHistory.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionHistory.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionHistory.java Mon Jul 13 15:55:55 2009
@@ -17,8 +17,7 @@
 package org.apache.jackrabbit.core.version;
 
 import org.apache.jackrabbit.spi.Name;
-import org.apache.jackrabbit.core.NodeId;
-import org.apache.jackrabbit.uuid.UUID;
+import org.apache.jackrabbit.core.id.NodeId;
 
 import javax.jcr.version.VersionException;
 
@@ -81,11 +80,11 @@
     int getNumVersions();
 
     /**
-     * Returns the UUID of the versionable node that this history belongs to.
+     * Returns the id of the versionable node that this history belongs to.
      *
-     * @return the UUID of the versionable node.
+     * @return the id of the versionable node.
      */
-    UUID getVersionableUUID();
+    NodeId getVersionableId();
 
     /**
      * Returns a name array of all version labels that exist in this

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionHistoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionHistoryImpl.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionHistoryImpl.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionHistoryImpl.java Mon Jul 13 15:55:55 2009
@@ -17,14 +17,13 @@
 package org.apache.jackrabbit.core.version;
 
 import org.apache.jackrabbit.core.NodeImpl;
-import org.apache.jackrabbit.core.NodeId;
+import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.core.state.ItemStateException;
 import org.apache.jackrabbit.core.state.NodeState;
 import org.apache.jackrabbit.core.state.PropertyState;
 import org.apache.jackrabbit.core.state.ChildNodeEntry;
 import org.apache.jackrabbit.core.value.InternalValue;
 import org.apache.jackrabbit.spi.Name;
-import org.apache.jackrabbit.uuid.UUID;
 import org.apache.jackrabbit.spi.commons.name.NameConstants;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -140,12 +139,11 @@
             for (PropertyState pState : labels) {
                 if (pState.getType() == PropertyType.REFERENCE) {
                     Name labelName = pState.getName();
-                    UUID ref = pState.getValues()[0].getUUID();
-                    NodeId id = new NodeId(ref);
+                    NodeId id = pState.getValues()[0].getNodeId();
                     if (node.getState().hasChildNodeEntry(id)) {
                         labelCache.put(labelName, node.getState().getChildNodeEntry(id).getName());
                     } else {
-                        log.warn("Error while resolving label reference. Version missing: " + ref);
+                        log.warn("Error while resolving label reference. Version missing: " + id);
                     }
                 }
             }
@@ -328,8 +326,8 @@
     /**
      * {@inheritDoc}
      */
-    public UUID getVersionableUUID() {
-        return versionableId.getUUID();
+    public NodeId getVersionableId() {
+        return versionableId;
     }
 
     /**
@@ -462,7 +460,8 @@
             if (version == null) {
                 labelNode.removeProperty(label);
             } else {
-                labelNode.setPropertyValue(label, InternalValue.create(version.getId().getUUID()));
+                labelNode.setPropertyValue(
+                        label, InternalValue.create(version.getId()));
             }
             labelNode.store();
         } catch (RepositoryException e) {
@@ -499,29 +498,30 @@
             Value[] preds = src.getProperty(NameConstants.JCR_PREDECESSORS).getValues();
             predecessors = new InternalValue[preds.length];
             for (int i = 0; i < preds.length; i++) {
-                UUID predId = UUID.fromString(preds[i].getString());
+                NodeId predId = new NodeId(preds[i].getString());
                 // check if version exist
-                if (!nameCache.containsValue(new NodeId(predId))) {
-                    throw new RepositoryException("invalid predecessor in source node");
+                if (!nameCache.containsValue(predId)) {
+                    throw new RepositoryException(
+                            "Invalid predecessor in source node: " + predId);
                 }
                 predecessors[i] = InternalValue.create(predId);
             }
         } else {
             // with simple versioning, the node does not contain a predecessors
             // property and we just use the 'head' version as predecessor
-            Iterator iter = nameCache.values().iterator();
+            Iterator<NodeId> iter = nameCache.values().iterator();
             NodeId last = null;
             while (iter.hasNext()) {
-                last = (NodeId) iter.next();
+                last = iter.next();
             }
             if (last == null) {
                 // should never happen
                 last = rootVersion.getId();
             }
-            predecessors = new InternalValue[]{InternalValue.create(last.getUUID())};
+            predecessors = new InternalValue[]{InternalValue.create(last)};
         }
 
-        NodeId versionId = new NodeId(UUID.randomUUID());
+        NodeId versionId = new NodeId();
         NodeStateEx vNode = node.addNode(name, NameConstants.NT_VERSION, versionId, true);
 
         // check for jcr:activity
@@ -571,11 +571,11 @@
             NodeState nodeState, NodeId copiedFrom) throws RepositoryException {
 
         // create history node
-        NodeId historyId = new NodeId(UUID.randomUUID());
+        NodeId historyId = new NodeId();
         NodeStateEx pNode = parent.addNode(name, NameConstants.NT_VERSIONHISTORY, historyId, true);
 
         // set the versionable uuid
-        String versionableUUID = nodeState.getNodeId().getUUID().toString();
+        String versionableUUID = nodeState.getNodeId().toString();
         pNode.setPropertyValue(NameConstants.JCR_VERSIONABLEUUID, InternalValue.create(versionableUUID));
 
         // create label node
@@ -583,11 +583,11 @@
 
         // initialize the 'jcr:copiedFrom' property
         if (copiedFrom != null) {
-            pNode.setPropertyValue(NameConstants.JCR_COPIEDFROM, InternalValue.create(copiedFrom.getUUID(), true));
+            pNode.setPropertyValue(NameConstants.JCR_COPIEDFROM, InternalValue.create(copiedFrom, true));
         }
         
         // create root version
-        NodeId versionId = new NodeId(UUID.randomUUID());
+        NodeId versionId = new NodeId();
         NodeStateEx vNode = pNode.addNode(NameConstants.JCR_ROOTVERSION, NameConstants.NT_VERSION, versionId, true);
 
         // initialize 'created' and 'predecessors'
@@ -603,10 +603,10 @@
         node.setPropertyValue(NameConstants.JCR_FROZENPRIMARYTYPE,
                 InternalValue.create(nodeState.getNodeTypeName()));
 
-        Set mixins = nodeState.getMixinTypeNames();
-        if (mixins.size() > 0) {
+        Set<Name> mixins = nodeState.getMixinTypeNames();
+        if (!mixins.isEmpty()) {
             InternalValue[] ivalues = new InternalValue[mixins.size()];
-            Iterator iter = mixins.iterator();
+            Iterator<Name> iter = mixins.iterator();
             for (int i = 0; i < mixins.size(); i++) {
                 ivalues[i] = InternalValue.create((Name) iter.next());
             }

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionImpl.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionImpl.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionImpl.java Mon Jul 13 15:55:55 2009
@@ -19,7 +19,7 @@
 import org.apache.jackrabbit.core.state.ChildNodeEntry;
 import org.apache.jackrabbit.core.state.ISMLocking.ReadLock;
 import org.apache.jackrabbit.core.value.InternalValue;
-import org.apache.jackrabbit.core.NodeId;
+import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.commons.name.NameConstants;
 
@@ -145,8 +145,7 @@
             if (values != null) {
                 InternalVersion[] versions = new InternalVersion[values.length];
                 for (int i = 0; i < values.length; i++) {
-                    NodeId vId = new NodeId(values[i].getUUID());
-                    versions[i] = versionHistory.getVersion(vId);
+                    versions[i] = versionHistory.getVersion(values[i].getNodeId());
                 }
                 return versions;
             } else {
@@ -179,8 +178,7 @@
         if (values != null) {
             InternalVersion[] versions = new InternalVersion[values.length];
             for (int i = 0; i < values.length; i++) {
-                NodeId vId = new NodeId(values[i].getUUID());
-                versions[i] = versionHistory.getVersion(vId);
+                versions[i] = versionHistory.getVersion(values[i].getNodeId());
             }
             return versions;
         } else {
@@ -196,8 +194,7 @@
     public InternalVersion getLinearPredecessor() {
         InternalValue[] values = node.getPropertyValues(NameConstants.JCR_PREDECESSORS);
         if (values != null && values.length > 0) {
-            NodeId vId = new NodeId(values[0].getUUID());
-            return versionHistory.getVersion(vId);
+            return versionHistory.getVersion(values[0].getNodeId());
         } else {
             return null;
         }
@@ -259,12 +256,12 @@
      * @param store if <code>true</code> the node is stored
      * @throws RepositoryException if a repository error occurs
      */
-    private void storeXCessors(List/*<InternalVersion>*/ cessors, Name propname, boolean store)
+    private void storeXCessors(List<InternalVersion> cessors, Name propname, boolean store)
             throws RepositoryException {
         InternalValue[] values = new InternalValue[cessors.size()];
         for (int i = 0; i < values.length; i++) {
             values[i] = InternalValue.create(
-                    ((InternalVersion) cessors.get(i)).getId().getUUID());
+                    ((InternalVersion) cessors.get(i)).getId());
         }
         node.setPropertyValues(propname, PropertyType.STRING, values);
         if (store) {
@@ -427,8 +424,8 @@
         InternalValue[] values = node.getPropertyValues(NameConstants.JCR_PREDECESSORS);
         if (values != null) {
             for (InternalValue value : values) {
-                NodeId vId = new NodeId(value.getUUID());
-                InternalVersionImpl v = (InternalVersionImpl) versionHistory.getVersion(vId);
+                InternalVersionImpl v = (InternalVersionImpl)
+                        versionHistory.getVersion(value.getNodeId());
                 v.internalAddSuccessor(this, false);
             }
         }
@@ -462,10 +459,11 @@
      */
     public InternalActivityImpl getActivity() throws RepositoryException {
         if (node.hasProperty(NameConstants.JCR_ACTIVITY)) {
-            NodeId actId = new NodeId(node.getPropertyValue(NameConstants.JCR_ACTIVITY).getUUID());
-            return (InternalActivityImpl) vMgr.getItem(actId);
+            InternalValue value = node.getPropertyValue(NameConstants.JCR_ACTIVITY);
+            return (InternalActivityImpl) vMgr.getItem(value.getNodeId());
         } else {
             return null;
         }
     }
+
 }

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionItem.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionItem.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionItem.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionItem.java Mon Jul 13 15:55:55 2009
@@ -16,7 +16,7 @@
  */
 package org.apache.jackrabbit.core.version;
 
-import org.apache.jackrabbit.core.NodeId;
+import org.apache.jackrabbit.core.id.NodeId;
 
 /**
  * This interface defines the base for all internal versioning items. Internal

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionItemImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionItemImpl.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionItemImpl.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionItemImpl.java Mon Jul 13 15:55:55 2009
@@ -16,7 +16,7 @@
  */
 package org.apache.jackrabbit.core.version;
 
-import org.apache.jackrabbit.core.NodeId;
+import org.apache.jackrabbit.core.id.NodeId;
 
 /**
  * Implements a <code>InternalVersionItem</code>.

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/JcrVersionManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/JcrVersionManagerImpl.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/JcrVersionManagerImpl.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/JcrVersionManagerImpl.java Mon Jul 13 15:55:55 2009
@@ -29,9 +29,9 @@
 import javax.jcr.version.Version;
 import javax.jcr.version.VersionHistory;
 
-import org.apache.jackrabbit.core.ItemId;
+import org.apache.jackrabbit.core.id.ItemId;
 import org.apache.jackrabbit.core.LazyItemIterator;
-import org.apache.jackrabbit.core.NodeId;
+import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.core.NodeImpl;
 import org.apache.jackrabbit.core.SessionImpl;
 import org.apache.jackrabbit.spi.commons.name.NameConstants;
@@ -301,9 +301,9 @@
         Iterator<NodeId> iter = changeSet.keySet().iterator();
         while (iter.hasNext()) {
             InternalVersion v = changeSet.remove(iter.next());
-            NodeId nodeId = new NodeId(v.getVersionHistory().getVersionableUUID());
             try {
-                NodeImpl node = session.getNodeById(nodeId);
+                NodeImpl node = session.getNodeById(
+                        v.getVersionHistory().getVersionableId());
                 InternalVersion base = ((VersionImpl) node.getBaseVersion()).getInternalVersion();
                 VersionImpl version = (VersionImpl) session.getNodeById(v.getId());
                 // if base version is newer than version, add to failed list

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/NodeStateEx.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/NodeStateEx.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/NodeStateEx.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/NodeStateEx.java Mon Jul 13 15:55:55 2009
@@ -16,8 +16,8 @@
  */
 package org.apache.jackrabbit.core.version;
 
-import org.apache.jackrabbit.core.NodeId;
-import org.apache.jackrabbit.core.PropertyId;
+import org.apache.jackrabbit.core.id.NodeId;
+import org.apache.jackrabbit.core.id.PropertyId;
 import org.apache.jackrabbit.core.PropertyImpl;
 import org.apache.jackrabbit.core.nodetype.EffectiveNodeType;
 import org.apache.jackrabbit.core.nodetype.NodeDef;
@@ -32,10 +32,8 @@
 import org.apache.jackrabbit.core.state.ChildNodeEntry;
 import org.apache.jackrabbit.core.value.InternalValue;
 import org.apache.jackrabbit.spi.Name;
-import org.apache.jackrabbit.uuid.UUID;
 import org.apache.jackrabbit.spi.commons.name.NameConstants;
 
-import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
 
@@ -136,11 +134,10 @@
      * @return the properties of this node
      */
     public PropertyState[] getProperties() throws ItemStateException {
-        Set set = nodeState.getPropertyNames();
+        Set<Name> set = nodeState.getPropertyNames();
         PropertyState[] props = new PropertyState[set.size()];
         int i = 0;
-        for (Iterator iter = set.iterator(); iter.hasNext();) {
-            Name propName = (Name) iter.next();
+        for (Name propName : set) {
             PropertyId propId = new PropertyId(nodeState.getNodeId(), propName);
             props[i++] = (PropertyState) stateMgr.getItemState(propId);
         }
@@ -348,9 +345,7 @@
         NodeState state = (NodeState) stateMgr.getItemState(id);
 
         // remove properties
-        Iterator iter = state.getPropertyNames().iterator();
-        while (iter.hasNext()) {
-            Name name = (Name) iter.next();
+        for (Name name :  state.getPropertyNames()) {
             PropertyId propId = new PropertyId(id, name);
             PropertyState propState = (PropertyState) stateMgr.getItemState(propId);
             stateMgr.destroy(propState);
@@ -358,9 +353,7 @@
         state.removeAllPropertyNames();
 
         // remove child nodes
-        iter = state.getChildNodeEntries().iterator();
-        while (iter.hasNext()) {
-            ChildNodeEntry entry = (ChildNodeEntry) iter.next();
+        for (ChildNodeEntry entry : state.getChildNodeEntries()) {
             removeNode(entry.getId());
         }
         state.removeAllChildNodeEntries();
@@ -431,7 +424,7 @@
 
         NodeStateEx node = createChildNode(nodeName, nodeTypeName, id);
         if (referenceable) {
-            node.setPropertyValue(NameConstants.JCR_UUID, InternalValue.create(node.getNodeId().getUUID().toString()));
+            node.setPropertyValue(NameConstants.JCR_UUID, InternalValue.create(node.getNodeId().toString()));
         }
         return node;
     }
@@ -461,7 +454,7 @@
         NodeId parentId = nodeState.getNodeId();
         // create a new node state
         if (id == null) {
-            id = new NodeId(UUID.randomUUID());
+            id = new NodeId();
         }
         NodeState state = stateMgr.createNew(id, nodeTypeName, parentId);
 
@@ -473,7 +466,7 @@
         NodeStateEx node = new NodeStateEx(stateMgr, ntReg, state, name);
         node.setPropertyValue(NameConstants.JCR_PRIMARYTYPE, InternalValue.create(nodeTypeName));
 
-        // add new child node entryn
+        // add new child node entry
         nodeState.addChildNodeEntry(name, id);
         if (nodeState.getStatus() == ItemState.STATUS_EXISTING) {
             nodeState.setStatus(ItemState.STATUS_EXISTING_MODIFIED);
@@ -489,12 +482,12 @@
      */
     public NodeStateEx[] getChildNodes() throws RepositoryException {
         try {
-            List entries = nodeState.getChildNodeEntries();
+            List<ChildNodeEntry> entries = nodeState.getChildNodeEntries();
             NodeStateEx[] children = new NodeStateEx[entries.size()];
-            for (int i = 0; i < entries.size(); i++) {
-                ChildNodeEntry entry = (ChildNodeEntry) entries.get(i);
+            int i = 0;
+            for (ChildNodeEntry entry : entries) {
                 NodeState state = (NodeState) stateMgr.getItemState(entry.getId());
-                children[i] = new NodeStateEx(stateMgr, ntReg, state, entry.getName());
+                children[i++] = new NodeStateEx(stateMgr, ntReg, state, entry.getName());
             }
             return children;
         } catch (ItemStateException e) {
@@ -526,9 +519,7 @@
 
         if (state.getStatus() != ItemState.STATUS_EXISTING) {
             // first store all transient properties
-            Set props = state.getPropertyNames();
-            for (Iterator iter = props.iterator(); iter.hasNext();) {
-                Name propName = (Name) iter.next();
+            for (Name propName : state.getPropertyNames()) {
                 PropertyState pstate = (PropertyState) stateMgr.getItemState(
                         new PropertyId(state.getNodeId(), propName));
                 if (pstate.getStatus() != ItemState.STATUS_EXISTING) {
@@ -536,9 +527,7 @@
                 }
             }
             // now store all child node entries
-            List nodes = state.getChildNodeEntries();
-            for (int i = 0; i < nodes.size(); i++) {
-                ChildNodeEntry entry = (ChildNodeEntry) nodes.get(i);
+            for (ChildNodeEntry entry : state.getChildNodeEntries()) {
                 NodeState nstate = (NodeState) stateMgr.getItemState(entry.getId());
                 store(nstate);
             }
@@ -571,9 +560,7 @@
     private void reload(NodeState state) throws ItemStateException {
         if (state.getStatus() != ItemState.STATUS_EXISTING) {
             // first discard all all transient properties
-            Set props = state.getPropertyNames();
-            for (Iterator iter = props.iterator(); iter.hasNext();) {
-                Name propName = (Name) iter.next();
+            for (Name propName : state.getPropertyNames()) {
                 PropertyState pstate = (PropertyState) stateMgr.getItemState(
                         new PropertyId(state.getNodeId(), propName));
                 if (pstate.getStatus() != ItemState.STATUS_EXISTING) {
@@ -581,9 +568,7 @@
                 }
             }
             // now reload all child node entries
-            List nodes = state.getChildNodeEntries();
-            for (int i = 0; i < nodes.size(); i++) {
-                ChildNodeEntry entry = (ChildNodeEntry) nodes.get(i);
+            for (ChildNodeEntry entry : state.getChildNodeEntries()) {
                 NodeState nstate = (NodeState) stateMgr.getItemState(entry.getId());
                 reload(nstate);
             }

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionHistoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionHistoryImpl.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionHistoryImpl.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionHistoryImpl.java Mon Jul 13 15:55:55 2009
@@ -18,7 +18,7 @@
 
 import org.apache.jackrabbit.core.AbstractNodeData;
 import org.apache.jackrabbit.core.ItemManager;
-import org.apache.jackrabbit.core.NodeId;
+import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.core.NodeImpl;
 import org.apache.jackrabbit.core.SessionImpl;
 import org.apache.jackrabbit.core.security.authorization.Permission;
@@ -108,8 +108,7 @@
     public VersionIterator getAllLinearVersions() throws RepositoryException {
         // get base version. this can certainly be optimized
         InternalVersionHistory vh = getInternalVersionHistory();
-        NodeId id = new NodeId(vh.getVersionableUUID());
-        Node vn = session.getNodeById(id);
+        Node vn = session.getNodeById(vh.getVersionableId());
         InternalVersion base = ((VersionImpl) vn.getBaseVersion()).getInternalVersion();
 
         return new VersionIteratorImpl(session, vh.getRootVersion(), base);
@@ -284,7 +283,7 @@
      * {@inheritDoc}
      */
     public String getVersionableIdentifier() throws RepositoryException {
-        return getInternalVersionHistory().getVersionableUUID().toString();
+        return getInternalVersionHistory().getVersionableId().toString();
     }
 
     /**



Mime
View raw message