jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r793613 [4/8] - in /jackrabbit/sandbox/JCR-1456: ./ jackrabbit-core/ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/ jackrabbit-core/src/main/java/org/apache/jackra...
Date Mon, 13 Jul 2009 15:56:03 GMT
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/AbstractQueryHandler.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/AbstractQueryHandler.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/AbstractQueryHandler.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/AbstractQueryHandler.java Mon Jul 13 15:55:55 2009
@@ -16,13 +16,14 @@
  */
 package org.apache.jackrabbit.core.query;
 
-import org.apache.jackrabbit.core.NodeIdIterator;
-import org.apache.jackrabbit.core.state.NodeStateIterator;
+import org.apache.jackrabbit.core.id.NodeId;
+import org.apache.jackrabbit.core.state.NodeState;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import javax.jcr.RepositoryException;
 import java.io.IOException;
+import java.util.Iterator;
 
 /**
  * Implements default behaviour for some methods of {@link QueryHandler}.
@@ -95,13 +96,14 @@
      * @throws RepositoryException if an error occurs while indexing a node.
      * @throws IOException if an error occurs while updating the index.
      */
-    public synchronized void updateNodes(NodeIdIterator remove, NodeStateIterator add)
+    public synchronized void updateNodes(
+            Iterator<NodeId> remove, Iterator<NodeState> add)
             throws RepositoryException, IOException {
         while (remove.hasNext()) {
-            deleteNode(remove.nextNodeId());
+            deleteNode(remove.next());
         }
         while (add.hasNext()) {
-            addNode(add.nextNodeState());
+            addNode(add.next());
         }
     }
 

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/ExecutableQuery.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/ExecutableQuery.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/ExecutableQuery.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/ExecutableQuery.java Mon Jul 13 15:55:55 2009
@@ -47,8 +47,15 @@
      * @param value   value to bind
      * @throws IllegalArgumentException      if <code>varName</code> is not a
      *                                       valid variable in this query.
-     * @throws javax.jcr.RepositoryException if an error occurs.
+     * @throws RepositoryException if an error occurs.
      */
     void bindValue(Name varName, Value value)
         throws IllegalArgumentException, RepositoryException;
+
+    /**
+     * @return the names of the bind variables in this query.
+     *
+     * @throws RepositoryException if an error occurs.
+     */
+    Name[] getBindVariableNames() throws RepositoryException;
 }

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/OnWorkspaceInconsistency.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/OnWorkspaceInconsistency.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/OnWorkspaceInconsistency.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/OnWorkspaceInconsistency.java Mon Jul 13 15:55:55 2009
@@ -58,9 +58,9 @@
             log.error("Node {} ({}) has missing child '{}' ({})",
                     new Object[]{
                         resolver.getJCRPath(path),
-                        node.getNodeId().getUUID().toString(),
+                        node.getNodeId(),
                         resolver.getJCRName(child.getName()),
-                        child.getId().getUUID().toString()
+                        child.getId()
                     });
             throw exception;
         }

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/QueryHandler.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/QueryHandler.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/QueryHandler.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/QueryHandler.java Mon Jul 13 15:55:55 2009
@@ -17,17 +17,16 @@
 package org.apache.jackrabbit.core.query;
 
 import org.apache.jackrabbit.core.ItemManager;
-import org.apache.jackrabbit.core.NodeIdIterator;
 import org.apache.jackrabbit.core.SessionImpl;
-import org.apache.jackrabbit.core.NodeId;
+import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.core.state.NodeState;
-import org.apache.jackrabbit.core.state.NodeStateIterator;
 import org.apache.jackrabbit.spi.commons.query.qom.QueryObjectModelTree;
 
 import javax.jcr.RepositoryException;
 import javax.jcr.query.InvalidQueryException;
 
 import java.io.IOException;
+import java.util.Iterator;
 
 /**
  * Defines an interface for the actual node indexing and query execution.
@@ -80,7 +79,7 @@
      * @throws RepositoryException if an error occurs while indexing a node.
      * @throws IOException if an error occurs while updating the index.
      */
-    void updateNodes(NodeIdIterator remove, NodeStateIterator add)
+    void updateNodes(Iterator<NodeId> remove, Iterator<NodeState> add)
             throws RepositoryException, IOException;
 
     /**

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/QueryHandlerContext.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/QueryHandlerContext.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/QueryHandlerContext.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/QueryHandlerContext.java Mon Jul 13 15:55:55 2009
@@ -20,7 +20,7 @@
 import org.apache.jackrabbit.core.nodetype.NodeTypeRegistry;
 import org.apache.jackrabbit.core.state.ItemStateManager;
 import org.apache.jackrabbit.core.state.SharedItemStateManager;
-import org.apache.jackrabbit.core.NodeId;
+import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.core.NamespaceRegistryImpl;
 import org.apache.jackrabbit.core.HierarchyManager;
 import org.apache.jackrabbit.core.CachingHierarchyManager;

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/QueryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/QueryImpl.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/QueryImpl.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/QueryImpl.java Mon Jul 13 15:55:55 2009
@@ -20,6 +20,7 @@
 import org.apache.jackrabbit.core.SessionImpl;
 import org.apache.jackrabbit.spi.commons.conversion.NameException;
 import org.apache.jackrabbit.spi.Path;
+import org.apache.jackrabbit.spi.Name;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -196,6 +197,18 @@
     }
 
     /**
+     * {@inheritDoc}
+     */
+    public String[] getBindVariableNames() throws RepositoryException {
+        Name[] names = query.getBindVariableNames();
+        String[] strNames = new String[names.length];
+        for (int i = 0; i < names.length; i++) {
+            strNames[i] = session.getJCRName(names[i]);
+        }
+        return strNames;
+    }
+
+    /**
      * Binds the given <code>value</code> to the variable named
      * <code>varName</code>.
      *
@@ -267,5 +280,5 @@
             throw new IllegalStateException("not initialized");
         }
     }
-}
 
+}

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/QueryManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/QueryManagerImpl.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/QueryManagerImpl.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/QueryManagerImpl.java Mon Jul 13 15:55:55 2009
@@ -32,7 +32,7 @@
 import org.apache.jackrabbit.core.ItemManager;
 import org.apache.jackrabbit.core.SearchManager;
 import org.apache.jackrabbit.core.SessionImpl;
-import org.apache.jackrabbit.core.NodeId;
+import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.spi.commons.query.qom.QueryObjectModelFactoryImpl;
 import org.apache.jackrabbit.spi.commons.query.qom.QueryObjectModelTree;
 import org.apache.jackrabbit.spi.commons.name.NameConstants;
@@ -80,8 +80,7 @@
         this.session = session;
         this.itemMgr = itemMgr;
         this.searchMgr = searchMgr;
-        this.qomFactory = new QueryObjectModelFactoryImpl(
-                session, session.getValueFactory()) {
+        this.qomFactory = new QueryObjectModelFactoryImpl(session) {
             protected QueryObjectModel createQuery(QueryObjectModelTree qomTree)
                     throws InvalidQueryException, RepositoryException {
                 return searchMgr.createQueryObjectModel(
@@ -152,7 +151,7 @@
         sanityCheck();
         List<Node> nodes = new ArrayList<Node>();
         try {
-            NodeId nodeId = new NodeId(UUID.fromString(node.getIdentifier()));
+            NodeId nodeId = new NodeId(node.getIdentifier());
             for (NodeId id : searchMgr.getWeaklyReferringNodes(nodeId)) {
                 nodes.add(session.getNodeById(id));
             }
@@ -194,8 +193,7 @@
 
         public QueryFactoryImpl(final Node node, final String language) {
             super(Arrays.asList(
-                new QOMQueryFactory(new QueryObjectModelFactoryImpl(
-                        session, session.getValueFactory()) {
+                new QOMQueryFactory(new QueryObjectModelFactoryImpl(session) {
                     protected QueryObjectModel createQuery(QueryObjectModelTree qomTree)
                             throws InvalidQueryException, RepositoryException {
                         return searchMgr.createQueryObjectModel(

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AbstractExcerpt.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AbstractExcerpt.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AbstractExcerpt.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AbstractExcerpt.java Mon Jul 13 15:55:55 2009
@@ -29,7 +29,7 @@
 import org.apache.lucene.document.Fieldable;
 import org.apache.lucene.analysis.TokenStream;
 import org.apache.lucene.analysis.Token;
-import org.apache.jackrabbit.core.NodeId;
+import org.apache.jackrabbit.core.id.NodeId;
 
 import java.io.IOException;
 import java.io.StringReader;
@@ -83,7 +83,7 @@
         IndexReader reader = index.getIndexReader();
         try {
             checkRewritten(reader);
-            Term idTerm = new Term(FieldNames.UUID, id.getUUID().toString());
+            Term idTerm = new Term(FieldNames.UUID, id.toString());
             TermDocs tDocs = reader.termDocs(idTerm);
             int docNumber;
             Document doc;

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AbstractQueryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AbstractQueryImpl.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AbstractQueryImpl.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AbstractQueryImpl.java Mon Jul 13 15:55:55 2009
@@ -140,6 +140,13 @@
     }
 
     /**
+     * {@inheritDoc}
+     */
+    public Name[] getBindVariableNames() throws RepositoryException {
+        return variableNames.toArray(new Name[variableNames.size()]);
+    }
+
+    /**
      * Adds a name to the set of variables.
      *
      * @param varName the name of the variable.

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AggregateRuleImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AggregateRuleImpl.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AggregateRuleImpl.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AggregateRuleImpl.java Mon Jul 13 15:55:55 2009
@@ -29,8 +29,8 @@
 import org.apache.jackrabbit.core.state.ChildNodeEntry;
 import org.apache.jackrabbit.core.state.PropertyState;
 import org.apache.jackrabbit.core.HierarchyManager;
-import org.apache.jackrabbit.core.NodeId;
-import org.apache.jackrabbit.core.PropertyId;
+import org.apache.jackrabbit.core.id.NodeId;
+import org.apache.jackrabbit.core.id.PropertyId;
 import org.apache.jackrabbit.util.Text;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CachingIndexReader.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CachingIndexReader.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CachingIndexReader.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CachingIndexReader.java Mon Jul 13 15:55:55 2009
@@ -25,7 +25,7 @@
 import org.apache.lucene.index.TermDocs;
 import org.apache.lucene.index.TermEnum;
 import org.apache.lucene.index.CorruptIndexException;
-import org.apache.jackrabbit.uuid.UUID;
+import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.commons.collections.map.LRUMap;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -34,7 +34,6 @@
 import java.util.BitSet;
 import java.util.Map;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.Collections;
 import java.text.NumberFormat;
 
@@ -84,9 +83,9 @@
     private final DocNumberCache cache;
 
     /**
-     * Maps document number to node UUID.
+     * Maps document number to node id.
      */
