jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tri...@apache.org
Subject svn commit: r378221 [6/7] - in /incubator/jackrabbit/trunk: contrib/ contrib/bdb-persistence/ contrib/bdb-persistence/src/java/org/apache/jackrabbit/core/state/bdb/ contrib/jca/ contrib/jcr-server/ contrib/jcrtaglib/ contrib/nt-ns-util/ contrib/orm-per...
Date Thu, 16 Feb 2006 10:48:29 GMT
Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/InternalVersionHistory.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/InternalVersionHistory.java?rev=378221&r1=378220&r2=378221&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/InternalVersionHistory.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/InternalVersionHistory.java Thu Feb 16 02:48:20 2006
@@ -17,6 +17,8 @@
 package org.apache.jackrabbit.core.version;
 
 import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.core.NodeId;
+import org.apache.jackrabbit.uuid.UUID;
 
 import javax.jcr.version.VersionException;
 import java.util.Iterator;
@@ -52,20 +54,20 @@
     /**
      * Checks if the version for the given uuid exists in this history.
      *
-     * @param uuid the uuid of the version
+     * @param id the id of the version
      * @return <code>true</code> if the version exists;
      *         <code>false</code> otherwise.
      */
-    boolean hasVersion(String uuid);
+    boolean hasVersion(NodeId id);
 
     /**
      * Returns the version with the given uuid or <code>null</code> if the
      * respective version does not exist.
      *
-     * @param uuid the uuid of the version
+     * @param id the id of the version
      * @return the internal version ot <code>null</code>
      */
-    InternalVersion getVersion(String uuid);
+    InternalVersion getVersion(NodeId id);
 
     /**
      * Equivalalent to {@link javax.jcr.version.VersionHistory#getVersionByLabel(java.lang.String)}
@@ -95,20 +97,20 @@
      *
      * @return the UUID of the versionable node.
      */
-    String getVersionableUUID();
+    UUID getVersionableUUID();
 
     /**
      * Returns a string  iterator over all version labels that exist in this
      * version history
      *
-     * @return
+     * @return the labels
      */
     QName[] getVersionLabels();
 
     /**
-     * Returns the UUID of the version labels node
+     * Returns the Id of the version labels node.
      *
-     * @return
+     * @return the id of the version labels node.
      */
-    String getVersionLabelsUUID();
+    NodeId getVersionLabelsId();
 }

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/InternalVersionHistoryImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/InternalVersionHistoryImpl.java?rev=378221&r1=378220&r2=378221&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/InternalVersionHistoryImpl.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/InternalVersionHistoryImpl.java Thu Feb 16 02:48:20 2006
@@ -17,6 +17,7 @@
 package org.apache.jackrabbit.core.version;
 
 import org.apache.jackrabbit.core.NodeImpl;
+import org.apache.jackrabbit.core.NodeId;
 import org.apache.jackrabbit.core.state.ItemStateException;
 import org.apache.jackrabbit.core.state.NodeState;
 import org.apache.jackrabbit.core.state.PropertyState;
@@ -61,7 +62,7 @@
 
     /**
      * the hashmap of all versions
-     * key = versionId (String)
+     * key = versionId (NodeId)
      * value = version
      */
     private HashMap versionCache = new HashMap();
@@ -84,12 +85,12 @@
     /**
      * the id of this history
      */
-    private String historyId;
+    private NodeId historyId;
 
     /**
-     * the if of the versionable node
+     * the id of the versionable node
      */
