jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r792485 - in /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core: ./ id/ persistence/bundle/util/ query/lucene/ state/ value/ version/ xml/
Date Thu, 09 Jul 2009 10:27:29 GMT
Author: jukka
Date: Thu Jul  9 10:27:28 2009
New Revision: 792485

URL: http://svn.apache.org/viewvc?rev=792485&view=rev
Log:
JCR-1232: Merge UUID to NodeId

Replace more uses of UUID with NodeId. Most notably:

  * Reference InternalValues now contain NodeIds instead of UUIDs
  * Item state serializers use NodeIds instead of UUIDs
  * Frozen ids in versioning are now NodeIds instead of UUIDs
  * Dropped Session.internalGetUUID() in favor of Session.getNodeId()
  * Dropped Session.getNodeByUUID(UUID) in favor of Session.getNodeById(NodeId)

None of these changes has functional effects, expect reducing the amount of extra NodeId objects that need to be instantiated when switching between representations.

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/BatchedItemOperations.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SessionImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/WorkspaceImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/id/NodeId.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/BundleBinding.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/ItemStateBinding.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/NodeIndexer.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/XAItemStateManager.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/value/InternalValue.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/value/InternalValueFactory.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/AbstractVersionManager.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalActivityImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenNode.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenNodeImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenVHImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionHistoryImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManagerImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/SessionImporter.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/WorkspaceImporter.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/BatchedItemOperations.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/BatchedItemOperations.java?rev=792485&r1=792484&r2=792485&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/BatchedItemOperations.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/BatchedItemOperations.java Thu Jul  9 10:27:28 2009
@@ -450,15 +450,13 @@
             InternalValue[] values = prop.getValues();
             InternalValue[] newVals = new InternalValue[values.length];
             for (int i = 0; i < values.length; i++) {
-                InternalValue val = values[i];
-                NodeId original = new NodeId(val.getUUID());
-                NodeId adjusted = refTracker.getMappedId(original);
+                NodeId adjusted = refTracker.getMappedId(values[i].getNodeId());
                 if (adjusted != null) {
-                    newVals[i] = InternalValue.create(adjusted.getUUID());
+                    newVals[i] = InternalValue.create(adjusted);
                     modified = true;
                 } else {
                     // reference doesn't need adjusting, just copy old value
-                    newVals[i] = val;
+                    newVals[i] = values[i];
                 }
             }
             if (modified) {
@@ -1816,7 +1814,7 @@
                     // the histories jcr:copiedFrom property
                     PropertyId propId = new PropertyId(srcState.getNodeId(), NameConstants.JCR_BASEVERSION);
                     PropertyState prop = (PropertyState) srcStateMgr.getItemState(propId);
-                    copiedFrom = new NodeId(prop.getValues()[0].getUUID());
+                    copiedFrom = prop.getValues()[0].getNodeId();
                 }
                 VersionManager manager = session.getVersionManager();
                 history = manager.getVersionHistory(session, newState, copiedFrom);
