jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r586065 [2/8] - in /jackrabbit/trunk/contrib/spi: client/src/test/java/org/apache/jackrabbit/jcr2spi/ jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ jcr2spi/src/main/java/...
Date Thu, 18 Oct 2007 18:41:57 GMT
Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildNodeEntries.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildNodeEntries.java?rev=586065&r1=586064&r2=586065&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildNodeEntries.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildNodeEntries.java Thu Oct 18 11:41:45 2007
@@ -16,8 +16,8 @@
  */
 package org.apache.jackrabbit.jcr2spi.hierarchy;
 
-import org.apache.jackrabbit.name.QName;
-import org.apache.jackrabbit.name.Path;
+import org.apache.jackrabbit.spi.Name;
+import org.apache.jackrabbit.spi.Path;
 import org.apache.jackrabbit.spi.ChildInfo;
 
 import javax.jcr.ItemNotFoundException;
@@ -74,7 +74,7 @@
      * @param nodeName the child node name.
      * @return same name sibling nodes with the given <code>nodeName</code>.
      */
-    List get(QName nodeName);
+    List get(Name nodeName);
 
     /**
      * Returns the <code>NodeEntry</code> with the given
@@ -86,7 +86,7 @@
      * @return the <code>NodeEntry</code> or <code>null</code> if there
      * is no such <code>NodeEntry</code>.
      */
-    NodeEntry get(QName nodeName, int index);
+    NodeEntry get(Name nodeName, int index);
 
     /**
      * Return the <code>NodeEntry</code> that matches the given nodeName and
@@ -97,7 +97,7 @@
      * @return
      * @throws IllegalArgumentException if the given uniqueID is null.
      */
-    NodeEntry get(QName nodeName, String uniqueID);
+    NodeEntry get(Name nodeName, String uniqueID);
 
     /**
      * Find the matching NodeEntry for the given <code>ChildInfo</code>. Returns

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildNodeEntriesImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildNodeEntriesImpl.java?rev=586065&r1=586064&r2=586065&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildNodeEntriesImpl.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildNodeEntriesImpl.java Thu Oct 18 11:41:45 2007
@@ -18,8 +18,8 @@
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.apache.jackrabbit.name.QName;
-import org.apache.jackrabbit.name.Path;
+import org.apache.jackrabbit.spi.Name;
+import org.apache.jackrabbit.spi.Path;
 import org.apache.jackrabbit.spi.ChildInfo;
 import org.apache.jackrabbit.spi.NodeId;
 import org.apache.jackrabbit.jcr2spi.state.Status;
@@ -172,16 +172,16 @@
     }
 
     /**
-     * @see ChildNodeEntries#get(QName)
+     * @see ChildNodeEntries#get(Name)
      */