-    private String versionableId;
+    private NodeId versionableId;
 
     /**
      * Creates a new VersionHistory object for the given node state.
@@ -111,10 +112,10 @@
         labelCache.clear();
 
         // get id
-        historyId = node.getUUID();
+        historyId = node.getNodeId();
 
         // get versionable id
-        versionableId = (String) node.getPropertyValue(QName.JCR_VERSIONABLEUUID).internalValue();
+        versionableId = NodeId.valueOf(node.getPropertyValue(QName.JCR_VERSIONABLEUUID).toString());
 
         // get entries
         NodeStateEx[] children = node.getChildNodes();
@@ -147,7 +148,7 @@
                 if (pState.getType() == PropertyType.REFERENCE) {
                     QName name = pState.getName();
                     UUID ref = (UUID) pState.getValues()[0].internalValue();
-                    InternalVersionImpl v = (InternalVersionImpl) getVersion(ref.toString());
+                    InternalVersionImpl v = (InternalVersionImpl) getVersion(new NodeId(ref));
                     labelCache.put(name, v);
                     v.internalAddLabel(name);
                 }
@@ -179,7 +180,7 @@
      * out when refreshing this history.
      */
     InternalVersionImpl createVersionInstance(NodeStateEx child) {
-        InternalVersionImpl v = (InternalVersionImpl) tempVersionCache.remove(child.getUUID());
+        InternalVersionImpl v = (InternalVersionImpl) tempVersionCache.remove(child.getNodeId());
         if (v != null) {
             v.clear();
         }
@@ -192,7 +193,7 @@
     /**
      * {@inheritDoc}
      */
-    public String getId() {
+    public NodeId getId() {
         return historyId;
     }
 
@@ -243,15 +244,15 @@
     /**
      * {@inheritDoc}
      */
-    public boolean hasVersion(String uuid) {
-        return versionCache.containsKey(uuid);
+    public boolean hasVersion(NodeId id) {
+        return versionCache.containsKey(id);
     }
 
     /**
      * {@inheritDoc}
      */
-    public InternalVersion getVersion(String uuid) {
-        return (InternalVersion) versionCache.get(uuid);
+    public InternalVersion getVersion(NodeId id) {
+        return (InternalVersion) versionCache.get(id);
     }
 
     /**
@@ -278,8 +279,8 @@
     /**
      * {@inheritDoc}
      */
-    public String getVersionableUUID() {
-        return versionableId;
+    public UUID getVersionableUUID() {
+        return versionableId.getUUID();
     }
 
     /**
@@ -292,8 +293,8 @@
     /**
      * {@inheritDoc}
      */
-    public String getVersionLabelsUUID() {
-        return labelNode.getUUID();
+    public NodeId getVersionLabelsId() {
+        return labelNode.getNodeId();
     }
 
     /**
@@ -383,7 +384,7 @@
             if (version == null) {
                 labelNode.removeProperty(label);
             } else {
-                labelNode.setPropertyValue(label, InternalValue.create(new UUID(version.getId())));
+                labelNode.setPropertyValue(label, InternalValue.create(version.getId().getUUID()));
             }
             labelNode.store();
         } catch (RepositoryException e) {
@@ -418,15 +419,15 @@
         Value[] preds = src.getProperty(QName.JCR_PREDECESSORS).getValues();
         InternalValue[] predecessors = new InternalValue[preds.length];
         for (int i = 0; i < preds.length; i++) {
-            String predId = preds[i].getString();
+            UUID predId = UUID.fromString(preds[i].getString());
             // check if version exist
-            if (!versionCache.containsKey(predId)) {
+            if (!versionCache.containsKey(new NodeId(predId))) {
                 throw new RepositoryException("invalid predecessor in source node");
             }
-            predecessors[i] = InternalValue.create(new UUID(predId));
+            predecessors[i] = InternalValue.create(predId);
         }
 
-        String versionId = UUID.randomUUID().toString();
+        NodeId versionId = new NodeId(UUID.randomUUID());
         NodeStateEx vNode = node.addNode(name, QName.NT_VERSION, versionId, true);
 
         // initialize 'created' and 'predecessors'
@@ -464,7 +465,7 @@
      */
     static InternalVersionHistoryImpl create(AbstractVersionManager vMgr,
                                              NodeStateEx parent,
-                                             String historyId, QName name,
+                                             NodeId historyId, QName name,
                                              NodeState nodeState)
             throws RepositoryException {
 
@@ -472,14 +473,14 @@
         NodeStateEx pNode = parent.addNode(name, QName.NT_VERSIONHISTORY, historyId, true);
 
         // set the versionable uuid
-        pNode.setPropertyValue(QName.JCR_VERSIONABLEUUID, InternalValue.create(nodeState.getUUID()));
+        String versionableUUID = nodeState.getNodeId().getUUID().toString();
+        pNode.setPropertyValue(QName.JCR_VERSIONABLEUUID, InternalValue.create(versionableUUID));
 
         // create label node
         pNode.addNode(QName.JCR_VERSIONLABELS, QName.NT_VERSIONLABELS, null, false);
 
         // create root version
-        String versionId = UUID.randomUUID().toString();
-
+        NodeId versionId = new NodeId(UUID.randomUUID());
         NodeStateEx vNode = pNode.addNode(QName.JCR_ROOTVERSION, QName.NT_VERSION, versionId, true);
 
         // initialize 'created' and 'predecessors'
@@ -491,7 +492,7 @@
         NodeStateEx node = vNode.addNode(QName.JCR_FROZENNODE, QName.NT_FROZENNODE, null, true);
 
         // initialize the internal properties
-        node.setPropertyValue(QName.JCR_FROZENUUID, InternalValue.create(nodeState.getUUID()));
+        node.setPropertyValue(QName.JCR_FROZENUUID, InternalValue.create(versionableUUID));
         node.setPropertyValue(QName.JCR_FROZENPRIMARYTYPE,
                 InternalValue.create(nodeState.getNodeTypeName()));
 

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/InternalVersionImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/InternalVersionImpl.java?rev=378221&r1=378220&r2=378221&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/InternalVersionImpl.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/InternalVersionImpl.java Thu Feb 16 02:48:20 2006
@@ -18,6 +18,7 @@
 
 import org.apache.jackrabbit.core.state.NodeState;
 import org.apache.jackrabbit.core.value.InternalValue;
+import org.apache.jackrabbit.core.NodeId;
 import org.apache.jackrabbit.name.QName;
 import org.apache.jackrabbit.uuid.UUID;
 
@@ -98,8 +99,8 @@
     /**
      * {@inheritDoc}
      */
-    public String getId() {
-        return node.getUUID();
+    public NodeId getId() {
+        return node.getNodeId();
     }
 
     /**
@@ -126,7 +127,7 @@
             if (entry == null) {
                 throw new InternalError("version has no frozen node: " + getId());
             }
-            return (InternalFrozenNode) vMgr.getItem(entry.getUUID());
+            return (InternalFrozenNode) vMgr.getItem(entry.getId());
         } catch (RepositoryException e) {
             throw new IllegalStateException("unable to retrieve frozen node: " + e);
         }
@@ -202,7 +203,8 @@
         InternalValue[] values = node.getPropertyValues(QName.JCR_PREDECESSORS);
         if (values != null) {
             for (int i = 0; i < values.length; i++) {
-                InternalVersionImpl v = (InternalVersionImpl) versionHistory.getVersion(values[i].internalValue().toString());
+                NodeId vId = new NodeId((UUID) values[i].internalValue());
+                InternalVersionImpl v = (InternalVersionImpl) versionHistory.getVersion(vId);
                 predecessors.add(v);
                 v.addSuccessor(this);
             }
@@ -235,7 +237,8 @@
     private void storePredecessors() throws RepositoryException {
         InternalValue[] values = new InternalValue[predecessors.size()];
         for (int i = 0; i < values.length; i++) {
-            values[i] = InternalValue.create(new UUID(((InternalVersion) predecessors.get(i)).getId()));
+            values[i] = InternalValue.create(
+                    ((InternalVersion) predecessors.get(i)).getId().getUUID());
         }
         node.setPropertyValues(QName.JCR_PREDECESSORS, PropertyType.STRING, values);
     }
@@ -308,7 +311,7 @@
      * adds a label to the label cache. does not affect storage
      *
      * @param label
-     * @return
+     * @return <code>true</code> if the label was added
      */
     boolean internalAddLabel(QName label) {
         if (labelCache == null) {
@@ -321,7 +324,7 @@
      * removes a label from the label cache. does not affect storage
      *
      * @param label
-     * @return
+     * @return <code>true</code> if the label was removed
      */
     boolean internalRemoveLabel(QName label) {
         if (labelCache == null) {
@@ -335,7 +338,7 @@
      * checks, if a label is in the label cache
      *
      * @param label
-     * @return
+     * @return <code>true</code> if the label exists
      */
     boolean internalHasLabel(QName label) {
         if (labelCache == null) {
@@ -348,7 +351,7 @@
     /**
      * returns the array of the cached labels
      *
-     * @return
+     * @return the internal labels
      */
     QName[] internalGetLabels() {
         if (labelCache == null) {

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/InternalVersionItem.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/InternalVersionItem.java?rev=378221&r1=378220&r2=378221&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/InternalVersionItem.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/InternalVersionItem.java Thu Feb 16 02:48:20 2006
@@ -16,6 +16,8 @@
  */
 package org.apache.jackrabbit.core.version;
 
+import org.apache.jackrabbit.core.NodeId;
+
 /**
  * This interface defines the base for all internal versioning items. Internal
  * versioning items are decoupled from their external form as exposed to the
@@ -25,16 +27,16 @@
 public interface InternalVersionItem {
 
     /**
-     * Returns the external id of this item
+     * Returns the id of this item.
      *
-     * @return
+     * @return the id of this item.
      */
-    String getId();
+    NodeId getId();
 
     /**
-     * returns the parent version item or null
+     * returns the parent version item or <code>null</code>.
      *
-     * @return
+     * @return the parent version item.
      */
     InternalVersionItem getParent();
 

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/InternalVersionItemImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/InternalVersionItemImpl.java?rev=378221&r1=378220&r2=378221&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/InternalVersionItemImpl.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/InternalVersionItemImpl.java Thu Feb 16 02:48:20 2006
@@ -16,6 +16,8 @@
  */
 package org.apache.jackrabbit.core.version;
 
+import org.apache.jackrabbit.core.NodeId;
+
 /**
  * Implements a <code>InternalVersionItem</code>.
  */
@@ -38,23 +40,23 @@
     /**
      * Returns the persistent version manager for this item
      *
-     * @return
+     * @return the version manager.
      */
     protected AbstractVersionManager getVersionManager() {
         return vMgr;
     }
 
     /**
-     * Returns the external id of this item
+     * Returns the id of this item
      *
-     * @return
+     * @return the id of this item.
      */
-    public abstract String getId();
+    public abstract NodeId getId();
 
     /**
-     * returns the parent version item or null
+     * returns the parent version item or <code>null</code>.
      *
-     * @return
+     * @return the parent version item or <code>null</code>.
      */
     public abstract InternalVersionItem getParent();
 

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/NodeStateEx.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/NodeStateEx.java?rev=378221&r1=378220&r2=378221&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/NodeStateEx.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/NodeStateEx.java Thu Feb 16 02:48:20 2006
@@ -85,14 +85,14 @@
     /**
      * returns the name of this node
      *
-     * @return
+     * @return the name of this node
      */
     public QName getName() {
         if (name == null) {
             try {
-                String parentId = nodeState.getParentUUID();
-                NodeState parent = (NodeState) stateMgr.getItemState(new NodeId(parentId));
-                name = parent.getChildNodeEntry(nodeState.getUUID()).getName();
+                NodeId parentId = nodeState.getParentId();
+                NodeState parent = (NodeState) stateMgr.getItemState(parentId);
+                name = parent.getChildNodeEntry(nodeState.getNodeId()).getName();
             } catch (ItemStateException e) {
                 // should never occurr
                 throw new IllegalStateException(e.toString());
@@ -102,26 +102,26 @@
     }
 
     /**
-     * Returns the uuid of this node
+     * Returns the id of this node.
      *
-     * @return
+     * @return the id of this node.
      */
-    public String getUUID() {
-        return nodeState.getUUID();
+    public NodeId getNodeId() {
+        return nodeState.getNodeId();
     }
 
     /**
-     * Returns the parent uuid of this node
+     * Returns the parent id of this node
      *
-     * @return
+     * @return the parent id of this node
      */
-    public String getParentUUID() {
-        return nodeState.getParentUUID();
+    public NodeId getParentId() {
+        return nodeState.getParentId();
     }
 
     /**
-     * Returns the node state wrpaee
-     * @return
+     * Returns the underlaying node state.
+     * @return the underlaying node state.
      */
     public NodeState getState() {
         return nodeState;
@@ -130,7 +130,7 @@
     /**
      * Returns the properties of this node
      *
-     * @return
+     * @return the properties of this node
      */
     public PropertyState[] getProperties() throws ItemStateException {
         Set set = nodeState.getPropertyNames();
@@ -138,7 +138,7 @@
         int i = 0;
         for (Iterator iter = set.iterator(); iter.hasNext();) {
             QName propName = (QName) iter.next();
-            PropertyId propId = new PropertyId(nodeState.getUUID(), propName);
+            PropertyId propId = new PropertyId(nodeState.getNodeId(), propName);
             props[i++] = (PropertyState) stateMgr.getItemState(propId);
         }
         return props;
@@ -148,10 +148,10 @@
      * Checks if the given property exists
      *
      * @param name
-     * @return
+     * @return <code>true</code> if the given property exists.
      */
     public boolean hasProperty(QName name) {
-        PropertyId propId = new PropertyId(nodeState.getUUID(), name);
+        PropertyId propId = new PropertyId(nodeState.getNodeId(), name);
         return stateMgr.hasItemState(propId);
     }
 
@@ -159,10 +159,10 @@
      * Returns the values of the given property of <code>null</code>
      *
      * @param name
-     * @return
+     * @return the values of the given property.
      */
     public InternalValue[] getPropertyValues(QName name) {
-        PropertyId propId = new PropertyId(nodeState.getUUID(), name);
+        PropertyId propId = new PropertyId(nodeState.getNodeId(), name);
         try {
             PropertyState ps = (PropertyState) stateMgr.getItemState(propId);
             return ps.getValues();
@@ -175,10 +175,10 @@
      * Returns the value of the given property or <code>null</code>
      *
      * @param name
-     * @return
+     * @return the value of the given property.
      */
     public InternalValue getPropertyValue(QName name) {
-        PropertyId propId = new PropertyId(nodeState.getUUID(), name);
+        PropertyId propId = new PropertyId(nodeState.getNodeId(), name);
         try {
             PropertyState ps = (PropertyState) stateMgr.getItemState(propId);
             return ps.getValues()[0];
@@ -234,13 +234,13 @@
      * @param name
      * @param type
      * @param multiValued
-     * @return
+     * @return the property state
      * @throws RepositoryException
      */
     private PropertyState getOrCreatePropertyState(QName name, int type, boolean multiValued)
             throws RepositoryException {
 
-        PropertyId propId = new PropertyId(nodeState.getUUID(), name);
+        PropertyId propId = new PropertyId(nodeState.getNodeId(), name);
         if (stateMgr.hasItemState(propId)) {
             try {
                 PropertyState propState = (PropertyState) stateMgr.getItemState(propId);
@@ -257,7 +257,7 @@
                 throw new RepositoryException("Unable to create property: " + e.toString());
             }
         } else {
-            PropertyState propState = stateMgr.createNew(name, nodeState.getUUID());
+            PropertyState propState = stateMgr.createNew(name, nodeState.getNodeId());
             propState.setType(type);
             propState.setMultiValued(multiValued);
 
@@ -290,7 +290,7 @@
         try {
             return ntReg.getEffectiveNodeType((QName[]) set.toArray(new QName[set.size()]));
         } catch (NodeTypeConflictException ntce) {
-            String msg = "internal error: failed to build effective node type for node " + nodeState.getUUID();
+            String msg = "internal error: failed to build effective node type for node " + nodeState.getNodeId();
             throw new RepositoryException(msg, ntce);
         }
     }
@@ -301,7 +301,7 @@
      * checks if the given child node exists.
      *
      * @param name
-     * @return
+     * @return <code>true</code> if the given child exists.
      */
     public boolean hasNode(QName name) {
         return nodeState.hasChildNodeEntry(name);
@@ -311,7 +311,7 @@
      * removes the (first) child node with the given name.
      *
      * @param name
-     * @return
+     * @return <code>true</code> if the child was removed
      * @throws RepositoryException
      */
     public boolean removeNode(QName name) throws RepositoryException {
@@ -323,7 +323,7 @@
      *
      * @param name
      * @param index
-     * @return
+     * @return <code>true</code> if the child was removed.
      * @throws RepositoryException
      */
     public boolean removeNode(QName name, int index) throws RepositoryException {
@@ -332,7 +332,7 @@
             if (entry == null) {
                 return false;
             } else {
-                ItemState state = stateMgr.getItemState(new NodeId(entry.getUUID()));
+                ItemState state = stateMgr.getItemState(entry.getId());
                 stateMgr.destroy(state);
                 nodeState.removeChildNodeEntry(name, index);
                 nodeState.setStatus(ItemState.STATUS_EXISTING_MODIFIED);
@@ -347,7 +347,7 @@
      * removes the property with the given name
      *
      * @param name
-     * @return
+     * @return <code>true</code> if the property was removed.
      * @throws RepositoryException
      */
     public boolean removeProperty(QName name) throws RepositoryException {
@@ -355,7 +355,7 @@
             if (!nodeState.hasPropertyName(name)) {
                 return false;
             } else {
-                PropertyId propId = new PropertyId(nodeState.getUUID(), name);
+                PropertyId propId = new PropertyId(nodeState.getNodeId(), name);
                 ItemState state = stateMgr.getItemState(propId);
                 stateMgr.destroy(state);
                 nodeState.removePropertyName(name);
@@ -373,7 +373,7 @@
      *
      * @param name
      * @param index
-     * @return
+     * @return the node state.
      * @throws RepositoryException
      */
     public NodeStateEx getNode(QName name, int index) throws RepositoryException {
@@ -382,7 +382,7 @@
             return null;
         }
         try {
-            NodeState state = (NodeState) stateMgr.getItemState(new NodeId(entry.getUUID()));
+            NodeState state = (NodeState) stateMgr.getItemState(entry.getId());
             return new NodeStateEx(stateMgr, ntReg, state, name);
         } catch (ItemStateException e) {
             throw new RepositoryException("Unable to getNode: " + e.toString());
@@ -394,18 +394,18 @@
      *
      * @param nodeName
      * @param nodeTypeName
-     * @return
+     * @return the node state
      * @throws NoSuchNodeTypeException
      * @throws ConstraintViolationException
      * @throws RepositoryException
      */
     public NodeStateEx addNode(QName nodeName, QName nodeTypeName,
-                                  String uuid, boolean referenceable)
+                               NodeId id, boolean referenceable)
             throws NoSuchNodeTypeException, ConstraintViolationException, RepositoryException {
 
-        NodeStateEx node = createChildNode(nodeName, nodeTypeName, uuid);
+        NodeStateEx node = createChildNode(nodeName, nodeTypeName, id);
         if (referenceable) {
-            node.setPropertyValue(QName.JCR_UUID, InternalValue.create(node.getUUID()));
+            node.setPropertyValue(QName.JCR_UUID, InternalValue.create(node.getNodeId().getUUID().toString()));
         }
         return node;
     }
@@ -414,17 +414,17 @@
      * creates a new child node
      *
      * @param name
-     * @param uuid
-     * @return
+     * @param id
+     * @return the newly created node.
      */
-    private NodeStateEx createChildNode(QName name, QName nodeTypeName, String uuid)
+    private NodeStateEx createChildNode(QName name, QName nodeTypeName, NodeId id)
             throws RepositoryException {
-        String parentUUID = nodeState.getUUID();
+        NodeId parentId = nodeState.getNodeId();
         // create a new node state
-        if (uuid == null) {
-            uuid = UUID.randomUUID().toString();    // version 4 uuid
+        if (id == null) {
+            id = new NodeId(UUID.randomUUID());
         }
-        NodeState state = stateMgr.createNew(uuid, nodeTypeName, parentUUID);
+        NodeState state = stateMgr.createNew(id, nodeTypeName, parentId);
 
         NodeDef cnd = getEffectiveNodeType().getApplicableChildNodeDef(name, nodeTypeName);
         state.setDefinitionId(cnd.getId());
@@ -434,7 +434,7 @@
         node.setPropertyValue(QName.JCR_PRIMARYTYPE, InternalValue.create(nodeTypeName));
 
         // add new child node entryn
-        nodeState.addChildNodeEntry(name, state.getUUID());
+        nodeState.addChildNodeEntry(name, id);
         if (nodeState.getStatus() == ItemState.STATUS_EXISTING) {
             nodeState.setStatus(ItemState.STATUS_EXISTING_MODIFIED);
         }
@@ -444,7 +444,7 @@
     /**
      * returns all child nodes
      *
-     * @return
+     * @return the child nodes.
      * @throws RepositoryException
      */
     public NodeStateEx[] getChildNodes() throws RepositoryException {
@@ -453,7 +453,7 @@
             NodeStateEx[] children = new NodeStateEx[entries.size()];
             for (int i = 0; i < entries.size(); i++) {
                 NodeState.ChildNodeEntry entry = (NodeState.ChildNodeEntry) entries.get(i);
-                NodeState state = (NodeState) stateMgr.getItemState(new NodeId(entry.getUUID()));
+                NodeState state = (NodeState) stateMgr.getItemState(entry.getId());
                 children[i] = new NodeStateEx(stateMgr, ntReg, state, entry.getName());
             }
             return children;
@@ -489,7 +489,8 @@
             Set props = state.getPropertyNames();
             for (Iterator iter = props.iterator(); iter.hasNext();) {
                 QName propName = (QName) iter.next();
-                PropertyState pstate = (PropertyState) stateMgr.getItemState(new PropertyId(state.getUUID(), propName));
+                PropertyState pstate = (PropertyState) stateMgr.getItemState(
+                        new PropertyId(state.getNodeId(), propName));
                 if (pstate.getStatus() != ItemState.STATUS_EXISTING) {
                     stateMgr.store(pstate);
                 }
@@ -498,7 +499,7 @@
             List nodes = state.getChildNodeEntries();
             for (int i = 0; i < nodes.size(); i++) {
                 NodeState.ChildNodeEntry entry = (NodeState.ChildNodeEntry) nodes.get(i);
-                NodeState nstate = (NodeState) stateMgr.getItemState(new NodeId(entry.getUUID()));
+                NodeState nstate = (NodeState) stateMgr.getItemState(entry.getId());
                 store(nstate);
             }
             // and store itself
@@ -515,7 +516,7 @@
         try {
             reload(nodeState);
             // refetch nodestate if discarded
-            nodeState = (NodeState) stateMgr.getItemState(nodeState.getId());
+            nodeState = (NodeState) stateMgr.getItemState(nodeState.getNodeId());
         } catch (ItemStateException e) {
             throw new RepositoryException(e);
         }
@@ -533,7 +534,8 @@
             Set props = state.getPropertyNames();
             for (Iterator iter = props.iterator(); iter.hasNext();) {
                 QName propName = (QName) iter.next();
-                PropertyState pstate = (PropertyState) stateMgr.getItemState(new PropertyId(state.getUUID(), propName));
+                PropertyState pstate = (PropertyState) stateMgr.getItemState(
+                        new PropertyId(state.getNodeId(), propName));
                 if (pstate.getStatus() != ItemState.STATUS_EXISTING) {
                     pstate.discard();
                 }
@@ -542,7 +544,7 @@
             List nodes = state.getChildNodeEntries();
             for (int i = 0; i < nodes.size(); i++) {
                 NodeState.ChildNodeEntry entry = (NodeState.ChildNodeEntry) nodes.get(i);
-                NodeState nstate = (NodeState) stateMgr.getItemState(new NodeId(entry.getUUID()));
+                NodeState nstate = (NodeState) stateMgr.getItemState(entry.getId());
                 reload(nstate);
             }
             // and reload itself

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/VersionImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/VersionImpl.java?rev=378221&r1=378220&r2=378221&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/VersionImpl.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/VersionImpl.java Thu Feb 16 02:48:20 2006
@@ -56,7 +56,7 @@
     /**
      * Returns the internal version
      *
-     * @return
+     * @return the internal version
      */
     protected InternalVersion getInternalVersion() {
         return version;

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/VersionItemStateProvider.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/VersionItemStateProvider.java?rev=378221&r1=378220&r2=378221&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/VersionItemStateProvider.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/VersionItemStateProvider.java Thu Feb 16 02:48:20 2006
@@ -22,18 +22,17 @@
 import org.apache.jackrabbit.core.PropertyId;
 import org.apache.jackrabbit.core.state.ItemState;
 import org.apache.jackrabbit.core.state.ItemStateException;
+import org.apache.jackrabbit.core.state.ItemStateListener;
 import org.apache.jackrabbit.core.state.NoSuchItemStateException;
 import org.apache.jackrabbit.core.state.NodeReferences;
 import org.apache.jackrabbit.core.state.NodeReferencesId;
 import org.apache.jackrabbit.core.state.PropertyState;
 import org.apache.jackrabbit.core.state.SharedItemStateManager;
-import org.apache.jackrabbit.core.state.ItemStateListener;
 import org.apache.jackrabbit.core.value.InternalValue;
 import org.apache.jackrabbit.core.virtual.VirtualItemStateProvider;
 import org.apache.jackrabbit.core.virtual.VirtualNodeState;
 import org.apache.jackrabbit.core.virtual.VirtualPropertyState;
 import org.apache.jackrabbit.name.QName;
-import org.apache.jackrabbit.uuid.UUID;
 import org.apache.log4j.Logger;
 
 import javax.jcr.RepositoryException;
@@ -106,7 +105,7 @@
      * @inheritDoc
      */
     public VirtualNodeState createNodeState(VirtualNodeState parent, QName name,
-                                            String uuid, QName nodeTypeName)
+                                            NodeId id, QName nodeTypeName)
             throws RepositoryException {
         throw new IllegalStateException("VersionManager should never create a VirtualNodeState");
     }
@@ -129,12 +128,12 @@
                 PropertyState prop = (PropertyState) item;
                 if (prop.getName().equals(QName.JCR_SUCCESSORS)) {
                     try {
-                        InternalVersion v = vMgr.getVersion(prop.getParentUUID());
+                        InternalVersion v = vMgr.getVersion(prop.getParentId());
                         if (v != null) {
                             InternalVersion[] succs = v.getSuccessors();
                             InternalValue[] succV = new InternalValue[succs.length];
                             for (int i = 0; i < succs.length; i++) {
-                                succV[i] = InternalValue.create(new UUID(succs[i].getId()));
+                                succV[i] = InternalValue.create(succs[i].getId().getUUID());
                             }
                             prop.setValues(succV);
                         }
@@ -162,7 +161,7 @@
 
     /**
      * @inheritDoc
-     */ 
+     */
     public boolean setNodeReferences(NodeReferences refs) {
         return vMgr.setNodeReferences(refs);
     }

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/VersionIteratorImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/VersionIteratorImpl.java?rev=378221&r1=378220&r2=378221&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/VersionIteratorImpl.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/VersionIteratorImpl.java Thu Feb 16 02:48:20 2006
@@ -16,6 +16,9 @@
  */
 package org.apache.jackrabbit.core.version;
 
+import org.apache.jackrabbit.core.NodeId;
+import org.apache.jackrabbit.core.SessionImpl;
+
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 import javax.jcr.version.Version;
@@ -46,7 +49,7 @@
     /**
      * the session for wrapping the versions
      */
-    private final Session session;
+    private final SessionImpl session;
 
     /**
      * Creates a new VersionIterator that iterates over the version tree,
@@ -55,7 +58,7 @@
      * @param rootVersion
      */
     public VersionIteratorImpl(Session session, InternalVersion rootVersion) {
-        this.session = session;
+        this.session = (SessionImpl) session;
 
         addVersion(rootVersion);
     }
@@ -67,11 +70,11 @@
         if (versions.isEmpty()) {
             throw new NoSuchElementException();
         }
-        String id = (String) versions.removeFirst();
+        NodeId id = (NodeId) versions.removeFirst();
         pos++;
 
         try {
-            return (Version) session.getNodeByUUID(id);
+            return (Version) session.getNodeById(id);
         } catch (RepositoryException e) {
             throw new ConcurrentModificationException("Unable to provide element: " + e.toString());
         }
@@ -130,7 +133,7 @@
      * @param v
      */
     private synchronized void addVersion(InternalVersion v) {
-        String id = v.getId();
+        NodeId id = v.getId();
         if (!versions.contains(id)) {
             versions.add(id);
             InternalVersion[] vs = v.getSuccessors();

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/VersionManager.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/VersionManager.java?rev=378221&r1=378220&r2=378221&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/VersionManager.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/VersionManager.java Thu Feb 16 02:48:20 2006
@@ -17,6 +17,7 @@
 package org.apache.jackrabbit.core.version;
 
 import org.apache.jackrabbit.core.NodeImpl;
+import org.apache.jackrabbit.core.NodeId;
 import org.apache.jackrabbit.core.state.NodeState;
 import org.apache.jackrabbit.core.virtual.VirtualItemStateProvider;
 import org.apache.jackrabbit.name.QName;
@@ -36,7 +37,7 @@
      * returns the virtual item state provider that exposes the internal versions
      * as items.
      *
-     * @return
+     * @return the virtual item state provider.
      */
     VirtualItemStateProvider getVirtualItemStateProvider();
 
@@ -48,7 +49,7 @@
      * @param node
      * @return
      * @throws RepositoryException
-     * @see #getVersionHistory(Session, NodeState) 
+     * @see #getVersionHistory(Session, NodeState)
      */
     VersionHistory createVersionHistory(Session session, NodeState node)
             throws RepositoryException;
@@ -111,36 +112,36 @@
      * Checks if the version history with the given id exists
      *
      * @param id
-     * @return
+     * @return <code>true</code> if the version history exists.
      */
-    boolean hasVersionHistory(String id);
+    boolean hasVersionHistory(NodeId id);
 
     /**
      * Returns the version history with the given id
      *
      * @param id
-     * @return
+     * @return the version history.
      * @throws RepositoryException
      */
-    InternalVersionHistory getVersionHistory(String id)
+    InternalVersionHistory getVersionHistory(NodeId id)
             throws RepositoryException;
 
     /**
      * Checks if the version with the given id exists
      *
      * @param id
-     * @return
+     * @return <code>true</code> if the version exists.
      */
-    boolean hasVersion(String id);
+    boolean hasVersion(NodeId id);
 
     /**
      * Returns the version with the given id
      *
      * @param id
-     * @return
+     * @return the version.
      * @throws RepositoryException
      */
-    InternalVersion getVersion(String id) throws RepositoryException;
+    InternalVersion getVersion(NodeId id) throws RepositoryException;
 
     /**
      * Close this version manager. After having closed a persistence

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/VersionManagerImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/VersionManagerImpl.java?rev=378221&r1=378220&r2=378221&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/VersionManagerImpl.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/VersionManagerImpl.java Thu Feb 16 02:48:20 2006
@@ -23,8 +23,8 @@
 import org.apache.jackrabbit.core.SessionImpl;
 import org.apache.jackrabbit.core.nodetype.NodeTypeRegistry;
 import org.apache.jackrabbit.core.observation.DelegatingObservationDispatcher;
-import org.apache.jackrabbit.core.observation.EventStateCollectionFactory;
 import org.apache.jackrabbit.core.observation.EventStateCollection;
+import org.apache.jackrabbit.core.observation.EventStateCollectionFactory;
 import org.apache.jackrabbit.core.state.ChangeLog;
 import org.apache.jackrabbit.core.state.ItemStateException;
 import org.apache.jackrabbit.core.state.LocalItemStateManager;
@@ -40,17 +40,17 @@
 import org.apache.log4j.Logger;
 
 import javax.jcr.PropertyType;
+import javax.jcr.ReferentialIntegrityException;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
-import javax.jcr.ReferentialIntegrityException;
 import javax.jcr.version.Version;
 import javax.jcr.version.VersionException;
 import javax.jcr.version.VersionHistory;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
-import java.util.Collection;
 
 /**
  * This Class implements a VersionManager.
@@ -64,11 +64,6 @@
     private static Logger log = Logger.getLogger(VersionManager.class);
 
     /**
-     * The root node UUID for the version storage
-     */
-    private final String VERSION_STORAGE_NODE_UUID;
-
-    /**
      * The persistence manager for the versions
      */
     private final PersistenceManager pMgr;
@@ -113,22 +108,21 @@
      *
      */
     public VersionManagerImpl(PersistenceManager pMgr, NodeTypeRegistry ntReg,
-                              DelegatingObservationDispatcher obsMgr, String rootUUID,
-                              String rootParentUUID) throws RepositoryException {
+                              DelegatingObservationDispatcher obsMgr, NodeId rootId,
+                              NodeId rootParentId) throws RepositoryException {
         try {
             this.pMgr = pMgr;
             this.ntReg = ntReg;
             this.obsMgr = obsMgr;
-            this.VERSION_STORAGE_NODE_UUID = rootUUID;
 
             // need to store the version storage root directly into the persistence manager
-            if (!pMgr.exists(new NodeId(rootUUID))) {
-                NodeState root = pMgr.createNew(new NodeId(rootUUID));
-                root.setParentUUID(rootParentUUID);
+            if (!pMgr.exists(rootId)) {
+                NodeState root = pMgr.createNew(rootId);
+                root.setParentId(rootParentId);
                 root.setDefinitionId(ntReg.getEffectiveNodeType(QName.REP_SYSTEM).getApplicableChildNodeDef(
                         QName.JCR_VERSIONSTORAGE, QName.REP_VERSIONSTORAGE).getId());
                 root.setNodeTypeName(QName.REP_VERSIONSTORAGE);
-                PropertyState pt = pMgr.createNew(new PropertyId(rootUUID, QName.JCR_PRIMARYTYPE));
+                PropertyState pt = pMgr.createNew(new PropertyId(rootId, QName.JCR_PRIMARYTYPE));
                 pt.setDefinitionId(ntReg.getEffectiveNodeType(QName.REP_SYSTEM).getApplicablePropertyDef(
                         QName.JCR_PRIMARYTYPE, PropertyType.NAME, false).getId());
                 pt.setMultiValued(false);
@@ -141,9 +135,9 @@
                 pMgr.store(cl);
             }
             sharedStateMgr =
-                    new VersionItemStateManager(pMgr, VERSION_STORAGE_NODE_UUID, ntReg);
+                    new VersionItemStateManager(pMgr, rootId, ntReg);
             stateMgr = new LocalItemStateManager(sharedStateMgr, this);
-            NodeState nodeState = (NodeState) stateMgr.getItemState(new NodeId(VERSION_STORAGE_NODE_UUID));
+            NodeState nodeState = (NodeState) stateMgr.getItemState(rootId);
             historyRoot = new NodeStateEx(stateMgr, ntReg, nodeState, QName.JCR_VERSIONSTORAGE);
 
             // create the virtual item state provider
@@ -187,41 +181,40 @@
         }
 
         if (history == null) {
-            throw new VersionException("History already exists for node " + node.getUUID());
+            throw new VersionException("History already exists for node " + node.getNodeId());
         }
-        return (VersionHistory) session.getNodeByUUID(history.getId());
+        return (VersionHistory) ((SessionImpl) session).getNodeById(history.getId());
     }
 
     /**
      * {@inheritDoc}
      */
-    public boolean hasItem(String id) {
-        return versionItems.containsKey(id) || stateMgr.hasItemState(new NodeId(id));
+    public boolean hasItem(NodeId id) {
+        return versionItems.containsKey(id) || stateMgr.hasItemState(id);
     }
 
     /**
      * {@inheritDoc}
      */
-    protected synchronized InternalVersionItem getItem(String uuid)
+    protected synchronized InternalVersionItem getItem(NodeId id)
             throws RepositoryException {
 
-        NodeId id = new NodeId(uuid);
         try {
-            InternalVersionItem item = (InternalVersionItem) versionItems.get(uuid);
+            InternalVersionItem item = (InternalVersionItem) versionItems.get(id);
             if (item == null) {
                 if (stateMgr.hasItemState(id)) {
                     NodeState state = (NodeState) stateMgr.getItemState(id);
                     NodeStateEx pNode = new NodeStateEx(stateMgr, ntReg, state, null);
-                    String parentUUID = pNode.getParentUUID();
+                    NodeId parentId = pNode.getParentId();
                     InternalVersionItem parent =
-                            (parentUUID != null) ? getItem(parentUUID) : null;
+                            (parentId != null) ? getItem(parentId) : null;
                     QName ntName = state.getNodeTypeName();
                     if (ntName.equals(QName.NT_FROZENNODE)) {
                         item = new InternalFrozenNodeImpl(this, pNode, parent);
                     } else if (ntName.equals(QName.NT_VERSIONEDCHILD)) {
                         item = new InternalFrozenVHImpl(this, pNode, parent);
                     } else if (ntName.equals(QName.NT_VERSION)) {
-                        item = ((InternalVersionHistory) parent).getVersion(uuid);
+                        item = ((InternalVersionHistory) parent).getVersion(id);
                     } else if (ntName.equals(QName.NT_VERSIONHISTORY)) {
                         item = new InternalVersionHistoryImpl(this, pNode);
                     } else {
@@ -229,7 +222,7 @@
                     }
                 }
                 if (item != null) {
-                    versionItems.put(uuid, item);
+                    versionItems.put(id, item);
                 }
             }
             return item;
@@ -253,8 +246,8 @@
             eventSource = (SessionImpl) node.getSession();
 
             String histUUID = node.getProperty(QName.JCR_VERSIONHISTORY).getString();
-            version = checkin(
-                    (InternalVersionHistoryImpl) getVersionHistory(histUUID), node);
+            version = checkin((InternalVersionHistoryImpl)
+                    getVersionHistory(NodeId.valueOf(histUUID)), node);
 
             // invalidate predecessors successor properties
             InternalVersion[] preds = version.getPredecessors();
@@ -263,7 +256,7 @@
                 versProvider.onPropertyChanged(propId);
             }
         }
-        return (AbstractVersion) eventSource.getNodeByUUID(version.getId());
+        return (AbstractVersion) eventSource.getNodeById(version.getId());
     }
 
     /**
@@ -327,7 +320,7 @@
         if (v == null) {
             return null;
         } else {
-            return (Version) eventSource.getNodeByUUID(v.getId());
+            return (Version) eventSource.getNodeByUUID(v.getId().getUUID());
         }
     }
 
@@ -366,7 +359,7 @@
 
     public boolean setNodeReferences(NodeReferences refs) {
         try {
-            InternalVersionItem item = getItem(refs.getTargetId().getUUID());
+            InternalVersionItem item = getItem(refs.getTargetId());
             setItemReferences(item, refs.getReferences());
             return true;
         } catch (RepositoryException e) {
@@ -384,7 +377,7 @@
         Iterator iter = references.iterator();
         while (iter.hasNext()) {
             PropertyId id = (PropertyId) iter.next();
-            if (!hasItem(id.getParentUUID())) {
+            if (!hasItem(id.getParentId())) {
                 refs.add(id);
             }
         }
@@ -425,7 +418,7 @@
      * @return the id of the version history root node
      */
     NodeId getHistoryRootId() {
-        return (NodeId) historyRoot.getState().getId();
+        return historyRoot.getState().getNodeId();
     }
 
     /**
@@ -462,10 +455,10 @@
     class VersionItemStateManager extends SharedItemStateManager {
 
         public VersionItemStateManager(PersistenceManager persistMgr,
-                                       String rootNodeUUID,
+                                       NodeId rootNodeId,
                                        NodeTypeRegistry ntReg)
                 throws ItemStateException {
-            super(persistMgr, rootNodeUUID, ntReg, false);
+            super(persistMgr, rootNodeId, ntReg, false);
         }
 
         protected void checkReferentialIntegrity(ChangeLog changes)

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/XAVersionManager.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/XAVersionManager.java?rev=378221&r1=378220&r2=378221&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/XAVersionManager.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/XAVersionManager.java Thu Feb 16 02:48:20 2006
@@ -16,35 +16,36 @@
  */
 package org.apache.jackrabbit.core.version;
 
+import org.apache.jackrabbit.core.InternalXAResource;
+import org.apache.jackrabbit.core.ItemId;
 import org.apache.jackrabbit.core.NodeId;
 import org.apache.jackrabbit.core.NodeImpl;
-import org.apache.jackrabbit.core.ItemId;
+import org.apache.jackrabbit.core.SessionImpl;
 import org.apache.jackrabbit.core.TransactionContext;
 import org.apache.jackrabbit.core.TransactionException;
-import org.apache.jackrabbit.core.InternalXAResource;
-import org.apache.jackrabbit.core.observation.EventStateCollectionFactory;
 import org.apache.jackrabbit.core.nodetype.NodeTypeRegistry;
+import org.apache.jackrabbit.core.observation.EventStateCollectionFactory;
+import org.apache.jackrabbit.core.state.ChangeLog;
+import org.apache.jackrabbit.core.state.ItemState;
 import org.apache.jackrabbit.core.state.ItemStateException;
+import org.apache.jackrabbit.core.state.NoSuchItemStateException;
 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.core.state.XAItemStateManager;
-import org.apache.jackrabbit.core.state.ItemState;
-import org.apache.jackrabbit.core.state.NoSuchItemStateException;
-import org.apache.jackrabbit.core.state.ChangeLog;
 import org.apache.jackrabbit.core.virtual.VirtualItemStateProvider;
-import org.apache.jackrabbit.core.virtual.VirtualPropertyState;
 import org.apache.jackrabbit.core.virtual.VirtualNodeState;
+import org.apache.jackrabbit.core.virtual.VirtualPropertyState;
 import org.apache.jackrabbit.name.QName;
 
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 import javax.jcr.version.Version;
-import javax.jcr.version.VersionHistory;
 import javax.jcr.version.VersionException;
-import java.util.Map;
+import javax.jcr.version.VersionHistory;
 import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * Implementation of a {@link VersionManager} that works in an XA environment.
@@ -118,7 +119,7 @@
         if (isInXA()) {
             InternalVersionHistory history = createVersionHistory(node);
             xaItems.put(history.getId(), history);
-            return (VersionHistory) session.getNodeByUUID(history.getId());
+            return (VersionHistory) ((SessionImpl) session).getNodeById(history.getId());
         }
         return vMgr.createVersionHistory(session, node);
     }
@@ -129,9 +130,9 @@
     public Version checkin(NodeImpl node) throws RepositoryException {
         if (isInXA()) {
             String histUUID = node.getProperty(QName.JCR_VERSIONHISTORY).getString();
-            InternalVersion version = checkin(
-                    (InternalVersionHistoryImpl) getVersionHistory(histUUID), node);
-            return (Version) node.getSession().getNodeByUUID(version.getId());
+            InternalVersion version = checkin((InternalVersionHistoryImpl)
+                    getVersionHistory(NodeId.valueOf(histUUID)), node);
+            return (Version) ((SessionImpl) node.getSession()).getNodeById(version.getId());
         }
         return vMgr.checkin(node);
     }
@@ -165,7 +166,7 @@
             if (v == null) {
                 return null;
             } else {
-                return (Version) history.getSession().getNodeByUUID(v.getId());
+                return (Version) ((SessionImpl) history.getSession()).getNodeById(v.getId());
             }
         }
         return vMgr.setVersionLabel(history, version, label, move);
@@ -208,7 +209,7 @@
      * {@inheritDoc}
      */
     public VirtualNodeState createNodeState(VirtualNodeState parent, QName name,
-                                            String uuid, QName nodeTypeName)
+                                            NodeId id, QName nodeTypeName)
             throws RepositoryException {
 
         throw new IllegalStateException("Read-only");
@@ -282,13 +283,13 @@
     /**
      * {@inheritDoc}
      */
-     protected InternalVersionItem getItem(String uuid) throws RepositoryException {
+     protected InternalVersionItem getItem(NodeId id) throws RepositoryException {
         InternalVersionItem item = null;
         if (xaItems != null) {
-            item = (InternalVersionItem) xaItems.get(uuid);
+            item = (InternalVersionItem) xaItems.get(id);
         }
         if (item == null) {
-            item = vMgr.getItem(uuid);
+            item = vMgr.getItem(id);
         }
         return item;
     }
@@ -296,11 +297,11 @@
     /**
      * {@inheritDoc}
      */
-    protected boolean hasItem(String uuid) {
-        if (xaItems != null && xaItems.containsKey(uuid)) {
+    protected boolean hasItem(NodeId id) {
+        if (xaItems != null && xaItems.containsKey(id)) {
             return true;
         }
-        return vMgr.hasItem(uuid);
+        return vMgr.hasItem(id);
     }
 
     /**
@@ -464,7 +465,7 @@
 
         NodeState state;
         try {
-            state = (NodeState) stateMgr.getItemState(new NodeId(history.getId()));
+            state = (NodeState) stateMgr.getItemState(history.getId());
         } catch (ItemStateException e) {
             throw new RepositoryException("Unable to make local copy", e);
         }

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/virtual/AbstractVISProvider.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/virtual/AbstractVISProvider.java?rev=378221&r1=378220&r2=378221&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/virtual/AbstractVISProvider.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/virtual/AbstractVISProvider.java Thu Feb 16 02:48:20 2006
@@ -118,7 +118,7 @@
         if (id instanceof NodeId) {
             ItemState s;
             if (nodes.contains(id)) {
-                s = (ItemState) nodes.get(id);
+                s = nodes.get(id);
             } else if (id.equals(rootNodeId)) {
                 s = getRootState();
             } else {
@@ -135,7 +135,7 @@
      */
     public NodeReferences getNodeReferences(NodeReferencesId id)
             throws NoSuchItemStateException, ItemStateException {
-        throw new NoSuchItemStateException(id.getUUID());
+        throw new NoSuchItemStateException(id.toString());
     }
 
     /**
@@ -181,7 +181,7 @@
      * Checks if this provide has the node state of the given node id
      *
      * @param id
-     * @return
+     * @return <code>true</code> if it has the node state
      */
     protected abstract boolean internalHasNodeState(NodeId id);
 
@@ -200,13 +200,13 @@
      * Checks if this provider has the property state of the given id.
      *
      * @param id
-     * @return
+     * @return <code>true</code> if it has the property state
      */
     protected boolean internalHasPropertyState(PropertyId id) {
 
         try {
             // get parent state
-            NodeState parent = (NodeState) getItemState(new NodeId(id.getParentUUID()));
+            NodeState parent = (NodeState) getItemState(id.getParentId());
 
             // handle some default prop states
             if (parent instanceof VirtualNodeState) {
@@ -230,7 +230,7 @@
             throws NoSuchItemStateException, ItemStateException {
 
         // get parent state
-        NodeState parent = (NodeState) getItemState(new NodeId(id.getParentUUID()));
+        NodeState parent = (NodeState) getItemState(id.getParentId());
 
         // handle some default prop states
         if (parent instanceof VirtualNodeState) {
@@ -247,7 +247,8 @@
                                                     boolean multiValued)
             throws RepositoryException {
         PropDef def = getApplicablePropertyDef(parent, name, type, multiValued);
-        VirtualPropertyState prop = new VirtualPropertyState(name, parent.getUUID());
+        PropertyId id = new PropertyId(parent.getNodeId(), name);
+        VirtualPropertyState prop = new VirtualPropertyState(id);
         prop.setType(type);
         prop.setMultiValued(multiValued);
         prop.setDefinitionId(def.getId());
@@ -258,7 +259,7 @@
      * {@inheritDoc}
      */
     public VirtualNodeState createNodeState(VirtualNodeState parent, QName name,
-                                            String uuid, QName nodeTypeName)
+                                            NodeId id, QName nodeTypeName)
             throws RepositoryException {
 
         NodeDefId def;
@@ -275,10 +276,10 @@
 
         // create a new node state
         VirtualNodeState state;
-        if (uuid == null) {
-            uuid = UUID.randomUUID().toString();    // version 4 uuid
+        if (id == null) {
+            id = new NodeId(UUID.randomUUID());
         }
-        state = new VirtualNodeState(this, parent.getUUID(), uuid, nodeTypeName, new QName[0]);
+        state = new VirtualNodeState(this, parent.getNodeId(), id, nodeTypeName, new QName[0]);
         state.setDefinitionId(def);
 
         cache(state);
@@ -288,7 +289,7 @@
     /**
      * returns the node type manager
      *
-     * @return
+     * @return the node type manager
      */
     protected NodeTypeRegistry getNodeTypeRegistry() {
         return ntReg;
@@ -333,7 +334,7 @@
                 Iterator iter = state.getChildNodeEntries().iterator();
                 while (iter.hasNext()) {
                     NodeState.ChildNodeEntry pe = (NodeState.ChildNodeEntry) iter.next();
-                    invalidateItem(new NodeId(pe.getUUID()), true);
+                    invalidateItem(pe.getId(), true);
                 }
             }
             state.notifyStateUpdated();
@@ -385,7 +386,7 @@
         try {
             return ntReg.getEffectiveNodeType((QName[]) set.toArray(new QName[set.size()]));
         } catch (NodeTypeConflictException ntce) {
-            String msg = "internal error: failed to build effective node type for node " + parent.getUUID();
+            String msg = "internal error: failed to build effective node type for node " + parent.getNodeId();
             throw new RepositoryException(msg, ntce);
         }
     }

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/virtual/VirtualItemStateProvider.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/virtual/VirtualItemStateProvider.java?rev=378221&r1=378220&r2=378221&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/virtual/VirtualItemStateProvider.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/virtual/VirtualItemStateProvider.java Thu Feb 16 02:48:20 2006
@@ -18,7 +18,6 @@
 
 import org.apache.jackrabbit.core.ItemId;
 import org.apache.jackrabbit.core.NodeId;
-import org.apache.jackrabbit.core.state.ItemStateListener;
 import org.apache.jackrabbit.core.state.ItemStateManager;
 import org.apache.jackrabbit.core.state.NodeReferences;
 import org.apache.jackrabbit.name.QName;
@@ -34,14 +33,14 @@
      * Checks if the id refers to the root of a virtual tree.
      *
      * @param id
-     * @return
+     * @return <code>true</code> if it is the root
      */
     boolean isVirtualRoot(ItemId id);
 
     /**
      * Returns the id of the root node of the virtual tree.
      *
-     * @return
+     * @return the id of the root node of the virtual tree.
      */
     NodeId getVirtualRootId();
 
@@ -56,8 +55,8 @@
      * @throws RepositoryException
      */
     VirtualPropertyState createPropertyState(VirtualNodeState parent,
-                                                    QName name, int type,
-                                                    boolean multiValued)
+                                             QName name, int type,
+                                             boolean multiValued)
             throws RepositoryException;
 
     /**
@@ -65,14 +64,14 @@
      *
      * @param parent
      * @param name
-     * @param uuid
+     * @param id
      * @param nodeTypeName
      * @return
      * @throws RepositoryException
      */
     VirtualNodeState createNodeState(VirtualNodeState parent, QName name,
-                                            String uuid, QName nodeTypeName)
-            throws RepositoryException;
+                                     NodeId id, QName nodeTypeName)
+        throws RepositoryException;
 
     /**
      * Informs this provider that the node references to one of its states has

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/virtual/VirtualNodeState.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/virtual/VirtualNodeState.java?rev=378221&r1=378220&r2=378221&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/virtual/VirtualNodeState.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/virtual/VirtualNodeState.java Thu Feb 16 02:48:20 2006
@@ -20,6 +20,7 @@
 import org.apache.jackrabbit.core.state.NoSuchItemStateException;
 import org.apache.jackrabbit.core.state.NodeState;
 import org.apache.jackrabbit.core.value.InternalValue;
+import org.apache.jackrabbit.core.NodeId;
 import org.apache.jackrabbit.name.QName;
 
 import javax.jcr.PropertyType;
@@ -50,19 +51,19 @@
      * creates a new virtual node state
      *
      * @param stateMgr
-     * @param parentUUID
-     * @param uuid
+     * @param parentId
+     * @param id
      * @param nodeTypeName
      * @param mixins
      * @throws RepositoryException
      */
     public VirtualNodeState(AbstractVISProvider stateMgr,
-                            String parentUUID,
-                            String uuid,
+                            NodeId parentId,
+                            NodeId id,
                             QName nodeTypeName,
                             QName[] mixins)
             throws RepositoryException {
-        super(uuid, nodeTypeName, parentUUID, ItemState.STATUS_EXISTING, false);
+        super(id, nodeTypeName, parentId, ItemState.STATUS_EXISTING, false);
         this.stateMgr = stateMgr;
         addListener(stateMgr);
         // add default properties
@@ -73,7 +74,7 @@
     /**
      * Returns the properties of this node
      *
-     * @return
+     * @return the properties.
      */
     public VirtualPropertyState[] getProperties() {
         return (VirtualPropertyState[]) properties.values().toArray(new VirtualPropertyState[properties.size()]);
@@ -84,7 +85,7 @@
      * Returns the values of the given property of <code>null</code>
      *
      * @param name
-     * @return
+     * @return the values
      */
     public InternalValue[] getPropertyValues(QName name) throws NoSuchItemStateException {
         VirtualPropertyState ps = getProperty(name);
@@ -99,7 +100,7 @@
      * Returns the value of the given property or <code>null</code>
      *
      * @param name
-     * @return
+     * @return the value
      */
     public InternalValue getPropertyValue(QName name) throws NoSuchItemStateException {
         VirtualPropertyState ps = getProperty(name);

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/virtual/VirtualPropertyState.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/virtual/VirtualPropertyState.java?rev=378221&r1=378220&r2=378221&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/virtual/VirtualPropertyState.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/virtual/VirtualPropertyState.java Thu Feb 16 02:48:20 2006
@@ -16,10 +16,10 @@
  */
 package org.apache.jackrabbit.core.virtual;
 
+import org.apache.jackrabbit.core.PropertyId;
 import org.apache.jackrabbit.core.state.ItemState;
 import org.apache.jackrabbit.core.state.PropertyState;
 import org.apache.jackrabbit.core.value.InternalValue;
-import org.apache.jackrabbit.name.QName;
 
 /**
  * This Class implements a virtual property state
@@ -33,16 +33,15 @@
 
     /**
      * Creates a new virtual property state
-     * @param name
-     * @param parentUUID
+     * @param id
      */
-    public VirtualPropertyState(QName name, String parentUUID) {
-        super(name, parentUUID, ItemState.STATUS_EXISTING, false);
+    public VirtualPropertyState(PropertyId id) {
+        super(id, ItemState.STATUS_EXISTING, false);
     }
 
     /**
      * Returns the virtual value provider, if registered.
-     * @return
+     * @return the virtual value provider
      */
     public VirtualValueProvider getValueProvider() {
         return valueProvider;
@@ -59,12 +58,12 @@
     /**
      * Returns the value of this state evt. by using the registered virtual
      * value provider.
-     * @return
+     * @return the values
      */
     public InternalValue[] getValues() {
         InternalValue[] values = null;
         if (valueProvider != null) {
-            values = valueProvider.getVirtualValues(name);
+            values = valueProvider.getVirtualValues(getName());
         }
         return valueProvider == null ? super.getValues() : values;
     }

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/DocViewImportHandler.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/DocViewImportHandler.java?rev=378221&r1=378220&r2=378221&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/DocViewImportHandler.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/DocViewImportHandler.java Thu Feb 16 02:48:20 2006
@@ -20,6 +20,7 @@
 import org.apache.jackrabbit.name.NamespaceResolver;
 import org.apache.jackrabbit.name.QName;
 import org.apache.jackrabbit.util.ISO9075;
+import org.apache.jackrabbit.core.NodeId;
 import org.apache.log4j.Logger;
 import org.xml.sax.Attributes;
 import org.xml.sax.SAXException;
@@ -174,7 +175,7 @@
             nodeName = ISO9075.decode(nodeName);
 
             // properties
-            String uuid = null;
+            NodeId id = null;
             QName nodeTypeName = null;
             QName[] mixinTypes = null;
 
@@ -221,7 +222,7 @@
                 } else if (propName.equals(QName.JCR_UUID)) {
                     // jcr:uuid
                     if (attrValue.length() > 0) {
-                        uuid = attrValue;
+                        id = NodeId.valueOf(attrValue);
                     }
                 } else {
                     propValues = new Importer.TextValue[1];
@@ -232,7 +233,7 @@
             }
 
             Importer.NodeInfo node =
-                    new Importer.NodeInfo(nodeName, nodeTypeName, mixinTypes, uuid);
+                    new Importer.NodeInfo(nodeName, nodeTypeName, mixinTypes, id);
             // all information has been collected, now delegate to importer
             importer.startNode(node, props, nsContext);
             // push current node data onto stack

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/Importer.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/Importer.java?rev=378221&r1=378220&r2=378221&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/Importer.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/Importer.java Thu Feb 16 02:48:20 2006
@@ -18,6 +18,7 @@
 
 import org.apache.jackrabbit.name.NamespaceResolver;
 import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.core.NodeId;
 
 import javax.jcr.RepositoryException;
 import java.io.IOException;
@@ -59,17 +60,17 @@
         private QName name;
         private QName nodeTypeName;
         private QName[] mixinNames;
-        private String uuid;
+        private NodeId id;
 
         public NodeInfo() {
         }
 
         public NodeInfo(QName name, QName nodeTypeName, QName[] mixinNames,
-                        String uuid) {
+                        NodeId id) {
             this.name = name;
             this.nodeTypeName = nodeTypeName;
             this.mixinNames = mixinNames;
-            this.uuid = uuid;
+            this.id = id;
         }
 
         public void setName(QName name) {
@@ -96,12 +97,12 @@
             return mixinNames;
         }
 
-        public void setUUID(String uuid) {
-            this.uuid = uuid;
+        public void setId(NodeId id) {
+            this.id = id;
         }
 
-        public String getUUID() {
-            return uuid;
+        public NodeId getId() {
+            return id;
         }
     }
 

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/SessionImporter.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/SessionImporter.java?rev=378221&r1=378220&r2=378221&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/SessionImporter.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/SessionImporter.java Thu Feb 16 02:48:20 2006
@@ -18,6 +18,7 @@
 
 import org.apache.jackrabbit.core.NodeImpl;
 import org.apache.jackrabbit.core.SessionImpl;
+import org.apache.jackrabbit.core.NodeId;
 import org.apache.jackrabbit.core.nodetype.EffectiveNodeType;
 import org.apache.jackrabbit.core.nodetype.PropDef;
 import org.apache.jackrabbit.core.util.ReferenceChangeTracker;
@@ -26,6 +27,7 @@
 import org.apache.jackrabbit.name.QName;
 import org.apache.jackrabbit.value.ReferenceValue;
 import org.apache.jackrabbit.value.ValueHelper;
+import org.apache.jackrabbit.uuid.UUID;
 import org.apache.log4j.Logger;
 
 import javax.jcr.ImportUUIDBehavior;
@@ -88,7 +90,7 @@
                                   QName nodeName,
                                   QName nodeTypeName,
                                   QName[] mixinNames,
-                                  String uuid)
+                                  NodeId id)
             throws RepositoryException {
         NodeImpl node;
 
@@ -121,6 +123,7 @@
         }
 
         // add node
+        UUID uuid = id == null ? UUID.randomUUID() : id.getUUID();
         node = parent.addNode(nodeName, nodeTypeName, uuid);
         // add mixins
         if (mixinNames != null) {
@@ -142,10 +145,10 @@
                     nodeInfo.getNodeTypeName(), nodeInfo.getMixinNames(), null);
             // remember uuid mapping
             if (node.isNodeType(QName.MIX_REFERENCEABLE)) {
-                refTracker.mappedUUID(nodeInfo.getUUID(), node.getUUID());
+                refTracker.mappedUUID(nodeInfo.getId().getUUID(), node.getNodeId().getUUID());
             }
         } else if (uuidBehavior == ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW) {
-            String msg = "a node with uuid " + nodeInfo.getUUID() + " already exists!";
+            String msg = "a node with uuid " + nodeInfo.getId() + " already exists!";
             log.debug(msg);
             throw new ItemExistsException(msg);
         } else if (uuidBehavior == ImportUUIDBehavior.IMPORT_UUID_COLLISION_REMOVE_EXISTING) {
@@ -160,7 +163,7 @@
             // create new with given uuid
             node = createNode(parent, nodeInfo.getName(),
                     nodeInfo.getNodeTypeName(), nodeInfo.getMixinNames(),
-                    nodeInfo.getUUID());
+                    nodeInfo.getId());
         } else if (uuidBehavior == ImportUUIDBehavior.IMPORT_UUID_COLLISION_REPLACE_EXISTING) {
             if (conflicting.getDepth() == 0) {
                 String msg = "root node cannot be replaced";
@@ -174,7 +177,7 @@
             // create new with given uuid at same location as conflicting
             node = createNode(parent, nodeInfo.getName(),
                     nodeInfo.getNodeTypeName(), nodeInfo.getMixinNames(),
-                    nodeInfo.getUUID());
+                    nodeInfo.getId());
         } else {
             String msg = "unknown uuidBehavior: " + uuidBehavior;
             log.debug(msg);
@@ -202,7 +205,7 @@
         // process node
 
         NodeImpl node = null;
-        String uuid = nodeInfo.getUUID();
+        NodeId id = nodeInfo.getId();
         QName nodeName = nodeInfo.getName();
         QName ntName = nodeInfo.getNodeTypeName();
         QName[] mixins = nodeInfo.getMixinNames();
@@ -237,14 +240,14 @@
 
         if (node == null) {
             // create node
-            if (uuid == null) {
+            if (id == null) {
                 // no potential uuid conflict, always add new node
                 node = createNode(parent, nodeName, ntName, mixins, null);
             } else {
                 // potential uuid conflict
                 NodeImpl conflicting;
                 try {
-                    conflicting = (NodeImpl) session.getNodeByUUID(uuid);
+                    conflicting = session.getNodeById(id);
                 } catch (ItemNotFoundException infe) {
                     conflicting = null;
                 }
@@ -253,7 +256,7 @@
                     node = resolveUUIDConflict(parent, conflicting, nodeInfo);
                 } else {
                     // create new with given uuid
-                    node = createNode(parent, nodeName, ntName, mixins, uuid);
+                    node = createNode(parent, nodeName, ntName, mixins, id);
                 }
             }
         }
@@ -410,8 +413,8 @@
                 Value[] newVals = new Value[values.length];
                 for (int i = 0; i < values.length; i++) {
                     Value val = values[i];
-                    String original = val.getString();
-                    String adjusted = refTracker.getMappedUUID(original);
+                    UUID original = UUID.fromString(val.getString());
+                    UUID adjusted = refTracker.getMappedUUID(original);
                     if (adjusted != null) {
                         newVals[i] = new ReferenceValue(session.getNodeByUUID(adjusted));
                     } else {
@@ -422,8 +425,8 @@
                 prop.setValue(newVals);
             } else {
                 Value val = prop.getValue();
-                String original = val.getString();
-                String adjusted = refTracker.getMappedUUID(original);
+                UUID original = UUID.fromString(val.getString());
+                UUID adjusted = refTracker.getMappedUUID(original);
                 if (adjusted != null) {
                     prop.setValue(session.getNodeByUUID(adjusted));
                 }

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/SysViewImportHandler.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/SysViewImportHandler.java?rev=378221&r1=378220&r2=378221&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/SysViewImportHandler.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/SysViewImportHandler.java Thu Feb 16 02:48:20 2006
@@ -20,6 +20,7 @@
 import org.apache.jackrabbit.name.NamespaceResolver;
 import org.apache.jackrabbit.name.QName;
 import org.apache.jackrabbit.name.UnknownPrefixException;
+import org.apache.jackrabbit.core.NodeId;
 import org.xml.sax.Attributes;
 import org.xml.sax.SAXException;
 
@@ -75,7 +76,9 @@
             QName[] mixins = (QName[]) state.mixinNames.toArray(new QName[state.mixinNames.size()]);
             node.setMixinNames(mixins);
         }
-        node.setUUID(state.uuid);
+        if (state.uuid != null) {
+            node.setId(NodeId.valueOf(state.uuid));
+        }
         // call Importer
         try {
             if (start) {

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/WorkspaceImporter.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/WorkspaceImporter.java?rev=378221&r1=378220&r2=378221&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/WorkspaceImporter.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/WorkspaceImporter.java Thu Feb 16 02:48:20 2006
@@ -160,17 +160,17 @@
             // remember uuid mapping
             EffectiveNodeType ent = itemOps.getEffectiveNodeType(node);
             if (ent.includesNodeType(QName.MIX_REFERENCEABLE)) {
-                refTracker.mappedUUID(nodeInfo.getUUID(), node.getUUID());
+                refTracker.mappedUUID(nodeInfo.getId().getUUID(), node.getNodeId().getUUID());
             }
         } else if (uuidBehavior == ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW) {
-            String msg = "a node with uuid " + nodeInfo.getUUID()
+            String msg = "a node with uuid " + nodeInfo.getId()
                     + " already exists!";
             log.debug(msg);
             throw new ItemExistsException(msg);
         } else if (uuidBehavior == ImportUUIDBehavior.IMPORT_UUID_COLLISION_REMOVE_EXISTING) {
             // make sure conflicting node is not importTarget or an ancestor thereof
-            Path p0 = hierMgr.getPath(importTarget.getId());
-            Path p1 = hierMgr.getPath(conflicting.getId());
+            Path p0 = hierMgr.getPath(importTarget.getNodeId());
+            Path p1 = hierMgr.getPath(conflicting.getNodeId());
             try {
                 if (p1.equals(p0) || p1.isAncestorOf(p0)) {
                     String msg = "cannot remove ancestor node";
@@ -205,15 +205,15 @@
             // do create new node
             node = itemOps.createNodeState(parent, nodeInfo.getName(),
                     nodeInfo.getNodeTypeName(), nodeInfo.getMixinNames(),
-                    nodeInfo.getUUID());
+                    nodeInfo.getId());
         } else if (uuidBehavior == ImportUUIDBehavior.IMPORT_UUID_COLLISION_REPLACE_EXISTING) {
-            if (conflicting.getParentUUID() == null) {
+            NodeId parentId = conflicting.getParentId();
+            if (parentId == null) {
                 String msg = "root node cannot be replaced";
                 log.debug(msg);
                 throw new RepositoryException(msg);
             }
             // 'replace' current parent with parent of conflicting
-            NodeId parentId = new NodeId(conflicting.getParentUUID());
             try {
                 parent = itemOps.getNodeState(parentId);
             } catch (ItemNotFoundException infe) {
@@ -244,7 +244,7 @@
             // do create new node
             node = itemOps.createNodeState(parent, nodeInfo.getName(),
                     nodeInfo.getNodeTypeName(), nodeInfo.getMixinNames(),
-                    nodeInfo.getUUID());
+                    nodeInfo.getId());
         } else {
             String msg = "unknown uuidBehavior: " + uuidBehavior;
             log.debug(msg);
@@ -364,7 +364,7 @@
             // process node
 
             NodeState node = null;
-            String uuid = nodeInfo.getUUID();
+            NodeId id = nodeInfo.getId();
             QName nodeName = nodeInfo.getName();
             QName ntName = nodeInfo.getNodeTypeName();
             QName[] mixins = nodeInfo.getMixinNames();
@@ -380,7 +380,7 @@
                 // a node with that name already exists...
                 NodeState.ChildNodeEntry entry =
                         parent.getChildNodeEntry(nodeName, 1);
-                NodeId idExisting = new NodeId(entry.getUUID());
+                NodeId idExisting = entry.getId();
                 NodeState existing = (NodeState) itemOps.getItemState(idExisting);
                 NodeDef def = ntReg.getNodeDef(existing.getDefinitionId());
 
@@ -394,7 +394,7 @@
                         parents.push(null); // push null onto stack for skipped node
                         succeeded = true;
                         log.debug("skipping protected node "
-                                + itemOps.safeGetJCRPath(existing.getId()));
+                                + itemOps.safeGetJCRPath(existing.getNodeId()));
                         return;
                     }
                     if (def.isAutoCreated() && entExisting.includesNodeType(ntName)) {
@@ -402,14 +402,14 @@
                         // no need to create it
                         node = existing;
                     } else {
-                        throw new ItemExistsException(itemOps.safeGetJCRPath(existing.getId()));
+                        throw new ItemExistsException(itemOps.safeGetJCRPath(existing.getNodeId()));
                     }
                 }
             }
 
             if (node == null) {
                 // there's no node with that name...
-                if (uuid == null) {
+                if (id == null) {
                     // no potential uuid conflict, always create new node
 
                     NodeDef def =
@@ -431,7 +431,7 @@
                          *
                          * see http://issues.apache.org/jira/browse/JCR-61
                          */
-                        PropertyId propId = new PropertyId(parent.getUUID(), nodeName);
+                        PropertyId propId = new PropertyId(parent.getNodeId(), nodeName);
                         PropertyState conflicting = itemOps.getPropertyState(propId);
                         if (conflicting.getStatus() == ItemState.STATUS_NEW) {
                             // assume this property has been imported as well;
@@ -464,7 +464,7 @@
                     NodeState conflicting;
 
                     try {
-                        conflicting = itemOps.getNodeState(new NodeId(uuid));
+                        conflicting = itemOps.getNodeState(id);
                     } catch (ItemNotFoundException infe) {
                         conflicting = null;
                     }
@@ -491,7 +491,7 @@
                                 BatchedItemOperations.CHECK_ACCESS
                                 | BatchedItemOperations.CHECK_CONSTRAINTS);
                         // do create new node
-                        node = itemOps.createNodeState(parent, nodeName, ntName, mixins, uuid, def);
+                        node = itemOps.createNodeState(parent, nodeName, ntName, mixins, id, def);
                     }
                 }
             }
@@ -510,7 +510,7 @@
 
                 if (node.hasPropertyName(propName)) {
                     // a property with that name already exists...
-                    PropertyId idExisting = new PropertyId(node.getUUID(), propName);
+                    PropertyId idExisting = new PropertyId(node.getNodeId(), propName);
                     PropertyState existing =
                             (PropertyState) itemOps.getItemState(idExisting);
                     def = ntReg.getPropDef(existing.getDefinitionId());
@@ -527,7 +527,7 @@
                         // no need to create it
                         prop = existing;
                     } else {
-                        throw new ItemExistsException(itemOps.safeGetJCRPath(existing.getId()));
+                        throw new ItemExistsException(itemOps.safeGetJCRPath(existing.getPropertyId()));
                     }
                 }
                 if (prop == null) {
@@ -557,7 +557,7 @@
 
                 // check multi-valued characteristic
                 if ((tva.length == 0 || tva.length > 1) && !def.isMultiple()) {
-                    throw new ConstraintViolationException(itemOps.safeGetJCRPath(prop.getId())
+                    throw new ConstraintViolationException(itemOps.safeGetJCRPath(prop.getPropertyId())
                             + " is not multi-valued");
                 }
 
@@ -720,10 +720,10 @@
                 InternalValue[] newVals = new InternalValue[values.length];
                 for (int i = 0; i < values.length; i++) {
                     InternalValue val = values[i];
-                    String original = ((UUID) val.internalValue()).toString();
-                    String adjusted = refTracker.getMappedUUID(original);
+                    UUID original = (UUID) val.internalValue();
+                    UUID adjusted = refTracker.getMappedUUID(original);
                     if (adjusted != null) {
-                        newVals[i] = InternalValue.create(UUID.fromString(adjusted));
+                        newVals[i] = InternalValue.create(adjusted);
                         modified = true;
                     } else {
                         // reference doesn't need adjusting, just copy old value



Mime
View raw message