@@ -1853,13 +1851,13 @@
                         if (propName.equals(NameConstants.JCR_VERSIONHISTORY)) {
                             // jcr:versionHistory
                             InternalValue value = InternalValue.create(
-                                    history.getVersionHistoryId().getUUID());
+                                    history.getVersionHistoryId());
                             newChildState.setValues(new InternalValue[] { value });
                         } else if (propName.equals(NameConstants.JCR_BASEVERSION)
                                 || propName.equals(NameConstants.JCR_PREDECESSORS)) {
                             // jcr:baseVersion or jcr:predecessors
                             InternalValue value = InternalValue.create(
-                                    history.getRootVersionId().getUUID());
+                                    history.getRootVersionId());
                             newChildState.setValues(new InternalValue[] { value });
                         } else if (propName.equals(NameConstants.JCR_ISCHECKEDOUT)) {
                             // jcr:isCheckedOut

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemImpl.java?rev=792485&r1=792484&r2=792485&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemImpl.java Thu Jul  9 10:27:28 2009
@@ -70,7 +70,6 @@
 import org.apache.jackrabbit.spi.Path;
 import org.apache.jackrabbit.spi.commons.name.NameConstants;
 import org.apache.jackrabbit.util.Text;
-import org.apache.jackrabbit.uuid.UUID;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -515,13 +514,13 @@
                                 boolean satisfied = false;
                                 String constraintViolationMsg = null;
                                 try {
-                                    UUID targetUUID = values[i].getUUID();
+                                    NodeId targetId = values[i].getNodeId();
                                     if (propDef.getRequiredType() == PropertyType.WEAKREFERENCE
-                                        && !itemMgr.itemExists(new NodeId(targetUUID))) {
+                                        && !itemMgr.itemExists(targetId)) {
                                         // target of weakref doesn;t exist, skip
                                         continue;
                                     }
-                                    Node targetNode = session.getNodeByUUID(targetUUID);
+                                    Node targetNode = session.getNodeById(targetId);
                                     /**
                                      * constraints are OR-ed, i.e. at least one
                                      * has to be satisfied
@@ -749,9 +748,9 @@
                         VersionHistoryInfo history =
                             vMgr.getVersionHistory(session, nodeState, null);
                         InternalValue historyId = InternalValue.create(
-                                history.getVersionHistoryId().getUUID());
+                                history.getVersionHistoryId());
                         InternalValue versionId = InternalValue.create(
-                                history.getRootVersionId().getUUID());
+                                history.getRootVersionId());
                         node.internalSetProperty(
                                 NameConstants.JCR_VERSIONHISTORY, historyId);
                         node.internalSetProperty(

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java?rev=792485&r1=792484&r2=792485&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java Thu Jul  9 10:27:28 2009
@@ -1368,15 +1368,6 @@
     }
 
     /**
-     * Returns the (internal) uuid of this node.
-     *
-     * @return the uuid of this node
-     */
-    public UUID internalGetUUID() {
-        return ((NodeId) id).getUUID();
-    }
-
-    /**
      * Checks various pre-conditions that are common to all
      * <code>setProperty()</code> methods. The checks performed are:
      * <ul>
@@ -1635,8 +1626,8 @@
      * @param nodeName     name of the new node
      * @param nodeTypeName name of the new node's node type or <code>null</code>
      *                     if it should be determined automatically
-     * @param uuid         uuid of the new node or <code>null</code> if a new
-     *                     uuid should be assigned
+     * @param id           id of the new node or <code>null</code> if a new
+     *                     id should be assigned
      * @return the newly added node
      * @throws ItemExistsException
      * @throws NoSuchNodeTypeException
@@ -1646,7 +1637,7 @@
      * @throws RepositoryException
      */
     public synchronized NodeImpl addNode(Name nodeName, Name nodeTypeName,
-                                         UUID uuid)
+                                         NodeId id)
             throws ItemExistsException, NoSuchNodeTypeException, VersionException,
             ConstraintViolationException, LockException, RepositoryException {
         // check state of this instance
@@ -1660,7 +1651,7 @@
         if (nodeTypeName != null) {
             nt = session.getNodeTypeManager().getNodeType(nodeTypeName);
         }
-        return internalAddChildNode(nodeName, nt, uuid == null ? null : new NodeId(uuid));
+        return internalAddChildNode(nodeName, nt, id);
     }
 
     /**
@@ -1990,7 +1981,7 @@
         existing.remove();
 
         // create new child node
-        NodeImpl node = addNode(nodeName, nodeTypeName, id.getUUID());
+        NodeImpl node = addNode(nodeName, nodeTypeName, id);
         if (mixinNames != null) {
             for (int i = 0; i < mixinNames.length; i++) {
                 node.addMixin(mixinNames[i]);
@@ -3034,7 +3025,7 @@
             throw new UnsupportedRepositoryOperationException();
         }
 
-        return internalGetUUID().toString();
+        return getNodeId().toString();
     }
 
     /**
@@ -3359,7 +3350,9 @@
         try {
             internalSetProperty(NameConstants.JCR_ISCHECKEDOUT, InternalValue.create(false));
             if (isFull) {
-                internalSetProperty(NameConstants.JCR_BASEVERSION, InternalValue.create(new UUID(v.getUUID())));
+                internalSetProperty(
+                        NameConstants.JCR_BASEVERSION,
+                        InternalValue.create(new NodeId(v.getUUID())));
                 internalSetProperty(NameConstants.JCR_PREDECESSORS, InternalValue.EMPTY_ARRAY, PropertyType.REFERENCE);
                 if (hasProperty(NameConstants.JCR_ACTIVITY)) {
                     removeChildProperty(NameConstants.JCR_ACTIVITY);
@@ -3413,11 +3406,11 @@
                 Version baseVersion = session.getVersionManager().checkout(this);
                 props[1] = internalSetProperty(NameConstants.JCR_PREDECESSORS,
                         new InternalValue[]{
-                                InternalValue.create(new UUID(baseVersion.getUUID()))
+                                InternalValue.create(new NodeId(baseVersion.getUUID()))
                         });
                 if (activity != null) {
                     props[2] = internalSetProperty(NameConstants.JCR_ACTIVITY,
-                            InternalValue.create(activity.getNodeId().getUUID()));
+                            InternalValue.create(activity.getNodeId()));
                 }
             }
             if (hasPendingChanges) {
@@ -3569,7 +3562,7 @@
             try {
                 // check if versionable node exists
                 InternalFrozenNode fn = ((VersionImpl) version).getInternalFrozenNode();
-                node = (NodeImpl) session.getNodeByUUID(fn.getFrozenUUID());
+                node = (NodeImpl) session.getNodeById(fn.getFrozenId());
                 if (removeExisting) {
                     try {
                         Path relative = session.getQPath(relPath);
@@ -3579,7 +3572,7 @@
                         // move to respective location
                         session.move(node.getPath(), session.getJCRPath(dstPath));
                         // need to refetch ?
-                        node = (NodeImpl) session.getNodeByUUID(fn.getFrozenUUID());
+                        node = (NodeImpl) session.getNodeById(fn.getFrozenId());
                     } catch (NameException e) {
                         throw new RepositoryException(e);
                     }
@@ -3885,9 +3878,9 @@
                 Value[] vals = getProperty(NameConstants.JCR_PREDECESSORS).getValues();
                 InternalValue[] v = new InternalValue[vals.length + 1];
                 for (int i = 0; i < vals.length; i++) {
-                    v[i] = InternalValue.create(UUID.fromString(vals[i].getString()));
+                    v[i] = InternalValue.create(new NodeId(vals[i].getString()));
                 }
-                v[vals.length] = InternalValue.create(UUID.fromString(version.getUUID()));
+                v[vals.length] = InternalValue.create(new NodeId(version.getUUID()));
                 internalSetProperty(NameConstants.JCR_PREDECESSORS, v);
             }
 
@@ -3932,7 +3925,7 @@
             int i = 0;
             while (iter.hasNext()) {
                 String uuid = iter.next();
-                vals[i++] = InternalValue.create(UUID.fromString(uuid));
+                vals[i++] = InternalValue.create(new NodeId(uuid));
             }
             internalSetProperty(NameConstants.JCR_MERGEFAILED, vals);
         }
@@ -4013,10 +4006,10 @@
         NodeTypeManagerImpl ntMgr = session.getNodeTypeManager();
         NodeTypeImpl nt = ntMgr.getNodeType(frozen.getFrozenPrimaryType());
 
-        // get frozen uuid
-        UUID uuid = frozen.getFrozenUUID();
+        // get frozen id
+        NodeId id = frozen.getFrozenId();
 
-        NodeImpl node = internalAddChildNode(name, nt, new NodeId(uuid));
+        NodeImpl node = internalAddChildNode(name, nt, id);
 
         // get frozen mixin
         // todo: also respect mixing types on creation?
@@ -4057,10 +4050,10 @@
         NodeTypeManagerImpl ntMgr = session.getNodeTypeManager();
         NodeTypeImpl nt = ntMgr.getNodeType(frozen.getFrozenPrimaryType());
 
-        // get frozen uuid
-        UUID uuid = frozen.getFrozenUUID();
+        // get frozen id
+        NodeId id = frozen.getFrozenId();
 
-        NodeImpl node = internalAddNode(relPath, nt, new NodeId(uuid));
+        NodeImpl node = internalAddNode(relPath, nt, id);
 
         // get frozen mixin
         // todo: also respect mixing types on creation?
@@ -4327,8 +4320,9 @@
 
         if (isFull) {
             // 2. N's jcr:baseVersion property will be changed to point to V.
-            UUID uuid = ((NodeId) version.getId()).getUUID();
-            internalSetProperty(NameConstants.JCR_BASEVERSION, InternalValue.create(uuid));
+            internalSetProperty(
+                    NameConstants.JCR_BASEVERSION,
+                    InternalValue.create((NodeId) version.getId()));
 
             // 4. N's jcr:predecessor property is set to null
             internalSetProperty(NameConstants.JCR_PREDECESSORS, InternalValue.EMPTY_ARRAY, PropertyType.REFERENCE);
@@ -4362,8 +4356,7 @@
 
         // check uuid
         if (isNodeType(NameConstants.MIX_REFERENCEABLE)) {
-            UUID uuid = freeze.getFrozenUUID();
-            if (!internalGetUUID().equals(uuid)) {
+            if (!getNodeId().equals(freeze.getFrozenId())) {
                 throw new ItemExistsException("Unable to restore version of " + this + ". UUID changed.");
             }
         }
@@ -4435,10 +4428,10 @@
             } else if (n.getDefinition().getOnParentVersion() == OnParentVersionAction.VERSION) {
                 // only remove, if node to be restored does not contain child,
                 // or if restored child is not versionable
-                UUID vhUUID = n.hasProperty(NameConstants.JCR_VERSIONHISTORY)
-                        ? new UUID(n.getProperty(NameConstants.JCR_VERSIONHISTORY).getString())
+                NodeId vhId = n.hasProperty(NameConstants.JCR_VERSIONHISTORY)
+                        ? new NodeId(n.getProperty(NameConstants.JCR_VERSIONHISTORY).getString())
                         : null;
-                if (vhUUID == null || !freeze.hasFrozenHistory(vhUUID)) {
+                if (vhId == null || !freeze.hasFrozenHistory(vhId)) {
                     n.internalRemove(true);
                 }
             }
@@ -4451,9 +4444,9 @@
             if (child instanceof InternalFrozenNode) {
                 InternalFrozenNode f = (InternalFrozenNode) child;
                 // check for existing
-                if (f.getFrozenUUID() != null) {
+                if (f.getFrozenId() != null) {
                     try {
-                        NodeImpl existing = (NodeImpl) session.getNodeByUUID(f.getFrozenUUID());
+                        NodeImpl existing = (NodeImpl) session.getNodeById(f.getFrozenId());
                         // check if one of this restore trees node
                         if (removeExisting) {
                             existing.remove();

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SessionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SessionImpl.java?rev=792485&r1=792484&r2=792485&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SessionImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SessionImpl.java Thu Jul  9 10:27:28 2009
@@ -102,7 +102,6 @@
 import org.apache.jackrabbit.spi.commons.conversion.NameException;
 import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
 import org.apache.jackrabbit.spi.commons.namespace.NamespaceResolver;
-import org.apache.jackrabbit.uuid.UUID;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.xml.sax.ContentHandler;
@@ -515,35 +514,6 @@
     }
 
     /**
-     * Retrieves the referenceable node with the given <code>UUID</code>.
-     *
-     * @param uuid uuid of the node to be retrieved
-     * @return referenceable node with the given uuid
-     * @throws ItemNotFoundException if no node exists with the given uuid or
-     * if the existing node is not referenceable.
-     * @throws RepositoryException if another error occurs.
-     * @see #getNodeByUUID(String)
-     * @see #getNodeById(NodeId)
-     */
-    public Node getNodeByUUID(UUID uuid) throws ItemNotFoundException, RepositoryException {
-        NodeImpl node = getNodeById(new NodeId(uuid));
-        // since the uuid of a node is only exposed through jcr:uuid declared
-        // by mix:referenceable it's rather unlikely that a client can possibly
-        // know the internal uuid of a non-referenceable node; omitting the
-        // check for mix:referenceable seems therefore to be a reasonable
-        // compromise in order to improve performance.
-/*
-        if (node.isNodeType(Name.MIX_REFERENCEABLE)) {
-            return node;
-        } else {
-            // there is a node with that uuid but the node does not expose it
-            throw new ItemNotFoundException(uuid.toString());
-        }
-*/
-        return node;
-    }
-
-    /**
      * Retrieves the <code>Node</code> with the given id.
      *
      * @param id id of node to be retrieved
@@ -861,7 +831,21 @@
      */
     public Node getNodeByUUID(String uuid) throws ItemNotFoundException, RepositoryException {
         try {
-            return getNodeByUUID(UUID.fromString(uuid));
+            NodeImpl node = getNodeById(new NodeId(uuid));
+            // since the uuid of a node is only exposed through jcr:uuid declared
+            // by mix:referenceable it's rather unlikely that a client can possibly
+            // know the internal uuid of a non-referenceable node; omitting the
+            // check for mix:referenceable seems therefore to be a reasonable
+            // compromise in order to improve performance.
+            /*
+            if (node.isNodeType(Name.MIX_REFERENCEABLE)) {
+                return node;
+            } else {
+                // there is a node with that uuid but the node does not expose it
+                throw new ItemNotFoundException(uuid.toString());
+            }
+             */
+            return node;
         } catch (IllegalArgumentException e) {
             // Assuming the exception is from UUID.fromString()
             throw new RepositoryException("Invalid UUID: " + uuid, e);

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/WorkspaceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/WorkspaceImpl.java?rev=792485&r1=792484&r2=792485&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/WorkspaceImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/WorkspaceImpl.java Thu Jul  9 10:27:28 2009
@@ -833,7 +833,7 @@
                 Version[] restored = null;
                 for (VersionImpl v : toRestore.values()) {
                     try {
-                        NodeImpl node = (NodeImpl) session.getNodeByUUID(v.getInternalFrozenNode().getFrozenUUID());
+                        NodeImpl node = (NodeImpl) session.getNodeById(v.getInternalFrozenNode().getFrozenId());
                         restored = node.internalRestore(v, vsel, removeExisting);
                         // remove restored versions from set
                         for (Version r : restored) {

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/id/NodeId.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/id/NodeId.java?rev=792485&r1=792484&r2=792485&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/id/NodeId.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/id/NodeId.java Thu Jul  9 10:27:28 2009
@@ -47,6 +47,16 @@
     }
 
     /**
+     * Creates a node identifier from the given UUID string.
+     *
+     * @param uuid UUID string
+     * @throws IllegalArgumentException if the UUID string is invalid
+     */
+    public NodeId(String uuid) throws IllegalArgumentException {
+        this(new UUID(uuid));
+    }
+
+    /**
      * Returns <code>true</code> as this class represents a node identifier,
      * not a property identifier.
      *

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/BundleBinding.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/BundleBinding.java?rev=792485&r1=792484&r2=792485&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/BundleBinding.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/BundleBinding.java Thu Jul  9 10:27:28 2009
@@ -29,7 +29,6 @@
 import org.apache.jackrabbit.core.nodetype.NodeDefId;
 import org.apache.jackrabbit.core.nodetype.PropDefId;
 import org.apache.jackrabbit.spi.Name;
-import org.apache.jackrabbit.uuid.UUID;
 import org.apache.jackrabbit.spi.commons.name.NameFactoryImpl;
 import org.apache.jackrabbit.spi.commons.name.NameConstants;
 
@@ -187,8 +186,8 @@
             return false;
         }
         try {
-            UUID parentUuid = readUUID(in);
-            log.debug("ParentUUID: " + parentUuid);
+            NodeId parentId = readID(in);
+            log.debug("ParentUUID: " + parentId);
         } catch (IOException e) {
             log.error("Error while reading ParentUUID: " + e);
             return false;
@@ -231,11 +230,11 @@
             return false;
         }
         try {
-            UUID cneUUID = readUUID(in);
-            while (cneUUID != null) {
+            NodeId cneId = readID(in);
+            while (cneId != null) {
                 Name cneName = readQName(in);
-                log.debug("ChildNodentry: " + cneUUID + ":" + cneName);
-                cneUUID = readUUID(in);
+                log.debug("ChildNodentry: " + cneId + ":" + cneName);
+                cneId = readID(in);
             }
         } catch (IOException e) {
             log.error("Error while reading child node entry: " + e);
@@ -397,7 +396,7 @@
                     break;
                 case PropertyType.WEAKREFERENCE:
                 case PropertyType.REFERENCE:
-                    val = InternalValue.create(readUUID(in));
+                    val = InternalValue.create(readID(in));
                     break;
                 default:
                     // because writeUTF(String) has a size limit of 64k,
@@ -548,8 +547,8 @@
                 case PropertyType.WEAKREFERENCE:
                 case PropertyType.REFERENCE:
                     try {
-                        UUID uuid = readUUID(in);
-                        log.debug("  reference: " + uuid);
+                        NodeId id = readID(in);
+                        log.debug("  reference: " + id);
                     } catch (IOException e) {
                         log.error("Error while reading reference value: " + e);
                         return false;
@@ -721,7 +720,7 @@
                     break;
                 case PropertyType.WEAKREFERENCE:
                 case PropertyType.REFERENCE:
-                    writeUUID(out, val.getUUID());
+                    writeID(out, val.getNodeId());
                     break;
                 default:
                     // because writeUTF(String) has a size limit of 64k,

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/ItemStateBinding.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/ItemStateBinding.java?rev=792485&r1=792484&r2=792485&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/ItemStateBinding.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/ItemStateBinding.java Thu Jul  9 10:27:28 2009
@@ -286,33 +286,33 @@
     }
 
     /**
-     * Deserializes a UUID
+     * Deserializes a node identifier
      * @param in the input stream
-     * @return the uuid
+     * @return the node id
      * @throws IOException in an I/O error occurs.
      */
-    public UUID readUUID(DataInputStream in) throws IOException {
+    public NodeId readNodeId(DataInputStream in) throws IOException {
         if (in.readBoolean()) {
             byte[] bytes = new byte[16];
             in.readFully(bytes);
-            return new UUID(bytes);
+            return new NodeId(new UUID(bytes));
         } else {
             return null;
         }
     }
 
     /**
-     * Serializes a UUID
+     * Serializes a node identifier
      * @param out the output stream
-     * @param uuid the uuid
+     * @param uuid the node id
      * @throws IOException in an I/O error occurs.
      */
-    public void writeUUID(DataOutputStream out, String uuid) throws IOException {
-        if (uuid == null) {
+    public void writeNodeId(DataOutputStream out, String id) throws IOException {
+        if (id == null) {
             out.writeBoolean(false);
         } else {
             out.writeBoolean(true);
-            out.write(UUID.fromString(uuid).getRawBytes());
+            out.write(UUID.fromString(id).getRawBytes());
         }
     }
 
@@ -382,21 +382,6 @@
     }
 
     /**
-     * Serializes a UUID
-     * @param out the output stream
-     * @param uuid the uuid
-     * @throws IOException in an I/O error occurs.
-     */
-    public void writeUUID(DataOutputStream out, UUID uuid) throws IOException {
-        if (uuid == null) {
-            out.writeBoolean(false);
-        } else {
-            out.writeBoolean(true);
-            out.write(uuid.getRawBytes());
-        }
-    }
-
-    /**
      * Deserializes a Name
      * @param in the input stream
      * @return the qname
@@ -489,8 +474,9 @@
      * @throws IOException in an I/O error occurs.
      */
     public PropertyId readPropertyId(DataInputStream in) throws IOException {
-        UUID uuid = readUUID(in);
+        NodeId id = readNodeId(in);
         Name name = readQName(in);
-        return new PropertyId(new NodeId(uuid), name);
+        return new PropertyId(id, name);
     }
+
 }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/NodeIndexer.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/NodeIndexer.java?rev=792485&r1=792484&r2=792485&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/NodeIndexer.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/NodeIndexer.java Thu Jul  9 10:27:28 2009
@@ -30,7 +30,6 @@
 import org.apache.jackrabbit.spi.Path;
 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;
 import org.apache.lucene.document.Document;
@@ -319,12 +318,12 @@
                 break;
             case PropertyType.REFERENCE:
                 if (isIndexed(name)) {
-                    addReferenceValue(doc, fieldName, value.getUUID(), false);
+                    addReferenceValue(doc, fieldName, value.getNodeId(), false);
                 }
                 break;
             case PropertyType.WEAKREFERENCE:
                 if (isIndexed(name)) {
-                    addReferenceValue(doc, fieldName, value.getUUID(), true);
+                    addReferenceValue(doc, fieldName, value.getNodeId(), true);
                 }
                 break;
             case PropertyType.PATH:
@@ -583,8 +582,7 @@
      * @param weak          Flag indicating whether it's a WEAKREFERENCE (true) or a REFERENCE (flase)
      */
     protected void addReferenceValue(Document doc, String fieldName, Object internalValue, boolean weak) {
-        UUID value = (UUID) internalValue;
-        String uuid = value.toString();
+        String uuid = internalValue.toString();
         doc.add(createFieldWithoutNorms(fieldName, uuid,
                 weak ? PropertyType.WEAKREFERENCE : PropertyType.REFERENCE));
         doc.add(new Field(FieldNames.PROPERTIES,

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java?rev=792485&r1=792484&r2=792485&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java Thu Jul  9 10:27:28 2009
@@ -50,7 +50,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;
 
@@ -913,14 +912,14 @@
             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);
+            NodeReferencesId refsId = new NodeReferencesId(target);
             if (virtualProvider == null
                     || !virtualProvider.hasNodeReferences(refsId)) {
                 // get or create the references instance
@@ -947,15 +946,15 @@
                     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);
+            NodeReferencesId refsId = new NodeReferencesId(target);
             if (virtualProvider == null
                     || !virtualProvider.hasNodeReferences(refsId)) {
                 // either get node references from change log or load from

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/XAItemStateManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/XAItemStateManager.java?rev=792485&r1=792484&r2=792485&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/XAItemStateManager.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/XAItemStateManager.java Thu Jul  9 10:27:28 2009
@@ -30,6 +30,7 @@
 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.NodeReferencesId;
 import org.apache.jackrabbit.core.id.PropertyId;
 import org.apache.jackrabbit.core.observation.EventStateCollectionFactory;
@@ -377,14 +378,14 @@
         // apply changes from change log
         ChangeLog changes = getChangeLog();
         if (changes != null) {
-            UUID uuid = id.getTargetId().getUUID();
+            NodeId target = id.getTargetId();
             // check removed reference properties
             for (Iterator it = filterReferenceProperties(changes.deletedStates());
                  it.hasNext(); ) {
                 PropertyState prop = (PropertyState) it.next();
                 InternalValue[] values = prop.getValues();
                 for (int i = 0; i < values.length; i++) {
-                    if (values[i].getUUID().equals(uuid)) {
+                    if (values[i].getNodeId().equals(target)) {
                         refs.removeReference(prop.getPropertyId());
                         break;
                     }
@@ -396,7 +397,7 @@
                 PropertyState prop = (PropertyState) it.next();
                 InternalValue[] values = prop.getValues();
                 for (int i = 0; i < values.length; i++) {
-                    if (values[i].getUUID().equals(uuid)) {
+                    if (values[i].getNodeId().equals(target)) {
                         refs.addReference(prop.getPropertyId());
                         break;
                     }
@@ -414,7 +415,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(target)) {
                                 refs.removeReference(old.getPropertyId());
                                 break;
                             }
@@ -429,7 +430,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(target)) {
                             refs.addReference(prop.getPropertyId());
                             break;
                         }
@@ -476,10 +477,9 @@
                 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(),
+                                new NodeReferencesId(vals[i].getNodeId()));
                     }
                 }
             }
@@ -493,19 +493,17 @@
                 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(),
+                                new NodeReferencesId(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(),
+                                new NodeReferencesId(vals[i].getNodeId()));
                     }
                 }
             }
@@ -517,10 +515,9 @@
                 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(),
+                                new NodeReferencesId(vals[i].getNodeId()));
                     }
                 }
             }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/value/InternalValue.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/value/InternalValue.java?rev=792485&r1=792484&r2=792485&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/value/InternalValue.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/value/InternalValue.java Thu Jul  9 10:27:28 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/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/value/InternalValueFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/value/InternalValueFactory.java?rev=792485&r1=792484&r2=792485&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/value/InternalValueFactory.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/value/InternalValueFactory.java Thu Jul  9 10:27:28 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/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/AbstractVersionManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/AbstractVersionManager.java?rev=792485&r1=792484&r2=792485&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/AbstractVersionManager.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/AbstractVersionManager.java Thu Jul  9 10:27:28 2009
@@ -546,7 +546,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/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalActivityImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalActivityImpl.java?rev=792485&r1=792484&r2=792485&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalActivityImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalActivityImpl.java Thu Jul  9 10:27:28 2009
@@ -30,7 +30,6 @@
 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/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenNode.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenNode.java?rev=792485&r1=792484&r2=792485&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenNode.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenNode.java Thu Jul  9 10:27:28 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/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenNodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenNodeImpl.java?rev=792485&r1=792484&r2=792485&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenNodeImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenNodeImpl.java Thu Jul  9 10:27:28 2009
@@ -25,7 +25,6 @@
 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;
@@ -72,9 +71,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
@@ -117,9 +116,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
@@ -195,9 +194,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 +220,7 @@
     /**
      * {@inheritDoc}
      */
-    public UUID getFrozenUUID() {
+    public NodeId getFrozenId() {
         return frozenUUID;
     }
 
@@ -281,7 +279,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 +333,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/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenVHImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenVHImpl.java?rev=792485&r1=792484&r2=792485&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenVHImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenVHImpl.java Thu Jul  9 10:27:28 2009
@@ -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/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionHistoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionHistoryImpl.java?rev=792485&r1=792484&r2=792485&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionHistoryImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionHistoryImpl.java Thu Jul  9 10:27:28 2009
@@ -140,12 +140,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);
                     }
                 }
             }