-    private final Map docNumber2uuid;
+    private final Map<Integer, NodeId> docNumber2id;
 
     /**
      * A cache of TermDocs that are regularly read from the index.
@@ -104,6 +103,7 @@
      *                  when this index reader is constructed.
      * @throws IOException if an error occurs while reading from the index.
      */
+    @SuppressWarnings("unchecked")
     CachingIndexReader(IndexReader delegatee,
                        DocNumberCache cache,
                        boolean initCache)
@@ -126,8 +126,8 @@
             cacheInitializer.run();
         }
         // limit cache to 1% of maxDoc(), but at least 10.
-        this.docNumber2uuid = Collections.synchronizedMap(new LRUMap(
-                Math.max(10, delegatee.maxDoc() / 100)));
+        this.docNumber2id = Collections.synchronizedMap(
+                new LRUMap(Math.max(10, delegatee.maxDoc() / 100)));
         this.termDocsCache = new TermDocsCache(delegatee, FieldNames.PROPERTIES);
     }
 
@@ -208,7 +208,7 @@
     //--------------------< FilterIndexReader overwrites >----------------------
 
     /**
-     * Uses the {@link #docNumber2uuid} cache for document lookups that are only
+     * Uses the {@link #docNumber2id} cache for document lookups that are only
      * interested in the {@link FieldSelectors#UUID}.
      *
      * @param n the document number.
@@ -222,14 +222,14 @@
         if (fieldSelector == FieldSelectors.UUID) {
             Integer docNum = new Integer(n);
             Document doc;
-            UUID uuid = (UUID) docNumber2uuid.get(docNum);
-            if (uuid == null) {
+            NodeId id = docNumber2id.get(docNum);
+            if (id == null) {
                 doc = super.document(n, fieldSelector);
-                uuid = UUID.fromString(doc.get(FieldNames.UUID));
-                docNumber2uuid.put(docNum, uuid);
+                id = new NodeId(doc.get(FieldNames.UUID));
+                docNumber2id.put(docNum, id);
             } else {
                 doc = new Document();
-                doc.add(new Field(FieldNames.UUID, uuid.toString(),
+                doc.add(new Field(FieldNames.UUID, id.toString(),
                         Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS));
             }
             return doc;
@@ -391,17 +391,17 @@
          */
         private void initializeParents(IndexReader reader) throws IOException {
             long time = System.currentTimeMillis();
-            final Map docs = new HashMap();
+            final Map<Object, NodeInfo> docs = new HashMap<Object, NodeInfo>();
             // read UUIDs
             collectTermDocs(reader, new Term(FieldNames.UUID, ""), new TermDocsCollector() {
                 public void collect(Term term, TermDocs tDocs) throws IOException {
-                    UUID uuid = UUID.fromString(term.text());
+                    NodeId id = new NodeId(term.text());
                     while (tDocs.next()) {
                         int doc = tDocs.doc();
                         // skip shareable nodes
                         if (!shareableNodes.get(doc)) {
-                            NodeInfo info = new NodeInfo(doc, uuid);
-                            docs.put(new Integer(doc), info);
+                            NodeInfo info = new NodeInfo(doc, id);
+                            docs.put(doc, info);
                         }
                     }
                 }
@@ -410,16 +410,16 @@
             // read PARENTs
             collectTermDocs(reader, new Term(FieldNames.PARENT, "0"), new TermDocsCollector() {
                 public void collect(Term term, TermDocs tDocs) throws IOException {
-                    UUID uuid = UUID.fromString(term.text());
+                    NodeId id = new NodeId(term.text());
                     while (tDocs.next()) {
                         Integer docId = new Integer(tDocs.doc());
                         NodeInfo info = (NodeInfo) docs.get(docId);
                         if (info == null) {
                             // shareable node, see above
                         } else {
-                            info.parent = uuid;
+                            info.parent = id;
                             docs.remove(docId);
-                            docs.put(info.uuid, info);
+                            docs.put(info.id, info);
                         }
                     }
                 }
@@ -430,10 +430,8 @@
             }
 
             double foreignParents = 0;
-            Iterator it = docs.values().iterator();
-            while (it.hasNext()) {
-                NodeInfo info = (NodeInfo) it.next();
-                NodeInfo parent = (NodeInfo) docs.get(info.parent);
+            for (NodeInfo info : docs.values()) {
+                NodeInfo parent = docs.get(info.parent);
                 if (parent != null) {
                     parents[info.docId] = DocId.create(parent.docId);
                 } else if (info.parent != null) {
@@ -524,13 +522,13 @@
 
         final int docId;
 
-        final UUID uuid;
+        final NodeId id;
 
-        UUID parent;
+        NodeId parent;
 
-        public NodeInfo(int docId, UUID uuid) {
+        public NodeInfo(int docId, NodeId id) {
             this.docId = docId;
-            this.uuid = uuid;
+            this.id = id;
         }
     }
 }

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CachingMultiIndexReader.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CachingMultiIndexReader.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CachingMultiIndexReader.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CachingMultiIndexReader.java Mon Jul 13 15:55:55 2009
@@ -16,7 +16,7 @@
  */
 package org.apache.jackrabbit.core.query.lucene;
 
-import org.apache.jackrabbit.uuid.UUID;
+import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.lucene.index.MultiReader;
 import org.apache.lucene.index.Term;
 import org.apache.lucene.index.TermDocs;
@@ -42,7 +42,8 @@
     /**
      * Map of {@link OffsetReader}s, identified by creation tick.
      */
-    private final Map readersByCreationTick = new HashMap();
+    private final Map<Long, OffsetReader> readersByCreationTick =
+        new HashMap<Long, OffsetReader>();
 
     /**
      * Document number cache if available. May be <code>null</code>.
@@ -77,7 +78,7 @@
             starts[i] = maxDoc;
             maxDoc += subReaders[i].maxDoc();
             OffsetReader offsetReader = new OffsetReader(subReaders[i], starts[i]);
-            readersByCreationTick.put(new Long(subReaders[i].getCreationTick()), offsetReader);
+            readersByCreationTick.put(subReaders[i].getCreationTick(), offsetReader);
         }
         starts[subReaders.length] = maxDoc;
     }
@@ -116,8 +117,8 @@
                 // check if valid:
                 // 1) reader must be in the set of readers
                 // 2) doc must not be deleted
-                OffsetReader offsetReader = (OffsetReader) readersByCreationTick.get(
-                        new Long(e.creationTick));
+                OffsetReader offsetReader =
+                    readersByCreationTick.get(e.creationTick);
                 if (offsetReader != null && !offsetReader.reader.isDeleted(e.doc)) {
                     return new SingleTermDocs(e.doc + offsetReader.offset);
                 }
@@ -180,12 +181,12 @@
     /**
      * {@inheritDoc}
      */
-    public ForeignSegmentDocId createDocId(UUID uuid) throws IOException {
-        Term id = new Term(FieldNames.UUID, uuid.toString());
+    public ForeignSegmentDocId createDocId(NodeId id) throws IOException {
+        Term term = new Term(FieldNames.UUID, id.toString());
         int doc;
         long tick;
         for (int i = 0; i < subReaders.length; i++) {
-            TermDocs docs = subReaders[i].termDocs(id);
+            TermDocs docs = subReaders[i].termDocs(term);
             try {
                 if (docs.next()) {
                     doc = docs.doc();

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ChildAxisQuery.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ChildAxisQuery.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ChildAxisQuery.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ChildAxisQuery.java Mon Jul 13 15:55:55 2009
@@ -16,7 +16,7 @@
  */
 package org.apache.jackrabbit.core.query.lucene;
 
-import org.apache.jackrabbit.core.NodeId;
+import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.core.SessionImpl;
 import org.apache.jackrabbit.core.query.lucene.hits.AdaptingHits;
 import org.apache.jackrabbit.core.query.lucene.hits.Hits;
@@ -630,7 +630,7 @@
             Hits childrenHits = new AdaptingHits();
             for (Iterator it = uuids.values().iterator(); it.hasNext(); ) {
                 String uuid = (String) it.next();
-                NodeId id = new NodeId(UUID.fromString(uuid));
+                NodeId id = new NodeId(uuid);
                 try {
                     long time = System.currentTimeMillis();
                     NodeState state = (NodeState) itemMgr.getItemState(id);
@@ -645,7 +645,7 @@
                     }
                     while (entries.hasNext()) {
                         NodeId childId = ((ChildNodeEntry) entries.next()).getId();
-                        Term uuidTerm = new Term(FieldNames.UUID, childId.getUUID().toString());
+                        Term uuidTerm = new Term(FieldNames.UUID, childId.toString());
                         TermDocs docs = reader.termDocs(uuidTerm);
                         try {
                             if (docs.next()) {

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ConsistencyCheck.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ConsistencyCheck.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ConsistencyCheck.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ConsistencyCheck.java Mon Jul 13 15:55:55 2009
@@ -20,8 +20,7 @@
 import org.apache.jackrabbit.core.state.NodeState;
 import org.apache.jackrabbit.core.state.ItemStateException;
 import org.apache.jackrabbit.core.state.ChildNodeEntry;
-import org.apache.jackrabbit.core.NodeId;
-import org.apache.jackrabbit.uuid.UUID;
+import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.lucene.document.Document;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -63,9 +62,9 @@
     private final MultiIndex index;
 
     /**
-     * All the document UUIDs within the index.
+     * All the document ids within the index.
      */
-    private Set<UUID> documentUUIDs;
+    private Set<NodeId> documentIds;
 
     /**
      * List of all errors.
@@ -147,10 +146,10 @@
      * @throws IOException if an error occurs while running the check.
      */
     private void run() throws IOException {
-        // UUIDs of multiple nodes in the index
-        Set<UUID> multipleEntries = new HashSet<UUID>();
-        // collect all documents UUIDs
-        documentUUIDs = new HashSet<UUID>();
+        // Ids of multiple nodes in the index
+        Set<NodeId> multipleEntries = new HashSet<NodeId>();
+        // collect all documents ids
+        documentIds = new HashSet<NodeId>();
         CachingMultiIndexReader reader = index.getIndexReader();
         try {
             for (int i = 0; i < reader.maxDoc(); i++) {
@@ -162,13 +161,13 @@
                     continue;
                 }
                 Document d = reader.document(i, FieldSelectors.UUID);
-                UUID uuid = UUID.fromString(d.get(FieldNames.UUID));
-                if (stateMgr.hasItemState(new NodeId(uuid))) {
-                    if (!documentUUIDs.add(uuid)) {
-                        multipleEntries.add(uuid);
+                NodeId id = new NodeId(d.get(FieldNames.UUID));
+                if (stateMgr.hasItemState(id)) {
+                    if (!documentIds.add(id)) {
+                        multipleEntries.add(id);
                     }
                 } else {
-                    errors.add(new NodeDeleted(uuid));
+                    errors.add(new NodeDeleted(id));
                 }
             }
         } finally {
@@ -176,8 +175,8 @@
         }
 
         // create multiple entries errors
-        for (UUID uuid : multipleEntries) {
-            errors.add(new MultipleEntries(uuid));
+        for (NodeId id : multipleEntries) {
+            errors.add(new MultipleEntries(id));
         }
 
         reader = index.getIndexReader();
@@ -192,21 +191,20 @@
                     continue;
                 }
                 Document d = reader.document(i, FieldSelectors.UUID_AND_PARENT);
-                UUID uuid = UUID.fromString(d.get(FieldNames.UUID));
+                NodeId id = new NodeId(d.get(FieldNames.UUID));
                 String parentUUIDString = d.get(FieldNames.PARENT);
-                UUID parentUUID = null;
+                NodeId parentId = null;
                 if (parentUUIDString.length() > 0) {
-                    parentUUID = UUID.fromString(parentUUIDString);
+                    parentId = new NodeId(parentUUIDString);
                 }
-                if (parentUUID == null || documentUUIDs.contains(parentUUID)) {
+                if (parentId == null || documentIds.contains(parentId)) {
                     continue;
                 }
                 // parent is missing
-                NodeId parentId = new NodeId(parentUUID);
                 if (stateMgr.hasItemState(parentId)) {
-                    errors.add(new MissingAncestor(uuid, parentUUID));
+                    errors.add(new MissingAncestor(id, parentId));
                 } else {
-                    errors.add(new UnknownParent(uuid, parentUUID));
+                    errors.add(new UnknownParent(id, parentId));
                 }
             }
         } finally {
@@ -257,11 +255,11 @@
      */
     private class MissingAncestor extends ConsistencyCheckError {
 
-        private final UUID parentUUID;
+        private final NodeId parentId;
 
-        private MissingAncestor(UUID uuid, UUID parentUUID) {
-            super("Parent of " + uuid + " missing in index. Parent: " + parentUUID, uuid);
-            this.parentUUID = parentUUID;
+        private MissingAncestor(NodeId id, NodeId parentId) {
+            super("Parent of " + id + " missing in index. Parent: " + parentId, id);
+            this.parentId = parentId;
         }
 
         /**
@@ -277,15 +275,15 @@
          * @throws IOException if an error occurs while repairing.
          */
         public void repair() throws IOException {
-            NodeId parentId = new NodeId(parentUUID);
-            while (parentId != null && !documentUUIDs.contains(parentId.getUUID())) {
+            NodeId ancestorId = parentId;
+            while (ancestorId != null && !documentIds.contains(ancestorId)) {
                 try {
-                    NodeState n = (NodeState) stateMgr.getItemState(parentId);
+                    NodeState n = (NodeState) stateMgr.getItemState(ancestorId);
                     log.info("Reparing missing node " + getPath(n));
                     Document d = index.createDocument(n);
                     index.addDocument(d);
-                    documentUUIDs.add(n.getNodeId().getUUID());
-                    parentId = n.getParentId();
+                    documentIds.add(n.getNodeId());
+                    ancestorId = n.getParentId();
                 } catch (ItemStateException e) {
                     throw new IOException(e.toString());
                 } catch (RepositoryException e) {
@@ -300,8 +298,8 @@
      */
     private class UnknownParent extends ConsistencyCheckError {
 
-        private UnknownParent(UUID uuid, UUID parentUUID) {
-            super("Node " + uuid + " has unknown parent: " + parentUUID, uuid);
+        private UnknownParent(NodeId id, NodeId parentId) {
+            super("Node " + id + " has unknown parent: " + parentId, id);
         }
 
         /**
@@ -316,7 +314,7 @@
          * No operation.
          */
         public void repair() throws IOException {
-            log.warn("Unknown parent for " + uuid + " cannot be repaired");
+            log.warn("Unknown parent for " + id + " cannot be repaired");
         }
     }
 
@@ -325,8 +323,8 @@
      */
     private class MultipleEntries extends ConsistencyCheckError {
 
-        MultipleEntries(UUID uuid) {
-            super("Multiple entries found for node " + uuid, uuid);
+        MultipleEntries(NodeId id) {
+            super("Multiple entries found for node " + id, id);
         }
 
         /**
@@ -344,14 +342,14 @@
          */
         public void repair() throws IOException {
             // first remove all occurrences
-            index.removeAllDocuments(uuid);
+            index.removeAllDocuments(id);
             // then re-index the node
             try {
-                NodeState node = (NodeState) stateMgr.getItemState(new NodeId(uuid));
+                NodeState node = (NodeState) stateMgr.getItemState(id);
                 log.info("Re-indexing duplicate node occurrences in index: " + getPath(node));
                 Document d = index.createDocument(node);
                 index.addDocument(d);
-                documentUUIDs.add(node.getNodeId().getUUID());
+                documentIds.add(node.getNodeId());
             } catch (ItemStateException e) {
                 throw new IOException(e.toString());
             } catch (RepositoryException e) {
@@ -365,8 +363,8 @@
      */
     private class NodeDeleted extends ConsistencyCheckError {
 
-        NodeDeleted(UUID uuid) {
-            super("Node " + uuid + " does not longer exist.", uuid);
+        NodeDeleted(NodeId id) {
+            super("Node " + id + " does not longer exist.", id);
         }
 
         /**
@@ -382,8 +380,8 @@
          * @throws IOException if an error occurs while repairing.
          */
         public void repair() throws IOException {
-            log.info("Removing deleted node from index: " + uuid);
-            index.removeDocument(uuid);
+            log.info("Removing deleted node from index: " + id);
+            index.removeDocument(id);
         }
     }
 }

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ConsistencyCheckError.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ConsistencyCheckError.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ConsistencyCheckError.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ConsistencyCheckError.java Mon Jul 13 15:55:55 2009
@@ -16,7 +16,7 @@
  */
 package org.apache.jackrabbit.core.query.lucene;
 
-import org.apache.jackrabbit.uuid.UUID;
+import org.apache.jackrabbit.core.id.NodeId;
 
 import java.io.IOException;
 
@@ -31,13 +31,13 @@
     protected final String message;
 
     /**
-     * The UUID of the affected node.
+     * The id of the affected node.
      */
-    protected final UUID uuid;
+    protected final NodeId id;
 
-    ConsistencyCheckError(String message, UUID uuid) {
+    ConsistencyCheckError(String message, NodeId id) {
         this.message = message;
-        this.uuid = uuid;
+        this.id = id;
     }
 
     /**

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DocId.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DocId.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DocId.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DocId.java Mon Jul 13 15:55:55 2009
@@ -16,7 +16,7 @@
  */
 package org.apache.jackrabbit.core.query.lucene;
 
-import org.apache.jackrabbit.uuid.UUID;
+import org.apache.jackrabbit.core.id.NodeId;
 
 import java.io.IOException;
 import java.util.BitSet;
@@ -114,24 +114,24 @@
     }
 
     /**
-     * Creates a <code>DocId</code> based on a node UUID.
+     * Creates a <code>DocId</code> based on a UUID.
      *
-     * @param uuid the node uuid.
-     * @return a <code>DocId</code> based on a node UUID.
+     * @param uuid the UUID
+     * @return a <code>DocId</code> based on the UUID.
      * @throws IllegalArgumentException if the <code>uuid</code> is malformed.
      */
     static DocId create(String uuid) {
-        return create(UUID.fromString(uuid));
+        return create(new NodeId(uuid));
     }
 
     /**
-     * Creates a <code>DocId</code> based on a node UUID.
+     * Creates a <code>DocId</code> based on a node id.
      *
-     * @param uuid the node uuid.
-     * @return a <code>DocId</code> based on a node UUID.
+     * @param id the node id
+     * @return a <code>DocId</code> based on the node id
      */
-    static DocId create(UUID uuid) {
-        return new UUIDDocId(uuid);
+    static DocId create(NodeId id) {
+        return new UUIDDocId(id);
     }
 
     /**
@@ -202,19 +202,14 @@
     }
 
     /**
-     * <code>DocId</code> based on a UUID.
+     * <code>DocId</code> based on a node id.
      */
     private static final class UUIDDocId extends DocId {
 
         /**
-         * The least significant 64 bits of the uuid (bytes 8-15)
+         * The node identifier.
          */
-        private final long lsb;
-
-        /**
-         * The most significant 64 bits of the uuid (bytes 0-7)
-         */
-        private final long msb;
+        private final NodeId id;
 
         /**
          * The previously calculated foreign segment document id.
@@ -222,13 +217,12 @@
         private ForeignSegmentDocId doc;
 
         /**
-         * Creates a <code>DocId</code> based on a Node uuid.
+         * Creates a <code>DocId</code> based on a node id.
          *
-         * @param uuid the Node uuid.
+         * @param id the node id.
          */
-        UUIDDocId(UUID uuid) {
-            this.lsb = uuid.getLeastSignificantBits();
-            this.msb = uuid.getMostSignificantBits();
+        UUIDDocId(NodeId id) {
+            this.id = id;
         }
 
         /**
@@ -243,7 +237,7 @@
             }
             if (realDoc == -1) {
                 // Cached doc was invalid => create new one
-                segDocId = reader.createDocId(new UUID(msb, lsb));
+                segDocId = reader.createDocId(id);
                 if (segDocId != null) {
                     realDoc = reader.getDocumentNumber(segDocId);
                     doc = segDocId;
@@ -284,7 +278,7 @@
          * @return a String representation for this <code>DocId</code>.
          */
         public String toString() {
-            return "UUIDDocId(" + new UUID(msb, lsb) + ")";
+            return "UUIDDocId(" + id + ")";
         }
     }
 
@@ -305,7 +299,7 @@
         MultiUUIDDocId(String[] uuids) {
             this.docIds = new UUIDDocId[uuids.length];
             for (int i = 0; i < uuids.length; i++) {
-                docIds[i] = new UUIDDocId(UUID.fromString(uuids[i]));
+                docIds[i] = new UUIDDocId(new NodeId(uuids[i]));
             }
         }
 
@@ -353,7 +347,7 @@
             for (int i = 0; i < docIds.length; i++) {
                 sb.append(separator);
                 separator = ", ";
-                sb.append(new UUID(docIds[i].msb, docIds[i].lsb));
+                sb.append(docIds[i].id);
             }
             sb.append(")");
             return sb.toString();

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ExcerptProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ExcerptProvider.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ExcerptProvider.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ExcerptProvider.java Mon Jul 13 15:55:55 2009
@@ -16,7 +16,7 @@
  */
 package org.apache.jackrabbit.core.query.lucene;
 
-import org.apache.jackrabbit.core.NodeId;
+import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.commons.name.NameFactoryImpl;
 import org.apache.lucene.search.Query;

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexingConfigurationImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexingConfigurationImpl.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexingConfigurationImpl.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexingConfigurationImpl.java Mon Jul 13 15:55:55 2009
@@ -26,7 +26,7 @@
 import org.apache.jackrabbit.core.state.PropertyState;
 import org.apache.jackrabbit.core.state.ChildNodeEntry;
 import org.apache.jackrabbit.core.HierarchyManager;
-import org.apache.jackrabbit.core.PropertyId;
+import org.apache.jackrabbit.core.id.PropertyId;
 import org.apache.jackrabbit.core.HierarchyManagerImpl;
 import org.apache.jackrabbit.core.nodetype.xml.AdditionalNamespaceResolver;
 import org.apache.jackrabbit.core.nodetype.NodeTypeRegistry;

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexingQueue.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexingQueue.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexingQueue.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexingQueue.java Mon Jul 13 15:55:55 2009
@@ -23,7 +23,7 @@
 import java.util.List;
 import java.util.ArrayList;
 
-import org.apache.jackrabbit.core.NodeId;
+import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.uuid.UUID;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.index.Term;
@@ -98,11 +98,10 @@
         String[] uuids = queueStore.getPending();
         for (int i = 0; i < uuids.length; i++) {
             try {
-                UUID uuid = UUID.fromString(uuids[i]);
-                Document doc = index.createDocument(new NodeId(uuid));
+                Document doc = index.createDocument(new NodeId(uuids[i]));
                 pendingDocuments.put(uuids[i], doc);
                 log.debug("added node {}. New size of indexing queue: {}",
-                        uuid, new Integer(pendingDocuments.size()));
+                        uuids[i], new Integer(pendingDocuments.size()));
             } catch (IllegalArgumentException e) {
                 log.warn("Invalid UUID in indexing queue store: " + uuids[i]);
             } catch (RepositoryException e) {

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitIndexReader.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitIndexReader.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitIndexReader.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/JackrabbitIndexReader.java Mon Jul 13 15:55:55 2009
@@ -18,7 +18,7 @@
 
 import org.apache.lucene.index.FilterIndexReader;
 import org.apache.lucene.index.IndexReader;
-import org.apache.jackrabbit.uuid.UUID;
+import org.apache.jackrabbit.core.id.NodeId;
 
 import java.io.IOException;
 
@@ -98,8 +98,8 @@
     /**
      * {@inheritDoc}
      */
-    public ForeignSegmentDocId createDocId(UUID uuid) throws IOException {
-        return reader.createDocId(uuid);
+    public ForeignSegmentDocId createDocId(NodeId id) throws IOException {
+        return reader.createDocId(id);
     }
 
     /**

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LuceneQueryBuilder.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LuceneQueryBuilder.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LuceneQueryBuilder.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LuceneQueryBuilder.java Mon Jul 13 15:55:55 2009
@@ -33,7 +33,7 @@
 
 import org.apache.jackrabbit.core.HierarchyManager;
 import org.apache.jackrabbit.core.HierarchyManagerImpl;
-import org.apache.jackrabbit.core.NodeId;
+import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.core.RepositoryImpl;
 import org.apache.jackrabbit.core.SearchManager;
 import org.apache.jackrabbit.core.SessionImpl;
@@ -846,7 +846,7 @@
                     try {
                         NodeId id = hmgr.resolveNodePath(session.getQPath(node.getStringValue()));
                         if (id != null) {
-                            query = new SimilarityQuery(id.getUUID().toString(), analyzer);
+                            query = new SimilarityQuery(id.toString(), analyzer);
                         } else {
                             query = new BooleanQuery();
                         }
@@ -874,10 +874,7 @@
             boolean selectParent = true; 
             for (int i = steps.length - 2; i >= 0; i--) {
                 LocationStepQueryNode step = steps[i];
-                Name name = null;
-                if (!RelationQueryNode.STAR_NAME_TEST.equals(steps[i].getNameTest())) {
-                    name = steps[i].getNameTest();
-                }
+                Name name = steps[i].getNameTest();
                 if (i == steps.length - 2) {
                     if (step instanceof DerefQueryNode) {
                         query = createPredicateDeref(query, (DerefQueryNode) step, data);

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LuceneQueryHits.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LuceneQueryHits.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LuceneQueryHits.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LuceneQueryHits.java Mon Jul 13 15:55:55 2009
@@ -22,7 +22,7 @@
 import org.apache.lucene.search.IndexSearcher;
 import org.apache.lucene.search.Scorer;
 import org.apache.lucene.index.IndexReader;
-import org.apache.jackrabbit.core.NodeId;
+import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.uuid.UUID;
 
 /**
@@ -58,8 +58,7 @@
             return null;
         }
         int doc = scorer.doc();
-        String uuid = reader.document(doc).get(FieldNames.UUID);
-        NodeId id = new NodeId(UUID.fromString(uuid));
+        NodeId id = new NodeId(reader.document(doc).get(FieldNames.UUID));
         return new ScoreNode(id, scorer.score(), doc);
     }
 

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MultiIndex.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MultiIndex.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MultiIndex.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MultiIndex.java Mon Jul 13 15:55:55 2009
@@ -16,7 +16,7 @@
  */
 package org.apache.jackrabbit.core.query.lucene;
 
-import org.apache.jackrabbit.core.NodeId;
+import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.core.query.lucene.directory.DirectoryManager;
 import org.apache.jackrabbit.core.state.ItemStateException;
 import org.apache.jackrabbit.core.state.ItemStateManager;
@@ -24,7 +24,6 @@
 import org.apache.jackrabbit.core.state.NodeState;
 import org.apache.jackrabbit.core.state.ChildNodeEntry;
 import org.apache.jackrabbit.uuid.Constants;
-import org.apache.jackrabbit.uuid.UUID;
 import org.apache.jackrabbit.util.Timer;
 import org.apache.jackrabbit.spi.Path;
 import org.apache.jackrabbit.spi.PathFactory;
@@ -393,7 +392,7 @@
      * Atomically updates the index by removing some documents and adding
      * others.
      *
-     * @param remove collection of <code>UUID</code>s that identify documents to
+     * @param remove collection of <code>id</code>s that identify documents to
      *               remove
      * @param add    collection of <code>Document</code>s to add. Some of the
      *               elements in this collection may be <code>null</code>, to
@@ -401,7 +400,7 @@
      * @throws IOException if an error occurs while updating the index.
      */
     synchronized void update(
-            Collection<UUID> remove, Collection<Document> add)
+            Collection<NodeId> remove, Collection<Document> add)
             throws IOException {
         // make sure a reader is available during long updates
         if (add.size() > handler.getBufferSize()) {
@@ -417,8 +416,8 @@
 
             boolean flush = false;
 
-            for (UUID uuid : remove) {
-                executeAndLog(new DeleteNode(transactionId, uuid));
+            for (NodeId id : remove) {
+                executeAndLog(new DeleteNode(transactionId, id));
             }
 
             for (Document document : add) {
@@ -451,39 +450,39 @@
      *                     index.
      */
     void addDocument(Document doc) throws IOException {
-        Collection<UUID> empty = Collections.emptyList();
+        Collection<NodeId> empty = Collections.emptyList();
         update(empty, Collections.singleton(doc));
     }
 
     /**
-     * Deletes the first document that matches the <code>uuid</code>.
+     * Deletes the first document that matches the <code>id</code>.
      *
-     * @param uuid document that match this <code>uuid</code> will be deleted.
+     * @param id document that match this <code>id</code> will be deleted.
      * @throws IOException if an error occurs while deleting the document.
      */
-    void removeDocument(UUID uuid) throws IOException {
+    void removeDocument(NodeId id) throws IOException {
         Collection<Document> empty = Collections.emptyList();
-        update(Collections.singleton(uuid), empty);
+        update(Collections.singleton(id), empty);
     }
 
     /**
-     * Deletes all documents that match the <code>uuid</code>.
+     * Deletes all documents that match the <code>id</code>.
      *
-     * @param uuid documents that match this <code>uuid</code> will be deleted.
+     * @param id documents that match this <code>id</code> will be deleted.
      * @return the number of deleted documents.
      * @throws IOException if an error occurs while deleting documents.
      */
-    synchronized int removeAllDocuments(UUID uuid) throws IOException {
+    synchronized int removeAllDocuments(NodeId id) throws IOException {
         synchronized (updateMonitor) {
             updateInProgress = true;
         }
         int num;
         try {
-            Term idTerm = new Term(FieldNames.UUID, uuid.toString());
+            Term idTerm = new Term(FieldNames.UUID, id.toString());
             executeAndLog(new Start(Action.INTERNAL_TRANSACTION));
             num = volatileIndex.removeDocument(idTerm);
             if (num > 0) {
-                redoLog.append(new DeleteNode(getTransactionId(), uuid));
+                redoLog.append(new DeleteNode(getTransactionId(), id));
             }
             for (int i = 0; i < indexes.size(); i++) {
                 PersistentIndex index = (PersistentIndex) indexes.get(i);
@@ -491,7 +490,7 @@
                 if (indexNames.contains(index.getName())) {
                     int removed = index.removeDocument(idTerm);
                     if (removed > 0) {
-                        redoLog.append(new DeleteNode(getTransactionId(), uuid));
+                        redoLog.append(new DeleteNode(getTransactionId(), id));
                     }
                     num += removed;
                 }
@@ -1068,7 +1067,7 @@
         if (excludedIDs.contains(id)) {
             return count;
         }
-        executeAndLog(new AddNode(getTransactionId(), id.getUUID()));
+        executeAndLog(new AddNode(getTransactionId(), id));
         if (++count % 100 == 0) {
             PathResolver resolver = new DefaultNamePathResolver(
                     handler.getContext().getNamespaceRegistry());
@@ -1182,10 +1181,10 @@
      *                           the indexing queue to the index.
      */
     private void checkIndexingQueue(boolean transactionPresent) {
-        Map<UUID, Document> finished = new HashMap<UUID, Document>();
+        Map<NodeId, Document> finished = new HashMap<NodeId, Document>();
         for (Document document : indexingQueue.getFinishedDocuments()) {
-            UUID uuid = UUID.fromString(document.get(FieldNames.UUID));
-            finished.put(uuid, document);
+            NodeId id = new NodeId(document.get(FieldNames.UUID));
+            finished.put(id, document);
         }
 
         // now update index with the remaining ones if there are any
@@ -1194,14 +1193,14 @@
                     new Long(finished.size()));
 
             // remove documents from the queue
-            for (UUID uuid : finished.keySet()) {
-                indexingQueue.removeDocument(uuid.toString());
+            for (NodeId id : finished.keySet()) {
+                indexingQueue.removeDocument(id.toString());
             }
 
             try {
                 if (transactionPresent) {
-                    for (UUID uuid : finished.keySet()) {
-                        executeAndLog(new DeleteNode(getTransactionId(), uuid));
+                    for (NodeId id : finished.keySet()) {
+                        executeAndLog(new DeleteNode(getTransactionId(), id));
                     }
                     for (Document document : finished.values()) {
                         executeAndLog(new AddNode(getTransactionId(), document));
@@ -1512,9 +1511,9 @@
                 + 2;
 
         /**
-         * The uuid of the node to add.
+         * The id of the node to add.
          */
-        private final UUID uuid;
+        private final NodeId id;
 
         /**
          * The document to add to the index, or <code>null</code> if not available.
@@ -1525,11 +1524,11 @@
          * Creates a new AddNode action.
          *
          * @param transactionId the id of the transaction that executes this action.
-         * @param uuid the uuid of the node to add.
+         * @param id the id of the node to add.
          */
-        AddNode(long transactionId, UUID uuid) {
+        AddNode(long transactionId, NodeId id) {
             super(transactionId, Action.TYPE_ADD_NODE);
-            this.uuid = uuid;
+            this.id = id;
         }
 
         /**
@@ -1539,7 +1538,7 @@
          * @param doc the document to add.
          */
         AddNode(long transactionId, Document doc) {
-            this(transactionId, UUID.fromString(doc.get(FieldNames.UUID)));
+            this(transactionId, new NodeId(doc.get(FieldNames.UUID)));
             this.doc = doc;
         }
 
@@ -1548,8 +1547,7 @@
          *
          * @param transactionId the id of the transaction that executes this
          *                      action.
-         * @param arguments     the arguments to this action. The uuid of the node
-         *                      to add
+         * @param arguments     The UUID of the node to add
          * @return the AddNode action.
          * @throws IllegalArgumentException if the arguments are malformed. Not a
          *                                  UUID.
@@ -1560,7 +1558,7 @@
             if (arguments.length() != Constants.UUID_FORMATTED_LENGTH) {
                 throw new IllegalArgumentException("arguments is not a uuid");
             }
-            return new AddNode(transactionId, UUID.fromString(arguments));
+            return new AddNode(transactionId, new NodeId(arguments));
         }
 
         /**
@@ -1571,7 +1569,7 @@
         public void execute(MultiIndex index) throws IOException {
             if (doc == null) {
                 try {
-                    doc = index.createDocument(new NodeId(uuid));
+                    doc = index.createDocument(id);
                 } catch (RepositoryException e) {
                     // node does not exist anymore
                     log.debug(e.getMessage());
@@ -1591,7 +1589,7 @@
             logLine.append(' ');
             logLine.append(Action.ADD_NODE);
             logLine.append(' ');
-            logLine.append(uuid);
+            logLine.append(id);
             return logLine.toString();
         }
     }
@@ -1801,19 +1799,19 @@
                 + 2;
 
         /**
-         * The uuid of the node to remove.
+         * The id of the node to remove.
          */
-        private final UUID uuid;
+        private final NodeId id;
 
         /**
          * Creates a new DeleteNode action.
          *
          * @param transactionId the id of the transaction that executes this action.
-         * @param uuid the uuid of the node to delete.
+         * @param id the id of the node to delete.
          */
-        DeleteNode(long transactionId, UUID uuid) {
+        DeleteNode(long transactionId, NodeId id) {
             super(transactionId, Action.TYPE_DELETE_NODE);
-            this.uuid = uuid;
+            this.id = id;
         }
 
         /**
@@ -1821,7 +1819,7 @@
          *
          * @param transactionId the id of the transaction that executes this
          *                      action.
-         * @param arguments     the uuid of the node to delete.
+         * @param arguments     the UUID of the node to delete.
          * @return the DeleteNode action.
          * @throws IllegalArgumentException if the arguments are malformed. Not a
          *                                  UUID.
@@ -1831,7 +1829,7 @@
             if (arguments.length() != Constants.UUID_FORMATTED_LENGTH) {
                 throw new IllegalArgumentException("arguments is not a uuid");
             }
-            return new DeleteNode(transactionId, UUID.fromString(arguments));
+            return new DeleteNode(transactionId, new NodeId(arguments));
         }
 
         /**
@@ -1840,7 +1838,7 @@
          * @inheritDoc
          */
         public void execute(MultiIndex index) throws IOException {
-            String uuidString = uuid.toString();
+            String uuidString = id.toString();
             // check if indexing queue is still working on
             // this node from a previous update
             Document doc = index.indexingQueue.removeDocument(uuidString);
@@ -1874,7 +1872,7 @@
             logLine.append(' ');
             logLine.append(Action.DELETE_NODE);
             logLine.append(' ');
-            logLine.append(uuid);
+            logLine.append(id);
             return logLine.toString();
         }
     }

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MultiIndexReader.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MultiIndexReader.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MultiIndexReader.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MultiIndexReader.java Mon Jul 13 15:55:55 2009
@@ -17,7 +17,7 @@
 package org.apache.jackrabbit.core.query.lucene;
 
 import org.apache.lucene.index.IndexReader;
-import org.apache.jackrabbit.uuid.UUID;
+import org.apache.jackrabbit.core.id.NodeId;
 
 import java.io.IOException;
 
@@ -34,14 +34,14 @@
     IndexReader[] getIndexReaders();
 
     /**
-     * Creates a document id for the given <code>uuid</code>.
+     * Creates a document id for the given node identifier.
      *
-     * @param uuid the uuid of the node.
+     * @param id the id of the node.
      * @return a foreign segment doc id or <code>null</code> if there is no node
-     *         with the given <code>uuid</code>.
+     *         with the given <code>id</code>.
      * @throws IOException if an error occurs while reading from the index.
      */
-    ForeignSegmentDocId createDocId(UUID uuid) throws IOException;
+    ForeignSegmentDocId createDocId(NodeId id) throws IOException;
 
     /**
      * Returns the document number for the passed <code>docId</code>. If the id

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/NodeIndexer.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/NodeIndexer.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/NodeIndexer.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/NodeIndexer.java Mon Jul 13 15:55:55 2009
@@ -16,8 +16,8 @@
  */
 package org.apache.jackrabbit.core.query.lucene;
 
-import org.apache.jackrabbit.core.PropertyId;
-import org.apache.jackrabbit.core.NodeId;
+import org.apache.jackrabbit.core.id.PropertyId;
+import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.core.state.ItemStateException;
 import org.apache.jackrabbit.core.state.ItemStateManager;
 import org.apache.jackrabbit.core.state.NoSuchItemStateException;
@@ -30,7 +30,6 @@
 import org.apache.jackrabbit.spi.Path;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.commons.name.NameConstants;
-import org.apache.jackrabbit.uuid.UUID;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.apache.lucene.document.Document;
@@ -185,7 +184,7 @@
         // special fields
         // UUID
         doc.add(new Field(
-                FieldNames.UUID, node.getNodeId().getUUID().toString(),
+                FieldNames.UUID, node.getNodeId().toString(),
                 Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS));
         try {
             // parent UUID
@@ -319,12 +318,12 @@
                 break;
             case PropertyType.REFERENCE:
                 if (isIndexed(name)) {
-                    addReferenceValue(doc, fieldName, value.getUUID(), false);
+                    addReferenceValue(doc, fieldName, value.getNodeId(), false);
                 }
                 break;
             case PropertyType.WEAKREFERENCE:
                 if (isIndexed(name)) {
-                    addReferenceValue(doc, fieldName, value.getUUID(), true);
+                    addReferenceValue(doc, fieldName, value.getNodeId(), true);
                 }
                 break;
             case PropertyType.PATH:
@@ -583,8 +582,7 @@
      * @param weak          Flag indicating whether it's a WEAKREFERENCE (true) or a REFERENCE (flase)
      */
     protected void addReferenceValue(Document doc, String fieldName, Object internalValue, boolean weak) {
-        UUID value = (UUID) internalValue;
-        String uuid = value.toString();
+        String uuid = internalValue.toString();
         doc.add(createFieldWithoutNorms(fieldName, uuid,
                 weak ? PropertyType.WEAKREFERENCE : PropertyType.REFERENCE));
         doc.add(new Field(FieldNames.PROPERTIES,

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/PredicateDerefQuery.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/PredicateDerefQuery.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/PredicateDerefQuery.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/PredicateDerefQuery.java Mon Jul 13 15:55:55 2009
@@ -140,7 +140,7 @@
         if (cQuery == subQuery) {
             return this;
         } else {
-            return new PredicateDerefQuery(subQuery, refProperty, nameTest, version, nsMappings);
+            return new PredicateDerefQuery(cQuery, refProperty, nameTest, version, nsMappings);
         }
     }
 

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/QueryHitsQuery.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/QueryHitsQuery.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/QueryHitsQuery.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/QueryHitsQuery.java Mon Jul 13 15:55:55 2009
@@ -193,7 +193,7 @@
             Set sortedDocs = new TreeSet();
             try {
                 while ((node = hits.nextScoreNode()) != null) {
-                    String uuid = node.getNodeId().getUUID().toString();
+                    String uuid = node.getNodeId().toString();
                     Term id = new Term(FieldNames.UUID, uuid);
                     TermDocs tDocs = reader.termDocs(id);
                     try {

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/QueryResultImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/QueryResultImpl.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/QueryResultImpl.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/QueryResultImpl.java Mon Jul 13 15:55:55 2009
@@ -27,6 +27,7 @@
 import javax.jcr.ItemNotFoundException;
 import javax.jcr.NodeIterator;
 import javax.jcr.RepositoryException;
+import javax.jcr.UnsupportedRepositoryOperationException;
 import javax.jcr.query.QueryResult;
 import javax.jcr.query.RowIterator;
 import java.io.IOException;
@@ -184,6 +185,17 @@
     /**
      * {@inheritDoc}
      */
+    public String[] getSelectorNames() throws RepositoryException {
+        String[] names = new String[selectorNames.length];
+        for (int i = 0; i < selectorNames.length; i++) {
+            names[i] = session.getJCRName(selectorNames[i]);
+        }
+        return names;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
     public String[] getColumnNames() throws RepositoryException {
         return columns.keySet().toArray(new String[columns.size()]);
     }

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/RowIteratorImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/RowIteratorImpl.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/RowIteratorImpl.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/RowIteratorImpl.java Mon Jul 13 15:55:55 2009
@@ -17,7 +17,7 @@
 package org.apache.jackrabbit.core.query.lucene;
 
 import org.apache.jackrabbit.core.NodeImpl;
-import org.apache.jackrabbit.core.NodeId;
+import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.core.ItemManager;
 import org.apache.jackrabbit.core.HierarchyManager;
 import org.apache.jackrabbit.spi.commons.conversion.NameException;

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ScoreNode.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ScoreNode.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ScoreNode.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ScoreNode.java Mon Jul 13 15:55:55 2009
@@ -18,7 +18,7 @@
 
 import java.io.IOException;
 
-import org.apache.jackrabbit.core.NodeId;
+import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.Term;
 import org.apache.lucene.index.TermDocs;

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java Mon Jul 13 15:55:55 2009
@@ -18,8 +18,7 @@
 
 import org.apache.jackrabbit.core.ItemManager;
 import org.apache.jackrabbit.core.SessionImpl;
-import org.apache.jackrabbit.core.NodeId;
-import org.apache.jackrabbit.core.NodeIdIterator;
+import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.core.HierarchyManager;
 import org.apache.jackrabbit.core.fs.FileSystem;
 import org.apache.jackrabbit.core.fs.FileSystemResource;
@@ -32,7 +31,6 @@
 import org.apache.jackrabbit.core.query.lucene.directory.DirectoryManager;
 import org.apache.jackrabbit.core.query.lucene.directory.FSDirectoryManager;
 import org.apache.jackrabbit.core.state.NodeState;
-import org.apache.jackrabbit.core.state.NodeStateIterator;
 import org.apache.jackrabbit.core.state.ItemStateManager;
 import org.apache.jackrabbit.core.state.PropertyState;
 import org.apache.jackrabbit.core.state.ItemStateException;
@@ -46,7 +44,6 @@
 import org.apache.jackrabbit.spi.commons.query.DefaultQueryNodeFactory;
 import org.apache.jackrabbit.spi.commons.query.qom.QueryObjectModelTree;
 import org.apache.jackrabbit.spi.commons.query.qom.OrderingImpl;
-import org.apache.jackrabbit.uuid.UUID;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.apache.lucene.analysis.Analyzer;
@@ -77,6 +74,7 @@
 import java.io.IOException;
 import java.io.File;
 import java.util.Collections;
+import java.util.Iterator;
 import java.util.List;
 import java.util.ArrayList;
 import java.util.HashSet;
@@ -328,7 +326,7 @@
     private boolean autoRepair = true;
 
     /**
-     * The uuid resolver cache size.
+     * The id resolver cache size.
      * <p/>
      * Default value is: <code>1000</code>.
      */
@@ -571,7 +569,7 @@
     }
 
     /**
-     * Removes the node with <code>uuid</code> from the search index.
+     * Removes the node with <code>id</code> from the search index.
      * @param id the id of the node to remove from the index.
      * @throws IOException if an error occurs while removing the node from
      * the index.
@@ -585,35 +583,35 @@
      * {@link MultiIndex#update(Collection, Collection)} and
      * transforms the two iterators to the required types.
      *
-     * @param remove uuids of nodes to remove.
+     * @param remove ids of nodes to remove.
      * @param add    NodeStates to add. Calls to <code>next()</code> on this
      *               iterator may return <code>null</code>, to indicate that a
      *               node could not be indexed successfully.
      * @throws RepositoryException if an error occurs while indexing a node.
      * @throws IOException         if an error occurs while updating the index.
      */
-    public void updateNodes(NodeIdIterator remove, NodeStateIterator add)
+    public void updateNodes(Iterator<NodeId> remove, Iterator<NodeState> add)
             throws RepositoryException, IOException {
         checkOpen();
 
-        Map<UUID, NodeState> aggregateRoots = new HashMap<UUID, NodeState>();
-        Set<UUID> removedUUIDs = new HashSet<UUID>();
-        Set<UUID> addedUUIDs = new HashSet<UUID>();
+        Map<NodeId, NodeState> aggregateRoots = new HashMap<NodeId, NodeState>();
+        Set<NodeId> removedIds = new HashSet<NodeId>();
+        Set<NodeId> addedIds = new HashSet<NodeId>();
 
-        Collection<UUID> removeCollection = new ArrayList<UUID>();
+        Collection<NodeId> removeCollection = new ArrayList<NodeId>();
         while (remove.hasNext()) {
-            UUID uuid = remove.nextNodeId().getUUID();
-            removeCollection.add(uuid);
-            removedUUIDs.add(uuid);
+            NodeId id = remove.next();
+            removeCollection.add(id);
+            removedIds.add(id);
         }
 
         Collection<Document> addCollection = new ArrayList<Document>();
         while (add.hasNext()) {
-            NodeState state = add.nextNodeState();
+            NodeState state = add.next();
             if (state != null) {
-                UUID uuid = state.getNodeId().getUUID();
-                addedUUIDs.add(uuid);
-                removedUUIDs.remove(uuid);
+                NodeId id = state.getNodeId();
+                addedIds.add(id);
+                removedIds.remove(id);
                 retrieveAggregateRoot(state, aggregateRoots);
 
                 try {
@@ -631,10 +629,10 @@
 
         // remove any aggregateRoot nodes that are new
         // and therefore already up-to-date
-        aggregateRoots.keySet().removeAll(addedUUIDs);
+        aggregateRoots.keySet().removeAll(addedIds);
 
-        // based on removed UUIDs get affected aggregate root nodes
-        retrieveAggregateRoot(removedUUIDs, aggregateRoots);
+        // based on removed ids get affected aggregate root nodes
+        retrieveAggregateRoot(removedIds, aggregateRoots);
 
         // update aggregates if there are any affected
         if (!aggregateRoots.isEmpty()) {
@@ -718,7 +716,7 @@
             IndexSearcher searcher = new IndexSearcher(reader);
             try {
                 Query q = new TermQuery(new Term(
-                        FieldNames.WEAK_REFS, id.getUUID().toString()));
+                        FieldNames.WEAK_REFS, id.toString()));
                 searcher.search(q, new HitCollector() {
                     public void collect(int doc, float score) {
                         docs.add(doc);
@@ -729,8 +727,7 @@
             }
             for (Integer doc : docs) {
                 Document d = reader.document(doc, FieldSelectors.UUID);
-                UUID uuid = UUID.fromString(d.get(FieldNames.UUID));
-                ids.add(new NodeId(uuid));
+                ids.add(new NodeId(d.get(FieldNames.UUID)));
             }
         } finally {
             Util.closeOrRelease(reader);
@@ -1306,7 +1303,7 @@
                                 for (Fieldable fulltextField : fulltextFields) {
                                     doc.add(fulltextField);
                                 }
-                                doc.add(new Field(FieldNames.AGGREGATED_NODE_UUID, aggregate.getNodeId().getUUID().toString(), Field.Store.NO, Field.Index.NOT_ANALYZED_NO_NORMS));
+                                doc.add(new Field(FieldNames.AGGREGATED_NODE_UUID, aggregate.getNodeId().toString(), Field.Store.NO, Field.Index.NOT_ANALYZED_NO_NORMS));
                             }
                         }
                     }
@@ -1334,7 +1331,7 @@
                                     value = FieldNames.createNamedValue(path, value);
                                     t.setTermBuffer(value);
                                     doc.add(new Field(field.name(), new SingletonTokenStream(t)));
-                                    doc.add(new Field(FieldNames.AGGREGATED_NODE_UUID, parent.getNodeId().getUUID().toString(), Field.Store.NO, Field.Index.NOT_ANALYZED_NO_NORMS));
+                                    doc.add(new Field(FieldNames.AGGREGATED_NODE_UUID, parent.getNodeId().toString(), Field.Store.NO, Field.Index.NOT_ANALYZED_NO_NORMS));
                                 }
                             }
                         }
@@ -1348,7 +1345,7 @@
             } catch (Exception e) {
                 // do not fail if aggregate cannot be created
                 log.warn("Exception while building indexing aggregate for"
-                        + " node with UUID: " + state.getNodeId().getUUID(), e);
+                        + " node with id: " + state.getNodeId(), e);
             }
         }
     }
@@ -1391,11 +1388,10 @@
      *
      * @param state the node state for which we want to retrieve the aggregate
      *              root.
-     * @param map   aggregate roots are collected in this map. Key=UUID,
-     *              value=NodeState.
+     * @param map   aggregate roots are collected in this map.
      */
     protected void retrieveAggregateRoot(
-            NodeState state, Map<UUID, NodeState> map) {
+            NodeState state, Map<NodeId, NodeState> map) {
         if (indexingConfig != null) {
             AggregateRule[] aggregateRules = indexingConfig.getAggregateRules();
             if (aggregateRules == null) {
@@ -1405,25 +1401,25 @@
                 for (AggregateRule aggregateRule : aggregateRules) {
                     NodeState root = aggregateRule.getAggregateRoot(state);
                     if (root != null) {
-                        map.put(root.getNodeId().getUUID(), root);
+                        map.put(root.getNodeId(), root);
                     }
                 }
             } catch (Exception e) {
                 log.warn("Unable to get aggregate root for "
-                        + state.getNodeId().getUUID(), e);
+                        + state.getNodeId(), e);
             }
         }
     }
 
     /**
-     * Retrieves the root of the indexing aggregate for <code>removedUUIDs</code>
+     * Retrieves the root of the indexing aggregate for <code>removedIds</code>
      * and puts it into <code>map</code>.
      *
-     * @param removedUUIDs   the UUIDs of removed nodes.
+     * @param removedIds     the ids of removed nodes.
      * @param map            aggregate roots are collected in this map
      */
     protected void retrieveAggregateRoot(
-            Set<UUID> removedUUIDs, Map<UUID, NodeState> map) {
+            Set<NodeId> removedIds, Map<NodeId, NodeState> map) {
         if (indexingConfig != null) {
             AggregateRule[] aggregateRules = indexingConfig.getAggregateRules();
             if (aggregateRules == null) {
@@ -1434,21 +1430,20 @@
             try {
                 CachingMultiIndexReader reader = index.getIndexReader();
                 try {
-                    Term aggregateUUIDs =
+                    Term aggregateIds =
                         new Term(FieldNames.AGGREGATED_NODE_UUID, "");
                     TermDocs tDocs = reader.termDocs();
                     try {
                         ItemStateManager ism = getContext().getItemStateManager();
-                        for (UUID uuid : removedUUIDs) {
-                            aggregateUUIDs =
-                                aggregateUUIDs.createTerm(uuid.toString());
-                            tDocs.seek(aggregateUUIDs);
+                        for (NodeId id : removedIds) {
+                            aggregateIds =
+                                aggregateIds.createTerm(id.toString());
+                            tDocs.seek(aggregateIds);
                             while (tDocs.next()) {
                                 Document doc = reader.document(
                                         tDocs.doc(), FieldSelectors.UUID);
-                                NodeId nId = new NodeId(
-                                        UUID.fromString(doc.get(FieldNames.UUID)));
-                                map.put(nId.getUUID(), (NodeState) ism.getItemState(nId));
+                                NodeId nId = new NodeId(doc.get(FieldNames.UUID));
+                                map.put(nId, (NodeState) ism.getItemState(nId));
                                 found++;
                             }
                         }
@@ -1578,9 +1573,9 @@
         /**
          * {@inheritDoc}
          */
-        public ForeignSegmentDocId createDocId(UUID uuid) throws IOException {
+        public ForeignSegmentDocId createDocId(NodeId id) throws IOException {
             for (CachingMultiIndexReader subReader : subReaders) {
-                ForeignSegmentDocId doc = subReader.createDocId(uuid);
+                ForeignSegmentDocId doc = subReader.createDocId(id);
                 if (doc != null) {
                     return doc;
                 }

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SharedFieldSortComparator.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SharedFieldSortComparator.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SharedFieldSortComparator.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SharedFieldSortComparator.java Mon Jul 13 15:55:55 2009
@@ -26,8 +26,8 @@
 import org.apache.jackrabbit.core.state.ItemStateManager;
 import org.apache.jackrabbit.core.state.PropertyState;
 import org.apache.jackrabbit.core.HierarchyManager;
-import org.apache.jackrabbit.core.NodeId;
-import org.apache.jackrabbit.core.PropertyId;
+import org.apache.jackrabbit.core.id.NodeId;
+import org.apache.jackrabbit.core.id.PropertyId;
 import org.apache.jackrabbit.core.value.InternalValue;
 import org.apache.jackrabbit.spi.Path;
 import org.apache.jackrabbit.spi.PathFactory;
@@ -187,7 +187,7 @@
                 IndexReader reader = readers.get(idx);
                 Document doc = reader.document(i.doc - starts[idx], FieldSelectors.UUID);
                 String uuid = doc.get(FieldNames.UUID);
-                Path path = hmgr.getPath(new NodeId(UUID.fromString(uuid)));
+                Path path = hmgr.getPath(new NodeId(uuid));
                 PathBuilder builder = new PathBuilder(path);
                 builder.addAll(relPath.getElements());
                 PropertyId id = hmgr.resolvePropertyPath(builder.getPath());

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SimpleExcerptProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SimpleExcerptProvider.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SimpleExcerptProvider.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SimpleExcerptProvider.java Mon Jul 13 15:55:55 2009
@@ -17,8 +17,8 @@
 package org.apache.jackrabbit.core.query.lucene;
 
 import org.apache.lucene.search.Query;
-import org.apache.jackrabbit.core.NodeId;
-import org.apache.jackrabbit.core.PropertyId;
+import org.apache.jackrabbit.core.id.NodeId;
+import org.apache.jackrabbit.core.id.PropertyId;
 import org.apache.jackrabbit.core.value.InternalValue;
 import org.apache.jackrabbit.core.state.ItemStateManager;
 import org.apache.jackrabbit.core.state.NodeState;

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SingleColumnQueryResult.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SingleColumnQueryResult.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SingleColumnQueryResult.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SingleColumnQueryResult.java Mon Jul 13 15:55:55 2009
@@ -85,4 +85,5 @@
     protected ExcerptProvider createExcerptProvider() throws IOException {
         return index.createExcerptProvider(query);
     }
+
 }



Mime
View raw message