-    public List get(QName nodeName) {
+    public List get(Name nodeName) {
         return entriesByName.getList(nodeName);
     }
 
     /**
-     * @see ChildNodeEntries#get(QName, int)
+     * @see ChildNodeEntries#get(Name, int)
      */
-    public NodeEntry get(QName nodeName, int index) {
+    public NodeEntry get(Name nodeName, int index) {
         if (index < Path.INDEX_DEFAULT) {
             throw new IllegalArgumentException("index is 1-based");
         }
@@ -189,9 +189,9 @@
     }
 
     /**
-     * @see ChildNodeEntries#get(QName, String)
+     * @see ChildNodeEntries#get(Name, String)
      */
-    public NodeEntry get(QName nodeName, String uniqueID) {
+    public NodeEntry get(Name nodeName, String uniqueID) {
         if (uniqueID == null || nodeName == null) {
             throw new IllegalArgumentException();
         }
@@ -253,7 +253,7 @@
      * @return
      */
     private LinkedEntries.LinkNode internalAdd(NodeEntry entry, int index) {
-        QName nodeName = entry.getQName();
+        Name nodeName = entry.getName();
 
         // retrieve ev. sibling node with same index. if index is 'undefined'
         // the existing entry is always null and no reordering occurs.
@@ -295,7 +295,7 @@
                 throw new NoSuchElementException();
             }
             LinkedEntries.LinkNode insertLN = internalAdd(entry, Path.INDEX_UNDEFINED);
-            reorder(entry.getQName(), insertLN, beforeLN);
+            reorder(entry.getName(), insertLN, beforeLN);
         } else {
             // 'before' is null -> simply append new entry at the end
             add(entry);
@@ -312,7 +312,7 @@
     public synchronized NodeEntry remove(NodeEntry childEntry) {
         LinkedEntries.LinkNode ln = entries.removeNodeEntry(childEntry);
         if (ln != null) {
-            entriesByName.remove(childEntry.getQName(), ln);
+            entriesByName.remove(childEntry.getName(), ln);
             return childEntry;
         } else {
             return null;
@@ -348,7 +348,7 @@
 
         NodeEntry previousBefore = insertLN.getNextLinkNode().getNodeEntry();
         if (previousBefore != beforeEntry) {
-            reorder(insertEntry.getQName(), insertLN, beforeLN);
+            reorder(insertEntry.getName(), insertLN, beforeLN);
         }
         return previousBefore;
     }
@@ -359,7 +359,7 @@
      * @param insertLN
      * @param beforeLN
      */
-    private void reorder(QName insertName, LinkedEntries.LinkNode insertLN, LinkedEntries.LinkNode beforeLN) {
+    private void reorder(Name insertName, LinkedEntries.LinkNode insertLN, LinkedEntries.LinkNode beforeLN) {
         // reorder named map
         if (entriesByName.containsSiblings(insertName)) {
             int position;
@@ -375,7 +375,7 @@
                     LinkedEntries.LinkNode ln = (LinkedEntries.LinkNode) it.next();
                     if (ln == beforeLN) {
                         break;
-                    } else if (ln != insertLN && ln.getNodeEntry().getQName().equals(insertName)) {
+                    } else if (ln != insertLN && ln.getNodeEntry().getName().equals(insertName)) {
                         position++;
                     } // else: ln == inserLN OR no SNS -> not relevant for position count
                 }
@@ -495,7 +495,7 @@
          */
         private final class LinkNode extends Node {
 
-            private final QName qName;
+            private final Name qName;
 
             protected LinkNode() {
                 super();
@@ -504,7 +504,7 @@
 
             protected LinkNode(Object value) {
                 super(new WeakReference(value));
-                qName = ((NodeEntry) value).getQName();
+                qName = ((NodeEntry) value).getName();
             }
 
             protected void setValue(Object value) {
@@ -582,7 +582,7 @@
 
     //--------------------------------------------------------------------------
     /**
-     * Mapping of QName to LinkNode OR List of LinkNode(s) in case of SNSiblings.
+     * Mapping of Name to LinkNode OR List of LinkNode(s) in case of SNSiblings.
      */
     private static class NameMap {
 
@@ -595,7 +595,7 @@
          * @param qName
          * @return
          */
-        public boolean containsSiblings(QName qName) {
+        public boolean containsSiblings(Name qName) {
             return snsMap.containsKey(qName);
         }
 
@@ -607,7 +607,7 @@
          * @return a single <code>NodeEntry</code> or a <code>List</code> of
          * NodeEntry objects.
          */
-        private Object get(QName qName) {
+        private Object get(Name qName) {
             Object val = nameMap.get(qName);
             if (val != null) {
                 return ((LinkedEntries.LinkNode) val).getNodeEntry();
@@ -633,7 +633,7 @@
          * @param qName
          * @return
          */
-        public List getList(QName qName) {
+        public List getList(Name qName) {
             Object obj = get(qName);
             if (obj == null) {
                 return Collections.EMPTY_LIST;
@@ -646,7 +646,7 @@
             }
         }
 
-        public NodeEntry getNodeEntry(QName qName, int index) {
+        public NodeEntry getNodeEntry(Name qName, int index) {
             Object obj = get(qName);
             if (obj == null) {
                 return null;
@@ -663,7 +663,7 @@
             return null;
         }
 
-        public LinkedEntries.LinkNode getLinkNode(QName qName, int index) {
+        public LinkedEntries.LinkNode getLinkNode(Name qName, int index) {
             if (index < Path.INDEX_DEFAULT) {
                 throw new IllegalArgumentException("Illegal index " + index);
             }
@@ -679,7 +679,7 @@
             }
         }
 
-        public void put(QName qName, LinkedEntries.LinkNode value) {
+        public void put(Name qName, LinkedEntries.LinkNode value) {
             // if 'nameMap' already contains a single entry -> move it to snsMap
             LinkedEntries.LinkNode single = (LinkedEntries.LinkNode) nameMap.remove(qName);
             List l;
@@ -699,7 +699,7 @@
             }
         }
 
-        public LinkedEntries.LinkNode remove(QName qName, LinkedEntries.LinkNode value) {
+        public LinkedEntries.LinkNode remove(Name qName, LinkedEntries.LinkNode value) {
             Object rm = nameMap.remove(qName);
             if (rm == null) {
                 List l = (List) snsMap.get(qName);
@@ -710,7 +710,7 @@
             return ((LinkedEntries.LinkNode) rm);
         }
 
-        public void reorder(QName qName, LinkedEntries.LinkNode insertValue, int position) {
+        public void reorder(Name qName, LinkedEntries.LinkNode insertValue, int position) {
             List sns = (List) snsMap.get(qName);
             if (sns == null) {
                 // no same name siblings -> no special handling required

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildPropertyEntries.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildPropertyEntries.java?rev=586065&r1=586064&r2=586065&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildPropertyEntries.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildPropertyEntries.java Thu Oct 18 11:41:45 2007
@@ -16,7 +16,7 @@
  */
 package org.apache.jackrabbit.jcr2spi.hierarchy;
 
-import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.spi.Name;
 
 import java.util.Collection;
 
@@ -31,16 +31,16 @@
      * @param propertyName
      * @return true if a property entry with the given name exists.
      */
-    public boolean contains(QName propertyName);
+    public boolean contains(Name propertyName);
 
     /**
-     * Return the PropertyEntry with the given <code>QName</code> or
+     * Return the PropertyEntry with the given <code>Name</code> or
      * <code>null</code>.
      *
      * @param propertyName
      * @return
      */
-    public PropertyEntry get(QName propertyName);
+    public PropertyEntry get(Name propertyName);
 
     /**
      * Returns an unmodifiable collection containing all <code>PropertyEntry</code>
@@ -53,7 +53,7 @@
     /**
      * Returns an unmodifiable collection containing all existing property names.
      *
-     * @return Collection of <code>QName</code>
+     * @return Collection of <code>Name</code>
      */
     public Collection getPropertyNames();
 
@@ -73,11 +73,11 @@
     public void addAll(Collection propertyEntries);
 
     /**
-     * Remove the collection entry with the given <code>QName</code>.
+     * Remove the collection entry with the given <code>Name</code>.
      *
      * @param propertyName
      * @return true If this <code>ChildPropertyEntries</code> contained any
-     * entry with the given <code>QName</code>. False otherwise.
+     * entry with the given <code>Name</code>. False otherwise.
      */
-    public boolean remove(QName propertyName);
+    public boolean remove(Name propertyName);
 }

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildPropertyEntriesImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildPropertyEntriesImpl.java?rev=586065&r1=586064&r2=586065&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildPropertyEntriesImpl.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildPropertyEntriesImpl.java Thu Oct 18 11:41:45 2007
@@ -18,7 +18,7 @@
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.spi.Name;
 
 import java.util.Map;
 import java.util.Iterator;
@@ -48,16 +48,16 @@
     }
 
     /**
-     * @see ChildPropertyEntries#contains(QName)
+     * @see ChildPropertyEntries#contains(Name)
      */
-    public boolean contains(QName propertyName) {
+    public boolean contains(Name propertyName) {
         return properties.containsKey(propertyName);
     }
 
     /**
-     * @see ChildPropertyEntries#get(QName)
+     * @see ChildPropertyEntries#get(Name)
      */
-    public PropertyEntry get(QName propertyName) {
+    public PropertyEntry get(Name propertyName) {
         Object ref = properties.get(propertyName);
         if (ref == null) {
             // no entry exists with the given name
@@ -80,7 +80,7 @@
         synchronized (properties) {
             Set entries = new HashSet(properties.size());
             for (Iterator it = getPropertyNames().iterator(); it.hasNext();) {
-                QName propName = (QName) it.next();
+                Name propName = (Name) it.next();
                 entries.add(get(propName));
             }
             return Collections.unmodifiableCollection(entries);
@@ -99,7 +99,7 @@
      */
     public void add(PropertyEntry propertyEntry) {
         Reference ref = new WeakReference(propertyEntry);
-        properties.put(propertyEntry.getQName(), ref);
+        properties.put(propertyEntry.getName(), ref);
     }
 
     /**
@@ -115,9 +115,9 @@
     }
 
     /**
-     * @see ChildPropertyEntries#remove(QName)
+     * @see ChildPropertyEntries#remove(Name)
      */
-    public boolean remove(QName propertyName) {
+    public boolean remove(Name propertyName) {
         return properties.remove(propertyName) != null;
     }
 }

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/EntryFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/EntryFactory.java?rev=586065&r1=586064&r2=586065&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/EntryFactory.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/EntryFactory.java Thu Oct 18 11:41:45 2007
@@ -20,7 +20,8 @@
 import org.slf4j.LoggerFactory;
 import org.apache.jackrabbit.jcr2spi.state.TransientItemStateFactory;
 import org.apache.jackrabbit.spi.IdFactory;
-import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.spi.Name;
+import org.apache.jackrabbit.spi.PathFactory;
 
 /**
  * <code>EntryFactory</code>...
@@ -34,6 +35,8 @@
      */
     private final IdFactory idFactory;
 
+    private final PathFactory pathFactory;
+
     private final NodeEntry rootEntry;
 
     /**
@@ -46,8 +49,9 @@
      */
     private final TransientItemStateFactory isf;
 
-    public EntryFactory(TransientItemStateFactory isf, IdFactory idFactory, NodeEntryListener listener) {
+    public EntryFactory(TransientItemStateFactory isf, IdFactory idFactory, NodeEntryListener listener, PathFactory pathFactory) {
         this.idFactory = idFactory;
+        this.pathFactory = pathFactory;
         this.isf = isf;
         this.listener = listener;
         this.rootEntry = NodeEntryImpl.createRootEntry(this);
@@ -61,14 +65,14 @@
         return rootEntry;
     }
 
-    public NodeEntry createNodeEntry(NodeEntry parent, QName qName, String uniqueId) {
+    public NodeEntry createNodeEntry(NodeEntry parent, Name qName, String uniqueId) {
         if (!(parent instanceof NodeEntryImpl)) {
             throw new IllegalArgumentException();
         }
         return NodeEntryImpl.createNodeEntry((NodeEntryImpl) parent, qName, uniqueId, this);
     }
 
-    public PropertyEntry createPropertyEntry(NodeEntry parent, QName qName) {
+    public PropertyEntry createPropertyEntry(NodeEntry parent, Name qName) {
         if (!(parent instanceof NodeEntryImpl)) {
             throw new IllegalArgumentException();
         }
@@ -77,6 +81,10 @@
 
     public IdFactory getIdFactory() {
         return idFactory;
+    }
+
+    public PathFactory getPathFactory() {
+        return pathFactory;
     }
 
     public TransientItemStateFactory getItemStateFactory() {

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyEntry.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyEntry.java?rev=586065&r1=586064&r2=586065&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyEntry.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyEntry.java Thu Oct 18 11:41:45 2007
@@ -16,8 +16,8 @@
  */
 package org.apache.jackrabbit.jcr2spi.hierarchy;
 
-import org.apache.jackrabbit.name.QName;
-import org.apache.jackrabbit.name.Path;
+import org.apache.jackrabbit.spi.Name;
+import org.apache.jackrabbit.spi.Path;
 import org.apache.jackrabbit.jcr2spi.state.ItemState;
 import org.apache.jackrabbit.jcr2spi.state.ChangeLog;
 import org.apache.jackrabbit.jcr2spi.state.Status;
@@ -41,7 +41,7 @@
     /**
      * @return the name of this hierarchy entry.
      */
-    public QName getQName();
+    public Name getName();
 
     /**
      * @return the path of this hierarchy entry.

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyEntryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyEntryImpl.java?rev=586065&r1=586064&r2=586065&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyEntryImpl.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyEntryImpl.java Thu Oct 18 11:41:45 2007
@@ -16,8 +16,8 @@
  */
 package org.apache.jackrabbit.jcr2spi.hierarchy;
 
-import org.apache.jackrabbit.name.QName;
-import org.apache.jackrabbit.name.Path;
+import org.apache.jackrabbit.spi.Name;
+import org.apache.jackrabbit.spi.Path;
 import org.apache.jackrabbit.jcr2spi.state.ItemState;
 import org.apache.jackrabbit.jcr2spi.state.ChangeLog;
 import org.apache.jackrabbit.jcr2spi.state.Status;
@@ -45,7 +45,7 @@
     /**
      * The name of the target item state.
      */
-    protected QName name;
+    protected Name name;
 
     /**
      * Hard reference to the parent <code>NodeEntry</code>.
@@ -66,7 +66,7 @@
      * @param name   the name of the child item.
      * @param factory
      */
-    HierarchyEntryImpl(NodeEntryImpl parent, QName name, EntryFactory factory) {
+    HierarchyEntryImpl(NodeEntryImpl parent, Name name, EntryFactory factory) {
         this.parent = parent;
         this.name = name;
         this.factory = factory;
@@ -153,9 +153,9 @@
     //-----------------------------------------------------< HierarchyEntry >---
     /**
      * @inheritDoc
-     * @see HierarchyEntry#getQName()
+     * @see HierarchyEntry#getName()
      */
-    public QName getQName() {
+    public Name getName() {
         return name;
     }
 

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyEventListener.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyEventListener.java?rev=586065&r1=586064&r2=586065&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyEventListener.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyEventListener.java Thu Oct 18 11:41:45 2007
@@ -25,7 +25,7 @@
 import org.apache.jackrabbit.spi.Event;
 import org.apache.jackrabbit.spi.EventBundle;
 import org.apache.jackrabbit.spi.NodeId;
-import org.apache.jackrabbit.name.Path;
+import org.apache.jackrabbit.spi.Path;
 
 import javax.jcr.RepositoryException;
 import java.util.Collection;
@@ -54,7 +54,8 @@
             EventFilter filter = null;
             try {
                 // listen to all events except 'local' ones
-                filter = wspManager.createEventFilter(Event.ALL_TYPES, Path.ROOT, true, null, null, true);
+                Path root = wspManager.getPathFactory().getRootPath();
+                filter = wspManager.createEventFilter(Event.ALL_TYPES, root, true, null, null, true);
             } catch (RepositoryException e) {
                 // spi does not support observation, or another error occurred.
             }

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyManager.java?rev=586065&r1=586064&r2=586065&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyManager.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyManager.java Thu Oct 18 11:41:45 2007
@@ -16,7 +16,7 @@
  */
 package org.apache.jackrabbit.jcr2spi.hierarchy;
 
-import org.apache.jackrabbit.name.Path;
+import org.apache.jackrabbit.spi.Path;
 import org.apache.jackrabbit.jcr2spi.state.ItemState;
 import org.apache.jackrabbit.spi.ItemId;
 

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyManagerImpl.java?rev=586065&r1=586064&r2=586065&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyManagerImpl.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyManagerImpl.java Thu Oct 18 11:41:45 2007
@@ -18,10 +18,11 @@
 
 import org.apache.jackrabbit.jcr2spi.state.ItemState;
 import org.apache.jackrabbit.jcr2spi.state.TransientItemStateFactory;
-import org.apache.jackrabbit.name.Path;
+import org.apache.jackrabbit.spi.Path;
 import org.apache.jackrabbit.spi.ItemId;
 import org.apache.jackrabbit.spi.IdFactory;
 import org.apache.jackrabbit.spi.NodeId;
+import org.apache.jackrabbit.spi.PathFactory;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -41,9 +42,9 @@
     private final UniqueIdResolver uniqueIdResolver;
     private final IdFactory idFactory;
 
-    public HierarchyManagerImpl(TransientItemStateFactory isf, IdFactory idFactory) {
+    public HierarchyManagerImpl(TransientItemStateFactory isf, IdFactory idFactory, PathFactory pathFactory) {
         uniqueIdResolver = new UniqueIdResolver(isf);
-        rootEntry = new EntryFactory(isf, idFactory, uniqueIdResolver).createRootEntry();
+        rootEntry = new EntryFactory(isf, idFactory, uniqueIdResolver, pathFactory).createRootEntry();
         this.idFactory = idFactory;
     }
 

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntry.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntry.java?rev=586065&r1=586064&r2=586065&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntry.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntry.java Thu Oct 18 11:41:45 2007
@@ -18,8 +18,8 @@
 
 import org.apache.jackrabbit.jcr2spi.state.NodeState;
 import org.apache.jackrabbit.jcr2spi.state.PropertyState;
-import org.apache.jackrabbit.name.QName;
-import org.apache.jackrabbit.name.Path;
+import org.apache.jackrabbit.spi.Name;
+import org.apache.jackrabbit.spi.Path;
 import org.apache.jackrabbit.spi.NodeId;
 import org.apache.jackrabbit.spi.QNodeDefinition;
 import org.apache.jackrabbit.spi.QPropertyDefinition;
@@ -70,7 +70,7 @@
     /**
      * @return the index of this child node entry to suppport same-name siblings.
      * If the index of this entry cannot be determined
-     * {@link org.apache.jackrabbit.name.Path#INDEX_UNDEFINED} is returned.
+     * {@link org.apache.jackrabbit.spi.Path#INDEX_UNDEFINED} is returned.
      */
     public int getIndex();
 
@@ -112,34 +112,34 @@
      * Determines if there is a valid <code>NodeEntry</code> with the
      * specified <code>nodeName</code>.
      *
-     * @param nodeName <code>QName</code> object specifying a node name
+     * @param nodeName <code>Name</code> object specifying a node name
      * @return <code>true</code> if there is a <code>NodeEntry</code> with
      * the specified <code>nodeName</code>.
      */
-    public boolean hasNodeEntry(QName nodeName);
+    public boolean hasNodeEntry(Name nodeName);
 
     /**
      * Determines if there is a valid <code>NodeEntry</code> with the
      * specified <code>name</code> and <code>index</code>.
      *
-     * @param nodeName  <code>QName</code> object specifying a node name.
+     * @param nodeName  <code>Name</code> object specifying a node name.
      * @param index 1-based index if there are same-name child node entries.
      * @return <code>true</code> if there is a <code>NodeEntry</code> with
      * the specified <code>name</code> and <code>index</code>.
      */
-    public boolean hasNodeEntry(QName nodeName, int index);
+    public boolean hasNodeEntry(Name nodeName, int index);
 
     /**
      * Returns the valid <code>NodeEntry</code> with the specified name
      * and index or <code>null</code> if there's no matching entry.
      *
-     * @param nodeName <code>QName</code> object specifying a node name.
+     * @param nodeName <code>Name</code> object specifying a node name.
      * @param index 1-based index if there are same-name child node entries.
      * @return The <code>NodeEntry</code> with the specified name and index
      * or <code>null</code> if there's no matching entry.
      * @throws RepositoryException If an unexpected error occurs.
      */
-    public NodeEntry getNodeEntry(QName nodeName, int index) throws RepositoryException;
+    public NodeEntry getNodeEntry(Name nodeName, int index) throws RepositoryException;
 
     /**
      * Returns the valid <code>NodeEntry</code> with the specified name
@@ -148,14 +148,14 @@
      * sure, that it's list of child entries is up to date and eventually
      * try to load the node entry.
      *
-     * @param nodeName <code>QName</code> object specifying a node name.
+     * @param nodeName <code>Name</code> object specifying a node name.
      * @param index 1-based index if there are same-name child node entries.
      * @param loadIfNotFound
      * @return The <code>NodeEntry</code> with the specified name and index
      * or <code>null</code> if there's no matching entry.
      * @throws RepositoryException If an unexpected error occurs.
      */
-    public NodeEntry getNodeEntry(QName nodeName, int index, boolean loadIfNotFound) throws RepositoryException;
+    public NodeEntry getNodeEntry(Name nodeName, int index, boolean loadIfNotFound) throws RepositoryException;
 
     /**
      * Returns a unmodifiable iterator of <code>NodeEntry</code> objects
@@ -174,7 +174,7 @@
      * @return list of <code>NodeEntry</code> objects
      * @throws RepositoryException If an unexpected error occurs.
      */
-    public List getNodeEntries(QName nodeName) throws RepositoryException;
+    public List getNodeEntries(Name nodeName) throws RepositoryException;
 
     /**
      * Adds a new child NodeEntry to this entry.
@@ -184,7 +184,7 @@
      * @return the new <code>NodeEntry</code>
      * @throws RepositoryException If an unexpected error occurs.
      */
-    public NodeEntry addNodeEntry(QName nodeName, String uniqueID, int index) throws RepositoryException;
+    public NodeEntry addNodeEntry(Name nodeName, String uniqueID, int index) throws RepositoryException;
 
     /**
      * Adds a new, transient child <code>NodeEntry</code>
@@ -196,27 +196,27 @@
      * @return
      * @throws RepositoryException If an error occurs.
      */
-    public NodeState addNewNodeEntry(QName nodeName, String uniqueID, QName primaryNodeType, QNodeDefinition definition) throws RepositoryException;
+    public NodeState addNewNodeEntry(Name nodeName, String uniqueID, Name primaryNodeType, QNodeDefinition definition) throws RepositoryException;
 
     /**
-     * Determines if there is a property entry with the specified <code>QName</code>.
+     * Determines if there is a property entry with the specified <code>Name</code>.
      *
-     * @param propName <code>QName</code> object specifying a property name
+     * @param propName <code>Name</code> object specifying a property name
      * @return <code>true</code> if there is a property entry with the specified
-     * <code>QName</code>.
+     * <code>Name</code>.
      */
-    public boolean hasPropertyEntry(QName propName);
+    public boolean hasPropertyEntry(Name propName);
 
     /**
      * Returns the valid <code>PropertyEntry</code> with the specified name
      * or <code>null</code> if no matching entry exists.
      *
-     * @param propName <code>QName</code> object specifying a property name.
+     * @param propName <code>Name</code> object specifying a property name.
      * @return The <code>PropertyEntry</code> with the specified name or
      * <code>null</code> if no matching entry exists.
      * @throws RepositoryException If an unexpected error occurs.
      */
-    public PropertyEntry getPropertyEntry(QName propName) throws RepositoryException;
+    public PropertyEntry getPropertyEntry(Name propName) throws RepositoryException;
 
     /**
      * Returns the valid <code>PropertyEntry</code> with the specified name
@@ -225,13 +225,13 @@
      * sure, that it's list of property entries is up to date and eventually
      * try to load the property entry with the given name.
      *
-     * @param propName <code>QName</code> object specifying a property name.
+     * @param propName <code>Name</code> object specifying a property name.
      * @param loadIfNotFound
      * @return The <code>PropertyEntry</code> with the specified name or
      * <code>null</code> if no matching entry exists.
      * @throws RepositoryException If an unexpected error occurs.
      */
-    public PropertyEntry getPropertyEntry(QName propName,  boolean loadIfNotFound) throws RepositoryException;
+    public PropertyEntry getPropertyEntry(Name propName,  boolean loadIfNotFound) throws RepositoryException;
 
     /**
      * Returns an unmodifiable Iterator over those children that represent valid
@@ -243,7 +243,7 @@
 
     /**
      * Add an existing <code>PropertyEntry</code> with the given name.
-     * Please note the difference to {@link #addNewPropertyEntry(QName, QPropertyDefinition)}
+     * Please note the difference to {@link #addNewPropertyEntry(Name, QPropertyDefinition)}
      * which adds a new, transient entry.
      *
      * @param propName
@@ -251,10 +251,10 @@
      * @throws ItemExistsException if a child item exists with the given name
      * @throws RepositoryException if an unexpected error occurs.
      */
-    public PropertyEntry addPropertyEntry(QName propName) throws ItemExistsException, RepositoryException;
+    public PropertyEntry addPropertyEntry(Name propName) throws ItemExistsException, RepositoryException;
 
     /**
-     * Adds property entries for the given <code>QName</code>s. It depends on
+     * Adds property entries for the given <code>Name</code>s. It depends on
      * the status of this <code>NodeEntry</code>, how conflicts are resolved
      * and whether or not existing entries that are missing in the iterator
      * get removed.
@@ -274,7 +274,7 @@
      * @throws ItemExistsException
      * @throws RepositoryException if an unexpected error occurs.
      */
-    public PropertyState addNewPropertyEntry(QName propName, QPropertyDefinition definition) throws ItemExistsException, RepositoryException;
+    public PropertyState addNewPropertyEntry(Name propName, QPropertyDefinition definition) throws ItemExistsException, RepositoryException;
 
     /**
      * Reorders this NodeEntry before the sibling entry specified by the given
@@ -300,7 +300,7 @@
      * @throws RepositoryException If the entry to be moved is not a child of this
      * NodeEntry or if an unexpected error occurs.
      */
-    public NodeEntry move(QName newName, NodeEntry newParent, boolean transientMove) throws RepositoryException;
+    public NodeEntry move(Name newName, NodeEntry newParent, boolean transientMove) throws RepositoryException;
 
     /**
      * @return true if this <code>NodeEntry</code> is transiently moved.

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntryImpl.java?rev=586065&r1=586064&r2=586065&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntryImpl.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntryImpl.java Thu Oct 18 11:41:45 2007
@@ -16,9 +16,8 @@
  */
 package org.apache.jackrabbit.jcr2spi.hierarchy;
 
-import org.apache.jackrabbit.name.QName;
-import org.apache.jackrabbit.name.Path;
-import org.apache.jackrabbit.name.MalformedPathException;
+import org.apache.jackrabbit.spi.Name;
+import org.apache.jackrabbit.spi.Path;
 import org.apache.jackrabbit.spi.NodeId;
 import org.apache.jackrabbit.spi.Event;
 import org.apache.jackrabbit.spi.ItemId;
@@ -26,6 +25,7 @@
 import org.apache.jackrabbit.spi.QPropertyDefinition;
 import org.apache.jackrabbit.spi.IdFactory;
 import org.apache.jackrabbit.spi.PropertyId;
+import org.apache.jackrabbit.spi.PathFactory;
 import org.apache.jackrabbit.jcr2spi.state.NodeState;
 import org.apache.jackrabbit.jcr2spi.state.ItemState;
 import org.apache.jackrabbit.jcr2spi.state.ChangeLog;
@@ -33,6 +33,8 @@
 import org.apache.jackrabbit.jcr2spi.state.PropertyState;
 import org.apache.jackrabbit.jcr2spi.state.ItemStateLifeCycleListener;
 import org.apache.jackrabbit.jcr2spi.util.StateUtility;
+import org.apache.jackrabbit.name.NameConstants;
+import org.apache.jackrabbit.name.PathBuilder;
 import org.apache.commons.collections.iterators.IteratorChain;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -81,7 +83,7 @@
 
     /**
      * Map of properties.<br>
-     * Key = {@link QName} of property,<br>
+     * Key = {@link Name} of property,<br>
      * Value = {@link PropertyEntry}.
      */
     private final ChildPropertyEntries properties;
@@ -112,7 +114,7 @@
      * @param name      the name of the child node.
      * @param factory   the entry factory.
      */
-    private NodeEntryImpl(NodeEntryImpl parent, QName name, String uniqueID, EntryFactory factory) {
+    private NodeEntryImpl(NodeEntryImpl parent, Name name, String uniqueID, EntryFactory factory) {
         super(parent, name, factory);
         this.uniqueID = uniqueID; // NOTE: don't use setUniqueID (for mod only)
 
@@ -129,7 +131,7 @@
      * @return
      */
     static NodeEntry createRootEntry(EntryFactory factory) {
-        return new NodeEntryImpl(null, QName.ROOT, null, factory);
+        return new NodeEntryImpl(null, NameConstants.ROOT, null, factory);
     }
 
     /**
@@ -140,7 +142,7 @@
      * @param factory
      * @return
      */
-    static NodeEntry createNodeEntry(NodeEntryImpl parent, QName name, String uniqueId, EntryFactory factory) {
+    static NodeEntry createNodeEntry(NodeEntryImpl parent, Name name, String uniqueId, EntryFactory factory) {
         return new NodeEntryImpl(parent, name, uniqueId, factory);
     }
 
@@ -291,11 +293,13 @@
         if (uniqueID != null) {
             return idFactory.createNodeId(uniqueID);
         } else {
+            PathFactory pf = factory.getPathFactory();
             if (parent == null) {
                 // root node
-                return idFactory.createNodeId((String) null, Path.ROOT);
+                return idFactory.createNodeId((String) null, pf.getRootPath());
             } else {
-                return idFactory.createNodeId(parent.getId(), Path.create(getQName(), getIndex()));
+                Path p = pf.create(getName(), getIndex());
+                return idFactory.createNodeId(parent.getId(), p);
             }
         }
     }
@@ -309,8 +313,9 @@
             // uniqueID and root-node -> internal id is always the same as getId().
             return getId();
         } else {
+            PathFactory pf = factory.getPathFactory();
             NodeId parentId = (revertInfo != null) ? revertInfo.oldParent.getWorkspaceId() : parent.getWorkspaceId();
-            return idFactory.createNodeId(parentId, Path.create(getWorkspaceQName(), getWorkspaceIndex()));
+            return idFactory.createNodeId(parentId, pf.create(getWorkspaceName(), getWorkspaceIndex()));
         }
     }
 
@@ -372,9 +377,9 @@
      */
     public HierarchyEntry getDeepEntry(Path path) throws PathNotFoundException, RepositoryException {
         NodeEntryImpl entry = this;
-        Path.PathElement[] elems = path.getElements();
+        Path.Element[] elems = path.getElements();
         for (int i = 0; i < elems.length; i++) {
-            Path.PathElement elem = elems[i];
+            Path.Element elem = (Path.Element) elems[i];
             // check for root element
             if (elem.denotesRoot()) {
                 if (getParent() != null) {
@@ -384,7 +389,7 @@
             }
 
             int index = elem.getNormalizedIndex();
-            QName name = elem.getName();
+            Name name = elem.getName();
 
             // first try to resolve to known node or property entry
             NodeEntry cne = (entry.childNodeEntries == null) ? null : entry.getNodeEntry(name, index, false);
@@ -414,20 +419,14 @@
                 * 2) if the NameElement does not have SNS-index => try Property
                 * 3) else throw
                 */
-                Path remainingPath;
-                try {
-                    Path.PathBuilder pb = new Path.PathBuilder();
-                    for (int j = i; j < elems.length; j++) {
-                        pb.addLast(elems[j]);
-                    }
-                    remainingPath = pb.getPath();
-                } catch (MalformedPathException e) {
-                    // should not get here
-                    throw new RepositoryException("Invalid path");
+                PathBuilder pb = new PathBuilder(factory.getPathFactory());
+                for (int j = i; j < elems.length; j++) {
+                    pb.addLast(elems[j]);
                 }
+                Path remainingPath = pb.getPath();
 
                 NodeId parentId = entry.getId();
-                IdFactory idFactory = entry.factory.getIdFactory();
+                IdFactory idFactory = factory.getIdFactory();
 
                 NodeId nodeId = idFactory.createNodeId(parentId, remainingPath);
                 NodeEntry ne = entry.loadNodeEntry(nodeId);
@@ -458,7 +457,7 @@
     public HierarchyEntry lookupDeepEntry(Path workspacePath) {
         NodeEntryImpl entry = this;
         for (int i = 0; i < workspacePath.getLength(); i++) {
-            Path.PathElement elem = workspacePath.getElement(i);
+            Path.Element elem = workspacePath.getElements()[i];
             // check for root element
             if (elem.denotesRoot()) {
                 if (getParent() != null) {
@@ -469,7 +468,7 @@
             }
 
             int index = elem.getNormalizedIndex();
-            QName childName = elem.getName();
+            Name childName = elem.getName();
 
             // first try to resolve node
             NodeEntry cne = entry.lookupNodeEntry(null, childName, index);
@@ -487,9 +486,9 @@
 
     /**
      * @inheritDoc
-     * @see NodeEntry#hasNodeEntry(QName)
+     * @see NodeEntry#hasNodeEntry(Name)
      */
-    public synchronized boolean hasNodeEntry(QName nodeName) {
+    public synchronized boolean hasNodeEntry(Name nodeName) {
         try {
             List namedEntries = childNodeEntries().get(nodeName);
             if (namedEntries.isEmpty()) {
@@ -505,9 +504,9 @@
 
     /**
      * @inheritDoc
-     * @see NodeEntry#hasNodeEntry(QName, int)
+     * @see NodeEntry#hasNodeEntry(Name, int)
      */
-    public synchronized boolean hasNodeEntry(QName nodeName, int index) {
+    public synchronized boolean hasNodeEntry(Name nodeName, int index) {
         try {
             return getNodeEntry(nodeName, index) != null;
         } catch (RepositoryException e) {
@@ -518,17 +517,17 @@
 
     /**
      * @inheritDoc
-     * @see NodeEntry#getNodeEntry(QName, int)
+     * @see NodeEntry#getNodeEntry(Name, int)
      */
-    public synchronized NodeEntry getNodeEntry(QName nodeName, int index) throws RepositoryException {
+    public synchronized NodeEntry getNodeEntry(Name nodeName, int index) throws RepositoryException {
         return getNodeEntry(nodeName, index, false);
     }
 
     /**
      * @inheritDoc
-     * @see NodeEntry#getNodeEntry(QName, int, boolean)
+     * @see NodeEntry#getNodeEntry(Name, int, boolean)
      */
-    public NodeEntry getNodeEntry(QName nodeName, int index, boolean loadIfNotFound) throws RepositoryException {
+    public NodeEntry getNodeEntry(Name nodeName, int index, boolean loadIfNotFound) throws RepositoryException {
         // TODO: avoid loading the child-infos if childNodeEntries == null
         List entries = childNodeEntries().get(nodeName);
         NodeEntry cne = null;
@@ -542,9 +541,11 @@
                 }
             }
         } else if (loadIfNotFound
-                && !containsAtticChild(entries, nodeName, index) 
+                && !containsAtticChild(entries, nodeName, index)
                 && Status.NEW != getStatus()) {
-            NodeId cId = factory.getIdFactory().createNodeId(getId(), Path.create(nodeName, index));
+
+            PathFactory pf = factory.getPathFactory();
+            NodeId cId = factory.getIdFactory().createNodeId(getId(), pf.create(nodeName, index));
             cne = loadNodeEntry(cId);
         }
         return cne;
@@ -566,9 +567,9 @@
     }
 
     /**
-     * @see NodeEntry#getNodeEntries(QName)
+     * @see NodeEntry#getNodeEntries(Name)
      */
-    public synchronized List getNodeEntries(QName nodeName) throws RepositoryException {
+    public synchronized List getNodeEntries(Name nodeName) throws RepositoryException {
         List namedEntries = childNodeEntries().get(nodeName);
         if (namedEntries.isEmpty()) {
             return Collections.EMPTY_LIST;
@@ -589,18 +590,18 @@
 
     /**
      * @inheritDoc
-     * @see NodeEntry#addNodeEntry(QName, String, int)
+     * @see NodeEntry#addNodeEntry(Name, String, int)
      */
-    public NodeEntry addNodeEntry(QName nodeName, String uniqueID, int index) throws RepositoryException {
+    public NodeEntry addNodeEntry(Name nodeName, String uniqueID, int index) throws RepositoryException {
         return internalAddNodeEntry(nodeName, uniqueID, index, childNodeEntries());
     }
 
     /**
      * @inheritDoc
-     * @see NodeEntry#addNewNodeEntry(QName, String, QName, QNodeDefinition)
+     * @see NodeEntry#addNewNodeEntry(Name, String, Name, QNodeDefinition)
      */
-    public NodeState addNewNodeEntry(QName nodeName, String uniqueID,
-                                     QName primaryNodeType, QNodeDefinition definition) throws RepositoryException {
+    public NodeState addNewNodeEntry(Name nodeName, String uniqueID,
+                                     Name primaryNodeType, QNodeDefinition definition) throws RepositoryException {
         NodeEntry entry = internalAddNodeEntry(nodeName, uniqueID, Path.INDEX_UNDEFINED, childNodeEntries());
         NodeState state = factory.getItemStateFactory().createNewNodeState(entry, primaryNodeType, definition);
         if (!entry.isAvailable()) {
@@ -617,8 +618,8 @@
      * @param childEntries
      * @return
      */
-    private NodeEntry internalAddNodeEntry(QName nodeName, String uniqueID,
-                                               int index, ChildNodeEntries childEntries) {
+    private NodeEntry internalAddNodeEntry(Name nodeName, String uniqueID,
+                                           int index, ChildNodeEntries childEntries) {
         NodeEntry entry = factory.createNodeEntry(this, nodeName, uniqueID);
         childEntries.add(entry, index);
         return entry;
@@ -626,18 +627,18 @@
 
     /**
      * @inheritDoc
-     * @see NodeEntry#hasPropertyEntry(QName)
+     * @see NodeEntry#hasPropertyEntry(Name)
      */
-    public synchronized boolean hasPropertyEntry(QName propName) {
+    public synchronized boolean hasPropertyEntry(Name propName) {
         PropertyEntry entry = properties.get(propName);
         return EntryValidation.isValidPropertyEntry(entry);
     }
 
     /**
      * @inheritDoc
-     * @see NodeEntry#getPropertyEntry(QName)
+     * @see NodeEntry#getPropertyEntry(Name)
      */
-    public synchronized PropertyEntry getPropertyEntry(QName propName) {
+    public synchronized PropertyEntry getPropertyEntry(Name propName) {
         PropertyEntry entry = properties.get(propName);
         if (EntryValidation.isValidPropertyEntry(entry)) {
             return entry;
@@ -648,9 +649,9 @@
 
     /**
      * @inheritDoc
-     * @see NodeEntry#getPropertyEntry(QName, boolean)
+     * @see NodeEntry#getPropertyEntry(Name, boolean)
      */
-    public PropertyEntry getPropertyEntry(QName propName, boolean loadIfNotFound) throws RepositoryException {
+    public PropertyEntry getPropertyEntry(Name propName, boolean loadIfNotFound) throws RepositoryException {
         PropertyEntry entry = properties.get(propName);
         if (entry == null && loadIfNotFound && Status.NEW != getStatus()) {
             PropertyId propId = factory.getIdFactory().createPropertyId(getId(), propName);
@@ -687,9 +688,9 @@
 
     /**
      * @inheritDoc
-     * @see NodeEntry#addPropertyEntry(QName)
+     * @see NodeEntry#addPropertyEntry(Name)
      */
-    public PropertyEntry addPropertyEntry(QName propName) throws ItemExistsException {
+    public PropertyEntry addPropertyEntry(Name propName) throws ItemExistsException {
         // TODO: check for existing prop.
         return internalAddPropertyEntry(propName);
     }
@@ -701,7 +702,7 @@
      * @param propName
      * @return
      */
-    private PropertyEntry internalAddPropertyEntry(QName propName) {
+    private PropertyEntry internalAddPropertyEntry(Name propName) {
         PropertyEntry entry = factory.createPropertyEntry(this, propName);
         properties.add(entry);
 
@@ -724,7 +725,7 @@
 
         // add all entries that are missing
         for (Iterator it = propNames.iterator(); it.hasNext();) {
-            QName propName = (QName) it.next();
+            Name propName = (Name) it.next();
             if (!properties.contains(propName)) {
                 addPropertyEntry(propName);
             }
@@ -736,7 +737,7 @@
         ItemState state = internalGetItemState();
         if (containsExtra && (state == null || state.getStatus() == Status.INVALIDATED)) {
             for (Iterator it = diff.iterator(); it.hasNext();) {
-                QName propName = (QName) it.next();
+                Name propName = (Name) it.next();
                 PropertyEntry pEntry = properties.get(propName);
                 if (pEntry != null) {
                     pEntry.remove();
@@ -747,9 +748,9 @@
 
     /**
      * @inheritDoc
-     * @see NodeEntry#addNewPropertyEntry(QName, QPropertyDefinition)
+     * @see NodeEntry#addNewPropertyEntry(Name, QPropertyDefinition)
      */
-    public PropertyState addNewPropertyEntry(QName propName, QPropertyDefinition definition)
+    public PropertyState addNewPropertyEntry(Name propName, QPropertyDefinition definition)
             throws ItemExistsException, RepositoryException {
         // check for an existing property
         PropertyEntry existing = properties.get(propName);
@@ -793,7 +794,7 @@
     /**
      * @param propName
      */
-    void internalRemovePropertyEntry(QName propName) {
+    void internalRemovePropertyEntry(Name propName) {
         if (!properties.remove(propName)) {
             propertiesInAttic.remove(propName);
         }
@@ -821,9 +822,9 @@
     }
 
    /**
-    * @see NodeEntry#move(QName, NodeEntry, boolean)
+    * @see NodeEntry#move(Name, NodeEntry, boolean)
     */
-   public NodeEntry move(QName newName, NodeEntry newParent, boolean transientMove) throws RepositoryException {
+   public NodeEntry move(Name newName, NodeEntry newParent, boolean transientMove) throws RepositoryException {
        if (parent == null) {
            // the root may never be moved
            throw new RepositoryException("Root cannot be moved.");
@@ -840,7 +841,7 @@
        NodeEntryImpl entry = (NodeEntryImpl) parent.childNodeEntries().remove(this);
        if (entry != this) {
            // should never occur
-           String msg = "Internal error. Attempt to move NodeEntry (" + getQName() + ") which is not connected to its parent.";
+           String msg = "Internal error. Attempt to move NodeEntry (" + getName() + ") which is not connected to its parent.";
            log.error(msg);
            throw new RepositoryException(msg);
        }
@@ -864,7 +865,7 @@
      * @see NodeEntry#refresh(Event)
      */
     public void refresh(Event childEvent) {
-        QName eventName = childEvent.getQPath().getNameElement().getName();
+        Name eventName = childEvent.getPath().getNameElement().getName();
         switch (childEvent.getType()) {
             case Event.NODE_ADDED:
                 if (childNodeEntries == null) {
@@ -872,7 +873,7 @@
                     return;
                 }
 
-                int index = childEvent.getQPath().getNameElement().getNormalizedIndex();
+                int index = childEvent.getPath().getNameElement().getNormalizedIndex();
                 String uniqueChildID = null;
                 if (childEvent.getItemId().getPath() == null) {
                     uniqueChildID = childEvent.getItemId().getUniqueID();
@@ -902,7 +903,7 @@
             case Event.PROPERTY_ADDED:
                 // create a new property reference if it has not been
                 // added by some earlier 'add' event
-                HierarchyEntry child = lookupEntry(childEvent.getItemId(), childEvent.getQPath());
+                HierarchyEntry child = lookupEntry(childEvent.getItemId(), childEvent.getPath());
                 if (child == null) {
                     internalAddPropertyEntry(eventName);
                 } else {
@@ -912,14 +913,14 @@
 
             case Event.NODE_REMOVED:
             case Event.PROPERTY_REMOVED:
-                child = lookupEntry(childEvent.getItemId(), childEvent.getQPath());
+                child = lookupEntry(childEvent.getItemId(), childEvent.getPath());
                 if (child != null) {
                     child.remove();
                 } // else: child-Entry has not been loaded yet -> ignore
                 break;
 
             case Event.PROPERTY_CHANGED:
-                child = lookupEntry(childEvent.getItemId(), childEvent.getQPath());
+                child = lookupEntry(childEvent.getItemId(), childEvent.getPath());
                 if (child == null) {
                     // prop-Entry has not been loaded yet -> add propEntry
                     internalAddPropertyEntry(eventName);
@@ -955,29 +956,26 @@
      * @see HierarchyEntryImpl#buildPath(boolean)
      */
     Path buildPath(boolean wspPath) throws RepositoryException {
+        PathFactory pf = factory.getPathFactory();
         // shortcut for root state
         if (parent == null) {
-            return Path.ROOT;
+            return pf.getRootPath();
         }
         // build path otherwise
-        try {
-            Path.PathBuilder builder = new Path.PathBuilder();
-            buildPath(builder, this, wspPath);
-            return builder.getPath();
-        } catch (MalformedPathException e) {
-            String msg = "Failed to build path of " + this;
-            throw new RepositoryException(msg, e);
-        }
+        PathBuilder builder = new PathBuilder(pf);
+        buildPath(builder, this, wspPath);
+        return builder.getPath();
     }
 
     /**
      * Adds the path element of an item id to the path currently being built.
      * On exit, <code>builder</code> contains the path of this entry.
      *
-     * @param builder builder currently being used
-     * @param hEntry HierarchyEntry of the state the path should be built for.
+     * @param builder
+     * @param nEntry NodeEntryImpl of the state the path should be built for.
+     * @param wspPath true if the workspace path should be built
      */
-    private static void buildPath(Path.PathBuilder builder, NodeEntryImpl nEntry, boolean wspPath) throws RepositoryException {
+    private static void buildPath(PathBuilder builder, NodeEntryImpl nEntry, boolean wspPath) throws RepositoryException {
         NodeEntryImpl parentEntry = (wspPath && nEntry.revertInfo != null) ? nEntry.revertInfo.oldParent : nEntry.parent;
         // shortcut for root state
         if (parentEntry == null) {
@@ -989,18 +987,14 @@
         buildPath(builder, parentEntry, wspPath);
 
         int index = (wspPath) ? nEntry.getWorkspaceIndex() : nEntry.getIndex();
-        QName name = (wspPath) ? nEntry.getWorkspaceQName() : nEntry.getQName();
+        Name name = (wspPath) ? nEntry.getWorkspaceName() : nEntry.getName();
         // add to path
         if (index == Path.INDEX_UNDEFINED) {
             throw new RepositoryException("Invalid index " + index + " with nodeEntry " + nEntry);
         }
 
         // TODO: check again. special treatment for default index for consistency with PathFormat.parse
-        if (index == Path.INDEX_DEFAULT) {
-            builder.addLast(name);
-        } else {
-            builder.addLast(name, index);
-        }
+        builder.addLast(name, index);
     }
 
     //-----------------------------------------------< private || protected >---
@@ -1012,7 +1006,7 @@
         if (propertyEntry.getParent() != this) {
             throw new IllegalArgumentException("Internal error: Parent mismatch.");
         }
-        QName propName = propertyEntry.getQName();
+        Name propName = propertyEntry.getName();
         if (propertiesInAttic.containsKey(propName)) {
             properties.add((PropertyEntry) propertiesInAttic.remove(propName));
         } // else: propEntry has never been moved to the attic (see 'addPropertyEntry')
@@ -1024,8 +1018,8 @@
      * @param oldIndex
      * @return
      */
-    boolean matches(QName oldName, int oldIndex) {
-        return getWorkspaceQName().equals(oldName) && getWorkspaceIndex() == oldIndex;
+    boolean matches(Name oldName, int oldIndex) {
+        return getWorkspaceName().equals(oldName) && getWorkspaceIndex() == oldIndex;
     }
 
     /**
@@ -1033,16 +1027,16 @@
      * @param oldName
      * @return
      */
-    boolean matches(QName oldName) {
-        return getWorkspaceQName().equals(oldName);
+    boolean matches(Name oldName) {
+        return getWorkspaceName().equals(oldName);
     }
 
 
-    private QName getWorkspaceQName() {
+    private Name getWorkspaceName() {
         if (revertInfo != null) {
             return revertInfo.oldName;
         } else {
-            return getQName();
+            return getName();
         }
     }
 
@@ -1095,7 +1089,7 @@
      * @return
      */
     private HierarchyEntry lookupEntry(ItemId eventId, Path eventPath) {
-        QName childName = eventPath.getNameElement().getName();
+        Name childName = eventPath.getNameElement().getName();
         HierarchyEntry child;
         if (eventId.denotesNode()) {
             String uniqueChildID = (eventId.getPath() == null) ? eventId.getUniqueID() : null;
@@ -1109,7 +1103,7 @@
         return (child == null || child.getStatus() == Status.NEW) ? null : child;
     }
 
-    private NodeEntry lookupNodeEntry(String uniqueChildId, QName childName, int index) {
+    private NodeEntry lookupNodeEntry(String uniqueChildId, Name childName, int index) {
         NodeEntry child = null;
         if (uniqueChildId != null) {
             child = childNodeAttic.get(uniqueChildId);
@@ -1126,7 +1120,7 @@
         return child;
     }
 
-    private PropertyEntry lookupPropertyEntry(QName childName) {
+    private PropertyEntry lookupPropertyEntry(Name childName) {
         // for external prop-removal the attic must be consulted first
         // in order not access a NEW prop shadowing a transiently removed
         // property with the same name.
@@ -1139,16 +1133,16 @@
 
     /**
      * Deals with modified jcr:uuid and jcr:mixinTypes property.
-     * See {@link #notifyUUIDorMIXINRemoved(QName)}
+     * See {@link #notifyUUIDorMIXINRemoved(Name)}
      *
      * @param child
      */
     private void notifyUUIDorMIXINModified(PropertyEntry child) {
         try {
-            if (QName.JCR_UUID.equals(child.getQName())) {
+            if (NameConstants.JCR_UUID.equals(child.getName())) {
                 PropertyState ps = child.getPropertyState();
                 setUniqueID(ps.getValue().getString());
-            } else if (QName.JCR_MIXINTYPES.equals(child.getQName())) {
+            } else if (NameConstants.JCR_MIXINTYPES.equals(child.getName())) {
                 NodeState state = (NodeState) internalGetItemState();
                 if (state != null) {
                     PropertyState ps = child.getPropertyState();
@@ -1156,9 +1150,9 @@
                 } // nodestate not yet loaded -> ignore change
             }
         } catch (ItemNotFoundException e) {
-            log.debug("Property with name " + child.getQName() + " does not exist (anymore)");
+            log.debug("Property with name " + child.getName() + " does not exist (anymore)");
         } catch (RepositoryException e) {
-            log.debug("Unable to access child property " + child.getQName(), e.getMessage());
+            log.debug("Unable to access child property " + child.getName(), e.getMessage());
         }
     }
 
@@ -1168,13 +1162,13 @@
      *
      * @param propName
      */
-    private void notifyUUIDorMIXINRemoved(QName propName) {
-        if (QName.JCR_UUID.equals(propName)) {
+    private void notifyUUIDorMIXINRemoved(Name propName) {
+        if (NameConstants.JCR_UUID.equals(propName)) {
             setUniqueID(null);
-        } else if (QName.JCR_MIXINTYPES.equals(propName)) {
+        } else if (NameConstants.JCR_MIXINTYPES.equals(propName)) {
             NodeState state = (NodeState) internalGetItemState();
             if (state != null) {
-                state.setMixinTypeNames(QName.EMPTY_ARRAY);
+                state.setMixinTypeNames(Name.EMPTY_ARRAY);
             }
         }
     }
@@ -1205,9 +1199,6 @@
      * with this NodeEntry. NOTE, that if the childNodeEntries have not been
      * loaded yet, no attempt is made to do so.
      *
-     * @param createNewList if true, both properties and childNodeEntries are
-     * copied to new list, since recursive calls may call this node state to
-     * inform the removal of a child entry.
      * @param includeAttic
      * @return
      */
@@ -1239,7 +1230,7 @@
      * this <code>NodeEntry</code>.
      */
     private int getChildIndex(NodeEntry cne) throws ItemNotFoundException, RepositoryException {
-        List sns = childNodeEntries().get(cne.getQName());
+        List sns = childNodeEntries().get(cne.getName());
         // index is one based
         int index = Path.INDEX_DEFAULT;
         for (Iterator it = sns.iterator(); it.hasNext(); ) {
@@ -1267,7 +1258,7 @@
      * @param childIndex
      * @return
      */
-    private boolean containsAtticChild(List siblings, QName childName, int childIndex) {
+    private boolean containsAtticChild(List siblings, Name childName, int childIndex) {
         // check if a matching entry exists in the attic
         if (childNodeAttic.contains(childName, childIndex)) {
             return true;
@@ -1368,12 +1359,12 @@
     private class RevertInfo implements ItemStateLifeCycleListener {
 
         private NodeEntryImpl oldParent;
-        private QName oldName;
+        private Name oldName;
         private int oldIndex;
 
         private Map reorderedChildren;
 
-        private RevertInfo(NodeEntryImpl oldParent, QName oldName, int oldIndex) {
+        private RevertInfo(NodeEntryImpl oldParent, Name oldName, int oldIndex) {
             this.oldParent = oldParent;
             this.oldName = oldName;
             this.oldIndex = oldIndex;
@@ -1397,7 +1388,7 @@
                 // must be disposed manually
                 for (Iterator it = reorderedChildren.keySet().iterator(); it.hasNext();) {
                     NodeEntry ne = (NodeEntry) it.next();
-                    List sns = childNodeEntries.get(ne.getQName());
+                    List sns = childNodeEntries.get(ne.getName());
                     if (sns.size() > 1) {
                         for (Iterator snsIt = sns.iterator(); snsIt.hasNext();) {
                             NodeEntryImpl sibling = (NodeEntryImpl) snsIt.next();
@@ -1413,7 +1404,7 @@
         }
 
         private boolean isMoved() {
-            return oldParent != getParent() || !getQName().equals(oldName);
+            return oldParent != getParent() || !getName().equals(oldName);
         }
 
         private void reordered(NodeEntry insertEntry, NodeEntry previousBefore) {

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/PropertyEntryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/PropertyEntryImpl.java?rev=586065&r1=586064&r2=586065&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/PropertyEntryImpl.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/PropertyEntryImpl.java Thu Oct 18 11:41:45 2007
@@ -16,9 +16,8 @@
  */
 package org.apache.jackrabbit.jcr2spi.hierarchy;
 
-import org.apache.jackrabbit.name.QName;
-import org.apache.jackrabbit.name.Path;
-import org.apache.jackrabbit.name.MalformedPathException;
+import org.apache.jackrabbit.spi.Name;
+import org.apache.jackrabbit.spi.Path;
 import org.apache.jackrabbit.spi.PropertyId;
 import org.apache.jackrabbit.jcr2spi.state.PropertyState;
 import org.apache.jackrabbit.jcr2spi.state.ItemState;
@@ -40,7 +39,7 @@
      * @param name      the name of the property.
      * @param factory
      */
-    private PropertyEntryImpl(NodeEntryImpl parent, QName name, EntryFactory factory) {
+    private PropertyEntryImpl(NodeEntryImpl parent, Name name, EntryFactory factory) {
         super(parent, name, factory);
     }
 
@@ -52,7 +51,7 @@
      * @param factory
      * @return new <code>PropertyEntry</code>
      */
-    static PropertyEntry create(NodeEntryImpl parent, QName name, EntryFactory factory) {
+    static PropertyEntry create(NodeEntryImpl parent, Name name, EntryFactory factory) {
         return new PropertyEntryImpl(parent, name, factory);
     }
 
@@ -71,17 +70,8 @@
      * @see HierarchyEntryImpl#buildPath(boolean)
      */
     Path buildPath(boolean workspacePath) throws RepositoryException {
-        try {
-            Path.PathBuilder builder = new Path.PathBuilder();
-            builder.addAll(parent.buildPath(workspacePath).getElements());
-            // add property name to parent path
-            builder.addLast(getQName());
-
-            return builder.getPath();
-        } catch (MalformedPathException e) {
-            String msg = "Failed to build path of " + this;
-            throw new RepositoryException(msg, e);
-        }
+        Path parentPath = parent.buildPath(workspacePath);
+        return factory.getPathFactory().create(parentPath, getName(), true);
     }
 
     //------------------------------------------------------< PropertyEntry >---
@@ -89,14 +79,14 @@
      * @see PropertyEntry#getId()
      */
     public PropertyId getId() {
-        return factory.getIdFactory().createPropertyId(parent.getId(), getQName());
+        return factory.getIdFactory().createPropertyId(parent.getId(), getName());
     }
 
     /**
      * @see PropertyEntry#getWorkspaceId()
      */
     public PropertyId getWorkspaceId() {
-        return factory.getIdFactory().createPropertyId(parent.getWorkspaceId(), getQName());
+        return factory.getIdFactory().createPropertyId(parent.getWorkspaceId(), getName());
     }
 
     /**
@@ -124,7 +114,7 @@
     public void remove() {
         removeEntry(this);
         if (getStatus() != Status.STALE_DESTROYED) {
-            parent.internalRemovePropertyEntry(getQName());
+            parent.internalRemovePropertyEntry(getName());
         }
     }
 }

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/lock/LockManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/lock/LockManagerImpl.java?rev=586065&r1=586064&r2=586065&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/lock/LockManagerImpl.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/lock/LockManagerImpl.java Thu Oct 18 11:41:45 2007
@@ -33,7 +33,7 @@
 import org.apache.jackrabbit.jcr2spi.state.PropertyState;
 import org.apache.jackrabbit.spi.LockInfo;
 import org.apache.jackrabbit.spi.NodeId;
-import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.name.NameConstants;
 import org.slf4j.LoggerFactory;
 import org.slf4j.Logger;
 
@@ -292,7 +292,7 @@
      */
     private NodeState getLockHoldingState(NodeState nodeState) {
         NodeEntry entry = nodeState.getNodeEntry();
-        while (!entry.hasPropertyEntry(QName.JCR_LOCKISDEEP)) {
+        while (!entry.hasPropertyEntry(NameConstants.JCR_LOCKISDEEP)) {
             NodeEntry parent = entry.getParent();
             if (parent == null) {
                 // reached root state without finding a locked node
@@ -540,7 +540,7 @@
         private void startListening() {
             if (cacheBehaviour == CacheBehaviour.OBSERVATION) {
                 try {
-                    PropertyState ps = lockHoldingState.getPropertyState(QName.JCR_LOCKISDEEP);
+                    PropertyState ps = lockHoldingState.getPropertyState(NameConstants.JCR_LOCKISDEEP);
                     ps.addListener(this);
                 } catch (RepositoryException e) {
                     log.warn("Internal error", e);
@@ -551,8 +551,8 @@
         private void stopListening() {
             if (cacheBehaviour == CacheBehaviour.OBSERVATION) {
                 try {
-                    if (lockHoldingState.hasPropertyName(QName.JCR_LOCKISDEEP)) {
-                        PropertyState ps = lockHoldingState.getPropertyState(QName.JCR_LOCKISDEEP);
+                    if (lockHoldingState.hasPropertyName(NameConstants.JCR_LOCKISDEEP)) {
+                        PropertyState ps = lockHoldingState.getPropertyState(NameConstants.JCR_LOCKISDEEP);
                         ps.removeListener(this);
                     }
                 } catch (ItemNotFoundException e) {

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/name/LocalNamespaceMappings.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/name/LocalNamespaceMappings.java?rev=586065&r1=586064&r2=586065&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/name/LocalNamespaceMappings.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/name/LocalNamespaceMappings.java Thu Oct 18 11:41:45 2007
@@ -16,13 +16,11 @@
  */
 package org.apache.jackrabbit.jcr2spi.name;
 
-import org.apache.jackrabbit.name.NamespaceResolver;
-import org.apache.jackrabbit.name.AbstractNamespaceResolver;
-import org.apache.jackrabbit.name.NamespaceListener;
-import org.apache.jackrabbit.name.QName;
-import org.apache.jackrabbit.name.NameCache;
+import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.jcr2spi.SessionImpl;
 import org.apache.jackrabbit.util.XMLChar;
+import org.apache.jackrabbit.namespace.AbstractNamespaceResolver;
+import org.apache.jackrabbit.namespace.NamespaceListener;
 
 import javax.jcr.NamespaceException;
 import javax.jcr.RepositoryException;
@@ -42,12 +40,12 @@
  * instance) and keeps track of local namespace mappings added by the session.
  * <p>
  * The namespace resolution methods required by the
- * {@link NamespaceResolver NamespaceResolver} are implemented by first
+ * {@link org.apache.jackrabbit.namespace.NamespaceResolver NamespaceResolver} are implemented by first
  * looking up the local namespace mapping and then backing to the
  * underlying namespace registry.
  */
 public class LocalNamespaceMappings extends AbstractNamespaceResolver
-    implements NamespaceListener, NameCache {
+    implements NamespaceListener {
 
     /** The underlying global and persistent namespace registry. */
     private final NamespaceRegistryImpl nsReg;
@@ -58,6 +56,9 @@
     /** URI to prefix mappings of local namespaces. */
     private final HashMap uriToPrefix = new HashMap();
 
+   // private final NameResolver nameResolver;
+   // private final PathResolver pathResolver;
+
     /**
      * Creates a local namespace manager with the given underlying
      * namespace registry.
@@ -82,16 +83,16 @@
         if (prefix == null || uri == null) {
             throw new IllegalArgumentException("prefix/uri can not be null");
         }
-        if (QName.NS_EMPTY_PREFIX.equals(prefix)
-                || QName.NS_DEFAULT_URI.equals(uri)) {
+        if (Name.NS_EMPTY_PREFIX.equals(prefix)
+                || Name.NS_DEFAULT_URI.equals(uri)) {
             throw new NamespaceException("default namespace is reserved and can not be changed");
         }
         // special case: xml namespace
-        if (uri.equals(QName.NS_XML_URI)) {
+        if (uri.equals(Name.NS_XML_URI)) {
             throw new NamespaceException("xml namespace is reserved and can not be changed.");
         }
         // special case: prefixes xml*
-        if (prefix.toLowerCase().startsWith(QName.NS_XML_PREFIX)) {
+        if (prefix.toLowerCase().startsWith(Name.NS_XML_PREFIX)) {
             throw new NamespaceException("reserved prefix: " + prefix);
         }
         // check if the prefix is a valid XML prefix
@@ -165,46 +166,6 @@
      */
     public Map getLocalNamespaceMappings() {
         return new HashMap(prefixToURI);
-    }
-
-    //-------------------------------------------------------------< NameCache >
-
-    /**
-     * {@inheritDoc}
-     */
-    public QName retrieveName(String jcrName) {
-        if (prefixToURI.size() == 0) {
-            return nsReg.retrieveName(jcrName);
-        }
-        return null;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public String retrieveName(QName name) {
-        if (prefixToURI.size() == 0
-                || !uriToPrefix.containsKey(name.getNamespaceURI())) {
-            return nsReg.retrieveName(name);
-        }
-        return null;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void cacheName(String jcrName, QName name) {
-        if (prefixToURI.size() == 0
-                || !uriToPrefix.containsKey(name.getNamespaceURI())) {
-            nsReg.cacheName(jcrName, name);
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void evictAllNames() {
-        nsReg.evictAllNames();
     }
 
     //--------------------------------------------------< NamespaceResolver >---

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/name/NamespaceCache.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/name/NamespaceCache.java?rev=586065&r1=586064&r2=586065&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/name/NamespaceCache.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/name/NamespaceCache.java Thu Oct 18 11:41:45 2007
@@ -16,8 +16,8 @@
  */
 package org.apache.jackrabbit.jcr2spi.name;
 
-import org.apache.jackrabbit.name.QName;
-import org.apache.jackrabbit.name.NamespaceListener;
+import org.apache.jackrabbit.spi.Name;
+import org.apache.jackrabbit.namespace.NamespaceListener;
 import org.apache.jackrabbit.util.XMLChar;
 import org.apache.jackrabbit.spi.RepositoryService;
 import org.slf4j.Logger;
@@ -51,34 +51,34 @@
 
     static {
         // reserved prefixes
-        RESERVED_PREFIXES.add(QName.NS_XML_PREFIX);
-        RESERVED_PREFIXES.add(QName.NS_XMLNS_PREFIX);
+        RESERVED_PREFIXES.add(Name.NS_XML_PREFIX);
+        RESERVED_PREFIXES.add(Name.NS_XMLNS_PREFIX);
         // predefined (e.g. built-in) prefixes
-        RESERVED_PREFIXES.add(QName.NS_REP_PREFIX);
-        RESERVED_PREFIXES.add(QName.NS_JCR_PREFIX);
-        RESERVED_PREFIXES.add(QName.NS_NT_PREFIX);
-        RESERVED_PREFIXES.add(QName.NS_MIX_PREFIX);
-        RESERVED_PREFIXES.add(QName.NS_SV_PREFIX);
-        RESERVED_PREFIXES.add(QName.NS_EMPTY_PREFIX);
+        RESERVED_PREFIXES.add(Name.NS_REP_PREFIX);
+        RESERVED_PREFIXES.add(Name.NS_JCR_PREFIX);
+        RESERVED_PREFIXES.add(Name.NS_NT_PREFIX);
+        RESERVED_PREFIXES.add(Name.NS_MIX_PREFIX);
+        RESERVED_PREFIXES.add(Name.NS_SV_PREFIX);
+        RESERVED_PREFIXES.add(Name.NS_EMPTY_PREFIX);
         // reserved namespace URI's
-        RESERVED_URIS.add(QName.NS_XML_URI);
-        RESERVED_URIS.add(QName.NS_XMLNS_URI);
+        RESERVED_URIS.add(Name.NS_XML_URI);
+        RESERVED_URIS.add(Name.NS_XMLNS_URI);
         // predefined (e.g. built-in) namespace URI's
-        RESERVED_URIS.add(QName.NS_REP_URI);
-        RESERVED_URIS.add(QName.NS_JCR_URI);
-        RESERVED_URIS.add(QName.NS_NT_URI);
-        RESERVED_URIS.add(QName.NS_MIX_URI);
-        RESERVED_URIS.add(QName.NS_SV_URI);
-        RESERVED_URIS.add(QName.NS_DEFAULT_URI);
+        RESERVED_URIS.add(Name.NS_REP_URI);
+        RESERVED_URIS.add(Name.NS_JCR_URI);
+        RESERVED_URIS.add(Name.NS_NT_URI);
+        RESERVED_URIS.add(Name.NS_MIX_URI);
+        RESERVED_URIS.add(Name.NS_SV_URI);
+        RESERVED_URIS.add(Name.NS_DEFAULT_URI);
         // reserved and predefined namespaces
-        RESERVED_NAMESPACES.put(QName.NS_XML_PREFIX, QName.NS_XML_URI);
-        RESERVED_NAMESPACES.put(QName.NS_XMLNS_PREFIX, QName.NS_XMLNS_URI);
-        RESERVED_NAMESPACES.put(QName.NS_REP_PREFIX, QName.NS_REP_URI);
-        RESERVED_NAMESPACES.put(QName.NS_JCR_PREFIX, QName.NS_JCR_URI);
-        RESERVED_NAMESPACES.put(QName.NS_NT_PREFIX, QName.NS_NT_URI);
-        RESERVED_NAMESPACES.put(QName.NS_MIX_PREFIX, QName.NS_MIX_URI);
-        RESERVED_NAMESPACES.put(QName.NS_SV_PREFIX, QName.NS_SV_URI);
-        RESERVED_NAMESPACES.put(QName.NS_EMPTY_PREFIX, QName.NS_DEFAULT_URI);
+        RESERVED_NAMESPACES.put(Name.NS_XML_PREFIX, Name.NS_XML_URI);
+        RESERVED_NAMESPACES.put(Name.NS_XMLNS_PREFIX, Name.NS_XMLNS_URI);
+        RESERVED_NAMESPACES.put(Name.NS_REP_PREFIX, Name.NS_REP_URI);
+        RESERVED_NAMESPACES.put(Name.NS_JCR_PREFIX, Name.NS_JCR_URI);
+        RESERVED_NAMESPACES.put(Name.NS_NT_PREFIX, Name.NS_NT_URI);
+        RESERVED_NAMESPACES.put(Name.NS_MIX_PREFIX, Name.NS_MIX_URI);
+        RESERVED_NAMESPACES.put(Name.NS_SV_PREFIX, Name.NS_SV_URI);
+        RESERVED_NAMESPACES.put(Name.NS_EMPTY_PREFIX, Name.NS_DEFAULT_URI);
     }
 
     private final Set listeners = new HashSet();
@@ -220,7 +220,7 @@
         if (prefix == null || uri == null) {
             throw new IllegalArgumentException("prefix/uri can not be null");
         }
-        if (QName.NS_EMPTY_PREFIX.equals(prefix) || QName.NS_DEFAULT_URI.equals(uri)) {
+        if (Name.NS_EMPTY_PREFIX.equals(prefix) || Name.NS_DEFAULT_URI.equals(uri)) {
             throw new NamespaceException("default namespace is reserved and can not be changed");
         }
         if (RESERVED_URIS.contains(uri)) {
@@ -232,7 +232,7 @@
                 + prefix + " -> " + uri + ": reserved prefix");
         }
         // special case: prefixes xml*
-        if (prefix.toLowerCase().startsWith(QName.NS_XML_PREFIX)) {
+        if (prefix.toLowerCase().startsWith(Name.NS_XML_PREFIX)) {
             throw new NamespaceException("failed to register namespace "
                 + prefix + " -> " + uri + ": reserved prefix");
         }

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/name/NamespaceRegistryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/name/NamespaceRegistryImpl.java?rev=586065&r1=586064&r2=586065&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/name/NamespaceRegistryImpl.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/name/NamespaceRegistryImpl.java Thu Oct 18 11:41:45 2007
@@ -16,18 +16,10 @@
  */
 package org.apache.jackrabbit.jcr2spi.name;
 
-import org.apache.jackrabbit.name.AbstractNamespaceResolver;
-import org.apache.jackrabbit.name.IllegalNameException;
-import org.apache.jackrabbit.name.UnknownPrefixException;
-import org.apache.jackrabbit.name.NoPrefixDeclaredException;
-import org.apache.jackrabbit.name.QName;
-import org.apache.jackrabbit.name.NameCache;
-import org.apache.jackrabbit.name.NameFormat;
-import org.apache.jackrabbit.name.CachingNameResolver;
-import org.apache.jackrabbit.name.ParsingNameResolver;
-import org.apache.jackrabbit.name.NameResolver;
-import org.apache.jackrabbit.name.NameException;
-import org.apache.jackrabbit.name.NamespaceListener;
+import org.apache.jackrabbit.spi.NameFactory;
+import org.apache.jackrabbit.spi.PathFactory;
+import org.apache.jackrabbit.namespace.AbstractNamespaceResolver;
+import org.apache.jackrabbit.namespace.NamespaceListener;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -41,11 +33,10 @@
  * NamespaceRegistry.
  */
 public class NamespaceRegistryImpl extends AbstractNamespaceResolver
-    implements NamespaceRegistry, NameCache {
+    implements NamespaceRegistry {
 
     private static Logger log = LoggerFactory.getLogger(NamespaceRegistryImpl.class);
 
-    private final NameResolver resolver;
     private final NamespaceStorage storage;
     private final NamespaceCache nsCache;
 
@@ -53,15 +44,16 @@
      * Create a new <code>NamespaceRegistryImpl</code>.
      *
      * @param storage
+     * @param pathFactory
      */
     public NamespaceRegistryImpl(NamespaceStorage storage,
-                                 NamespaceCache nsCache) {
+                                 NamespaceCache nsCache,
+                                 NameFactory nameFactory, PathFactory pathFactory) {
         // listener support in AbstractNamespaceResolver is not needed
         // because we delegate listeners to NamespaceCache
         super(false);
         this.storage = storage;
         this.nsCache = nsCache;
-        this.resolver = new CachingNameResolver(new ParsingNameResolver(this));
     }
 
     //--------------------------------------------------< NamespaceRegistry >---
@@ -95,7 +87,7 @@
 
     /**
      * @see javax.jcr.NamespaceRegistry#getURI(String)
-     * @see org.apache.jackrabbit.name.NamespaceResolver#getURI(String)
+     * @see org.apache.jackrabbit.namespace.NamespaceResolver#getURI(String)
      */
     public String getURI(String prefix) throws NamespaceException {
         // try to load the uri
@@ -109,7 +101,7 @@
 
     /**
      * @see javax.jcr.NamespaceRegistry#getPrefix(String)
-     * @see org.apache.jackrabbit.name.NamespaceResolver#getPrefix(String)
+     * @see org.apache.jackrabbit.namespace.NamespaceResolver#getPrefix(String)
      */
     public String getPrefix(String uri) throws NamespaceException {
         // try to load the prefix
@@ -119,60 +111,6 @@
             log.debug("Internal error while loading registered namespaces.");
             throw new NamespaceException(uri + ": is not a registered namespace uri.");
         }
-    }
-
-    /**
-     * @see org.apache.jackrabbit.name.NamespaceResolver#getQName(String)
-     * @deprecated
-     */
-    public QName getQName(String name)
-            throws IllegalNameException, UnknownPrefixException {
-        return NameFormat.parse(name, this);
-    }
-
-    /**
-     * @see org.apache.jackrabbit.name.NamespaceResolver#getJCRName(QName)
-     * @deprecated
-     */
-    public String getJCRName(QName name) throws NoPrefixDeclaredException {
-        return NameFormat.format(name, this);
-    }
-
-    //----------------------------------------------------------< NameCache >---
-    /**
-     * {@inheritDoc}
-     */
-    public QName retrieveName(String jcrName) {
-        try {
-            return resolver.getQName(jcrName);
-        } catch (NameException e) {
-            return null;
-        } catch (NamespaceException e) {
-            return null;
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public String retrieveName(QName name) {
-        try {
-            return resolver.getJCRName(name);
-        } catch (NamespaceException e) {
-            return null;
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void cacheName(String jcrName, QName name) {
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void evictAllNames() {
     }
 
     //-----------------------< AbstractNamespaceResolver >----------------------

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/BitsetENTCacheImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/BitsetENTCacheImpl.java?rev=586065&r1=586064&r2=586065&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/BitsetENTCacheImpl.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/BitsetENTCacheImpl.java Thu Oct 18 11:41:45 2007
@@ -16,7 +16,7 @@
  */
 package org.apache.jackrabbit.jcr2spi.nodetype;
 
-import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.spi.Name;
 
 import java.util.TreeSet;
 import java.util.HashMap;
@@ -69,7 +69,7 @@
     /**
      * The reverse lookup table for bit numbers to names
      */
-    private QName[] names = new QName[1024];
+    private Name[] names = new Name[1024];
 
     /**
      * Creates a new bitset effective node type cache
@@ -82,7 +82,7 @@
     /**
      * {@inheritDoc}
      */
-    public Key getKey(QName[] ntNames) {
+    public Key getKey(Name[] ntNames) {
         return new BitsetKey(ntNames, nameIndex.size() + ntNames.length);
     }
 
@@ -122,7 +122,7 @@
     /**
      * {@inheritDoc}
      */
-    public void invalidate(QName name) {
+    public void invalidate(Name name) {
         /**
          * remove all affected effective node types from aggregates cache
          * (copy keys first to prevent ConcurrentModificationException)
@@ -167,7 +167,7 @@
      * @param name the name to lookup
      * @return the bit number for the given name
      */
-    private int getBitNumber(QName name) {
+    private int getBitNumber(Name name) {
         Integer i = (Integer) nameIndex.get(name);
         if (i == null) {
             synchronized (nameIndex) {
@@ -177,7 +177,7 @@
                     i = new Integer(idx);
                     nameIndex.put(name, i);
                     if (idx >= names.length) {
-                        QName[] newNames = new QName[names.length*2];
+                        Name[] newNames = new Name[names.length*2];
                         System.arraycopy(names, 0, newNames, 0, names.length);
                         names = newNames;
                     }
@@ -193,7 +193,7 @@
      * @param n the bit number to lookup
      * @return the node type name
      */
-    private QName getName(int n) {
+    private Name getName(int n) {
         return names[n];
     }
 
@@ -222,7 +222,7 @@
         BitsetENTCacheImpl clone = new BitsetENTCacheImpl();
         clone.sortedKeys.addAll(sortedKeys);
         clone.aggregates.putAll(aggregates);
-        clone.names = new QName[names.length];
+        clone.names = new Name[names.length];
         System.arraycopy(names, 0, clone.names, 0, names.length);
         clone.nameIndex.putAll(nameIndex);
         return clone;
@@ -255,7 +255,7 @@
         /**
          * The names of the node types that form this key.
          */
-        private final QName[] names;
+        private final Name[] names;
 
         /**
          * The array of longs that hold the bit information.
@@ -272,7 +272,7 @@
          * @param names the node type names
          * @param maxBit the approximative number of the geatest bit
          */
-        public BitsetKey(QName[] names, int maxBit) {
+        public BitsetKey(Name[] names, int maxBit) {
             this.names = names;
             bits = new long[maxBit/BPW+1];
 
@@ -290,7 +290,7 @@
          */
         private BitsetKey(long[] bits, int numBits) {
             this.bits = bits;
-            names = new QName[numBits];
+            names = new Name[numBits];
             int i = nextSetBit(0);
             int j=0;
             while (i >= 0) {
@@ -303,7 +303,7 @@
         /**
          * {@inheritDoc}
          */
-        public QName[] getNames() {
+        public Name[] getNames() {
             return names;
         }
 



Mime
View raw message