@@ -462,7 +461,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,26 +499,27 @@
             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());
@@ -583,7 +584,7 @@
 
         // 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
@@ -603,10 +604,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/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionImpl.java?rev=792485&r1=792484&r2=792485&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionImpl.java Thu Jul  9 10:27:28 2009
@@ -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;
         }
@@ -264,7 +261,7 @@
         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/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManagerImpl.java?rev=792485&r1=792484&r2=792485&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManagerImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManagerImpl.java Thu Jul  9 10:27:28 2009
@@ -485,7 +485,7 @@
             return null;
         } else {
             return (Version)
-                    ((SessionImpl) history.getSession()).getNodeByUUID(v.getId().getUUID());
+                    ((SessionImpl) history.getSession()).getNodeById(v.getId());
         }
     }
 

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/SessionImporter.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/SessionImporter.java?rev=792485&r1=792484&r2=792485&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/SessionImporter.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/SessionImporter.java Thu Jul  9 10:27:28 2009
@@ -90,8 +90,7 @@
         NodeImpl node;
 
         // add node
-        UUID uuid = (id == null) ? null : id.getUUID();
-        node = parent.addNode(nodeName, nodeTypeName, uuid);
+        node = parent.addNode(nodeName, nodeTypeName, id);
         // add mixins
         if (mixinNames != null) {
             for (int i = 0; i < mixinNames.length; i++) {
@@ -294,7 +293,7 @@
                     NodeId adjusted = refTracker.getMappedId(original);
                     if (adjusted != null) {
                         newVals[i] = session.getValueFactory().createValue(
-                                session.getNodeByUUID(adjusted.getUUID()),
+                                session.getNodeById(adjusted),
                                 prop.getType() != PropertyType.REFERENCE);
                     } else {
                         // reference doesn't need adjusting, just copy old value

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/WorkspaceImporter.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/WorkspaceImporter.java?rev=792485&r1=792484&r2=792485&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/WorkspaceImporter.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/WorkspaceImporter.java Thu Jul  9 10:27:28 2009
@@ -316,9 +316,9 @@
             VersionHistoryInfo history =
                 versionManager.getVersionHistory(session, node, null);
             InternalValue historyId = InternalValue.create(
-                    history.getVersionHistoryId().getUUID());
+                    history.getVersionHistoryId());
             InternalValue versionId = InternalValue.create(
-                    history.getRootVersionId().getUUID());
+                    history.getRootVersionId());
 
             // jcr:isCheckedOut
             conditionalAddProperty(
@@ -605,17 +605,16 @@
                 InternalValue[] values = prop.getValues();
                 InternalValue[] newVals = new InternalValue[values.length];
                 for (int i = 0; i < values.length; i++) {
-                    InternalValue val = values[i];
-                    NodeId original = new NodeId(val.getUUID());
-                    NodeId adjusted = refTracker.getMappedId(original);
+                    NodeId adjusted =
+                        refTracker.getMappedId(values[i].getNodeId());
                     if (adjusted != null) {
                         newVals[i] = InternalValue.create(
-                                adjusted.getUUID(),
+                                adjusted,
                                 prop.getType() != PropertyType.REFERENCE);
                         modified = true;
                     } else {
                         // reference doesn't need adjusting, just copy old value
-                        newVals[i] = val;
+                        newVals[i] = values[i];
                     }
                 }
                 if (modified) {



Mime
View raw message