jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tri...@apache.org
Subject svn commit: r378221 [5/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/state/SessionItemStateManager.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/SessionItemStateManager.java?rev=378221&r1=378220&r2=378221&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/SessionItemStateManager.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/SessionItemStateManager.java Thu Feb 16 02:48:20 2006
@@ -63,11 +63,11 @@
     /**
      * Creates a new <code>SessionItemStateManager</code> instance.
      *
-     * @param rootNodeUUID
+     * @param rootNodeId
      * @param persistentStateMgr
      * @param nsResolver
      */
-    public SessionItemStateManager(String rootNodeUUID,
+    public SessionItemStateManager(NodeId rootNodeId,
                                    UpdatableItemStateManager persistentStateMgr,
                                    NamespaceResolver nsResolver) {
 
@@ -75,7 +75,7 @@
         // create transient item state manager
         transientStateMgr = new TransientItemStateManager();
         // create hierarchy manager that uses both transient and persistent state
-        hierMgr = new CachingHierarchyManager(rootNodeUUID, this, nsResolver);
+        hierMgr = new CachingHierarchyManager(rootNodeId, this, nsResolver);
     }
 
     /**
@@ -185,22 +185,22 @@
     /**
      * {@inheritDoc}
      */
-    public NodeState createNew(String uuid, QName nodeTypeName,
-                               String parentUUID)
+    public NodeState createNew(NodeId id, QName nodeTypeName,
+                               NodeId parentId)
             throws IllegalStateException {
-        return persistentStateMgr.createNew(uuid, nodeTypeName, parentUUID);
+        return persistentStateMgr.createNew(id, nodeTypeName, parentId);
     }
 
     /**
-     * Customized variant of {@link #createNew(String, QName, String)} that
+     * Customized variant of {@link #createNew(NodeId, QName, NodeId)} that
      * connects the newly created persistent state with the transient state.
      */
     public NodeState createNew(NodeState transientState)
             throws IllegalStateException {
 
-        NodeState persistentState = createNew(transientState.getUUID(),
+        NodeState persistentState = createNew(transientState.getNodeId(),
                 transientState.getNodeTypeName(),
-                transientState.getParentUUID());
+                transientState.getParentId());
         transientState.connect(persistentState);
         return persistentState;
     }
@@ -208,20 +208,20 @@
     /**
      * {@inheritDoc}
      */
-    public PropertyState createNew(QName propName, String parentUUID)
+    public PropertyState createNew(QName propName, NodeId parentId)
             throws IllegalStateException {
-        return persistentStateMgr.createNew(propName, parentUUID);
+        return persistentStateMgr.createNew(propName, parentId);
     }
 
     /**
-     * Customized variant of {@link #createNew(String, QName, String)} that
+     * Customized variant of {@link #createNew(QName, NodeId)} that
      * connects the newly created persistent state with the transient state.
      */
     public PropertyState createNew(PropertyState transientState)
             throws IllegalStateException {
 
         PropertyState persistentState = createNew(transientState.getName(),
-                transientState.getParentUUID());
+                transientState.getParentId());
         transientState.connect(persistentState);
         return persistentState;
     }
@@ -263,7 +263,7 @@
     public void dispose() {
         // discard all transient changes
         transientStateMgr.disposeAllItemStates();
-        // dispose our (i.e. 'local') state manager 
+        // dispose our (i.e. 'local') state manager
         persistentStateMgr.dispose();
     }
 
@@ -281,7 +281,8 @@
     }
 
     /**
-     * @return
+     * @return <code>true</code> if this manager has any transient state;
+     *         <code>false</code> otherwise.
      */
     public boolean hasAnyTransientItemStates() {
         return transientStateMgr.hasAnyItemStates();
@@ -402,7 +403,7 @@
 
         // use a special attic-aware hierarchy manager
         ZombieHierarchyManager zombieHierMgr =
-                new ZombieHierarchyManager(hierMgr.getRootNodeId().getUUID(),
+                new ZombieHierarchyManager(hierMgr.getRootNodeId(),
                         this,
                         transientStateMgr.getAttic(),
                         hierMgr.getNamespaceResolver());
@@ -474,16 +475,16 @@
 
     //------< methods for creating & discarding transient ItemState instances >
     /**
-     * @param uuid
+     * @param id
      * @param nodeTypeName
-     * @param parentUUID
+     * @param parentId
      * @param initialStatus
      * @return
      * @throws ItemStateException
      */
-    public NodeState createTransientNodeState(String uuid, QName nodeTypeName, String parentUUID, int initialStatus)
+    public NodeState createTransientNodeState(NodeId id, QName nodeTypeName, NodeId parentId, int initialStatus)
             throws ItemStateException {
-        return transientStateMgr.createNodeState(uuid, nodeTypeName, parentUUID, initialStatus);
+        return transientStateMgr.createNodeState(id, nodeTypeName, parentId, initialStatus);
     }
 
     /**
@@ -501,15 +502,15 @@
     }
 
     /**
-     * @param parentUUID
+     * @param parentId
      * @param propName
      * @param initialStatus
      * @return
      * @throws ItemStateException
      */
-    public PropertyState createTransientPropertyState(String parentUUID, QName propName, int initialStatus)
+    public PropertyState createTransientPropertyState(NodeId parentId, QName propName, int initialStatus)
             throws ItemStateException {
-        return transientStateMgr.createPropertyState(parentUUID, propName, initialStatus);
+        return transientStateMgr.createPropertyState(parentId, propName, initialStatus);
     }
 
     /**

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java?rev=378221&r1=378220&r2=378221&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java Thu Feb 16 02:48:20 2006
@@ -32,6 +32,7 @@
 import org.apache.jackrabbit.core.value.InternalValue;
 import org.apache.jackrabbit.core.virtual.VirtualItemStateProvider;
 import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.uuid.UUID;
 import org.apache.log4j.Logger;
 
 import javax.jcr.PropertyType;
@@ -137,9 +138,9 @@
     private final boolean usesReferences;
 
     /**
-     * uuid of root node
+     * id of root node
      */
-    private final String rootNodeUUID;
+    private final NodeId rootNodeId;
 
     /**
      * Virtual item state providers
@@ -166,11 +167,11 @@
      * Creates a new <code>SharedItemStateManager</code> instance.
      *
      * @param persistMgr
-     * @param rootNodeUUID
+     * @param rootNodeId
      * @param ntReg
      */
     public SharedItemStateManager(PersistenceManager persistMgr,
-                                  String rootNodeUUID,
+                                  NodeId rootNodeId,
                                   NodeTypeRegistry ntReg,
                                   boolean usesReferences)
             throws ItemStateException {
@@ -178,10 +179,10 @@
         this.persistMgr = persistMgr;
         this.ntReg = ntReg;
         this.usesReferences = usesReferences;
-        this.rootNodeUUID = rootNodeUUID;
+        this.rootNodeId = rootNodeId;
         // create root node state if it doesn't yet exist
-        if (!hasNonVirtualItemState(new NodeId(rootNodeUUID))) {
-            createRootNodeState(rootNodeUUID, ntReg);
+        if (!hasNonVirtualItemState(rootNodeId)) {
+            createRootNodeState(rootNodeId, ntReg);
         }
     }
 
@@ -531,7 +532,7 @@
                 }
 
                 /* create event states */
-                events.createEventStates(rootNodeUUID, local,
+                events.createEventStates(rootNodeId, local,
                         SharedItemStateManager.this);
 
                 /* Push all changes from the local items to the shared items */
@@ -684,17 +685,17 @@
     /**
      * Create a new node state instance
      *
-     * @param uuid         uuid
+     * @param id         uuid
      * @param nodeTypeName node type name
-     * @param parentUUID   parent UUID
+     * @param parentId   parent UUID
      * @return new node state instance
      */
-    private NodeState createInstance(String uuid, QName nodeTypeName,
-                                     String parentUUID) {
+    private NodeState createInstance(NodeId id, QName nodeTypeName,
+                                     NodeId parentId) {
 
-        NodeState state = persistMgr.createNew(new NodeId(uuid));
+        NodeState state = persistMgr.createNew(id);
         state.setNodeTypeName(nodeTypeName);
-        state.setParentUUID(parentUUID);
+        state.setParentId(parentId);
         state.setStatus(ItemState.STATUS_NEW);
         state.addListener(this);
 
@@ -704,16 +705,16 @@
     /**
      * Create root node state
      *
-     * @param rootNodeUUID root node UUID
+     * @param rootNodeId root node id
      * @param ntReg        node type registry
      * @return root node state
      * @throws ItemStateException if an error occurs
      */
-    private NodeState createRootNodeState(String rootNodeUUID,
+    private NodeState createRootNodeState(NodeId rootNodeId,
                                           NodeTypeRegistry ntReg)
             throws ItemStateException {
 
-        NodeState rootState = createInstance(rootNodeUUID, QName.REP_ROOT, null);
+        NodeState rootState = createInstance(rootNodeId, QName.REP_ROOT, null);
 
         // FIXME need to manually setup root node by creating mandatory jcr:primaryType property
         // @todo delegate setup of root node to NodeTypeInstanceHandler
@@ -741,7 +742,7 @@
         // create jcr:primaryType property
         rootState.addPropertyName(propDef.getName());
 
-        PropertyState prop = createInstance(propDef.getName(), rootNodeUUID);
+        PropertyState prop = createInstance(propDef.getName(), rootNodeId);
         prop.setValues(new InternalValue[]{InternalValue.create(QName.REP_ROOT)});
         prop.setType(propDef.getRequiredType());
         prop.setMultiValued(propDef.isMultiple());
@@ -809,10 +810,10 @@
     private ItemState createInstance(ItemState other) {
         if (other.isNode()) {
             NodeState ns = (NodeState) other;
-            return createInstance(ns.getUUID(), ns.getNodeTypeName(), ns.getParentUUID());
+            return createInstance(ns.getNodeId(), ns.getNodeTypeName(), ns.getParentId());
         } else {
             PropertyState ps = (PropertyState) other;
-            return createInstance(ps.getName(), ps.getParentUUID());
+            return createInstance(ps.getName(), ps.getParentId());
         }
     }
 
@@ -820,11 +821,11 @@
      * Create a new property state instance
      *
      * @param propName   property name
-     * @param parentUUID parent UUID
+     * @param parentId parent Id
      * @return new property state instance
      */
-    private PropertyState createInstance(QName propName, String parentUUID) {
-        PropertyState state = persistMgr.createNew(new PropertyId(parentUUID, propName));
+    private PropertyState createInstance(QName propName, NodeId parentId) {
+        PropertyState state = persistMgr.createNew(new PropertyId(parentId, propName));
         state.setStatus(ItemState.STATUS_NEW);
         state.addListener(this);
 
@@ -876,12 +877,12 @@
             return ntReg.getEffectiveNodeType(types).includesNodeType(QName.MIX_REFERENCEABLE);
         } catch (NodeTypeConflictException ntce) {
             String msg = "internal error: failed to build effective node type for node "
-                    + state.getId();
+                    + state.getNodeId();
             log.debug(msg);
             throw new ItemStateException(msg, ntce);
         } catch (NoSuchNodeTypeException nsnte) {
             String msg = "internal error: failed to build effective node type for node "
-                    + state.getId();
+                    + state.getNodeId();
             log.debug(msg);
             throw new ItemStateException(msg, nsnte);
         }
@@ -901,8 +902,8 @@
      *                        node references object
      * @throws ItemStateException if an error occurs
      */
-    protected void updateReferences(ChangeLog changes, 
-                                    VirtualItemStateProvider virtualProvider) 
+    protected void updateReferences(ChangeLog changes,
+                                    VirtualItemStateProvider virtualProvider)
             throws ItemStateException {
 
         // process added REFERENCE properties
@@ -915,16 +916,16 @@
                     // add the new 'reference'
                     InternalValue[] vals = prop.getValues();
                     for (int i = 0; vals != null && i < vals.length; i++) {
-                        String uuid = vals[i].toString();
-                        NodeReferencesId refsId = new NodeReferencesId(uuid);
-                        if (virtualProvider != null && 
+                        NodeReferencesId refsId = new NodeReferencesId(
+                                (UUID) vals[i].internalValue());
+                        if (virtualProvider != null &&
                                 virtualProvider.hasNodeReferences(refsId)) {
                             continue;
                         }
                         NodeReferences refs =
                                 getOrCreateNodeReferences(refsId, changes);
                         // add reference
-                        refs.addReference((PropertyId) prop.getId());
+                        refs.addReference(prop.getPropertyId());
                         // update change log
                         changes.modified(refs);
                     }
@@ -945,9 +946,9 @@
                     // remove the old 'reference' from the target
                     InternalValue[] vals = oldProp.getValues();
                     for (int i = 0; vals != null && i < vals.length; i++) {
-                        String uuid = vals[i].toString();
-                        NodeReferencesId refsId = new NodeReferencesId(uuid);
-                        if (virtualProvider != null && 
+                        NodeReferencesId refsId = new NodeReferencesId(
+                                (UUID) vals[i].internalValue());
+                        if (virtualProvider != null &&
                                 virtualProvider.hasNodeReferences(refsId)) {
                             continue;
                         }
@@ -958,7 +959,7 @@
                             refs = getNodeReferences(refsId);
                         }
                         // remove reference
-                        refs.removeReference((PropertyId) oldProp.getId());
+                        refs.removeReference(oldProp.getPropertyId());
                         // update change log
                         changes.modified(refs);
                     }
@@ -969,16 +970,16 @@
                     // add the new 'reference' to the target
                     InternalValue[] vals = newProp.getValues();
                     for (int i = 0; vals != null && i < vals.length; i++) {
-                        String uuid = vals[i].toString();
-                        NodeReferencesId refsId = new NodeReferencesId(uuid);
-                        if (virtualProvider != null && 
+                        NodeReferencesId refsId = new NodeReferencesId(
+                                (UUID) vals[i].internalValue());
+                        if (virtualProvider != null &&
                                 virtualProvider.hasNodeReferences(refsId)) {
                             continue;
                         }
                         NodeReferences refs =
                                 getOrCreateNodeReferences(refsId, changes);
                         // add reference
-                        refs.addReference((PropertyId) newProp.getId());
+                        refs.addReference(newProp.getPropertyId());
                         // update change log
                         changes.modified(refs);
                     }
@@ -996,9 +997,9 @@
                     // remove the 'reference' from the target
                     InternalValue[] vals = prop.getValues();
                     for (int i = 0; vals != null && i < vals.length; i++) {
-                        String uuid = vals[i].toString();
-                        NodeReferencesId refsId = new NodeReferencesId(uuid);
-                        if (virtualProvider != null && 
+                        NodeReferencesId refsId = new NodeReferencesId(
+                                (UUID) vals[i].internalValue());
+                        if (virtualProvider != null &&
                                 virtualProvider.hasNodeReferences(refsId)) {
                             continue;
                         }
@@ -1009,7 +1010,7 @@
                             refs = getNodeReferences(refsId);
                         }
                         // remove reference
-                        refs.removeReference((PropertyId) prop.getId());
+                        refs.removeReference(prop.getPropertyId());
                         // update change log
                         changes.modified(refs);
                     }
@@ -1072,7 +1073,7 @@
             if (state.isNode()) {
                 NodeState node = (NodeState) state;
                 if (isReferenceable(node)) {
-                    NodeReferencesId refsId = new NodeReferencesId(node.getUUID());
+                    NodeReferencesId refsId = new NodeReferencesId(node.getNodeId());
                     // either get node references from change log or
                     // load from persistence manager
                     NodeReferences refs = changes.get(refsId);
@@ -1084,9 +1085,9 @@
                     }
                     // in some versioning operations (such as restore) a node
                     // may actually be deleted and then again added with the
-                    // same UUID, i.e. the node is still referenceable.  
-                    if (refs.hasReferences() && !changes.has(node.getId())) {
-                        String msg = node.getId()
+                    // same UUID, i.e. the node is still referenceable.
+                    if (refs.hasReferences() && !changes.has(node.getNodeId())) {
+                        String msg = node.getNodeId()
                                 + ": the node cannot be removed because it is still being referenced.";
                         log.debug(msg);
                         throw new ReferentialIntegrityException(msg);

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/TransientItemStateManager.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/TransientItemStateManager.java?rev=378221&r1=378220&r2=378221&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/TransientItemStateManager.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/TransientItemStateManager.java Thu Feb 16 02:48:20 2006
@@ -122,42 +122,42 @@
     //------------------< methods for listing & querying state of cache/attic >
 
     /**
-     * @return
+     * @return <code>true</code> if this manager has any state.
      */
     boolean hasAnyItemStates() {
         return !transientStore.isEmpty();
     }
 
     /**
-     * @return
+     * @return <code>true</code> if this manager has any state in attic
      */
     boolean hasAnyItemStatesInAttic() {
         return !atticStore.isEmpty();
     }
 
     /**
-     * @return
+     * @return the number of entries
      */
     int getEntriesCount() {
         return transientStore.size();
     }
 
     /**
-     * @return
+     * @return the number of entries in attic
      */
     int getEntriesInAtticCount() {
         return atticStore.size();
     }
 
     /**
-     * @return
+     * @return an iterator over all entries
      */
     Iterator getEntries() {
         return transientStore.values().iterator();
     }
 
     /**
-     * @return
+     * @return an iterator over all entries in attic
      */
     Iterator getEntriesInAttic() {
         return atticStore.values().iterator();
@@ -165,19 +165,17 @@
 
     //----------------< methods for creating & discarding ItemState instances >
     /**
-     * @param uuid
+     * @param id
      * @param nodeTypeName
-     * @param parentUUID
+     * @param parentId
      * @param initialStatus
      * @return
      * @throws ItemStateException
      */
-    NodeState createNodeState(String uuid, QName nodeTypeName,
-                              String parentUUID, int initialStatus)
+    NodeState createNodeState(NodeId id, QName nodeTypeName,
+                              NodeId parentId, int initialStatus)
             throws ItemStateException {
 
-        NodeId id = new NodeId(uuid);
-
         // check map; synchronized to ensure an entry is not created twice.
         synchronized (transientStore) {
             if (transientStore.contains(id)) {
@@ -186,7 +184,7 @@
                 throw new ItemStateException(msg);
             }
 
-            NodeState state = new NodeState(uuid, nodeTypeName, parentUUID,
+            NodeState state = new NodeState(id, nodeTypeName, parentId,
                     initialStatus, true);
             // put transient state in the map
             transientStore.put(state);
@@ -203,7 +201,7 @@
     NodeState createNodeState(NodeState overlayedState, int initialStatus)
             throws ItemStateException {
 
-        ItemId id = overlayedState.getId();
+        ItemId id = overlayedState.getNodeId();
 
         // check map; synchronized to ensure an entry is not created twice.
         synchronized (transientStore) {
@@ -221,16 +219,16 @@
     }
 
     /**
-     * @param parentUUID
+     * @param parentId
      * @param propName
      * @param initialStatus
      * @return
      * @throws ItemStateException
      */
-    PropertyState createPropertyState(String parentUUID, QName propName, int initialStatus)
+    PropertyState createPropertyState(NodeId parentId, QName propName, int initialStatus)
             throws ItemStateException {
 
-        PropertyId id = new PropertyId(parentUUID, propName);
+        PropertyId id = new PropertyId(parentId, propName);
 
         // check map; synchronized to ensure an entry is not created twice.
         synchronized (transientStore) {
@@ -240,7 +238,8 @@
                 throw new ItemStateException(msg);
             }
 
-            PropertyState state = new PropertyState(propName, parentUUID, initialStatus, true);
+            PropertyState state = new PropertyState(
+                    new PropertyId(parentId, propName), initialStatus, true);
             // put transient state in the map
             transientStore.put(state);
             return state;
@@ -256,7 +255,7 @@
     PropertyState createPropertyState(PropertyState overlayedState, int initialStatus)
             throws ItemStateException {
 
-        PropertyId id = new PropertyId(overlayedState.getParentUUID(),
+        PropertyId id = new PropertyId(overlayedState.getParentId(),
                 overlayedState.getName());
 
         // check map; synchronized to ensure an entry is not created twice.

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/UpdatableItemStateManager.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/UpdatableItemStateManager.java?rev=378221&r1=378220&r2=378221&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/UpdatableItemStateManager.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/UpdatableItemStateManager.java Thu Feb 16 02:48:20 2006
@@ -17,6 +17,7 @@
 package org.apache.jackrabbit.core.state;
 
 import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.core.NodeId;
 
 import javax.jcr.ReferentialIntegrityException;
 
@@ -52,14 +53,14 @@
      * i.e. not yet existing state. Call {@link #store}
      * on the returned object to make it persistent.
      *
-     * @param uuid         node UUID
+     * @param id           the id of the node
      * @param nodeTypeName qualified node type name
-     * @param parentUUID   parent node's UUID
+     * @param parentId     parent node's id
      * @return a node state
      * @throws IllegalStateException if the manager is not in edit mode.
      */
-    NodeState createNew(String uuid, QName nodeTypeName,
-                        String parentUUID) throws IllegalStateException;
+    NodeState createNew(NodeId id, QName nodeTypeName,
+                        NodeId parentId) throws IllegalStateException;
 
     /**
      * Creates a {@link PropertyState} instance representing new,
@@ -67,11 +68,11 @@
      * on the returned object to make it persistent.
      *
      * @param propName   qualified property name
-     * @param parentUUID parent node UUID
+     * @param parentId   parent node Id
      * @return a property state
      * @throws IllegalStateException if the manager is not in edit mode.
      */
-    PropertyState createNew(QName propName, String parentUUID)
+    PropertyState createNew(QName propName, NodeId parentId)
             throws IllegalStateException;
 
     /**

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/XAItemStateManager.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/XAItemStateManager.java?rev=378221&r1=378220&r2=378221&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/XAItemStateManager.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/XAItemStateManager.java Thu Feb 16 02:48:20 2006
@@ -25,6 +25,7 @@
 import org.apache.jackrabbit.core.observation.EventStateCollectionFactory;
 import org.apache.jackrabbit.core.value.InternalValue;
 import org.apache.jackrabbit.core.virtual.VirtualItemStateProvider;
+import org.apache.jackrabbit.uuid.UUID;
 import org.apache.log4j.Logger;
 
 import javax.jcr.ReferentialIntegrityException;
@@ -339,9 +340,9 @@
                 if (prop.getType() == PropertyType.REFERENCE) {
                     InternalValue[] vals = prop.getValues();
                     for (int i = 0; vals != null && i < vals.length; i++) {
-                        String uuid = vals[i].toString();
+                        UUID uuid = (UUID) vals[i].internalValue();
                         NodeReferencesId refsId = new NodeReferencesId(uuid);
-                        addVirtualReference((PropertyId) prop.getId(), refsId);
+                        addVirtualReference(prop.getPropertyId(), refsId);
                     }
                 }
             }
@@ -355,17 +356,17 @@
                 if (oldProp.getType() == PropertyType.REFERENCE) {
                     InternalValue[] vals = oldProp.getValues();
                     for (int i = 0; vals != null && i < vals.length; i++) {
-                        String uuid = vals[i].toString();
+                        UUID uuid = (UUID) vals[i].internalValue();
                         NodeReferencesId refsId = new NodeReferencesId(uuid);
-                        removeVirtualReference((PropertyId) oldProp.getId(), refsId);
+                        removeVirtualReference(oldProp.getPropertyId(), refsId);
                     }
                 }
                 if (newProp.getType() == PropertyType.REFERENCE) {
                     InternalValue[] vals = newProp.getValues();
                     for (int i = 0; vals != null && i < vals.length; i++) {
-                        String uuid = vals[i].toString();
+                        UUID uuid = (UUID) vals[i].internalValue();
                         NodeReferencesId refsId = new NodeReferencesId(uuid);
-                        addVirtualReference((PropertyId) newProp.getId(), refsId);
+                        addVirtualReference(newProp.getPropertyId(), refsId);
                     }
                 }
             }
@@ -377,9 +378,9 @@
                 if (prop.getType() == PropertyType.REFERENCE) {
                     InternalValue[] vals = prop.getValues();
                     for (int i = 0; vals != null && i < vals.length; i++) {
-                        String uuid = vals[i].toString();
+                        UUID uuid = (UUID) vals[i].internalValue();
                         NodeReferencesId refsId = new NodeReferencesId(uuid);
-                        removeVirtualReference((PropertyId) prop.getId(), refsId);
+                        removeVirtualReference(prop.getPropertyId(), refsId);
                     }
                 }
             }

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/db/SimpleDbPersistenceManager.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/db/SimpleDbPersistenceManager.java?rev=378221&r1=378220&r2=378221&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/db/SimpleDbPersistenceManager.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/db/SimpleDbPersistenceManager.java Thu Feb 16 02:48:20 2006
@@ -568,7 +568,7 @@
 
         // check if insert or update
         boolean update = state.getStatus() != ItemState.STATUS_NEW;
-        //boolean update = exists((NodeId) state.getId());
+        //boolean update = exists(state.getId());
         PreparedStatement stmt = (update) ? nodeStateUpdate : nodeStateInsert;
 
         try {
@@ -581,13 +581,13 @@
             // not have to additionally synchronize on the preparedStatement
 
             stmt.setBytes(1, out.toByteArray());
-            stmt.setString(2, state.getId().toString());
+            stmt.setString(2, state.getNodeId().toString());
             stmt.executeUpdate();
 
             // there's no need to close a ByteArrayOutputStream
             //out.close();
         } catch (Exception e) {
-            String msg = "failed to write node state: " + state.getId();
+            String msg = "failed to write node state: " + state.getNodeId();
             log.error(msg, e);
             throw new ItemStateException(msg, e);
         } finally {
@@ -612,7 +612,7 @@
 
         // check if insert or update
         boolean update = state.getStatus() != ItemState.STATUS_NEW;
-        //boolean update = exists((PropertyId) state.getId());
+        //boolean update = exists(state.getId());
         PreparedStatement stmt = (update) ? propertyStateUpdate : propertyStateInsert;
 
         try {
@@ -625,13 +625,13 @@
             // not have to additionally synchronize on the preparedStatement
 
             stmt.setBytes(1, out.toByteArray());
-            stmt.setString(2, state.getId().toString());
+            stmt.setString(2, state.getPropertyId().toString());
             stmt.executeUpdate();
 
             // there's no need to close a ByteArrayOutputStream
             //out.close();
         } catch (Exception e) {
-            String msg = "failed to write property state: " + state.getId();
+            String msg = "failed to write property state: " + state.getPropertyId();
             log.error(msg, e);
             throw new ItemStateException(msg, e);
         } finally {
@@ -650,10 +650,10 @@
 
         PreparedStatement stmt = nodeStateDelete;
         try {
-            stmt.setString(1, state.getId().toString());
+            stmt.setString(1, state.getNodeId().toString());
             stmt.executeUpdate();
         } catch (Exception e) {
-            String msg = "failed to delete node state: " + state.getId();
+            String msg = "failed to delete node state: " + state.getNodeId();
             log.error(msg, e);
             throw new ItemStateException(msg, e);
         } finally {
@@ -681,7 +681,7 @@
                         // delete internal resource representation of BLOB value
                         blobVal.delete(true);
                         // also remove from BLOBStore
-                        String blobId = blobStore.createId((PropertyId) state.getId(), i);
+                        String blobId = blobStore.createId(state.getPropertyId(), i);
                         try {
                             blobStore.remove(blobId);
                         } catch (Exception e) {
@@ -694,10 +694,10 @@
 
         PreparedStatement stmt = propertyStateDelete;
         try {
-            stmt.setString(1, state.getId().toString());
+            stmt.setString(1, state.getPropertyId().toString());
             stmt.executeUpdate();
         } catch (Exception e) {
-            String msg = "failed to delete property state: " + state.getId();
+            String msg = "failed to delete property state: " + state.getPropertyId();
             log.error(msg, e);
             throw new ItemStateException(msg, e);
         } finally {

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/mem/InMemPersistenceManager.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/mem/InMemPersistenceManager.java?rev=378221&r1=378220&r2=378221&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/mem/InMemPersistenceManager.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/mem/InMemPersistenceManager.java Thu Feb 16 02:48:20 2006
@@ -426,11 +426,11 @@
             Serializer.serialize(state, out);
 
             // store in serialized format in map for better memory efficiency
-            stateStore.put(state.getId(), out.toByteArray());
+            stateStore.put(state.getNodeId(), out.toByteArray());
             // there's no need to close a ByteArrayOutputStream
             //out.close();
         } catch (Exception e) {
-            String msg = "failed to write node state: " + state.getId();
+            String msg = "failed to write node state: " + state.getNodeId();
             log.debug(msg);
             throw new ItemStateException(msg, e);
         }
@@ -451,11 +451,11 @@
             Serializer.serialize(state, out, blobStore);
 
             // store in serialized format in map for better memory efficiency
-            stateStore.put(state.getId(), out.toByteArray());
+            stateStore.put(state.getPropertyId(), out.toByteArray());
             // there's no need to close a ByteArrayOutputStream
             //out.close();
         } catch (Exception e) {
-            String msg = "failed to store property state: " + state.getId();
+            String msg = "failed to store property state: " + state.getPropertyId();
             log.debug(msg);
             throw new ItemStateException(msg, e);
         }
@@ -470,7 +470,7 @@
         }
 
         // remove node state
-        stateStore.remove(state.getId());
+        stateStore.remove(state.getNodeId());
     }
 
     /**
@@ -497,7 +497,7 @@
         }
 
         // remove property state
-        stateStore.remove(state.getId());
+        stateStore.remove(state.getPropertyId());
     }
 
     /**
@@ -512,7 +512,7 @@
 
         byte[] data = (byte[]) refsStore.get(id);
         if (data == null) {
-            throw new NoSuchItemStateException(id.getUUID());
+            throw new NoSuchItemStateException(id.toString());
         }
 
         ByteArrayInputStream in = new ByteArrayInputStream(data);

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/obj/ObjectPersistenceManager.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/obj/ObjectPersistenceManager.java?rev=378221&r1=378220&r2=378221&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/obj/ObjectPersistenceManager.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/obj/ObjectPersistenceManager.java Thu Feb 16 02:48:20 2006
@@ -36,7 +36,6 @@
 import org.apache.jackrabbit.core.state.util.Serializer;
 import org.apache.jackrabbit.core.value.BLOBFileValue;
 import org.apache.jackrabbit.core.value.InternalValue;
-import org.apache.jackrabbit.name.QName;
 import org.apache.log4j.Logger;
 
 import javax.jcr.PropertyType;
@@ -82,9 +81,9 @@
         initialized = false;
     }
 
-    private static String buildNodeFolderPath(String uuid) {
+    private static String buildNodeFolderPath(NodeId id) {
         StringBuffer sb = new StringBuffer();
-        char[] chars = uuid.toCharArray();
+        char[] chars = id.getUUID().toString().toCharArray();
         int cnt = 0;
         for (int i = 0; i < chars.length; i++) {
             if (chars[i] == '-') {
@@ -100,12 +99,12 @@
         return sb.toString();
     }
 
-    private static String buildPropFilePath(String parentUUID, QName propName) {
+    private static String buildPropFilePath(PropertyId id) {
         String fileName;
         try {
             MessageDigest md5 = MessageDigest.getInstance("MD5");
-            md5.update(propName.getNamespaceURI().getBytes());
-            md5.update(propName.getLocalName().getBytes());
+            md5.update(id.getName().getNamespaceURI().getBytes());
+            md5.update(id.getName().getLocalName().getBytes());
             byte[] bytes = md5.digest();
             char[] chars = new char[32];
             for (int i = 0, j = 0; i < 16; i++) {
@@ -119,15 +118,15 @@
             log.fatal(msg, nsae);
             throw new InternalError(msg + nsae);
         }
-        return buildNodeFolderPath(parentUUID) + FileSystem.SEPARATOR + fileName;
+        return buildNodeFolderPath(id.getParentId()) + FileSystem.SEPARATOR + fileName;
     }
 
-    private static String buildNodeFilePath(String uuid) {
-        return buildNodeFolderPath(uuid) + FileSystem.SEPARATOR + NODEFILENAME;
+    private static String buildNodeFilePath(NodeId id) {
+        return buildNodeFolderPath(id) + FileSystem.SEPARATOR + NODEFILENAME;
     }
 
-    private static String buildNodeReferencesFilePath(String uuid) {
-        return buildNodeFolderPath(uuid) + FileSystem.SEPARATOR + NODEREFSFILENAME;
+    private static String buildNodeReferencesFilePath(NodeReferencesId id) {
+        return buildNodeFolderPath(id) + FileSystem.SEPARATOR + NODEREFSFILENAME;
     }
 
     //---------------------------------------------------< PersistenceManager >
@@ -187,7 +186,7 @@
             throw new IllegalStateException("not initialized");
         }
 
-        String nodeFilePath = buildNodeFilePath(id.getUUID());
+        String nodeFilePath = buildNodeFilePath(id);
 
         try {
             if (!itemStateFS.isFile(nodeFilePath)) {
@@ -229,7 +228,7 @@
             throw new IllegalStateException("not initialized");
         }
 
-        String propFilePath = buildPropFilePath(id.getParentUUID(), id.getName());
+        String propFilePath = buildPropFilePath(id);
 
         try {
             if (!itemStateFS.isFile(propFilePath)) {
@@ -268,7 +267,7 @@
             throw new IllegalStateException("not initialized");
         }
 
-        String refsFilePath = buildNodeReferencesFilePath(id.getUUID());
+        String refsFilePath = buildNodeReferencesFilePath(id);
 
         try {
             if (!itemStateFS.isFile(refsFilePath)) {
@@ -305,8 +304,7 @@
             throw new IllegalStateException("not initialized");
         }
 
-        String uuid = state.getUUID();
-        String nodeFilePath = buildNodeFilePath(uuid);
+        String nodeFilePath = buildNodeFilePath(state.getNodeId());
         FileSystemResource nodeFile = new FileSystemResource(itemStateFS, nodeFilePath);
         try {
             nodeFile.makeParentDirs();
@@ -314,12 +312,11 @@
             try {
                 // serialize node state
                 Serializer.serialize(state, out);
-                return;
             } finally {
                 out.close();
             }
         } catch (Exception e) {
-            String msg = "failed to write node state: " + uuid;
+            String msg = "failed to write node state: " + state.getNodeId();
             log.debug(msg);
             throw new ItemStateException(msg, e);
         }
@@ -333,7 +330,7 @@
             throw new IllegalStateException("not initialized");
         }
 
-        String propFilePath = buildPropFilePath(state.getParentUUID(), state.getName());
+        String propFilePath = buildPropFilePath(state.getPropertyId());
         FileSystemResource propFile = new FileSystemResource(itemStateFS, propFilePath);
         try {
             propFile.makeParentDirs();
@@ -341,12 +338,11 @@
             try {
                 // serialize property state
                 Serializer.serialize(state, out, blobStore);
-                return;
             } finally {
                 out.close();
             }
         } catch (Exception e) {
-            String msg = "failed to store property state: " + state.getParentUUID() + "/" + state.getName();
+            String msg = "failed to store property state: " + state.getParentId() + "/" + state.getName();
             log.debug(msg);
             throw new ItemStateException(msg, e);
         }
@@ -360,8 +356,7 @@
             throw new IllegalStateException("not initialized");
         }
 
-        String uuid = refs.getTargetId().getUUID();
-        String refsFilePath = buildNodeReferencesFilePath(uuid);
+        String refsFilePath = buildNodeReferencesFilePath(refs.getTargetId());
         FileSystemResource refsFile = new FileSystemResource(itemStateFS, refsFilePath);
         try {
             refsFile.makeParentDirs();
@@ -372,7 +367,7 @@
                 out.close();
             }
         } catch (Exception e) {
-            String msg = "failed to store references: " + uuid;
+            String msg = "failed to store references: " + refs.getTargetId();
             log.debug(msg);
             throw new ItemStateException(msg, e);
         }
@@ -386,8 +381,7 @@
             throw new IllegalStateException("not initialized");
         }
 
-        String uuid = state.getUUID();
-        String nodeFilePath = buildNodeFilePath(uuid);
+        String nodeFilePath = buildNodeFilePath(state.getNodeId());
         FileSystemResource nodeFile = new FileSystemResource(itemStateFS, nodeFilePath);
         try {
             if (nodeFile.exists()) {
@@ -395,7 +389,7 @@
                 nodeFile.delete(true);
             }
         } catch (FileSystemException fse) {
-            String msg = "failed to delete node state: " + uuid;
+            String msg = "failed to delete node state: " + state.getNodeId();
             log.debug(msg);
             throw new ItemStateException(msg, fse);
         }
@@ -424,7 +418,7 @@
             }
         }
         // delete property file
-        String propFilePath = buildPropFilePath(state.getParentUUID(), state.getName());
+        String propFilePath = buildPropFilePath(state.getPropertyId());
         FileSystemResource propFile = new FileSystemResource(itemStateFS, propFilePath);
         try {
             if (propFile.exists()) {
@@ -432,7 +426,7 @@
                 propFile.delete(true);
             }
         } catch (FileSystemException fse) {
-            String msg = "failed to delete property state: " + state.getParentUUID() + "/" + state.getName();
+            String msg = "failed to delete property state: " + state.getParentId() + "/" + state.getName();
             log.debug(msg);
             throw new ItemStateException(msg, fse);
         }
@@ -446,8 +440,7 @@
             throw new IllegalStateException("not initialized");
         }
 
-        String uuid = refs.getTargetId().getUUID();
-        String refsFilePath = buildNodeReferencesFilePath(uuid);
+        String refsFilePath = buildNodeReferencesFilePath(refs.getTargetId());
         FileSystemResource refsFile = new FileSystemResource(itemStateFS, refsFilePath);
         try {
             if (refsFile.exists()) {
@@ -455,7 +448,7 @@
                 refsFile.delete(true);
             }
         } catch (FileSystemException fse) {
-            String msg = "failed to delete references: " + uuid;
+            String msg = "failed to delete references: " + refs.getTargetId();
             log.debug(msg);
             throw new ItemStateException(msg, fse);
         }
@@ -470,7 +463,7 @@
         }
 
         try {
-            String propFilePath = buildPropFilePath(id.getParentUUID(), id.getName());
+            String propFilePath = buildPropFilePath(id);
             FileSystemResource propFile = new FileSystemResource(itemStateFS, propFilePath);
             return propFile.exists();
         } catch (FileSystemException fse) {
@@ -489,7 +482,7 @@
         }
 
         try {
-            String nodeFilePath = buildNodeFilePath(id.getUUID());
+            String nodeFilePath = buildNodeFilePath(id);
             FileSystemResource nodeFile = new FileSystemResource(itemStateFS, nodeFilePath);
             return nodeFile.exists();
         } catch (FileSystemException fse) {
@@ -510,8 +503,7 @@
         }
 
         try {
-            String uuid = id.getUUID();
-            String refsFilePath = buildNodeReferencesFilePath(uuid);
+            String refsFilePath = buildNodeReferencesFilePath(id);
             FileSystemResource refsFile = new FileSystemResource(itemStateFS, refsFilePath);
             return refsFile.exists();
         } catch (FileSystemException fse) {

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/util/FileSystemBLOBStore.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/util/FileSystemBLOBStore.java?rev=378221&r1=378220&r2=378221&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/util/FileSystemBLOBStore.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/util/FileSystemBLOBStore.java Thu Feb 16 02:48:20 2006
@@ -52,7 +52,7 @@
     public String createId(PropertyId id, int index) {
         // the blobId is a file system path
         StringBuffer sb = new StringBuffer();
-        char[] chars = id.getParentUUID().toCharArray();
+        char[] chars = id.getParentId().getUUID().toString().toCharArray();
         int cnt = 0;
         for (int i = 0; i < chars.length; i++) {
             if (chars[i] == '-') {
@@ -96,7 +96,9 @@
                 out.write(buffer, 0, read);
             }
         } finally {
-            out.close();
+            if (out != null) {
+                out.close();
+            }
         }
     }
 

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/util/Serializer.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/util/Serializer.java?rev=378221&r1=378220&r2=378221&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/util/Serializer.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/util/Serializer.java Thu Feb 16 02:48:20 2006
@@ -17,6 +17,7 @@
 package org.apache.jackrabbit.core.state.util;
 
 import org.apache.jackrabbit.core.PropertyId;
+import org.apache.jackrabbit.core.NodeId;
 import org.apache.jackrabbit.core.fs.FileSystemResource;
 import org.apache.jackrabbit.core.nodetype.NodeDefId;
 import org.apache.jackrabbit.core.nodetype.PropDefId;
@@ -74,10 +75,10 @@
         // primaryType
         out.writeUTF(state.getNodeTypeName().toString());
         // parentUUID
-        if (state.getParentUUID() == null) {
+        if (state.getParentId() == null) {
             out.write(NULL_UUID_PLACEHOLDER_BYTES);
         } else {
-            out.write(UUID.stringToBytes(state.getParentUUID()));
+            out.write(state.getParentId().getUUID().getRawBytes());
         }
         // definitionId
         out.writeUTF(state.getDefinitionId().toString());
@@ -102,7 +103,7 @@
         for (Iterator iter = c.iterator(); iter.hasNext();) {
             NodeState.ChildNodeEntry entry = (NodeState.ChildNodeEntry) iter.next();
             out.writeUTF(entry.getName().toString());   // name
-            out.write(UUID.stringToBytes(entry.getUUID()));    // uuid
+            out.write(entry.getId().getUUID().getRawBytes());    // uuid
         }
     }
 
@@ -126,7 +127,7 @@
         byte[] uuidBytes = new byte[UUID.UUID_BYTE_LENGTH];
         in.readFully(uuidBytes);
         if (!Arrays.equals(uuidBytes, NULL_UUID_PLACEHOLDER_BYTES)) {
-            state.setParentUUID(UUID.bytesToString(uuidBytes));
+            state.setParentId(new NodeId(new UUID(uuidBytes)));
         }
         // definitionId
         s = in.readUTF();
@@ -154,7 +155,7 @@
             QName name = QName.valueOf(in.readUTF());    // name
             // uuid
             in.readFully(uuidBytes);
-            state.addChildNodeEntry(name, UUID.bytesToString(uuidBytes));
+            state.addChildNodeEntry(name, new NodeId(new UUID(uuidBytes)));
         }
     }
 
@@ -194,7 +195,7 @@
                 // put binary value in BLOB store
                 BLOBFileValue blobVal = (BLOBFileValue) val.internalValue();
                 InputStream in = blobVal.getStream();
-                String blobId = blobStore.createId((PropertyId) state.getId(), i);
+                String blobId = blobStore.createId(state.getPropertyId(), i);
                 try {
                     blobStore.put(blobId, in, blobVal.getLength());
                 } finally {

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/xml/XMLPersistenceManager.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/xml/XMLPersistenceManager.java?rev=378221&r1=378220&r2=378221&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/xml/XMLPersistenceManager.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/xml/XMLPersistenceManager.java Thu Feb 16 02:48:20 2006
@@ -127,9 +127,9 @@
         initialized = false;
     }
 
-    private String buildNodeFolderPath(String uuid) {
+    private String buildNodeFolderPath(NodeId id) {
         StringBuffer sb = new StringBuffer();
-        char[] chars = uuid.toCharArray();
+        char[] chars = id.getUUID().toString().toCharArray();
         int cnt = 0;
         for (int i = 0; i < chars.length; i++) {
             if (chars[i] == '-') {
@@ -145,12 +145,12 @@
         return sb.toString();
     }
 
-    private String buildPropFilePath(String parentUUID, QName propName) {
+    private String buildPropFilePath(PropertyId id) {
         String fileName;
         try {
             MessageDigest md5 = MessageDigest.getInstance("MD5");
-            md5.update(propName.getNamespaceURI().getBytes());
-            md5.update(propName.getLocalName().getBytes());
+            md5.update(id.getName().getNamespaceURI().getBytes());
+            md5.update(id.getName().getLocalName().getBytes());
             byte[] bytes = md5.digest();
             char[] chars = new char[32];
             for (int i = 0, j = 0; i < 16; i++) {
@@ -164,15 +164,15 @@
             log.fatal(msg, nsae);
             throw new InternalError(msg + nsae);
         }
-        return buildNodeFolderPath(parentUUID) + "/" + fileName;
+        return buildNodeFolderPath(id.getParentId()) + "/" + fileName;
     }
 
-    private String buildNodeFilePath(String uuid) {
-        return buildNodeFolderPath(uuid) + "/" + NODEFILENAME;
+    private String buildNodeFilePath(NodeId id) {
+        return buildNodeFolderPath(id) + "/" + NODEFILENAME;
     }
 
-    private String buildNodeReferencesFilePath(String uuid) {
-        return buildNodeFolderPath(uuid) + "/" + NODEREFSFILENAME;
+    private String buildNodeReferencesFilePath(NodeId id) {
+        return buildNodeFolderPath(id) + "/" + NODEREFSFILENAME;
     }
 
     private void readState(DOMWalker walker, NodeState state)
@@ -185,7 +185,7 @@
             throw new ItemStateException(msg);
         }
         // check uuid
-        if (!state.getUUID().equals(walker.getAttribute(UUID_ATTRIBUTE))) {
+        if (!state.getNodeId().getUUID().toString().equals(walker.getAttribute(UUID_ATTRIBUTE))) {
             String msg = "invalid serialized state: uuid mismatch";
             log.debug(msg);
             throw new ItemStateException(msg);
@@ -203,7 +203,7 @@
         // primary parent
         String parentUUID = walker.getAttribute(PARENTUUID_ATTRIBUTE);
         if (parentUUID.length() > 0) {
-            state.setParentUUID(parentUUID);
+            state.setParentId(NodeId.valueOf(parentUUID));
         }
 
         // definition id
@@ -241,7 +241,7 @@
             while (walker.iterateElements(NODE_ELEMENT)) {
                 String childName = walker.getAttribute(NAME_ATTRIBUTE);
                 String childUUID = walker.getAttribute(UUID_ATTRIBUTE);
-                state.addChildNodeEntry(QName.valueOf(childName), childUUID);
+                state.addChildNodeEntry(QName.valueOf(childName), NodeId.valueOf(childUUID));
             }
             walker.leaveElement();
         }
@@ -263,8 +263,8 @@
             throw new ItemStateException(msg);
         }
         // check parentUUID
-        String parentUUID = walker.getAttribute(PARENTUUID_ATTRIBUTE);
-        if (!parentUUID.equals(state.getParentUUID())) {
+        NodeId parentId = NodeId.valueOf(walker.getAttribute(PARENTUUID_ATTRIBUTE));
+        if (!parentId.equals(state.getParentId())) {
             String msg = "invalid serialized state: parentUUID mismatch";
             log.debug(msg);
             throw new ItemStateException(msg);
@@ -341,7 +341,7 @@
                     }
                 } else {
                     // empty non-STRING value
-                    log.warn(state.getId() + ": ignoring empty value of type "
+                    log.warn(state.getPropertyId() + ": ignoring empty value of type "
                             + PropertyType.nameFromValue(type));
                 }
             }
@@ -433,7 +433,7 @@
         }
 
         Exception e = null;
-        String nodeFilePath = buildNodeFilePath(id.getUUID());
+        String nodeFilePath = buildNodeFilePath(id);
 
         try {
             if (!itemStateFS.isFile(nodeFilePath)) {
@@ -475,7 +475,7 @@
         }
 
         Exception e = null;
-        String propFilePath = buildPropFilePath(id.getParentUUID(), id.getName());
+        String propFilePath = buildPropFilePath(id);
 
         try {
             if (!itemStateFS.isFile(propFilePath)) {
@@ -510,8 +510,8 @@
             throw new IllegalStateException("not initialized");
         }
 
-        String uuid = state.getUUID();
-        String nodeFilePath = buildNodeFilePath(uuid);
+        NodeId id = state.getNodeId();
+        String nodeFilePath = buildNodeFilePath(id);
         FileSystemResource nodeFile = new FileSystemResource(itemStateFS, nodeFilePath);
         try {
             nodeFile.makeParentDirs();
@@ -530,8 +530,8 @@
 
                 writer.write("<?xml version=\"1.0\" encoding=\"" + encoding + "\"?>\n");
                 writer.write("<" + NODE_ELEMENT + " "
-                        + UUID_ATTRIBUTE + "=\"" + state.getUUID() + "\" "
-                        + PARENTUUID_ATTRIBUTE + "=\"" + (state.getParentUUID() == null ? "" : state.getParentUUID()) + "\" "
+                        + UUID_ATTRIBUTE + "=\"" + id.getUUID() + "\" "
+                        + PARENTUUID_ATTRIBUTE + "=\"" + (state.getParentId() == null ? "" : state.getParentId().getUUID().toString()) + "\" "
                         + DEFINITIONID_ATTRIBUTE + "=\"" + state.getDefinitionId().toString() + "\" "
                         + MODCOUNT_ATTRIBUTE + "=\"" + state.getModCount() + "\" "
                         + NODETYPE_ATTRIBUTE + "=\"" + Text.encodeIllegalXMLCharacters(state.getNodeTypeName().toString()) + "\">\n");
@@ -564,7 +564,7 @@
                     NodeState.ChildNodeEntry entry = (NodeState.ChildNodeEntry) iter.next();
                     writer.write("\t\t<" + NODE_ELEMENT + " "
                             + NAME_ATTRIBUTE + "=\"" + Text.encodeIllegalXMLCharacters(entry.getName().toString()) + "\" "
-                            + UUID_ATTRIBUTE + "=\"" + entry.getUUID() + "\">\n");
+                            + UUID_ATTRIBUTE + "=\"" + entry.getId().getUUID().toString() + "\">\n");
                     writer.write("\t\t</" + NODE_ELEMENT + ">\n");
                 }
                 writer.write("\t</" + NODES_ELEMENT + ">\n");
@@ -574,7 +574,7 @@
                 writer.close();
             }
         } catch (Exception e) {
-            String msg = "failed to write node state: " + uuid;
+            String msg = "failed to write node state: " + id;
             log.debug(msg);
             throw new ItemStateException(msg, e);
         }
@@ -588,7 +588,7 @@
             throw new IllegalStateException("not initialized");
         }
 
-        String propFilePath = buildPropFilePath(state.getParentUUID(), state.getName());
+        String propFilePath = buildPropFilePath(state.getPropertyId());
         FileSystemResource propFile = new FileSystemResource(itemStateFS, propFilePath);
         try {
             propFile.makeParentDirs();
@@ -618,7 +618,7 @@
                 writer.write("<?xml version=\"1.0\" encoding=\"" + encoding + "\"?>\n");
                 writer.write("<" + PROPERTY_ELEMENT + " "
                         + NAME_ATTRIBUTE + "=\"" + Text.encodeIllegalXMLCharacters(state.getName().toString()) + "\" "
-                        + PARENTUUID_ATTRIBUTE + "=\"" + state.getParentUUID() + "\" "
+                        + PARENTUUID_ATTRIBUTE + "=\"" + state.getParentId().getUUID() + "\" "
                         + MULTIVALUED_ATTRIBUTE + "=\"" + Boolean.toString(state.isMultiValued()) + "\" "
                         + DEFINITIONID_ATTRIBUTE + "=\"" + state.getDefinitionId().toString() + "\" "
                         + MODCOUNT_ATTRIBUTE + "=\"" + state.getModCount() + "\" "
@@ -636,7 +636,7 @@
                                 // put binary value in BLOB store
                                 BLOBFileValue blobVal = (BLOBFileValue) val.internalValue();
                                 InputStream in = blobVal.getStream();
-                                String blobId = blobStore.createId((PropertyId) state.getId(), i);
+                                String blobId = blobStore.createId(state.getPropertyId(), i);
                                 try {
                                     blobStore.put(blobId, in, blobVal.getLength());
                                 } finally {
@@ -683,7 +683,7 @@
                 writer.close();
             }
         } catch (Exception e) {
-            String msg = "failed to store property state: " + state.getParentUUID() + "/" + state.getName();
+            String msg = "failed to store property state: " + state.getParentId() + "/" + state.getName();
             log.debug(msg);
             throw new ItemStateException(msg, e);
         }
@@ -697,8 +697,8 @@
             throw new IllegalStateException("not initialized");
         }
 
-        String uuid = state.getUUID();
-        String nodeFilePath = buildNodeFilePath(uuid);
+        NodeId id = state.getNodeId();
+        String nodeFilePath = buildNodeFilePath(id);
         FileSystemResource nodeFile = new FileSystemResource(itemStateFS, nodeFilePath);
         try {
             if (nodeFile.exists()) {
@@ -706,7 +706,7 @@
                 nodeFile.delete(true);
             }
         } catch (FileSystemException fse) {
-            String msg = "failed to delete node state: " + uuid;
+            String msg = "failed to delete node state: " + id;
             log.debug(msg);
             throw new ItemStateException(msg, fse);
         }
@@ -735,7 +735,7 @@
             }
         }
         // delete property file
-        String propFilePath = buildPropFilePath(state.getParentUUID(), state.getName());
+        String propFilePath = buildPropFilePath(state.getPropertyId());
         FileSystemResource propFile = new FileSystemResource(itemStateFS, propFilePath);
         try {
             if (propFile.exists()) {
@@ -743,7 +743,7 @@
                 propFile.delete(true);
             }
         } catch (FileSystemException fse) {
-            String msg = "failed to delete property state: " + state.getParentUUID() + "/" + state.getName();
+            String msg = "failed to delete property state: " + state.getParentId() + "/" + state.getName();
             log.debug(msg);
             throw new ItemStateException(msg, fse);
         }
@@ -760,12 +760,10 @@
         }
 
         Exception e = null;
-        String uuid = id.getUUID();
-
-        String refsFilePath = buildNodeReferencesFilePath(uuid);
+        String refsFilePath = buildNodeReferencesFilePath(id);
         try {
             if (!itemStateFS.isFile(refsFilePath)) {
-                throw new NoSuchItemStateException(uuid);
+                throw new NoSuchItemStateException(id.toString());
             }
 
             InputStream in = itemStateFS.getInputStream(refsFilePath);
@@ -785,7 +783,7 @@
             e = fse;
             // fall through
         }
-        String msg = "failed to load references: " + uuid;
+        String msg = "failed to load references: " + id;
         log.debug(msg);
         throw new ItemStateException(msg, e);
     }
@@ -798,8 +796,8 @@
             throw new IllegalStateException("not initialized");
         }
 
-        String uuid = refs.getUUID();
-        String refsFilePath = buildNodeReferencesFilePath(uuid);
+        NodeReferencesId id = refs.getTargetId();
+        String refsFilePath = buildNodeReferencesFilePath(id);
         FileSystemResource refsFile = new FileSystemResource(itemStateFS, refsFilePath);
         try {
             refsFile.makeParentDirs();
@@ -830,7 +828,7 @@
                 writer.close();
             }
         } catch (Exception e) {
-            String msg = "failed to store references: " + uuid;
+            String msg = "failed to store references: " + id;
             log.debug(msg);
             throw new ItemStateException(msg, e);
         }
@@ -844,8 +842,8 @@
             throw new IllegalStateException("not initialized");
         }
 
-        String uuid = refs.getUUID();
-        String refsFilePath = buildNodeReferencesFilePath(uuid);
+        NodeReferencesId id = refs.getTargetId();
+        String refsFilePath = buildNodeReferencesFilePath(id);
         FileSystemResource refsFile = new FileSystemResource(itemStateFS, refsFilePath);
         try {
             if (refsFile.exists()) {
@@ -853,7 +851,7 @@
                 refsFile.delete(true);
             }
         } catch (FileSystemException fse) {
-            String msg = "failed to delete references: " + uuid;
+            String msg = "failed to delete references: " + id;
             log.debug(msg);
             throw new ItemStateException(msg, fse);
         }
@@ -868,7 +866,7 @@
         }
 
         try {
-            String nodeFilePath = buildNodeFilePath(id.getUUID());
+            String nodeFilePath = buildNodeFilePath(id);
             FileSystemResource nodeFile = new FileSystemResource(itemStateFS, nodeFilePath);
             return nodeFile.exists();
         } catch (FileSystemException fse) {
@@ -887,7 +885,7 @@
         }
 
         try {
-            String propFilePath = buildPropFilePath(id.getParentUUID(), id.getName());
+            String propFilePath = buildPropFilePath(id);
             FileSystemResource propFile = new FileSystemResource(itemStateFS, propFilePath);
             return propFile.exists();
         } catch (FileSystemException fse) {
@@ -908,8 +906,7 @@
         }
 
         try {
-            String uuid = id.getUUID();
-            String refsFilePath = buildNodeReferencesFilePath(uuid);
+            String refsFilePath = buildNodeReferencesFilePath(id);
             FileSystemResource refsFile = new FileSystemResource(itemStateFS, refsFilePath);
             return refsFile.exists();
         } catch (FileSystemException fse) {

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/util/ReferenceChangeTracker.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/util/ReferenceChangeTracker.java?rev=378221&r1=378220&r2=378221&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/util/ReferenceChangeTracker.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/util/ReferenceChangeTracker.java Thu Feb 16 02:48:20 2006
@@ -16,6 +16,8 @@
  */
 package org.apache.jackrabbit.core.util;
 
+import org.apache.jackrabbit.uuid.UUID;
+
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -52,12 +54,12 @@
 
     /**
      * Store the given uuid mapping for later lookup using
-     * <code>{@link #getMappedUUID(String)}</code>.
+     * <code>{@link #getMappedUUID(UUID)}</code>.
      *
      * @param oldUUID old uuid
      * @param newUUID new uuid
      */
-    public void mappedUUID(String oldUUID, String newUUID) {
+    public void mappedUUID(UUID oldUUID, UUID newUUID) {
         uuidMap.put(oldUUID, newUUID);
     }
 
@@ -77,10 +79,10 @@
      *
      * @param oldUUID old uuid
      * @return mapped new uuid or <code>null</code> if no such mapping exists
-     * @see #mappedUUID(String, String)
+     * @see #mappedUUID(UUID, UUID)
      */
-    public String getMappedUUID(String oldUUID) {
-        return (String) uuidMap.get(oldUUID);
+    public UUID getMappedUUID(UUID oldUUID) {
+        return (UUID) uuidMap.get(oldUUID);
     }
 
     /**

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/AbstractVersion.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/AbstractVersion.java?rev=378221&r1=378220&r2=378221&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/AbstractVersion.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/AbstractVersion.java Thu Feb 16 02:48:20 2006
@@ -82,7 +82,7 @@
         InternalVersion[] suc = getInternalVersion().getSuccessors();
         Version[] ret = new Version[suc.length];
         for (int i = 0; i < suc.length; i++) {
-            ret[i] = (Version) session.getNodeByUUID(suc[i].getId());
+            ret[i] = (Version) session.getNodeById(suc[i].getId());
         }
         return ret;
     }
@@ -95,7 +95,7 @@
         InternalVersion[] pred = getInternalVersion().getPredecessors();
         Version[] ret = new Version[pred.length];
         for (int i = 0; i < pred.length; i++) {
-            ret[i] = (Version) session.getNodeByUUID(pred[i].getId());
+            ret[i] = (Version) session.getNodeById(pred[i].getId());
         }
         return ret;
     }
@@ -104,7 +104,7 @@
      * {@inheritDoc}
      */
     public String getUUID() throws UnsupportedRepositoryOperationException, RepositoryException {
-        return getInternalVersion().getId();
+        return getInternalVersion().getId().getUUID().toString();
     }
 
     /**

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/AbstractVersionHistory.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/AbstractVersionHistory.java?rev=378221&r1=378220&r2=378221&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/AbstractVersionHistory.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/AbstractVersionHistory.java Thu Feb 16 02:48:20 2006
@@ -76,7 +76,7 @@
      * @see javax.jcr.version.VersionHistory#getRootVersion()
      */
     public Version getRootVersion() throws RepositoryException {
-        return (Version) session.getNodeByUUID(
+        return (Version) session.getNodeById(
                 getInternalVersionHistory().getRootVersion().getId());
     }
 
@@ -99,7 +99,7 @@
             if (v == null) {
                 throw new VersionException("No version with name '" + versionName + "' exists in this version history.");
             }
-            return (Version) session.getNodeByUUID(v.getId());
+            return (Version) session.getNodeById(v.getId());
         } catch (IllegalNameException e) {
             throw new VersionException(e);
         } catch (UnknownPrefixException e) {
@@ -117,7 +117,7 @@
             if (v == null) {
                 throw new VersionException("No version with label '" + label + "' exists in this version history.");
             }
-            return (Version) session.getNodeByUUID(v.getId());
+            return (Version) session.getNodeById(v.getId());
         } catch (IllegalNameException e) {
             throw new VersionException(e);
         } catch (UnknownPrefixException e) {
@@ -247,7 +247,7 @@
      */
     public String getUUID()
             throws UnsupportedRepositoryOperationException, RepositoryException {
-        return getInternalVersionHistory().getId();
+        return getInternalVersionHistory().getId().getUUID().toString();
     }
 
     /**
@@ -268,12 +268,10 @@
     }
 
     /**
-     * Returns the UUID of the node that was versioned.
-     *
-     * @return
+     * {@inheritDoc}
      */
     public String getVersionableUUID() throws RepositoryException {
-        return getInternalVersionHistory().getVersionableUUID();
+        return getInternalVersionHistory().getVersionableUUID().toString();
     }
 
     /**

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/AbstractVersionManager.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/AbstractVersionManager.java?rev=378221&r1=378220&r2=378221&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/AbstractVersionManager.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/AbstractVersionManager.java Thu Feb 16 02:48:20 2006
@@ -17,6 +17,8 @@
 package org.apache.jackrabbit.core.version;
 
 import org.apache.jackrabbit.core.NodeImpl;
+import org.apache.jackrabbit.core.NodeId;
+import org.apache.jackrabbit.core.SessionImpl;
 import org.apache.jackrabbit.core.state.ItemStateException;
 import org.apache.jackrabbit.core.state.LocalItemStateManager;
 import org.apache.jackrabbit.core.state.NodeState;
@@ -56,30 +58,30 @@
     /**
      * {@inheritDoc}
      */
-    public InternalVersion getVersion(String uuid) throws RepositoryException {
-        return (InternalVersion) getItem(uuid);
+    public InternalVersion getVersion(NodeId id) throws RepositoryException {
+        return (InternalVersion) getItem(id);
     }
 
     /**
      * {@inheritDoc}
      */
-    public InternalVersionHistory getVersionHistory(String uuid)
+    public InternalVersionHistory getVersionHistory(NodeId id)
             throws RepositoryException {
 
-        return (InternalVersionHistory) getItem(uuid);
+        return (InternalVersionHistory) getItem(id);
     }
 
     /**
      * {@inheritDoc}
      */
-    public boolean hasVersionHistory(String id) {
+    public boolean hasVersionHistory(NodeId id) {
         return hasItem(id);
     }
 
     /**
      * {@inheritDoc}
      */
-    public boolean hasVersion(String id) {
+    public boolean hasVersion(NodeId id) {
         return hasItem(id);
     }
 
@@ -91,30 +93,30 @@
     public VersionHistory getVersionHistory(Session session, NodeState node)
             throws RepositoryException {
 
-        String vhId = getVersionHistoryId(node);
+        NodeId vhId = getVersionHistoryId(node);
         if (vhId == null) {
             return null;
         }
-        return (VersionHistory) session.getNodeByUUID(vhId);
+        return (VersionHistory) ((SessionImpl) session).getNodeById(vhId);
     }
 
     /**
      * Returns the item with the given persistent id. Subclass responsibility.
-     * @param uuid uuid of item
+     * @param id the id of the item
      * @return version item
      * @throws RepositoryException if an error occurs
      */
-    protected abstract InternalVersionItem getItem(String uuid)
+    protected abstract InternalVersionItem getItem(NodeId id)
             throws RepositoryException;
 
     /**
      * Return a flag indicating if the item specified exists.
      * Subclass responsibility.
-     * @param uuid uuid of item
+     * @param id the id of the item
      * @return <code>true</code> if the item exists;
      *         <code>false</code> otherwise
      */
-    protected abstract boolean hasItem(String uuid);
+    protected abstract boolean hasItem(NodeId id);
 
     /**
      * Returns the item references that reference the given version item.
@@ -144,7 +146,7 @@
 
         try {
             // create deep path
-            String uuid = node.getUUID();
+            String uuid = node.getNodeId().getUUID().toString();
             NodeStateEx root = historyRoot;
             for (int i = 0; i < 3; i++) {
                 QName name = new QName(QName.NS_DEFAULT_URI, uuid.substring(i * 2, i * 2 + 2));
@@ -162,7 +164,7 @@
 
             // create new history node in the persistent state
             InternalVersionHistoryImpl hist = InternalVersionHistoryImpl.create(
-                    this, root, UUID.randomUUID().toString(), historyNodeName, node);
+                    this, root, new NodeId(UUID.randomUUID()), historyNodeName, node);
 
             // end update
             stateMgr.update();
@@ -190,10 +192,10 @@
      *         or <code>null</code> if that node doesn't have a version history.
      * @throws javax.jcr.RepositoryException if an error occurs
      */
-    String getVersionHistoryId(NodeState node) throws RepositoryException {
+    NodeId getVersionHistoryId(NodeState node) throws RepositoryException {
 
         // build and traverse path
-        String uuid = node.getUUID();
+        String uuid = node.getNodeId().getUUID().toString();
         NodeStateEx n = historyRoot;
         for (int i = 0; i < 3; i++) {
             QName name = new QName(QName.NS_DEFAULT_URI, uuid.substring(i * 2, i * 2 + 2));
@@ -206,7 +208,7 @@
         if (!n.hasNode(historyNodeName)) {
             return null;
         }
-        return n.getNode(historyNodeName, 1).getUUID();
+        return n.getNode(historyNodeName, 1).getNodeId();
     }
 
     /**
@@ -224,7 +226,7 @@
         Value[] values = node.getProperty(QName.JCR_PREDECESSORS).getValues();
         InternalVersion[] preds = new InternalVersion[values.length];
         for (int i = 0; i < values.length; i++) {
-            preds[i] = history.getVersion(values[i].getString());
+            preds[i] = history.getVersion(NodeId.valueOf(values[i].getString()));
         }
 
         // 0.1 search a predecessor, suitable for generating the new name

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/GenericVersionSelector.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/GenericVersionSelector.java?rev=378221&r1=378220&r2=378221&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/GenericVersionSelector.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/GenericVersionSelector.java Thu Feb 16 02:48:20 2006
@@ -80,7 +80,7 @@
     /**
      * Returns the name hint.
      *
-     * @return
+     * @return the name hint.
      */
     public String getName() {
         return name;
@@ -98,7 +98,7 @@
     /**
      * Returns the label hint
      *
-     * @return
+     * @return the label hint.
      */
     public String getLabel() {
         return label;
@@ -116,7 +116,7 @@
     /**
      * Returns the date hint
      *
-     * @return
+     * @return the date hint.
      */
     public Calendar getDate() {
         return date;
@@ -135,7 +135,7 @@
      * Returns the flag, if the latest version should be selected, if no
      * version can be found using the given hint.
      *
-     * @return
+     * @return <code>true</code> if it returns latest.
      */
     public boolean isReturnLatest() {
         return returnLatest;

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenNode.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenNode.java?rev=378221&r1=378220&r2=378221&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenNode.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenNode.java Thu Feb 16 02:48:20 2006
@@ -18,6 +18,7 @@
 
 import org.apache.jackrabbit.core.state.PropertyState;
 import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.uuid.UUID;
 
 import javax.jcr.version.VersionException;
 
@@ -49,7 +50,7 @@
      *
      * @return the frozen uuid.
      */
-    String getFrozenUUID();
+    UUID getFrozenUUID();
 
     /**
      * Returns the name of frozen primary type.
@@ -68,8 +69,9 @@
     /**
      * Checks if this frozen node has the frozen version history
      * @param uuid
-     * @return
+     * @return <code>true</code> if this node has the history;
+     *         <code>false</code> otherwise.
      */
-    boolean hasFrozenHistory(String uuid);
+    boolean hasFrozenHistory(UUID uud);
 
 }

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenNodeImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenNodeImpl.java?rev=378221&r1=378220&r2=378221&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenNodeImpl.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenNodeImpl.java Thu Feb 16 02:48:20 2006
@@ -18,6 +18,7 @@
 
 import org.apache.jackrabbit.core.NodeImpl;
 import org.apache.jackrabbit.core.PropertyImpl;
+import org.apache.jackrabbit.core.NodeId;
 import org.apache.jackrabbit.core.nodetype.NodeTypeImpl;
 import org.apache.jackrabbit.core.state.ItemStateException;
 import org.apache.jackrabbit.core.state.NodeState;
@@ -72,7 +73,7 @@
     /**
      * the frozen uuid of the original node
      */
-    private String frozenUUID = null;
+    private UUID frozenUUID = null;
 
     /**
      * the frozen primary type of the orginal node
@@ -109,7 +110,7 @@
             PropertyState prop = props[i];
             if (prop.getName().equals(QName.JCR_FROZENUUID)) {
                 // special property
-                frozenUUID = node.getPropertyValue(QName.JCR_FROZENUUID).internalValue().toString();
+                frozenUUID = UUID.fromString(node.getPropertyValue(QName.JCR_FROZENUUID).internalValue().toString());
             } else if (prop.getName().equals(QName.JCR_FROZENPRIMARYTYPE)) {
                 // special property
                 frozenPrimaryType = (QName) node.getPropertyValue(QName.JCR_FROZENPRIMARYTYPE).internalValue();
@@ -153,8 +154,8 @@
     /**
      * {@inheritDoc}
      */
-    public String getId() {
-        return node.getUUID();
+    public NodeId getId() {
+        return node.getNodeId();
     }
 
     /**
@@ -169,7 +170,7 @@
             int i = 0;
             while (iter.hasNext()) {
                 NodeState.ChildNodeEntry entry = (NodeState.ChildNodeEntry) iter.next();
-                freezes[i++] = (InternalFreeze) vMgr.getItem(entry.getUUID());
+                freezes[i++] = (InternalFreeze) vMgr.getItem(entry.getId());
             }
             return freezes;
         } catch (RepositoryException e) {
@@ -180,11 +181,12 @@
     /**
      * {@inheritDoc}
      */
-    public boolean hasFrozenHistory(String uuid) {
+    public boolean hasFrozenHistory(UUID uuid) {
         try {
-            NodeState.ChildNodeEntry entry  = node.getState().getChildNodeEntry(uuid);
+            NodeId id = new NodeId(uuid);
+            NodeState.ChildNodeEntry entry  = node.getState().getChildNodeEntry(id);
             if (entry != null) {
-                return vMgr.getItem(uuid) instanceof InternalFrozenVersionHistory;
+                return vMgr.getItem(id) instanceof InternalFrozenVersionHistory;
             }
         } catch (RepositoryException e) {
             // ignore
@@ -202,7 +204,7 @@
     /**
      * {@inheritDoc}
      */
-    public String getFrozenUUID() {
+    public UUID getFrozenUUID() {
         return frozenUUID;
     }
 
@@ -234,7 +236,7 @@
      * @throws RepositoryException
      */
     protected static NodeStateEx checkin(NodeStateEx parent, QName name,
-                                            NodeImpl src)
+                                         NodeImpl src)
             throws RepositoryException {
         return checkin(parent, name, src, MODE_VERSION);
     }
@@ -253,7 +255,7 @@
      * @throws RepositoryException
      */
     private static NodeStateEx checkin(NodeStateEx parent, QName name,
-                                            NodeImpl src, int mode)
+                                       NodeImpl src, int mode)
             throws RepositoryException {
 
         // create new node

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenVHImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenVHImpl.java?rev=378221&r1=378220&r2=378221&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenVHImpl.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenVHImpl.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.RepositoryException;
 import javax.jcr.version.VersionException;
@@ -54,15 +56,16 @@
     /**
      * {@inheritDoc}
      */
-    public String getId() {
-        return node.getUUID();
+    public NodeId getId() {
+        return node.getNodeId();
     }
 
     /**
      * {@inheritDoc}
      */
-    public String getVersionHistoryId() {
-        return node.getPropertyValue(QName.JCR_CHILDVERSIONHISTORY).internalValue().toString();
+    public NodeId getVersionHistoryId() {
+        return new NodeId((UUID)
+                node.getPropertyValue(QName.JCR_CHILDVERSIONHISTORY).internalValue());
     }
 
     /**
@@ -80,8 +83,9 @@
     /**
      * {@inheritDoc}
      */
-    public String getBaseVersionId() {
-        return (String) node.getPropertyValue(QName.JCR_BASEVERSION).internalValue();
+    public NodeId getBaseVersionId() {
+        return new NodeId((UUID)
+                node.getPropertyValue(QName.JCR_BASEVERSION).internalValue());
     }
 
     /**

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenVersionHistory.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenVersionHistory.java?rev=378221&r1=378220&r2=378221&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenVersionHistory.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenVersionHistory.java Thu Feb 16 02:48:20 2006
@@ -16,6 +16,8 @@
  */
 package org.apache.jackrabbit.core.version;
 
+import org.apache.jackrabbit.core.NodeId;
+
 import javax.jcr.version.VersionException;
 
 /**
@@ -30,7 +32,7 @@
      *
      * @return the id of the version history
      */
-    String getVersionHistoryId();
+    NodeId getVersionHistoryId();
 
     /**
      * Returns the version history that was assigned to the node at
@@ -48,7 +50,7 @@
      *
      * @return the id of the base version
      */
-    String getBaseVersionId();
+    NodeId getBaseVersionId();
 
     /**
      * Returns the base version that was assigned to the node at



Mime
View raw message