jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tri...@apache.org
Subject svn commit: r378221 [2/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/CachingHierarchyManager.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/CachingHierarchyManager.java?rev=378221&r1=378220&r2=378221&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/CachingHierarchyManager.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/CachingHierarchyManager.java Thu Feb 16 02:48:20 2006
@@ -91,14 +91,14 @@
     /**
      * Create a new instance of this class.
      *
-     * @param rootNodeUUID root node UUID
+     * @param rootNodeId   root node id
      * @param provider     item state manager
      * @param nsResolver   namespace resolver
      */
-    public CachingHierarchyManager(String rootNodeUUID,
+    public CachingHierarchyManager(NodeId rootNodeId,
                                    ItemStateManager provider,
                                    NamespaceResolver nsResolver) {
-        super(rootNodeUUID, provider, nsResolver);
+        super(rootNodeId, provider, nsResolver);
         upperLimit = DEFAULT_UPPER_LIMIT;
     }
 
@@ -288,7 +288,7 @@
      */
     private void stateModified(NodeState modified) {
         synchronized (cacheMonitor) {
-            LRUEntry entry = (LRUEntry) idCache.get(modified.getId());
+            LRUEntry entry = (LRUEntry) idCache.get(modified.getNodeId());
             if (entry == null) {
                 // Item not cached, ignore
                 return;
@@ -309,7 +309,7 @@
                 }
 
                 LRUEntry childEntry = (LRUEntry) child.get();
-                if (childEntry != null && !cne.getUUID().equals(childEntry.getUUID())) {
+                if (childEntry != null && !cne.getId().equals(childEntry.getId())) {
                     // Different child item, remove
                     child.remove();
                     evict(child);
@@ -367,19 +367,19 @@
     /**
      * {@inheritDoc}
      */
-    public void nodeAdded(NodeState state, QName name, int index, String uuid) {
+    public void nodeAdded(NodeState state, QName name, int index, NodeId id) {
         try {
-            Path path = Path.create(getPath(state.getId()), name, index, true);
-            insert(path, new NodeId(uuid));
+            Path path = Path.create(getPath(state.getNodeId()), name, index, true);
+            insert(path, id);
         } catch (PathNotFoundException e) {
-            log.warn("Unable to get path of node " + state.getId() +
+            log.warn("Unable to get path of node " + state.getNodeId() +
                     ", event ignored.");
         } catch (MalformedPathException e) {
-            log.warn("Unable to create path of " + uuid, e);
+            log.warn("Unable to create path of " + id, e);
         } catch (ItemNotFoundException e) {
-            log.warn("Unable to get path of " + state.getId(), e);
+            log.warn("Unable to get path of " + state.getNodeId(), e);
         } catch (RepositoryException e) {
-            log.warn("Unable to get path of " + state.getId(), e);
+            log.warn("Unable to get path of " + state.getNodeId(), e);
         }
     }
 
@@ -398,34 +398,34 @@
         while (iter.hasNext()) {
             NodeState.ChildNodeEntry now = (NodeState.ChildNodeEntry) iter.next();
             NodeState.ChildNodeEntry old =
-                    ((NodeState) state.getOverlayedState()).getChildNodeEntry(now.getUUID());
+                    ((NodeState) state.getOverlayedState()).getChildNodeEntry(now.getId());
 
             if (old == null) {
                 log.warn("Reordered child node not found in old list.");
                 continue;
             }
 
-            nodeAdded(state, now.getName(), now.getIndex(), now.getUUID());
-            nodeRemoved(state, old.getName(), old.getIndex(), old.getUUID());
+            nodeAdded(state, now.getName(), now.getIndex(), now.getId());
+            nodeRemoved(state, old.getName(), old.getIndex(), old.getId());
         }
     }
 
     /**
      * {@inheritDoc}
      */
-    public void nodeRemoved(NodeState state, QName name, int index, String uuid) {
+    public void nodeRemoved(NodeState state, QName name, int index, NodeId id) {
         try {
-            Path path = Path.create(getPath(state.getId()), name, index, true);
-            remove(path, new NodeId(uuid));
+            Path path = Path.create(getPath(state.getNodeId()), name, index, true);
+            remove(path, id);
         } catch (PathNotFoundException e) {
-            log.warn("Unable to get path of node " + state.getId() +
+            log.warn("Unable to get path of node " + state.getNodeId() +
                     ", event ignored.");
         } catch (MalformedPathException e) {
-            log.warn("Unable to create path of " + uuid, e);
+            log.warn("Unable to create path of " + id, e);
         } catch (ItemNotFoundException e) {
-            log.warn("Unable to get path of " + state.getId(), e);
+            log.warn("Unable to get path of " + state.getNodeId(), e);
         } catch (RepositoryException e) {
-            log.warn("Unable to get path of " + state.getId(), e);
+            log.warn("Unable to get path of " + state.getNodeId(), e);
         }
     }
 
@@ -479,7 +479,7 @@
      * @param path  path to item
      */
     private void cache(NodeState state, Path path) {
-        NodeId id = (NodeId) state.getId();
+        NodeId id = state.getNodeId();
 
         synchronized (cacheMonitor) {
             if (idCache.get(id) != null) {
@@ -734,15 +734,6 @@
          */
         public NodeId getId() {
             return id;
-        }
-
-        /**
-         * Return node UUID.
-         *
-         * @return node UUID
-         */
-        public String getUUID() {
-            return id.getUUID();
         }
 
         /**

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/HierarchyManagerImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/HierarchyManagerImpl.java?rev=378221&r1=378220&r2=378221&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/HierarchyManagerImpl.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/HierarchyManagerImpl.java Thu Feb 16 02:48:20 2006
@@ -51,10 +51,10 @@
     // used for outputting user-friendly paths and names
     protected final NamespaceResolver nsResolver;
 
-    public HierarchyManagerImpl(String rootNodeUUID,
+    public HierarchyManagerImpl(NodeId rootNodeId,
                                 ItemStateManager provider,
                                 NamespaceResolver nsResolver) {
-        rootNodeId = new NodeId(rootNodeUUID);
+        this.rootNodeId = rootNodeId;
         this.provider = provider;
         this.nsResolver = nsResolver;
     }
@@ -140,10 +140,10 @@
      *
      * @param state item state
      * @return <code>parentUUID</code> of the given item
-     * @see ZombieHierarchyManager#getParentUUID(ItemState)
+     * @see ZombieHierarchyManager#getParentId(ItemState)
      */
-    protected String getParentUUID(ItemState state) {
-        return state.getParentUUID();
+    protected NodeId getParentId(ItemState state) {
+        return state.getParentId();
     }
 
     /**
@@ -153,15 +153,15 @@
      * Low-level hook provided for specialized derived classes.
      *
      * @param parent node state
-     * @param uuid   uuid of child node entry
+     * @param id   id of child node entry
      * @return the <code>ChildNodeEntry</code> of <code>parent</code> with
      *         the specified <code>uuid</code> or <code>null</code> if there's
      *         no such entry.
-     * @see ZombieHierarchyManager#getChildNodeEntry(NodeState, String)
+     * @see ZombieHierarchyManager#getChildNodeEntry(NodeState, NodeId)
      */
     protected NodeState.ChildNodeEntry getChildNodeEntry(NodeState parent,
-                                                         String uuid) {
-        return parent.getChildNodeEntry(uuid);
+                                                         NodeId id) {
+        return parent.getChildNodeEntry(id);
     }
 
     /**
@@ -243,7 +243,7 @@
             // child node
             NodeState.ChildNodeEntry nodeEntry =
                     getChildNodeEntry(parentState, name, index);
-            childId = new NodeId(nodeEntry.getUUID());
+            childId = nodeEntry.getId();
 
         } else if (parentState.hasPropertyName(name)) {
             // property
@@ -256,7 +256,7 @@
                 throw new PathNotFoundException(safeGetJCRPath(path));
             }
 
-            childId = new PropertyId(parentState.getUUID(), name);
+            childId = new PropertyId(parentState.getNodeId(), name);
 
         } else {
             // no such item
@@ -283,26 +283,26 @@
             return;
         }
 
-        String parentUUID = getParentUUID(state);
-        if (parentUUID == null) {
+        NodeId parentId = getParentId(state);
+        if (parentId == null) {
             String msg = "failed to build path of " + state.getId()
                     + ": orphaned item";
             log.debug(msg);
             throw new ItemNotFoundException(msg);
         }
 
-        NodeState parent = (NodeState) getItemState(new NodeId(parentUUID));
+        NodeState parent = (NodeState) getItemState(parentId);
         // recursively build path of parent
         buildPath(builder, parent);
 
         if (state.isNode()) {
             NodeState nodeState = (NodeState) state;
-            String uuid = nodeState.getUUID();
-            NodeState.ChildNodeEntry entry = getChildNodeEntry(parent, uuid);
+            NodeId id = nodeState.getNodeId();
+            NodeState.ChildNodeEntry entry = getChildNodeEntry(parent, id);
             if (entry == null) {
                 String msg = "failed to build path of " + state.getId() + ": "
-                        + parent.getUUID() + " has no child entry for "
-                        + uuid;
+                        + parent.getNodeId() + " has no child entry for "
+                        + id;
                 log.debug(msg);
                 throw new ItemNotFoundException(msg);
             }
@@ -380,13 +380,13 @@
             NodeState parentState;
             try {
                 NodeState nodeState = (NodeState) getItemState(nodeId);
-                String parentUUID = getParentUUID(nodeState);
-                if (parentUUID == null) {
+                NodeId parentId= getParentId(nodeState);
+                if (parentId == null) {
                     // this is the root or an orphaned node
                     // FIXME
                     return EMPTY_NAME;
                 }
-                parentState = (NodeState) getItemState(new NodeId(parentUUID));
+                parentState = (NodeState) getItemState(parentId);
             } catch (NoSuchItemStateException nsis) {
                 String msg = "failed to resolve name of " + nodeId;
                 log.debug(msg);
@@ -398,7 +398,7 @@
             }
 
             NodeState.ChildNodeEntry entry =
-                    getChildNodeEntry(parentState, nodeId.getUUID());
+                    getChildNodeEntry(parentState, nodeId);
             if (entry == null) {
                 String msg = "failed to resolve name of " + nodeId;
                 log.debug(msg);
@@ -406,8 +406,7 @@
             }
             return entry.getName();
         } else {
-            PropertyId propId = (PropertyId) itemId;
-            return propId.getName();
+            return ((PropertyId) itemId).getName();
         }
     }
 
@@ -422,12 +421,12 @@
         }
         try {
             ItemState state = getItemState(id);
-            String parentUUID = getParentUUID(state);
+            NodeId parentId = getParentId(state);
             int depth = 0;
-            while (parentUUID != null) {
+            while (parentId != null) {
                 depth++;
-                state = getItemState(new NodeId(parentUUID));
-                parentUUID = getParentUUID(state);
+                state = getItemState(parentId);
+                parentId = getParentId(state);
             }
             return depth;
         } catch (NoSuchItemStateException nsise) {
@@ -452,14 +451,14 @@
         int depth = 1;
         try {
             ItemState state = getItemState(descendantId);
-            String parentUUID = getParentUUID(state);
-            while (parentUUID != null) {
-                if (parentUUID.equals(ancestorId.getUUID())) {
+            NodeId parentId = getParentId(state);
+            while (parentId != null) {
+                if (parentId.equals(ancestorId)) {
                     return depth;
                 }
                 depth++;
-                state = getItemState(new NodeId(parentUUID));
-                parentUUID = getParentUUID(state);
+                state = getItemState(parentId);
+                parentId = getParentId(state);
             }
             // not an ancestor
             return -1;
@@ -487,13 +486,13 @@
         }
         try {
             ItemState state = getItemState(itemId);
-            String parentUUID = getParentUUID(state);
-            while (parentUUID != null) {
-                if (parentUUID.equals(nodeId.getUUID())) {
+            NodeId parentId = getParentId(state);
+            while (parentId != null) {
+                if (parentId.equals(nodeId)) {
                     return true;
                 }
-                state = getItemState(new NodeId(parentUUID));
-                parentUUID = getParentUUID(state);
+                state = getItemState(parentId);
+                parentId = getParentId(state);
             }
             // not an ancestor
             return false;

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/ItemId.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/ItemId.java?rev=378221&r1=378220&r2=378221&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/ItemId.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/ItemId.java Thu Feb 16 02:48:20 2006
@@ -47,5 +47,6 @@
      * @see NodeId
      */
     public abstract boolean denotesNode();
+
 }
 

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/ItemImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/ItemImpl.java?rev=378221&r1=378220&r2=378221&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/ItemImpl.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/ItemImpl.java Thu Feb 16 02:48:20 2006
@@ -495,7 +495,7 @@
             if (itemState.isNode()) {
                 // the transient item is a node
                 NodeState nodeState = (NodeState) itemState;
-                ItemId id = nodeState.getId();
+                ItemId id = nodeState.getNodeId();
                 NodeImpl node = (NodeImpl) itemMgr.getItem(id);
                 NodeDefinition def = node.getDefinition();
                 // primary type
@@ -560,7 +560,7 @@
             } else {
                 // the transient item is a property
                 PropertyState propState = (PropertyState) itemState;
-                ItemId propId = propState.getId();
+                ItemId propId = propState.getPropertyId();
                 PropertyImpl prop = (PropertyImpl) itemMgr.getItem(propId);
                 PropertyDefinitionImpl def =
                         (PropertyDefinitionImpl) prop.getDefinition();
@@ -1088,23 +1088,23 @@
                 ItemState transientState = (ItemState) it.next();
                 if (transientState.isNode()) {
                     NodeState nodeState = (NodeState) transientState;
-                    Set dependentUUIDs = new HashSet();
+                    Set dependentIDs = new HashSet();
                     if (nodeState.hasOverlayedState()) {
-                        String oldParentUUID =
-                                nodeState.getOverlayedState().getParentUUID();
-                        String newParentUUID = nodeState.getParentUUID();
-                        if (oldParentUUID != null) {
-                            if (newParentUUID == null) {
+                        NodeId oldParentId =
+                                nodeState.getOverlayedState().getParentId();
+                        NodeId newParentId = nodeState.getParentId();
+                        if (oldParentId != null) {
+                            if (newParentId == null) {
                                 // node has been removed, add old parent
                                 // to dependencies
-                                dependentUUIDs.add(oldParentUUID);
+                                dependentIDs.add(oldParentId);
                             } else {
-                                if (oldParentUUID != null &&
-                                        !oldParentUUID.equals(newParentUUID)) {
+                                if (oldParentId!= null &&
+                                        !oldParentId.equals(newParentId)) {
                                     // node has been moved, add old and new parent
                                     // to dependencies
-                                    dependentUUIDs.add(oldParentUUID);
-                                    dependentUUIDs.add(newParentUUID);
+                                    dependentIDs.add(oldParentId);
+                                    dependentIDs.add(newParentId);
                                 }
                             }
                         }
@@ -1115,7 +1115,7 @@
                          cneIt.hasNext();) {
                         NodeState.ChildNodeEntry cne =
                                 (NodeState.ChildNodeEntry) cneIt.next();
-                        dependentUUIDs.add(cne.getUUID());
+                        dependentIDs.add(cne.getId());
                     }
                     // added child node entries
                     for (Iterator cneIt =
@@ -1123,14 +1123,14 @@
                          cneIt.hasNext();) {
                         NodeState.ChildNodeEntry cne =
                                 (NodeState.ChildNodeEntry) cneIt.next();
-                        dependentUUIDs.add(cne.getUUID());
+                        dependentIDs.add(cne.getId());
                     }
 
                     // now walk through dependencies and check whether they
                     // are within the scope of this save operation
-                    Iterator depIt = dependentUUIDs.iterator();
+                    Iterator depIt = dependentIDs.iterator();
                     while (depIt.hasNext()) {
-                        NodeId id = new NodeId((String) depIt.next());
+                        NodeId id = (NodeId) depIt.next();
                         if (!affectedIds.contains(id)) {
                             // need to save the parent as well
                             String msg = itemMgr.safeGetJCRPath(id)
@@ -1373,7 +1373,7 @@
         // check state of this instance
         sanityCheck();
 
-        if (state.getParentUUID() == null) {
+        if (state.getParentId() == null) {
             // shortcut
             return 0;
         }

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/ItemManager.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/ItemManager.java?rev=378221&r1=378220&r2=378221&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/ItemManager.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/ItemManager.java Thu Feb 16 02:48:20 2006
@@ -100,16 +100,17 @@
      *                          the new instance
      * @param session           the session associated with the new instance
      * @param rootNodeDef       the definition of the root node
-     * @param rootNodeUUID      the UUID of the root node
+     * @param rootNodeId        the id of the root node
      */
     protected ItemManager(ItemStateManager itemStateProvider, HierarchyManager hierMgr,
                           SessionImpl session, NodeDefinition rootNodeDef,
-                          String rootNodeUUID) {
+                          NodeId rootNodeId) {
         this.itemStateProvider = itemStateProvider;
         this.hierMgr = hierMgr;
         this.session = session;
         this.rootNodeDef = rootNodeDef;
-        rootNodeId = new NodeId(rootNodeUUID);
+        this.rootNodeId = rootNodeId;
+
         // setup item cache with weak references to items
         itemCache = new ReferenceMap(ReferenceMap.HARD, ReferenceMap.WEAK);
     }
@@ -130,15 +131,13 @@
              * todo need proper way of handling inconsistent/corrupt definition
              * e.g. 'flag' items that refer to non-existent definitions
              */
-            log.warn("node at " + safeGetJCRPath(state.getId())
+            log.warn("node at " + safeGetJCRPath(state.getNodeId())
                     + " has invalid definitionId (" + defId + ")");
 
             // fallback: try finding applicable definition
-            NodeId parentId = new NodeId(state.getParentUUID());
-            NodeImpl parent = (NodeImpl) getItem(parentId);
+            NodeImpl parent = (NodeImpl) getItem(state.getParentId());
             NodeState parentState = (NodeState) parent.getItemState();
-            NodeState.ChildNodeEntry cne =
-                    (NodeState.ChildNodeEntry) parentState.getChildNodeEntry(state.getUUID());
+            NodeState.ChildNodeEntry cne = parentState.getChildNodeEntry(state.getNodeId());
             def = parent.getApplicableChildNodeDefinition(cne.getName(), state.getNodeTypeName());
             state.setDefinitionId(def.unwrap().getId());
         }
@@ -154,12 +153,11 @@
              * todo need proper way of handling inconsistent/corrupt definition
              * e.g. 'flag' items that refer to non-existent definitions
              */
-            log.warn("property at " + safeGetJCRPath(state.getId())
+            log.warn("property at " + safeGetJCRPath(state.getPropertyId())
                     + " has invalid definitionId (" + defId + ")");
 
             // fallback: try finding applicable definition
-            NodeId parentId = new NodeId(state.getParentUUID());
-            NodeImpl parent = (NodeImpl) getItem(parentId);
+            NodeImpl parent = (NodeImpl) getItem(state.getParentId());
             def = parent.getApplicablePropertyDefinition(state.getName(), state.getType(), state.isMultiValued());
             state.setDefinitionId(def.unwrap().getId());
         }
@@ -346,9 +344,8 @@
 
         while (iter.hasNext()) {
             NodeState.ChildNodeEntry entry = (NodeState.ChildNodeEntry) iter.next();
-            NodeId id = new NodeId(entry.getUUID());
             // check read access
-            if (session.getAccessManager().isGranted(id, AccessManager.READ)) {
+            if (session.getAccessManager().isGranted(entry.getId(), AccessManager.READ)) {
                 return true;
             }
         }
@@ -379,10 +376,9 @@
 
         while (iter.hasNext()) {
             NodeState.ChildNodeEntry entry = (NodeState.ChildNodeEntry) iter.next();
-            NodeId id = new NodeId(entry.getUUID());
             // check read access
-            if (session.getAccessManager().isGranted(id, AccessManager.READ)) {
-                childIds.add(id);
+            if (session.getAccessManager().isGranted(entry.getId(), AccessManager.READ)) {
+                childIds.add(entry.getId());
             }
         }
 
@@ -412,10 +408,8 @@
 
         while (iter.hasNext()) {
             QName propName = (QName) iter.next();
-
-            PropertyId id = new PropertyId(parentId.getUUID(), propName);
             // check read access
-            if (session.getAccessManager().isGranted(id, AccessManager.READ)) {
+            if (session.getAccessManager().isGranted(new PropertyId(parentId, propName), AccessManager.READ)) {
                 return true;
             }
         }
@@ -447,7 +441,7 @@
 
         while (iter.hasNext()) {
             QName propName = (QName) iter.next();
-            PropertyId id = new PropertyId(parentId.getUUID(), propName);
+            PropertyId id = new PropertyId(parentId, propName);
             // check read access
             if (session.getAccessManager().isGranted(id, AccessManager.READ)) {
                 childIds.add(id);
@@ -486,20 +480,16 @@
 
     NodeImpl createNodeInstance(NodeState state, NodeDefinition def)
             throws RepositoryException {
-        NodeId id = new NodeId(state.getUUID());
+        NodeId id = state.getNodeId();
         // we want to be informed on life cycle changes of the new node object
         // in order to maintain item cache consistency
         ItemLifeCycleListener[] listeners = new ItemLifeCycleListener[]{this};
 
         // check special nodes
         if (state.getNodeTypeName().equals(QName.NT_VERSION)) {
-            InternalVersion version =
-                    session.getVersionManager().getVersion(state.getUUID());
             return createVersionInstance(id, state, def, listeners);
 
         } else if (state.getNodeTypeName().equals(QName.NT_VERSIONHISTORY)) {
-            InternalVersionHistory history =
-                    session.getVersionManager().getVersionHistory(state.getUUID());
             return createVersionHistoryInstance(id, state, def, listeners);
 
         } else {
@@ -517,13 +507,12 @@
 
     PropertyImpl createPropertyInstance(PropertyState state,
                                         PropertyDefinition def) {
-        PropertyId id = new PropertyId(state.getParentUUID(), state.getName());
         // we want to be informed on life cycle changes of the new property object
         // in order to maintain item cache consistency
         ItemLifeCycleListener[] listeners = new ItemLifeCycleListener[]{this};
         // create property object
-        PropertyImpl prop = new PropertyImpl(this, session, id, state, def, listeners);
-        return prop;
+        return new PropertyImpl(
+                this, session, state.getPropertyId(), state, def, listeners);
     }
 
     PropertyImpl createPropertyInstance(PropertyState state)
@@ -547,8 +536,7 @@
             NodeId id, NodeState state, NodeDefinition def,
             ItemLifeCycleListener[] listeners) throws RepositoryException {
 
-        InternalVersion version =
-                session.getVersionManager().getVersion(id.getUUID());
+        InternalVersion version = session.getVersionManager().getVersion(id);
         return new VersionImpl(this, session, id, state, def, listeners, version);
     }
 
@@ -566,7 +554,7 @@
             ItemLifeCycleListener[] listeners) throws RepositoryException {
 
         InternalVersionHistory history =
-                session.getVersionManager().getVersionHistory(id.getUUID());
+                session.getVersionManager().getVersionHistory(id);
         return new VersionHistoryImpl(this, session, id, state, def, listeners, history);
     }
 

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/ItemValidator.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/ItemValidator.java?rev=378221&r1=378220&r2=378221&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/ItemValidator.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/ItemValidator.java Thu Feb 16 02:48:20 2006
@@ -110,7 +110,7 @@
         QName[] requiredPrimaryTypes = def.getRequiredPrimaryTypes();
         for (int i = 0; i < requiredPrimaryTypes.length; i++) {
             if (!entPrimary.includesNodeType(requiredPrimaryTypes[i])) {
-                String msg = safeGetJCRPath(nodeState.getId())
+                String msg = safeGetJCRPath(nodeState.getNodeId())
                         + ": missing required primary type "
                         + requiredPrimaryTypes[i];
                 log.debug(msg);
@@ -122,7 +122,7 @@
         for (int i = 0; i < pda.length; i++) {
             PropDef pd = pda[i];
             if (!nodeState.hasPropertyName(pd.getName())) {
-                String msg = safeGetJCRPath(nodeState.getId())
+                String msg = safeGetJCRPath(nodeState.getNodeId())
                         + ": mandatory property " + pd.getName()
                         + " does not exist";
                 log.debug(msg);
@@ -134,7 +134,7 @@
         for (int i = 0; i < cnda.length; i++) {
             NodeDef cnd = cnda[i];
             if (!nodeState.hasChildNodeEntry(cnd.getName())) {
-                String msg = safeGetJCRPath(nodeState.getId())
+                String msg = safeGetJCRPath(nodeState.getNodeId())
                         + ": mandatory child node " + cnd.getName()
                         + " does not exist";
                 log.debug(msg);
@@ -167,12 +167,12 @@
             if (type == PropertyType.UNDEFINED) {
                 type = values[i].getType();
             } else if (type != values[i].getType()) {
-                throw new ConstraintViolationException(safeGetJCRPath(propState.getId())
+                throw new ConstraintViolationException(safeGetJCRPath(propState.getPropertyId())
                         + ": inconsistent value types");
             }
             if (def.getRequiredType() != PropertyType.UNDEFINED
                     && def.getRequiredType() != type) {
-                throw new ConstraintViolationException(safeGetJCRPath(propState.getId())
+                throw new ConstraintViolationException(safeGetJCRPath(propState.getPropertyId())
                         + ": requiredType constraint is not satisfied");
             }
         }
@@ -201,7 +201,7 @@
             return ntReg.getEffectiveNodeType(types);
         } catch (NodeTypeConflictException ntce) {
             String msg = "internal error: failed to build effective node type for node "
-                    + safeGetJCRPath(nodeState.getId());
+                    + safeGetJCRPath(nodeState.getNodeId());
             log.debug(msg);
             throw new RepositoryException(msg, ntce);
         }

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/NodeId.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/NodeId.java?rev=378221&r1=378220&r2=378221&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/NodeId.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/NodeId.java Thu Feb 16 02:48:20 2006
@@ -16,6 +16,8 @@
  */
 package org.apache.jackrabbit.core;
 
+import org.apache.jackrabbit.uuid.UUID;
+
 /**
  * Node identifier. An instance of this class identifies a node using its UUID.
  * Once created a node identifier instance is immutable.
@@ -26,14 +28,14 @@
     static final long serialVersionUID = 7026219091360041109L;
 
     /** UUID of the identified node */
-    private final String uuid;
+    private final UUID uuid;
 
     /**
      * Creates a node identifier instance for the identified node.
      *
      * @param uuid node UUID
      */
-    public NodeId(String uuid) {
+    public NodeId(UUID uuid) {
         if (uuid == null) {
             throw new IllegalArgumentException("uuid can not be null");
         }
@@ -56,7 +58,7 @@
      *
      * @return node UUID
      */
-    public String getUUID() {
+    public UUID getUUID() {
         return uuid;
     }
 
@@ -76,7 +78,7 @@
         if (s == null) {
             throw new IllegalArgumentException("invalid NodeId literal");
         }
-        return new NodeId(s);
+        return new NodeId(new UUID(s));
     }
 
     //-------------------------------------------< java.lang.Object overrides >
@@ -95,8 +97,7 @@
             return true;
         }
         if (obj instanceof NodeId) {
-            NodeId other = (NodeId) obj;
-            return uuid.equals(other.uuid);
+            return uuid.equals(((NodeId) obj).uuid);
         }
         return false;
     }
@@ -108,7 +109,7 @@
      * @see Object#toString()
      */
     public String toString() {
-        return uuid;
+        return uuid.toString();
     }
 
     /**

Added: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/NodeIdIterator.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/NodeIdIterator.java?rev=378221&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/NodeIdIterator.java (added)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/NodeIdIterator.java Thu Feb 16 02:48:20 2006
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ *                     as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.core;
+
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+
+/**
+ * <code>NodeIdIterator</code> extends the Iterator iterface by the NodeId
+ * specific methods.
+ */
+public interface NodeIdIterator extends Iterator {
+
+    /**
+     * Returns the next nodeid in the iteration.
+     * @return the next nodeid.
+     *
+     * @throws NoSuchElementException
+     */
+    NodeId nextNodeId() throws NoSuchElementException;
+}
\ No newline at end of file

Propchange: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/NodeIdIterator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/NodeIdIterator.java
------------------------------------------------------------------------------
    svn:keywords = author date id rev url

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/NodeImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/NodeImpl.java?rev=378221&r1=378220&r2=378221&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/NodeImpl.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/NodeImpl.java Thu Feb 16 02:48:20 2006
@@ -103,6 +103,7 @@
     /** same as ((NodeState) state).getNodeTypeName(); cached to avoid type casts */
     protected final QName primaryTypeName;
 
+    /** the definition of this node */
     protected NodeDefinition definition;
 
     // flag set in status passed to getOrCreateProperty if property was created
@@ -162,7 +163,7 @@
                 // check if property entry exists
                 NodeState thisState = (NodeState) state;
                 if (thisState.hasPropertyName(propName)) {
-                    return new PropertyId(thisState.getUUID(), propName);
+                    return new PropertyId(thisState.getNodeId(), propName);
                 } else {
                     // there's no property with that name
                     return null;
@@ -222,7 +223,7 @@
                     NodeState.ChildNodeEntry cne =
                             thisState.getChildNodeEntry(pe.getName(), index);
                     if (cne != null) {
-                        return new NodeId(cne.getUUID());
+                        return cne.getId();
                     } else {
                         // there's no child node with that name
                         return null;
@@ -316,7 +317,9 @@
             // mix:referenceable node type
             if (name.equals(QName.JCR_UUID)) {
                 // jcr:uuid property
-                genValues = new InternalValue[]{InternalValue.create(thisState.getUUID())};
+                genValues = new InternalValue[]{
+                        InternalValue.create(thisState.getNodeId().getUUID().toString())
+                };
             }
 /*
        todo consolidate version history creation code (currently in ItemImpl.initVersionHistories)
@@ -443,13 +446,13 @@
             throw new RepositoryException(msg);
         }
 
-        String parentUUID = ((NodeState) state).getUUID();
+        NodeId parentId = (NodeId) state.getId();
 
         // create a new property state
         PropertyState propState;
         try {
             propState =
-                    stateMgr.createTransientPropertyState(parentUUID, name,
+                    stateMgr.createTransientPropertyState(parentId, name,
                             ItemState.STATUS_NEW);
             propState.setType(type);
             propState.setMultiValued(def.isMultiple());
@@ -484,18 +487,18 @@
     protected synchronized NodeImpl createChildNode(QName name,
                                                     NodeDefinitionImpl def,
                                                     NodeTypeImpl nodeType,
-                                                    String uuid)
+                                                    NodeId id)
             throws RepositoryException {
-        String parentUUID = ((NodeState) state).getUUID();
+        NodeId parentId = (NodeId) state.getId();
         // create a new node state
         NodeState nodeState;
         try {
-            if (uuid == null) {
-                uuid = UUID.randomUUID().toString();    // version 4 uuid
+            if (id == null) {
+                id = new NodeId(UUID.randomUUID());
             }
             nodeState =
-                    stateMgr.createTransientNodeState(uuid, nodeType.getQName(),
-                            parentUUID, ItemState.STATUS_NEW);
+                    stateMgr.createTransientNodeState(id, nodeType.getQName(),
+                            parentId, ItemState.STATUS_NEW);
             nodeState.setDefinitionId(def.unwrap().getId());
         } catch (ItemStateException ise) {
             String msg = "failed to add child node " + name + " to "
@@ -518,7 +521,7 @@
         // modify the state of 'this', i.e. the parent node
         NodeState thisState = (NodeState) getOrCreateTransientItemState();
         // add new child node entry
-        thisState.addChildNodeEntry(name, nodeState.getUUID());
+        thisState.addChildNodeEntry(name, nodeState.getNodeId());
 
         // add 'auto-create' properties defined in node type
         PropertyDefinition[] pda = nodeType.getAutoCreatedPropertyDefinitions();
@@ -538,7 +541,7 @@
         return node;
     }
 
-    protected void renameChildNode(QName oldName, int index, String uuid,
+    protected void renameChildNode(QName oldName, int index, NodeId id,
                                    QName newName)
             throws RepositoryException {
         // modify the state of 'this', i.e. the parent node
@@ -573,7 +576,7 @@
         }
 
         // remove property
-        PropertyId propId = new PropertyId(thisState.getUUID(), propName);
+        PropertyId propId = new PropertyId(thisState.getNodeId(), propName);
         itemMgr.getItem(propId).setRemoved();
     }
 
@@ -594,7 +597,7 @@
         }
 
         // notify target of removal
-        NodeId childId = new NodeId(entry.getUUID());
+        NodeId childId = entry.getId();
         NodeImpl childNode = (NodeImpl) itemMgr.getItem(childId);
         childNode.onRemove();
 
@@ -630,7 +633,7 @@
                 NodeState.ChildNodeEntry entry =
                         (NodeState.ChildNodeEntry) tmp.get(i);
                 // recursively remove child node
-                NodeId childId = new NodeId(entry.getUUID());
+                NodeId childId = entry.getId();
                 NodeImpl childNode = (NodeImpl) itemMgr.getItem(childId);
                 childNode.onRemove();
                 // remove the child node entry
@@ -646,12 +649,12 @@
             // remove the property entry
             thisState.removePropertyName(propName);
             // remove property
-            PropertyId propId = new PropertyId(thisState.getUUID(), propName);
+            PropertyId propId = new PropertyId(thisState.getNodeId(), propName);
             itemMgr.getItem(propId).setRemoved();
         }
 
         // finally remove this node
-        thisState.setParentUUID(null);
+        thisState.setParentId(null);
         itemMgr.getItem(id).setRemoved();
     }
 
@@ -662,7 +665,7 @@
     }
 
     protected NodeImpl internalAddNode(String relPath, NodeTypeImpl nodeType,
-                                       String uuid)
+                                       NodeId id)
             throws ItemExistsException, PathNotFoundException, VersionException,
             ConstraintViolationException, LockException, RepositoryException {
         Path nodePath;
@@ -711,7 +714,7 @@
         parentNode.checkLock();
 
         // delegate the creation of the child node to the parent node
-        return parentNode.internalAddChildNode(nodeName, nodeType, uuid);
+        return parentNode.internalAddChildNode(nodeName, nodeType, id);
     }
 
     protected NodeImpl internalAddChildNode(QName nodeName,
@@ -722,7 +725,7 @@
     }
 
     protected NodeImpl internalAddChildNode(QName nodeName,
-                                            NodeTypeImpl nodeType, String uuid)
+                                            NodeTypeImpl nodeType, NodeId id)
             throws ItemExistsException, ConstraintViolationException,
             RepositoryException {
         Path nodePath;
@@ -766,7 +769,7 @@
                 throw new ItemExistsException(itemMgr.safeGetJCRPath(nodePath));
             }
             // check same-name sibling setting of existing node
-            NodeId newId = new NodeId(cne.getUUID());
+            NodeId newId = cne.getId();
             if (!((NodeImpl) itemMgr.getItem(newId)).getDefinition().allowsSameNameSiblings()) {
                 throw new ItemExistsException(itemMgr.safeGetJCRPath(nodePath));
             }
@@ -780,7 +783,7 @@
         }
 
         // now do create the child node
-        return createChildNode(nodeName, def, nodeType, uuid);
+        return createChildNode(nodeName, def, nodeType, id);
     }
 
     private void setMixinTypesProperty(Set mixinNames) throws RepositoryException {
@@ -788,7 +791,7 @@
         // get or create jcr:mixinTypes property
         PropertyImpl prop;
         if (thisState.hasPropertyName(QName.JCR_MIXINTYPES)) {
-            prop = (PropertyImpl) itemMgr.getItem(new PropertyId(thisState.getUUID(), QName.JCR_MIXINTYPES));
+            prop = (PropertyImpl) itemMgr.getItem(new PropertyId(thisState.getNodeId(), QName.JCR_MIXINTYPES));
         } else {
             // find definition for the jcr:mixinTypes property and create property
             PropertyDefinitionImpl def = getApplicablePropertyDefinition(QName.JCR_MIXINTYPES, PropertyType.NAME, true);
@@ -908,8 +911,8 @@
                 throw new InvalidItemStateException(msg);
             }
             // copy state from transient state:
-            // parent uuid's
-            persistentState.setParentUUID(transientState.getParentUUID());
+            // parent id's
+            persistentState.setParentId(transientState.getParentId());
             // mixin types
             persistentState.setMixinTypeNames(transientState.getMixinTypeNames());
             // id of definition
@@ -944,7 +947,7 @@
             stateMgr.disconnectTransientItemState(thisState);
         }
         // reapply transient changes
-        thisState.setParentUUID(transientState.getParentUUID());
+        thisState.setParentId(transientState.getParentId());
         thisState.setMixinTypeNames(transientState.getMixinTypeNames());
         thisState.setDefinitionId(transientState.getDefinitionId());
         thisState.setChildNodeEntries(transientState.getChildNodeEntries());
@@ -1153,7 +1156,8 @@
         HashSet set = new HashSet(thisState.getPropertyNames());
         for (Iterator iter = set.iterator(); iter.hasNext();) {
             QName propName = (QName) iter.next();
-            PropertyImpl prop = (PropertyImpl) itemMgr.getItem(new PropertyId(thisState.getUUID(), propName));
+            PropertyImpl prop = (PropertyImpl) itemMgr.getItem(
+                    new PropertyId(thisState.getNodeId(), propName));
             // check if property has been defined by mixin type (or one of its supertypes)
             NodeTypeImpl declaringNT = (NodeTypeImpl) prop.getDefinition().getDeclaringNodeType();
             if (!entRemaining.includesNodeType(declaringNT.getQName())) {
@@ -1167,7 +1171,7 @@
         ArrayList list = new ArrayList(thisState.getChildNodeEntries());
         for (Iterator iter = list.iterator(); iter.hasNext();) {
             NodeState.ChildNodeEntry entry = (NodeState.ChildNodeEntry) iter.next();
-            NodeImpl node = (NodeImpl) itemMgr.getItem(new NodeId(entry.getUUID()));
+            NodeImpl node = (NodeImpl) itemMgr.getItem(entry.getId());
             // check if node has been defined by mixin type (or one of its supertypes)
             NodeTypeImpl declaringNT = (NodeTypeImpl) node.getDefinition().getDeclaringNodeType();
             if (!entRemaining.includesNodeType(declaringNT.getQName())) {
@@ -1208,8 +1212,8 @@
      *
      * @return the uuid of this node
      */
-    public String internalGetUUID() {
-        return ((NodeState) state).getUUID();
+    public UUID internalGetUUID() {
+        return ((NodeId) state.getId()).getUUID();
     }
 
     /**
@@ -1373,9 +1377,8 @@
         if (cne == null) {
             throw new ItemNotFoundException();
         }
-        NodeId nodeId = new NodeId(cne.getUUID());
         try {
-            return (NodeImpl) itemMgr.getItem(nodeId);
+            return (NodeImpl) itemMgr.getItem(cne.getId());
         } catch (AccessDeniedException ade) {
             throw new ItemNotFoundException();
         }
@@ -1413,9 +1416,7 @@
         if (cne == null) {
             return false;
         }
-        NodeId nodeId = new NodeId(cne.getUUID());
-
-        return itemMgr.itemExists(nodeId);
+        return itemMgr.itemExists(cne.getId());
     }
 
     /**
@@ -1434,7 +1435,7 @@
         sanityCheck();
 
         NodeState thisState = (NodeState) state;
-        PropertyId propId = new PropertyId(thisState.getUUID(), name);
+        PropertyId propId = new PropertyId(thisState.getNodeId(), name);
         try {
             return (PropertyImpl) itemMgr.getItem(propId);
         } catch (AccessDeniedException ade) {
@@ -1459,7 +1460,7 @@
         if (!thisState.hasPropertyName(name)) {
             return false;
         }
-        PropertyId propId = new PropertyId(thisState.getUUID(), name);
+        PropertyId propId = new PropertyId(thisState.getNodeId(), name);
 
         return itemMgr.itemExists(propId);
     }
@@ -1487,7 +1488,7 @@
      * @throws RepositoryException
      */
     public synchronized NodeImpl addNode(QName nodeName, QName nodeTypeName,
-                                         String uuid)
+                                         UUID uuid)
             throws ItemExistsException, NoSuchNodeTypeException, VersionException,
             ConstraintViolationException, LockException, RepositoryException {
         // check state of this instance
@@ -1507,7 +1508,7 @@
         if (nodeTypeName != null) {
             nt = session.getNodeTypeManager().getNodeType(nodeTypeName);
         }
-        return internalAddChildNode(nodeName, nt, uuid);
+        return internalAddChildNode(nodeName, nt, new NodeId(uuid));
     }
 
     /**
@@ -1627,6 +1628,15 @@
         return session.getHierarchyManager().getName(id);
     }
 
+    /**
+     * Return the id of this <code>Node</code>.
+     *
+     * @return the id of this <code>Node</code>
+     */
+    public NodeId getNodeId() {
+        return (NodeId) id;
+    }
+
     //-----------------------------------------------------------------< Item >
     /**
      * {@inheritDoc}
@@ -1642,7 +1652,7 @@
         // check state of this instance
         sanityCheck();
 
-        if (state.getParentUUID() == null) {
+        if (state.getId() == null) {
             // this is the root node
             return "";
         }
@@ -1678,14 +1688,14 @@
         sanityCheck();
 
         // check if root node
-        String parentUUID = state.getParentUUID();
-        if (parentUUID == null) {
+        NodeId parentId = state.getParentId();
+        if (parentId == null) {
             String msg = "root node doesn't have a parent";
             log.debug(msg);
             throw new ItemNotFoundException(msg);
         }
 
-        return (Node) itemMgr.getItem(new NodeId(parentUUID));
+        return (Node) itemMgr.getItem(parentId);
     }
 
     //-----------------------------------------------------------------< Node >
@@ -2505,7 +2515,7 @@
         sanityCheck();
 
         try {
-            NodeReferencesId targetId = new NodeReferencesId(((NodeId) id).getUUID());
+            NodeReferencesId targetId = new NodeReferencesId((NodeId) id);
             if (stateMgr.hasNodeReferences(targetId)) {
                 NodeReferences refs = stateMgr.getNodeReferences(targetId);
                 // refs.getReferences() returns a list of PropertyId's
@@ -2592,7 +2602,7 @@
             throw new UnsupportedRepositoryOperationException();
         }
 
-        return ((NodeState) state).getUUID();
+        return internalGetUUID().toString();
     }
 
     /**
@@ -2666,17 +2676,17 @@
         // check state of this instance
         sanityCheck();
 
-        String parentUUID = state.getParentUUID();
-        if (parentUUID == null) {
+        NodeId parentId = state.getParentId();
+        if (parentId == null) {
             // the root node cannot have same-name siblings; always return 1
             return 1;
         }
 
         try {
             NodeState parent =
-                    (NodeState) stateMgr.getItemState(new NodeId(parentUUID));
+                    (NodeState) stateMgr.getItemState(parentId);
             NodeState.ChildNodeEntry parentEntry =
-                    parent.getChildNodeEntry(((NodeState) state).getUUID());
+                    parent.getChildNodeEntry((NodeId) state.getId());
             return parentEntry.getIndex();
         } catch (ItemStateException ise) {
             // should never get here...
@@ -3264,9 +3274,9 @@
         NodeTypeImpl nt = ntMgr.getNodeType(frozen.getFrozenPrimaryType());
 
         // get frozen uuid
-        String uuid = frozen.getFrozenUUID();
+        UUID uuid = frozen.getFrozenUUID();
 
-        NodeImpl node = internalAddChildNode(name, nt, uuid);
+        NodeImpl node = internalAddChildNode(name, nt, new NodeId(uuid));
 
         // get frozen mixin
         // todo: also respect mixing types on creation?
@@ -3308,9 +3318,9 @@
         NodeTypeImpl nt = ntMgr.getNodeType(frozen.getFrozenPrimaryType());
 
         // get frozen uuid
-        String uuid = frozen.getFrozenUUID();
+        UUID uuid = frozen.getFrozenUUID();
 
-        NodeImpl node = internalAddNode(relPath, nt, uuid);
+        NodeImpl node = internalAddNode(relPath, nt, new NodeId(uuid));
 
         // get frozen mixin
         // todo: also respect mixing types on creation?
@@ -3435,14 +3445,14 @@
         while (niter.hasNext()) {
             NodeImpl child = (NodeImpl) niter.nextNode();
             NodeImpl dstNode = null;
-            String uuid = child.internalGetUUID();
+            NodeId id = (NodeId) child.getId();
             if (hasNode(child.getQName())) {
                 // todo: does not work properly for samename siblings
                 dstNode = getNode(child.getQName());
             } else if (child.isNodeType(QName.MIX_REFERENCEABLE)) {
                 // if child is referenceable, check if correspondance exist in this workspace
                 try {
-                    dstNode = (NodeImpl) session.getNodeByUUID(uuid);
+                    dstNode = session.getNodeById(id);
                     if (removeExisting) {
                         dstNode.internalRemove(false);
                         dstNode = null;
@@ -3456,10 +3466,10 @@
                 }
             } else {
                 // if child is not referenceable, clear uuid
-                uuid = null;
+                id = null;
             }
             if (dstNode == null) {
-                dstNode = internalAddChildNode(child.getQName(), (NodeTypeImpl) child.getPrimaryNodeType(), uuid);
+                dstNode = internalAddChildNode(child.getQName(), (NodeTypeImpl) child.getPrimaryNodeType(), id);
                 // add mixins
                 NodeType[] mixins = child.getMixinNodeTypes();
                 for (int i = 0; i < mixins.length; i++) {
@@ -3529,7 +3539,7 @@
         restored.add(version);
 
         // 2. N's jcr:baseVersion property will be changed to point to V.
-        UUID uuid = new UUID(((NodeId) version.getId()).getUUID());
+        UUID uuid = ((NodeId) version.getId()).getUUID();
         internalSetProperty(QName.JCR_BASEVERSION, InternalValue.create(uuid));
 
         // 4. N's jcr:predecessor property is set to null
@@ -3557,8 +3567,8 @@
 
         // check uuid
         if (isNodeType(QName.MIX_REFERENCEABLE)) {
-            String uuid = freeze.getFrozenUUID();
-            if (uuid != null && !uuid.equals(getUUID())) {
+            UUID uuid = freeze.getFrozenUUID();
+            if (!internalGetUUID().equals(uuid)) {
                 throw new ItemExistsException("Unable to restore version of " + safeGetJCRPath() + ". UUID changed.");
             }
         }
@@ -3657,12 +3667,12 @@
 
             } else if (child instanceof InternalFrozenVersionHistory) {
                 InternalFrozenVersionHistory f = (InternalFrozenVersionHistory) child;
-                VersionHistory history = (VersionHistory) session.getNodeByUUID(f.getVersionHistoryId());
-                String nodeId = history.getVersionableUUID();
+                VersionHistory history = (VersionHistory) session.getNodeById(f.getVersionHistoryId());
+                NodeId nodeId = NodeId.valueOf(history.getVersionableUUID());
 
                 // check if representing versionable already exists somewhere
-                if (itemMgr.itemExists(new NodeId(nodeId))) {
-                    NodeImpl n = (NodeImpl) session.getNodeByUUID(nodeId);
+                if (itemMgr.itemExists(nodeId)) {
+                    NodeImpl n = session.getNodeById(nodeId);
                     if (n.getParent().isSame(this)) {
                         // so order at end
                         // orderBefore(n.getName(), "");

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/PropertyId.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/PropertyId.java?rev=378221&r1=378220&r2=378221&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/PropertyId.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/PropertyId.java Thu Feb 16 02:48:20 2006
@@ -28,8 +28,8 @@
     /** Serial version UID of this class. */
     static final long serialVersionUID = -3726624437800567892L;
 
-    /** UUID of the parent node. */
-    private final String parentUUID;
+    /** ID of the parent node. */
+    private final NodeId parentId;
 
     /** Qualified name of the property. */
     private final QName propName;
@@ -37,17 +37,17 @@
     /**
      * Creates a property identifier instance for the identified property.
      *
-     * @param parentUUID UUID of the parent node
+     * @param parentId the id of the parent node
      * @param propName qualified name of the property
      */
-    public PropertyId(String parentUUID, QName propName) {
-        if (parentUUID == null) {
-            throw new IllegalArgumentException("parentUUID can not be null");
+    public PropertyId(NodeId parentId, QName propName) {
+        if (parentId == null) {
+            throw new IllegalArgumentException("parentId can not be null");
         }
         if (propName == null) {
             throw new IllegalArgumentException("propName can not be null");
         }
-        this.parentUUID = parentUUID;
+        this.parentId = parentId;
         this.propName = propName;
     }
 
@@ -63,12 +63,12 @@
     }
 
     /**
-     * Returns the UUID of the parent node.
+     * Returns the Id of the parent node.
      *
-     * @return node UUID
+     * @return node Id
      */
-    public String getParentUUID() {
-        return parentUUID;
+    public NodeId getParentId() {
+        return parentId;
     }
 
     /**
@@ -103,7 +103,7 @@
         String uuid = s.substring(0, i);
         QName name = QName.valueOf(s.substring(i + 1));
 
-        return new PropertyId(uuid, name);
+        return new PropertyId(NodeId.valueOf(uuid), name);
     }
 
     //-------------------------------------------< java.lang.Object overrides >
@@ -123,7 +123,7 @@
         }
         if (obj instanceof PropertyId) {
             PropertyId other = (PropertyId) obj;
-            return parentUUID.equals(other.parentUUID)
+            return parentId.equals(other.parentId)
                     && propName.equals(other.propName);
         }
         return false;
@@ -136,7 +136,7 @@
      * @see Object#toString()
      */
     public String toString() {
-        return parentUUID + "/" + propName.toString();
+        return parentId + "/" + propName;
     }
 
     /**
@@ -152,7 +152,7 @@
         int h = hash;
         if (h == 0) {
             h = 17;
-            h = 37 * h + parentUUID.hashCode();
+            h = 37 * h + parentId.hashCode();
             h = 37 * h + propName.hashCode();
             hash = h;
         }

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/PropertyImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/PropertyImpl.java?rev=378221&r1=378220&r2=378221&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/PropertyImpl.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/PropertyImpl.java Thu Feb 16 02:48:20 2006
@@ -415,8 +415,7 @@
      * {@inheritDoc}
      */
     public QName getQName() {
-        PropertyId propId = (PropertyId) id;
-        return propId.getName();
+        return ((PropertyId) id).getName();
     }
 
     /**
@@ -654,7 +653,7 @@
         if (val.getType() == PropertyType.REFERENCE) {
             // reference, i.e. target UUID
             UUID targetUUID = (UUID) val.internalValue();
-            return (Node) itemMgr.getItem(new NodeId(targetUUID.toString()));
+            return (Node) itemMgr.getItem(new NodeId(targetUUID));
         } else {
             throw new ValueFormatException("property must be of type REFERENCE");
         }
@@ -1128,8 +1127,7 @@
         // check state of this instance
         sanityCheck();
 
-        PropertyId propId = (PropertyId) id;
-        QName name = propId.getName();
+        QName name = ((PropertyId) id).getName();
         try {
             return session.getNamespaceResolver().getJCRName(name);
         } catch (NoPrefixDeclaredException npde) {
@@ -1158,6 +1156,6 @@
         // check state of this instance
         sanityCheck();
 
-        return (Node) itemMgr.getItem(new NodeId(state.getParentUUID()));
+        return (Node) itemMgr.getItem(state.getParentId());
     }
 }

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java?rev=378221&r1=378220&r2=378221&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java Thu Feb 16 02:48:20 2006
@@ -44,7 +44,6 @@
 import org.apache.jackrabbit.core.version.VersionManagerImpl;
 import org.apache.jackrabbit.name.QName;
 import org.apache.jackrabbit.name.NoPrefixDeclaredException;
-import org.apache.jackrabbit.uuid.UUID;
 import org.apache.log4j.Logger;
 
 import javax.jcr.AccessDeniedException;
@@ -91,13 +90,24 @@
     private static final String REPOSITORY_LOCK = ".lock";
 
     /**
-     * hardcoded uuid of the repository root node
+     * hardcoded id of the repository root node
      */
-    private static final String ROOT_NODE_UUID = "cafebabe-cafe-babe-cafe-babecafebabe";
+    public static final NodeId ROOT_NODE_ID = NodeId.valueOf("cafebabe-cafe-babe-cafe-babecafebabe");
 
-    private static final String SYSTEM_ROOT_NODE_UUID = "deadbeef-cafe-babe-cafe-babecafebabe";
-    private static final String VERSION_STORAGE_NODE_UUID = "deadbeef-face-babe-cafe-babecafebabe";
-    private static final String NODETYPES_NODE_UUID = "deadbeef-cafe-cafe-cafe-babecafebabe";
+    /**
+     * hardcoded id of the "/jcr:system" node
+     */
+    public static final NodeId SYSTEM_ROOT_NODE_ID = NodeId.valueOf("deadbeef-cafe-babe-cafe-babecafebabe");
+
+    /**
+     * hardcoded id of the "/jcr:system/jcr:versionStorage" node
+     */
+    public static final NodeId VERSION_STORAGE_NODE_ID = NodeId.valueOf("deadbeef-face-babe-cafe-babecafebabe");
+
+    /**
+     * hardcoded id of the "/jcr:system/jcr:nodeTypes" node
+     */
+    public static final NodeId NODETYPES_NODE_ID = NodeId.valueOf("deadbeef-cafe-cafe-cafe-babecafebabe");
 
     /**
      * the name of the filesystem resource containing the properties of the
@@ -114,7 +124,7 @@
     public static final String STATS_NODE_COUNT_PROPERTY = "jcr.repository.stats.nodes.count";
     public static final String STATS_PROP_COUNT_PROPERTY = "jcr.repository.stats.properties.count";
 
-    private String rootNodeUUID;
+    private NodeId rootNodeId;
 
     private final NamespaceRegistryImpl nsReg;
     private final NodeTypeRegistry ntReg;
@@ -200,7 +210,7 @@
         metaDataStore = new BasedFileSystem(repStore, fsRootPath);
 
         // init root node uuid
-        rootNodeUUID = loadRootNodeUUID(metaDataStore);
+        rootNodeId = loadRootNodeId(metaDataStore);
 
         // load repository properties
         repProps = loadRepProps();
@@ -225,7 +235,7 @@
 
         // init virtual node type manager
         virtNTMgr = new VirtualNodeTypeStateManager(getNodeTypeRegistry(),
-                delegatingDispatcher, NODETYPES_NODE_UUID, SYSTEM_ROOT_NODE_UUID);
+                delegatingDispatcher, NODETYPES_NODE_ID, SYSTEM_ROOT_NODE_ID);
 
         // initialize default workspace
         String wspName = repConfig.getDefaultWorkspaceName();
@@ -271,10 +281,11 @@
         PersistenceManager pm = createPersistenceManager(vConfig.getHomeDir(),
                 vConfig.getFileSystem(),
                 vConfig.getPersistenceManagerConfig(),
-                rootNodeUUID,
+                rootNodeId,
                 nsReg,
                 ntReg);
-        return new VersionManagerImpl(pm, ntReg, delegatingDispatcher, VERSION_STORAGE_NODE_UUID, SYSTEM_ROOT_NODE_UUID);
+        return new VersionManagerImpl(pm, ntReg, delegatingDispatcher,
+                VERSION_STORAGE_NODE_ID, SYSTEM_ROOT_NODE_ID);
     }
 
     /**
@@ -339,7 +350,7 @@
      * @return
      * @throws RepositoryException
      */
-    protected String loadRootNodeUUID(FileSystem fs) throws RepositoryException {
+    protected NodeId loadRootNodeId(FileSystem fs) throws RepositoryException {
         FileSystemResource uuidFile = new FileSystemResource(fs, "rootUUID");
         try {
             if (uuidFile.exists()) {
@@ -372,7 +383,7 @@
                             // ignore
                         }
                     }
-                    return new UUID(new String(chars)).toString();
+                    return NodeId.valueOf(new String(chars));
                 } catch (Exception e) {
                     String msg = "failed to load persisted repository state";
                     log.debug(msg);
@@ -408,7 +419,7 @@
                     // store uuid in text format for better readability
                     OutputStreamWriter writer = new OutputStreamWriter(out);
                     try {
-                        writer.write(ROOT_NODE_UUID);
+                        writer.write(ROOT_NODE_ID.toString());
                     } finally {
                         try {
                             writer.close();
@@ -416,7 +427,7 @@
                             // ignore
                         }
                     }
-                    return ROOT_NODE_UUID;
+                    return ROOT_NODE_ID;
                 } catch (Exception e) {
                     String msg = "failed to persist repository state";
                     log.debug(msg);
@@ -504,13 +515,13 @@
         NodeImpl rootNode = (NodeImpl) sysSession.getRootNode();
         if (!rootNode.hasNode(QName.JCR_SYSTEM)) {
             NodeTypeImpl nt = sysSession.getNodeTypeManager().getNodeType(QName.REP_SYSTEM);
-            NodeImpl sysRoot = rootNode.internalAddChildNode(QName.JCR_SYSTEM, nt, SYSTEM_ROOT_NODE_UUID);
+            NodeImpl sysRoot = rootNode.internalAddChildNode(QName.JCR_SYSTEM, nt, SYSTEM_ROOT_NODE_ID);
             // add version storage
             nt = sysSession.getNodeTypeManager().getNodeType(QName.REP_VERSIONSTORAGE);
-            sysRoot.internalAddChildNode(QName.JCR_VERSIONSTORAGE, nt, VERSION_STORAGE_NODE_UUID);
+            sysRoot.internalAddChildNode(QName.JCR_VERSIONSTORAGE, nt, VERSION_STORAGE_NODE_ID);
             // add node types
             nt = sysSession.getNodeTypeManager().getNodeType(QName.REP_NODETYPES);
-            sysRoot.internalAddChildNode(QName.JCR_NODETYPES, nt, NODETYPES_NODE_UUID);
+            sysRoot.internalAddChildNode(QName.JCR_NODETYPES, nt, NODETYPES_NODE_ID);
             rootNode.save();
         }
 
@@ -545,7 +556,7 @@
                 if (repConfig.getSearchConfig() != null) {
                     SystemSession defSysSession = getSystemSession(wspName);
                     systemSearchMgr = new SystemSearchManager(repConfig.getSearchConfig(),
-                            nsReg, ntReg, defSysSession.getItemStateManager(), SYSTEM_ROOT_NODE_UUID);
+                            nsReg, ntReg, defSysSession.getItemStateManager(), SYSTEM_ROOT_NODE_ID);
                     ObservationManager obsMgr = defSysSession.getWorkspace().getObservationManager();
                     obsMgr.addEventListener(systemSearchMgr, Event.NODE_ADDED |
                             Event.NODE_REMOVED | Event.PROPERTY_ADDED |
@@ -583,11 +594,11 @@
         return vMgr;
     }
 
-    String getRootNodeUUID() {
+    NodeId getRootNodeId() {
         // check sanity of this instance
         sanityCheck();
 
-        return rootNodeUUID;
+        return rootNodeId;
     }
 
     /**
@@ -981,13 +992,13 @@
     private static PersistenceManager createPersistenceManager(File homeDir,
                                                                FileSystem fs,
                                                                PersistenceManagerConfig pmConfig,
-                                                               String rootNodeUUID,
+                                                               NodeId rootNodeId,
                                                                NamespaceRegistry nsReg,
                                                                NodeTypeRegistry ntReg)
             throws RepositoryException {
         try {
             PersistenceManager pm = (PersistenceManager) pmConfig.newInstance();
-            pm.init(new PMContext(homeDir, fs, rootNodeUUID, nsReg, ntReg));
+            pm.init(new PMContext(homeDir, fs, rootNodeId, nsReg, ntReg));
             return pm;
         } catch (Exception e) {
             String msg = "Cannot instantiate persistence manager " + pmConfig.getClassName();
@@ -1395,9 +1406,9 @@
                         nsReg,
                         ntReg,
                         itemStateMgr,
-                        rootNodeUUID,
+                        rootNodeId,
                         getSystemSearchManager(getName()),
-                        SYSTEM_ROOT_NODE_UUID);
+                        SYSTEM_ROOT_NODE_ID);
             }
             return searchMgr;
         }
@@ -1472,14 +1483,14 @@
             persistMgr = createPersistenceManager(new File(config.getHomeDir()),
                     fs,
                     config.getPersistenceManagerConfig(),
-                    rootNodeUUID,
+                    rootNodeId,
                     nsReg,
                     ntReg);
 
             // create item state manager
             try {
                 itemStateMgr =
-                        new SharedItemStateManager(persistMgr, rootNodeUUID, ntReg, true);
+                        new SharedItemStateManager(persistMgr, rootNodeId, ntReg, true);
                 try {
                     itemStateMgr.addVirtualItemStateProvider(
                             vMgr.getVirtualItemStateProvider());

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/SearchManager.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/SearchManager.java?rev=378221&r1=378220&r2=378221&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/SearchManager.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/SearchManager.java Thu Feb 16 02:48:20 2006
@@ -16,24 +16,24 @@
  */
 package org.apache.jackrabbit.core;
 
-import org.apache.commons.collections.iterators.AbstractIteratorDecorator;
 import org.apache.jackrabbit.core.config.SearchConfig;
 import org.apache.jackrabbit.core.fs.FileSystem;
 import org.apache.jackrabbit.core.fs.FileSystemException;
 import org.apache.jackrabbit.core.nodetype.NodeTypeRegistry;
 import org.apache.jackrabbit.core.observation.EventImpl;
 import org.apache.jackrabbit.core.observation.SynchronousEventListener;
+import org.apache.jackrabbit.core.query.AbstractQueryImpl;
 import org.apache.jackrabbit.core.query.QueryHandler;
 import org.apache.jackrabbit.core.query.QueryHandlerContext;
 import org.apache.jackrabbit.core.query.QueryImpl;
-import org.apache.jackrabbit.core.query.AbstractQueryImpl;
 import org.apache.jackrabbit.core.state.ItemStateException;
 import org.apache.jackrabbit.core.state.ItemStateManager;
-import org.apache.jackrabbit.core.state.ItemState;
+import org.apache.jackrabbit.core.state.NodeState;
+import org.apache.jackrabbit.core.state.NodeStateIterator;
 import org.apache.jackrabbit.name.AbstractNamespaceResolver;
-import org.apache.jackrabbit.name.Path;
 import org.apache.jackrabbit.name.NamespaceResolver;
 import org.apache.jackrabbit.name.NoPrefixDeclaredException;
+import org.apache.jackrabbit.name.Path;
 import org.apache.log4j.Logger;
 
 import javax.jcr.NamespaceException;
@@ -46,16 +46,17 @@
 import javax.jcr.query.Query;
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Properties;
 import java.util.Set;
 import java.util.Timer;
 import java.util.TimerTask;
-import java.util.Properties;
 import java.util.WeakHashMap;
-import java.util.Map;
-import java.util.Collections;
 
 /**
  * Acts as a global entry point to execute queries and index nodes.
@@ -135,7 +136,7 @@
     /**
      * The root node for this search manager.
      */
-    private final String rootNodeUUID;
+    private final NodeId rootNodeId;
 
     /**
      * QueryHandler where query execution is delegated to
@@ -154,10 +155,10 @@
     private final NamespaceResolver nsResolver;
 
     /**
-     * UUID of the node that should be excluded from indexing or <code>null</code>
+     * ID of the node that should be excluded from indexing or <code>null</code>
      * if no node should be excluded.
      */
-    private final String excludedNodeUUID;
+    private final NodeId excludedNodeId;
 
     /**
      * Path that will be excluded from indexing.
@@ -200,10 +201,10 @@
      * @param nsReg            the namespace registry.
      * @param ntReg the node type registry.
      * @param itemMgr the shared item state manager.
-     * @param rootNodeUUID     the uuid of the root node.
+     * @param rootNodeId     the id of the root node.
      * @param parentMgr        the parent search manager or <code>null</code> if
      *                         there is no parent search manager.
-     * @param excludedNodeUUID uuid of the node that should be excluded from
+     * @param excludedNodeId id of the node that should be excluded from
      *                         indexing. Any descendant of that node will also
      *                         be excluded from indexing.
      * @throws RepositoryException if the search manager cannot be initialized
@@ -212,16 +213,16 @@
                          final NamespaceRegistry nsReg,
                          NodeTypeRegistry ntReg,
                          ItemStateManager itemMgr,
-                         String rootNodeUUID,
+                         NodeId rootNodeId,
                          SearchManager parentMgr,
-                         String excludedNodeUUID) throws RepositoryException {
+                         NodeId excludedNodeId) throws RepositoryException {
         this.fs = config.getFileSystem();
         this.config = config;
         this.ntReg = ntReg;
         this.itemMgr = itemMgr;
-        this.rootNodeUUID = rootNodeUUID;
+        this.rootNodeId = rootNodeId;
         this.parentHandler = (parentMgr != null) ? parentMgr.handler : null;
-        this.excludedNodeUUID = excludedNodeUUID;
+        this.excludedNodeId = excludedNodeId;
         this.nsResolver = new AbstractNamespaceResolver() {
             public String getURI(String prefix) throws NamespaceException {
                 try {
@@ -263,9 +264,9 @@
             idleTime = DEFAULT_IDLE_TIME;
         }
 
-        if (excludedNodeUUID != null) {
-            HierarchyManagerImpl hmgr = new HierarchyManagerImpl(rootNodeUUID, itemMgr, nsResolver);
-            excludePath = hmgr.getPath(new NodeId(excludedNodeUUID));
+        if (excludedNodeId != null) {
+            HierarchyManagerImpl hmgr = new HierarchyManagerImpl(rootNodeId, itemMgr, nsResolver);
+            excludePath = hmgr.getPath(excludedNodeId);
         }
 
         // initialize query handler
@@ -375,9 +376,9 @@
         }
 
         // nodes that need to be removed from the index.
-        Set removedNodes = new HashSet();
+        final Set removedNodes = new HashSet();
         // nodes that need to be added to the index.
-        Set addedNodes = new HashSet();
+        final Set addedNodes = new HashSet();
         // property events
         List propEvents = new ArrayList();
 
@@ -392,9 +393,9 @@
             }
             long type = e.getType();
             if (type == Event.NODE_ADDED) {
-                addedNodes.add(e.getChildUUID());
+                addedNodes.add(e.getChildId());
             } else if (type == Event.NODE_REMOVED) {
-                removedNodes.add(e.getChildUUID());
+                removedNodes.add(e.getChildId());
             } else {
                 propEvents.add(e);
             }
@@ -403,42 +404,76 @@
         // sort out property events
         for (int i = 0; i < propEvents.size(); i++) {
             EventImpl event = (EventImpl) propEvents.get(i);
-            String nodeUUID = event.getParentUUID();
+            NodeId nodeId = event.getParentId();
             if (event.getType() == Event.PROPERTY_ADDED) {
-                if (addedNodes.add(nodeUUID)) {
+                if (addedNodes.add(nodeId)) {
                     // only property added
                     // need to re-index
-                    removedNodes.add(nodeUUID);
+                    removedNodes.add(nodeId);
                 } else {
                     // the node where this prop belongs to is also new
                 }
             } else if (event.getType() == Event.PROPERTY_CHANGED) {
                 // need to re-index
-                addedNodes.add(nodeUUID);
-                removedNodes.add(nodeUUID);
+                addedNodes.add(nodeId);
+                removedNodes.add(nodeId);
             } else {
                 // property removed event is only generated when node still exists
-                addedNodes.add(nodeUUID);
-                removedNodes.add(nodeUUID);
+                addedNodes.add(nodeId);
+                removedNodes.add(nodeId);
             }
         }
 
-        Iterator addedStates = new AbstractIteratorDecorator(addedNodes.iterator()) {
+        NodeStateIterator addedStates = new NodeStateIterator() {
+            private final Iterator iter = addedNodes.iterator();
+
+            public void remove() {
+                throw new UnsupportedOperationException();
+            }
+
+            public boolean hasNext() {
+                return iter.hasNext();
+            }
+
             public Object next() {
-                ItemState item = null;
-                String uuid = (String) super.next();
+                return nextNodeState();
+            }
+
+            public NodeState nextNodeState() {
+                NodeState item = null;
+                NodeId id= (NodeId) iter.next();
                 try {
-                    item = itemMgr.getItemState(new NodeId(uuid));
+                    item = (NodeState) itemMgr.getItemState(id);
                 } catch (ItemStateException e) {
-                    log.error("Unable to index node " + uuid + ": does not exist");
+                    log.error("Unable to index node " + id + ": does not exist");
                 }
                 return item;
             }
         };
+        NodeIdIterator removedIds = new NodeIdIterator() {
+            private final Iterator iter = removedNodes.iterator();
+
+            public NodeId nextNodeId() throws NoSuchElementException {
+                return (NodeId) iter.next();
+            }
+
+            public void remove() {
+                throw new UnsupportedOperationException();
+            }
+
+            public boolean hasNext() {
+                return iter.hasNext();
+            }
+
+            public Object next() {
+                return nextNodeId();
+            }
+        };
+
         if (removedNodes.size() > 0 || addedNodes.size() > 0) {
             try {
                 ensureInitialized();
-                handler.updateNodes(removedNodes.iterator(), addedStates);
+                handler.updateNodes(removedIds, addedStates);
             } catch (RepositoryException e) {
                 log.error("Error indexing node.", e);
             } catch (IOException e) {
@@ -489,8 +524,8 @@
         try {
             handler = (QueryHandler) config.newInstance();
             QueryHandlerContext context
-                    = new QueryHandlerContext(fs, itemMgr, rootNodeUUID,
-                            ntReg, parentHandler, excludedNodeUUID);
+                    = new QueryHandlerContext(fs, itemMgr, rootNodeId,
+                            ntReg, parentHandler, excludedNodeId);
             handler.init(context);
         } catch (Exception e) {
             throw new RepositoryException(e.getMessage(), e);

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/SessionImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/SessionImpl.java?rev=378221&r1=378220&r2=378221&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/SessionImpl.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/SessionImpl.java Thu Feb 16 02:48:20 2006
@@ -42,6 +42,7 @@
 import org.apache.jackrabbit.name.NamespaceResolver;
 import org.apache.jackrabbit.name.Path;
 import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.uuid.UUID;
 import org.apache.log4j.Logger;
 import org.apache.xml.serialize.OutputFormat;
 import org.apache.xml.serialize.XMLSerializer;
@@ -252,7 +253,7 @@
      * @return session item state manager
      */
     protected SessionItemStateManager createSessionItemStateManager(UpdatableItemStateManager manager) {
-        return new SessionItemStateManager(rep.getRootNodeUUID(),
+        return new SessionItemStateManager(rep.getRootNodeId(),
                 manager, getNamespaceResolver());
     }
 
@@ -280,7 +281,7 @@
     protected ItemManager createItemManager(SessionItemStateManager itemStateMgr,
                                             HierarchyManager hierMgr) {
         return new ItemManager(itemStateMgr, hierMgr, this,
-                ntMgr.getRootNodeDefinition(), rep.getRootNodeUUID());
+                ntMgr.getRootNodeDefinition(), rep.getRootNodeId());
     }
 
     /**
@@ -290,7 +291,7 @@
      */
     protected VersionManager createVersionManager(RepositoryImpl rep)
             throws RepositoryException {
-        
+
         return rep.getVersionManager();
     }
 
@@ -686,19 +687,33 @@
      * {@inheritDoc}
      */
     public Node getNodeByUUID(String uuid) throws ItemNotFoundException, RepositoryException {
+        return getNodeByUUID(UUID.fromString(uuid));
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Node getNodeByUUID(UUID uuid) throws ItemNotFoundException, RepositoryException {
+        NodeImpl node = getNodeById(new NodeId(uuid));
+        if (node.isNodeType(QName.MIX_REFERENCEABLE)) {
+            return node;
+        } else {
+            // there is a node with that uuid but the node does not expose it
+            throw new ItemNotFoundException(uuid.toString());
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public NodeImpl getNodeById(NodeId id) throws ItemNotFoundException, RepositoryException {
         // check sanity of this session
         sanityCheck();
 
         try {
-            NodeImpl node = (NodeImpl) getItemManager().getItem(new NodeId(uuid));
-            if (node.isNodeType(QName.MIX_REFERENCEABLE)) {
-                return node;
-            } else {
-                // there is a node with that uuid but the node does not expose it
-                throw new ItemNotFoundException(uuid);
-            }
+            return (NodeImpl) getItemManager().getItem(id);
         } catch (AccessDeniedException ade) {
-            throw new ItemNotFoundException(uuid);
+            throw new ItemNotFoundException(id.toString());
         }
     }
 
@@ -915,7 +930,7 @@
         srcParentNode.checkLock();
         destParentNode.checkLock();
 
-        String targetUUID = ((NodeState) targetNode.getItemState()).getUUID();
+        NodeId targetId = targetNode.getNodeId();
         int index = srcName.getIndex();
         if (index == 0) {
             index = 1;
@@ -923,7 +938,7 @@
 
         if (srcParentNode.isSame(destParentNode)) {
             // do rename
-            destParentNode.renameChildNode(srcName.getName(), index, targetUUID, destName.getName());
+            destParentNode.renameChildNode(srcName.getName(), index, targetId, destName.getName());
         } else {
             // do move:
             // 1. remove child node entry from old parent
@@ -933,11 +948,11 @@
             // 2. re-parent target node
             NodeState targetState =
                     (NodeState) targetNode.getOrCreateTransientItemState();
-            targetState.setParentUUID(destParentNode.internalGetUUID());
+            targetState.setParentId(destParentNode.getNodeId());
             // 3. add child node entry to new parent
             NodeState destParentState =
                     (NodeState) destParentNode.getOrCreateTransientItemState();
-            destParentState.addChildNodeEntry(destName.getName(), targetUUID);
+            destParentState.addChildNodeEntry(destName.getName(), targetId);
         }
 
         // change definition of target

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/SystemSearchManager.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/SystemSearchManager.java?rev=378221&r1=378220&r2=378221&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/SystemSearchManager.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/SystemSearchManager.java Thu Feb 16 02:48:20 2006
@@ -51,8 +51,8 @@
                  NamespaceRegistry nsReg,
                  NodeTypeRegistry ntReg,
                  ItemStateManager itemMgr,
-                 String rootNodeUUID) throws RepositoryException {
-        super(config, nsReg, ntReg, itemMgr, rootNodeUUID, null, null);
+                 NodeId rootNodeId) throws RepositoryException {
+        super(config, nsReg, ntReg, itemMgr, rootNodeId, null, null);
         this.nsReg = nsReg;
     }
 

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/WorkspaceImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/WorkspaceImpl.java?rev=378221&r1=378220&r2=378221&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/WorkspaceImpl.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/WorkspaceImpl.java Thu Feb 16 02:48:20 2006
@@ -129,7 +129,7 @@
         this.wspConfig = wspConfig;
         this.rep = rep;
         this.stateMgr = createItemStateManager(stateMgr);
-        this.hierMgr = new CachingHierarchyManager(rep.getRootNodeUUID(),
+        this.hierMgr = new CachingHierarchyManager(rep.getRootNodeId(),
                 this.stateMgr, session.getNamespaceResolver());
         this.session = session;
     }



Mime
View raw message