jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r586065 [4/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/nodetype/NodeTypeRegistryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeRegistryImpl.java?rev=586065&r1=586064&r2=586065&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeRegistryImpl.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeRegistryImpl.java Thu Oct 18 11:41:45 2007
@@ -22,11 +22,14 @@
 import org.apache.jackrabbit.jcr2spi.state.Status;
 import org.apache.jackrabbit.jcr2spi.state.PropertyState;
 import org.apache.jackrabbit.jcr2spi.hierarchy.PropertyEntry;
-import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.QNodeDefinition;
 import org.apache.jackrabbit.spi.QPropertyDefinition;
 import org.apache.jackrabbit.spi.QNodeTypeDefinition;
 import org.apache.jackrabbit.spi.QValue;
+import org.apache.jackrabbit.nodetype.InvalidNodeTypeDefException;
+import org.apache.jackrabbit.nodetype.NodeTypeConflictException;
+import org.apache.jackrabbit.name.NameConstants;
 import org.slf4j.LoggerFactory;
 import org.slf4j.Logger;
 
@@ -141,16 +144,16 @@
     /**
      * @see NodeTypeRegistry#getRegisteredNodeTypes()
      */
-    public QName[] getRegisteredNodeTypes() throws RepositoryException {
+    public Name[] getRegisteredNodeTypes() throws RepositoryException {
         Set qNames = registeredNTDefs.keySet();
-        return (QName[]) qNames.toArray(new QName[registeredNTDefs.size()]);
+        return (Name[]) qNames.toArray(new Name[registeredNTDefs.size()]);
     }
 
 
     /**
-     * @see NodeTypeRegistry#isRegistered(QName)
+     * @see NodeTypeRegistry#isRegistered(Name)
      */
-    public boolean isRegistered(QName nodeTypeName) {
+    public boolean isRegistered(Name nodeTypeName) {
         return registeredNTDefs.containsKey(nodeTypeName);
     }
 
@@ -169,7 +172,7 @@
         internalRegister(ntDef, ent);
 
         // notify listeners
-        notifyRegistered(ntDef.getQName());
+        notifyRegistered(ntDef.getName());
         return ent;
     }
 
@@ -188,15 +191,15 @@
 
         // notify listeners
         for (Iterator iter = ntDefs.iterator(); iter.hasNext();) {
-            QName ntName = ((QNodeTypeDefinition)iter.next()).getQName();
+            Name ntName = ((QNodeTypeDefinition)iter.next()).getName();
             notifyRegistered(ntName);
         }
     }
 
     /**
-     * @see NodeTypeRegistry#unregisterNodeType(QName)
+     * @see NodeTypeRegistry#unregisterNodeType(Name)
      */
-    public void unregisterNodeType(QName nodeTypeName) throws NoSuchNodeTypeException, RepositoryException {
+    public void unregisterNodeType(Name nodeTypeName) throws NoSuchNodeTypeException, RepositoryException {
         HashSet ntNames = new HashSet();
         ntNames.add(nodeTypeName);
         unregisterNodeTypes(ntNames);
@@ -209,7 +212,7 @@
             throws NoSuchNodeTypeException, RepositoryException {
         // do some preliminary checks
         for (Iterator iter = nodeTypeNames.iterator(); iter.hasNext();) {
-            QName ntName = (QName) iter.next();
+            Name ntName = (Name) iter.next();
             
             // Best effort check for node types other than those to be
             // unregistered that depend on the given node types
@@ -228,7 +231,7 @@
 
         // persist removal of node type definitions
         // NOTE: conflict with existing content not asserted on client
-        storage.unregisterNodeTypes((QName[]) nodeTypeNames.toArray(new QName[nodeTypeNames.size()]));
+        storage.unregisterNodeTypes((Name[]) nodeTypeNames.toArray(new Name[nodeTypeNames.size()]));
 
 
         // all preconditions are met, node types can now safely be unregistered
@@ -236,7 +239,7 @@
 
         // notify listeners
         for (Iterator iter = nodeTypeNames.iterator(); iter.hasNext();) {
-            QName ntName = (QName) iter.next();
+            Name ntName = (Name) iter.next();
             notifyUnregistered(ntName);
         }
     }
@@ -247,7 +250,7 @@
     public synchronized EffectiveNodeType reregisterNodeType(QNodeTypeDefinition ntd)
             throws NoSuchNodeTypeException, InvalidNodeTypeDefException,
             RepositoryException {
-        QName name = ntd.getQName();
+        Name name = ntd.getName();
         if (!registeredNTDefs.containsKey(name)) {
             throw new NoSuchNodeTypeException(name.toString());
         }
@@ -268,9 +271,9 @@
     }
 
     /**
-     * @see NodeTypeRegistry#getNodeTypeDefinition(QName)
+     * @see NodeTypeRegistry#getNodeTypeDefinition(Name)
      */
-    public QNodeTypeDefinition getNodeTypeDefinition(QName nodeTypeName)
+    public QNodeTypeDefinition getNodeTypeDefinition(Name nodeTypeName)
         throws NoSuchNodeTypeException {
         QNodeTypeDefinition def = (QNodeTypeDefinition) registeredNTDefs.get(nodeTypeName);
         if (def == null) {
@@ -280,25 +283,25 @@
     }
     //------------------------------------------< EffectiveNodeTypeProvider >---
     /**
-     * @see EffectiveNodeTypeProvider#getEffectiveNodeType(QName)
+     * @see EffectiveNodeTypeProvider#getEffectiveNodeType(Name)
      */
-    public synchronized EffectiveNodeType getEffectiveNodeType(QName ntName)
+    public synchronized EffectiveNodeType getEffectiveNodeType(Name ntName)
             throws NoSuchNodeTypeException {
         return getEffectiveNodeType(ntName, entCache, registeredNTDefs);
     }
 
     /**
-     * @see EffectiveNodeTypeProvider#getEffectiveNodeType(QName[])
+     * @see EffectiveNodeTypeProvider#getEffectiveNodeType(Name[])
      */
-    public synchronized EffectiveNodeType getEffectiveNodeType(QName[] ntNames)
+    public synchronized EffectiveNodeType getEffectiveNodeType(Name[] ntNames)
             throws NodeTypeConflictException, NoSuchNodeTypeException {
         return getEffectiveNodeType(ntNames, entCache, registeredNTDefs);
     }
 
     /**
-     * @see EffectiveNodeTypeProvider#getEffectiveNodeType(QName[], Map)
+     * @see EffectiveNodeTypeProvider#getEffectiveNodeType(Name[], Map)
      */
-    public EffectiveNodeType getEffectiveNodeType(QName[] ntNames, Map ntdMap)
+    public EffectiveNodeType getEffectiveNodeType(Name[] ntNames, Map ntdMap)
         throws NodeTypeConflictException, NoSuchNodeTypeException {
         return getEffectiveNodeType(ntNames, entCache, ntdMap);
     }
@@ -311,21 +314,21 @@
      */
     public EffectiveNodeType getEffectiveNodeType(NodeState nodeState) throws ConstraintViolationException, NoSuchNodeTypeException {
         try {
-            QName[] allNtNames;
+            Name[] allNtNames;
             if (nodeState.getStatus() == Status.EXISTING) {
                 allNtNames = nodeState.getNodeTypeNames();
             } else {
                 // TODO: check if correct (and only used for creating new)
-                QName primaryType = nodeState.getNodeTypeName();
-                allNtNames = new QName[] { primaryType }; // default
+                Name primaryType = nodeState.getNodeTypeName();
+                allNtNames = new Name[] { primaryType }; // default
                 try {
-                    PropertyEntry pe = nodeState.getNodeEntry().getPropertyEntry(QName.JCR_MIXINTYPES, true);
+                    PropertyEntry pe = nodeState.getNodeEntry().getPropertyEntry(NameConstants.JCR_MIXINTYPES, true);
                     if (pe != null) {
                         PropertyState mixins = pe.getPropertyState();
                         QValue[] values = mixins.getValues();
-                        allNtNames = new QName[values.length + 1];
+                        allNtNames = new Name[values.length + 1];
                         for (int i = 0; i < values.length; i++) {
-                            allNtNames[i] = values[i].getQName();
+                            allNtNames[i] = values[i].getName();
                         }
                         allNtNames[values.length] = primaryType;
                     } // else: no jcr:mixinTypes property exists -> ignore
@@ -349,12 +352,12 @@
      * @return
      * @throws NoSuchNodeTypeException
      */
-    private EffectiveNodeType getEffectiveNodeType(QName ntName,
+    private EffectiveNodeType getEffectiveNodeType(Name ntName,
                                                    EffectiveNodeTypeCache entCache,
                                                    Map ntdCache)
         throws NoSuchNodeTypeException {
         // 1. check if effective node type has already been built
-        EffectiveNodeTypeCache.Key key = entCache.getKey(new QName[]{ntName});
+        EffectiveNodeTypeCache.Key key = entCache.getKey(new Name[]{ntName});
         EffectiveNodeType ent = entCache.get(key);
         if (ent != null) {
             return ent;
@@ -390,7 +393,7 @@
      * @throws NodeTypeConflictException
      * @throws NoSuchNodeTypeException
      */
-    private EffectiveNodeType getEffectiveNodeType(QName[] ntNames,
+    private EffectiveNodeType getEffectiveNodeType(Name[] ntNames,
                                                    EffectiveNodeTypeCache entCache,
                                                    Map ntdCache)
         throws NodeTypeConflictException, NoSuchNodeTypeException {
@@ -432,7 +435,7 @@
                      * no matching sub-aggregates found:
                      * build aggregate of remaining node types through iteration
                      */
-                    QName[] remainder = key.getNames();
+                    Name[] remainder = key.getNames();
                     for (int i = 0; i < remainder.length; i++) {
                         QNodeTypeDefinition ntd = (QNodeTypeDefinition) ntdCache.get(remainder[i]);
                         EffectiveNodeTypeImpl ent = EffectiveNodeTypeImpl.create(this, ntd, ntdCache);
@@ -465,7 +468,7 @@
     /**
      * Notify the listeners that a node type <code>ntName</code> has been registered.
      */
-    private void notifyRegistered(QName ntName) {
+    private void notifyRegistered(Name ntName) {
         // copy listeners to array to avoid ConcurrentModificationException
         NodeTypeRegistryListener[] la =
                 new NodeTypeRegistryListener[listeners.size()];
@@ -484,7 +487,7 @@
     /**
      * Notify the listeners that a node type <code>ntName</code> has been re-registered.
      */
-    private void notifyReRegistered(QName ntName) {
+    private void notifyReRegistered(Name ntName) {
         // copy listeners to array to avoid ConcurrentModificationException
         NodeTypeRegistryListener[] la = new NodeTypeRegistryListener[listeners.size()];
         Iterator iter = listeners.values().iterator();
@@ -502,7 +505,7 @@
     /**
      * Notify the listeners that a node type <code>ntName</code> has been unregistered.
      */
-    private void notifyUnregistered(QName ntName) {
+    private void notifyUnregistered(Name ntName) {
         // copy listeners to array to avoid ConcurrentModificationException
         NodeTypeRegistryListener[] la = new NodeTypeRegistryListener[listeners.size()];
         Iterator iter = listeners.values().iterator();
@@ -534,7 +537,7 @@
             log.debug("Effective node type for " + ntd + " not yet built.");
         }
         // register nt-definition
-        registeredNTDefs.put(ntd.getQName(), ntd);
+        registeredNTDefs.put(ntd.getName(), ntd);
 
         // store property & child node definitions of new node type by id
         QPropertyDefinition[] pda = ntd.getPropertyDefs();
@@ -551,7 +554,7 @@
         }
     }
 
-    private void internalUnregister(QName name) {
+    private void internalUnregister(Name name) {
         QNodeTypeDefinition ntd = (QNodeTypeDefinition) registeredNTDefs.remove(name);
         entCache.invalidate(name);
 
@@ -574,7 +577,7 @@
 
     private void internalUnregister(Collection ntNames) {
         for (Iterator iter = ntNames.iterator(); iter.hasNext();) {
-            QName name = (QName) iter.next();
+            Name name = (Name) iter.next();
             internalUnregister(name);
         }
     }
@@ -612,10 +615,10 @@
          * will only contain those node type definitions that are known so far.
          *
          * @param nodeTypeName node type name
-         * @return a set of node type <code>QName</code>s
+         * @return a set of node type <code>Name</code>s
          * @throws NoSuchNodeTypeException
          */
-        private Set getDependentNodeTypes(QName nodeTypeName) throws NoSuchNodeTypeException {
+        private Set getDependentNodeTypes(Name nodeTypeName) throws NoSuchNodeTypeException {
             if (!nodetypeDefinitions.containsKey(nodeTypeName)) {
                 throw new NoSuchNodeTypeException(nodeTypeName.toString());
             }
@@ -626,7 +629,7 @@
             while (iter.hasNext()) {
                 QNodeTypeDefinition ntd = (QNodeTypeDefinition) iter.next();
                 if (ntd.getDependencies().contains(nodeTypeName)) {
-                    names.add(ntd.getQName());
+                    names.add(ntd.getName());
                 }
             }
             return names;
@@ -655,7 +658,7 @@
         }
 
         public boolean containsKey(Object key) {
-            if (!(key instanceof QName)) {
+            if (!(key instanceof Name)) {
                 return false;
             }
             return get(key) != null;
@@ -665,7 +668,7 @@
             if (!(value instanceof QNodeTypeDefinition)) {
                 return false;
             }
-            return get(((QNodeTypeDefinition)value).getQName()) != null;
+            return get(((QNodeTypeDefinition)value).getName()) != null;
         }
 
         public Set keySet() {
@@ -703,14 +706,14 @@
         }
 
         public Object get(Object key) {
-            if (!(key instanceof QName)) {
+            if (!(key instanceof Name)) {
                 throw new IllegalArgumentException();
             }
             QNodeTypeDefinition def = (QNodeTypeDefinition) nodetypeDefinitions.get(key);
             if (def == null) {
                 try {
                     // node type does either not exist or hasn't been loaded yet
-                    Iterator it = storage.getDefinitions(new QName[] {(QName) key});
+                    Iterator it = storage.getDefinitions(new Name[] {(Name) key});
                     updateInternalMap(it);
                 } catch (RepositoryException e) {
                     log.debug(e.getMessage());
@@ -729,8 +732,8 @@
             Iterator iter = nodetypeDefinitions.values().iterator();
             while (iter.hasNext()) {
                 QNodeTypeDefinition ntd = (QNodeTypeDefinition) iter.next();
-                ps.println(ntd.getQName());
-                QName[] supertypes = ntd.getSupertypes();
+                ps.println(ntd.getName());
+                Name[] supertypes = ntd.getSupertypes();
                 ps.println("\tSupertypes");
                 for (int i = 0; i < supertypes.length; i++) {
                     ps.println("\t\t" + supertypes[i]);
@@ -742,7 +745,7 @@
                 for (int i = 0; i < pd.length; i++) {
                     ps.print("\tPropertyDefinition");
                     ps.println(" (declared in " + pd[i].getDeclaringNodeType() + ") ");
-                    ps.println("\t\tName\t\t" + (pd[i].definesResidual() ? "*" : pd[i].getQName().toString()));
+                    ps.println("\t\tName\t\t" + (pd[i].definesResidual() ? "*" : pd[i].getName().toString()));
                     String type = pd[i].getRequiredType() == 0 ? "null" : PropertyType.nameFromValue(pd[i].getRequiredType());
                     ps.println("\t\tRequiredType\t" + type);                  
                     String[] vca = pd[i].getValueConstraints();
@@ -785,14 +788,14 @@
                 for (int i = 0; i < nd.length; i++) {
                     ps.print("\tNodeDefinition");
                     ps.println(" (declared in " + nd[i].getDeclaringNodeType() + ") ");
-                    ps.println("\t\tName\t\t" + (nd[i].definesResidual() ? "*" : nd[i].getQName().toString()));
-                    QName[] reqPrimaryTypes = nd[i].getRequiredPrimaryTypes();
+                    ps.println("\t\tName\t\t" + (nd[i].definesResidual() ? "*" : nd[i].getName().toString()));
+                    Name[] reqPrimaryTypes = nd[i].getRequiredPrimaryTypes();
                     if (reqPrimaryTypes != null && reqPrimaryTypes.length > 0) {
                         for (int n = 0; n < reqPrimaryTypes.length; n++) {
                             ps.print("\t\tRequiredPrimaryType\t" + reqPrimaryTypes[n]);
                         }
                     }
-                    QName defPrimaryType = nd[i].getDefaultPrimaryType();
+                    Name defPrimaryType = nd[i].getDefaultPrimaryType();
                     if (defPrimaryType != null) {
                         ps.print("\n\t\tDefaultPrimaryType\t" + defPrimaryType);
                     }

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeRegistryListener.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeRegistryListener.java?rev=586065&r1=586064&r2=586065&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeRegistryListener.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeRegistryListener.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;
 
 /**
  * The <code>NodeTypeRegistryListener</code> interface allows an implementing
@@ -32,19 +32,19 @@
      *
      * @param ntName name of the node type that has been registered
      */
-    void nodeTypeRegistered(QName ntName);
+    void nodeTypeRegistered(Name ntName);
 
     /**
      * Called when a node type has been re-registered.
      *
      * @param ntName name of the node type that has been registered
      */
-    void nodeTypeReRegistered(QName ntName);
+    void nodeTypeReRegistered(Name ntName);
 
     /**
      * Called when a node type has been deregistered.
      *
      * @param ntName name of the node type that has been unregistered
      */
-    void nodeTypeUnregistered(QName ntName);
+    void nodeTypeUnregistered(Name ntName);
 }

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeStorage.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeStorage.java?rev=586065&r1=586064&r2=586065&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeStorage.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeStorage.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 org.apache.jackrabbit.spi.QNodeTypeDefinition;
 
 import javax.jcr.nodetype.NoSuchNodeTypeException;
@@ -46,11 +46,11 @@
      * @throws NoSuchNodeTypeException
      * @throws RepositoryException
      */
-    public Iterator getDefinitions(QName[] nodeTypeNames) throws NoSuchNodeTypeException, RepositoryException;
+    public Iterator getDefinitions(Name[] nodeTypeNames) throws NoSuchNodeTypeException, RepositoryException;
 
     public void registerNodeTypes(QNodeTypeDefinition[] nodeTypeDefs) throws NoSuchNodeTypeException, RepositoryException;
 
     public void reregisterNodeTypes(QNodeTypeDefinition[] nodeTypeDefs) throws NoSuchNodeTypeException, RepositoryException;
 
-    public void unregisterNodeTypes(QName[] nodeTypeNames) throws NoSuchNodeTypeException, RepositoryException;
+    public void unregisterNodeTypes(Name[] nodeTypeNames) throws NoSuchNodeTypeException, RepositoryException;
 }

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/PropertyDefinitionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/PropertyDefinitionImpl.java?rev=586065&r1=586064&r2=586065&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/PropertyDefinitionImpl.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/PropertyDefinitionImpl.java Thu Oct 18 11:41:45 2007
@@ -16,10 +16,11 @@
  */
 package org.apache.jackrabbit.jcr2spi.nodetype;
 
-import org.apache.jackrabbit.name.NamespaceResolver;
 import org.apache.jackrabbit.spi.QPropertyDefinition;
 import org.apache.jackrabbit.spi.QValue;
 import org.apache.jackrabbit.value.ValueFormat;
+import org.apache.jackrabbit.conversion.NamePathResolver;
+import org.apache.jackrabbit.nodetype.InvalidConstraintException;
 import org.slf4j.LoggerFactory;
 import org.slf4j.Logger;
 
@@ -31,7 +32,7 @@
 /**
  * This class implements the <code>PropertyDefinition</code> interface.
  * All method calls are delegated to the wrapped {@link QPropertyDefinition},
- * performing the translation from <code>QName</code>s to JCR names
+ * performing the translation from <code>Name</code>s to JCR names
  * (and vice versa) where necessary.
  */
 public class PropertyDefinitionImpl extends ItemDefinitionImpl implements PropertyDefinition {
@@ -48,11 +49,11 @@
      *
      * @param propDef    property definition
      * @param ntMgr      node type manager
-     * @param nsResolver namespace resolver
+     * @param resolver
      */
     PropertyDefinitionImpl(QPropertyDefinition propDef, NodeTypeManagerImpl ntMgr,
-                           NamespaceResolver nsResolver, ValueFactory valueFactory) {
-        super(propDef, ntMgr, nsResolver);
+                           NamePathResolver resolver, ValueFactory valueFactory) {
+        super(propDef, ntMgr, resolver);
         this.valueFactory = valueFactory;
     }
 
@@ -70,7 +71,7 @@
         Value[] values = new Value[defVals.length];
         for (int i = 0; i < defVals.length; i++) {
             try {
-                values[i] = ValueFormat.getJCRValue(defVals[i], nsResolver, valueFactory);
+                values[i] = ValueFormat.getJCRValue(defVals[i], resolver, valueFactory);
             } catch (RepositoryException e) {
                 // should never get here
                 String propName = (getName() == null) ? "[null]" : getName();
@@ -101,7 +102,7 @@
             String[] vca = new String[constraints.length];
             for (int i = 0; i < constraints.length; i++) {
                 ValueConstraint constr = ValueConstraint.create(pd.getRequiredType(), constraints[i]);
-                vca[i] = constr.getDefinition(nsResolver);
+                vca[i] = constr.getDefinition(resolver);
             }
             return vca;
         } catch (InvalidConstraintException e) {

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/ValueConstraint.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/ValueConstraint.java?rev=586065&r1=586064&r2=586065&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/ValueConstraint.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/ValueConstraint.java Thu Oct 18 11:41:45 2007
@@ -16,25 +16,25 @@
  */
 package org.apache.jackrabbit.jcr2spi.nodetype;
 
-import org.apache.jackrabbit.name.IllegalNameException;
-import org.apache.jackrabbit.name.MalformedPathException;
-import org.apache.jackrabbit.name.NamespaceResolver;
-import org.apache.jackrabbit.name.NoPrefixDeclaredException;
-import org.apache.jackrabbit.name.UnknownPrefixException;
-import org.apache.jackrabbit.name.NameException;
-import org.apache.jackrabbit.name.NameFormat;
-import org.apache.jackrabbit.name.QName;
-import org.apache.jackrabbit.name.Path;
-import org.apache.jackrabbit.name.PathFormat;
+import org.apache.jackrabbit.conversion.NamePathResolver;
+import org.apache.jackrabbit.conversion.NameResolver;
+import org.apache.jackrabbit.conversion.NameException;
+import org.apache.jackrabbit.conversion.PathResolver;
+import org.apache.jackrabbit.spi.Name;
+import org.apache.jackrabbit.spi.Path;
 import org.apache.jackrabbit.spi.QPropertyDefinition;
 import org.apache.jackrabbit.spi.QValue;
 import org.apache.jackrabbit.value.DateValue;
+import org.apache.jackrabbit.nodetype.InvalidConstraintException;
+import org.apache.jackrabbit.name.PathFactoryImpl;
+import org.apache.jackrabbit.name.NameFactoryImpl;
 import org.slf4j.LoggerFactory;
 import org.slf4j.Logger;
 
 import javax.jcr.PropertyType;
 import javax.jcr.RepositoryException;
 import javax.jcr.ValueFormatException;
+import javax.jcr.NamespaceException;
 import javax.jcr.nodetype.ConstraintViolationException;
 import java.util.Calendar;
 import java.util.regex.Matcher;
@@ -72,8 +72,9 @@
      *
      * @return the definition of this constraint.
      * @see #getQualifiedDefinition()
+     * @param resolver
      */
-    public String getDefinition(NamespaceResolver nsResolver) {
+    public String getDefinition(NamePathResolver resolver) {
         return qualifiedDefinition;
     }
 
@@ -81,7 +82,7 @@
      * By default the qualified definition is the same as the JCR definition.
      *
      * @return the qualified definition String
-     * @see #getDefinition(NamespaceResolver)
+     * @see #getDefinition(NamePathResolver)
      */
     public String getQualifiedDefinition() {
         return qualifiedDefinition;
@@ -171,12 +172,12 @@
      *
      * @param type
      * @param definition
-     * @param nsResolver
+     * @param resolver
      * @return
      * @throws InvalidConstraintException
      */
     public static ValueConstraint create(int type, String definition,
-                                         NamespaceResolver nsResolver)
+                                         NamePathResolver resolver)
             throws InvalidConstraintException {
         if (definition == null) {
             throw new IllegalArgumentException("Illegal definition (null) for ValueConstraint.");
@@ -199,13 +200,13 @@
                 return new NumericConstraint(definition);
 
             case PropertyType.NAME:
-                return new NameConstraint(definition, nsResolver);
+                return new NameConstraint(definition, resolver);
 
             case PropertyType.PATH:
-                return new PathConstraint(definition, nsResolver);
+                return new PathConstraint(definition, resolver);
 
             case PropertyType.REFERENCE:
-                return new ReferenceConstraint(definition, nsResolver);
+                return new ReferenceConstraint(definition, resolver);
 
             default:
                 throw new IllegalArgumentException("Unknown/unsupported target type for constraint: " + PropertyType.nameFromValue(type));
@@ -621,6 +622,7 @@
  * <code>PathConstraint</code> ...
  */
 class PathConstraint extends ValueConstraint {
+
     final Path path;
     final boolean deep;
 
@@ -628,10 +630,11 @@
         super(qualifiedDefinition);
         // constraint format: qualified absolute or relative path with optional trailing wildcard
         deep = qualifiedDefinition.endsWith("*");
-        path = Path.valueOf(qualifiedDefinition);
+        // TODO improve. don't rely on a specific factory impl
+        path = PathFactoryImpl.getInstance().create(qualifiedDefinition);
     }
 
-    PathConstraint(String definition, NamespaceResolver nsResolver)
+    PathConstraint(String definition, PathResolver resolver)
             throws InvalidConstraintException {
         super(definition);
 
@@ -642,23 +645,28 @@
             definition = definition.substring(0, definition.length() - 1);
         }
         try {
-            path = PathFormat.parse(definition, nsResolver);
-        } catch (MalformedPathException mpe) {
+            path = resolver.getQPath(definition);
+        } catch (NameException e) {
+            String msg = "Invalid path expression specified as value constraint: " + definition;
+            log.debug(msg);
+            throw new InvalidConstraintException(msg, e);
+        } catch (NamespaceException e) {
             String msg = "Invalid path expression specified as value constraint: " + definition;
             log.debug(msg);
-            throw new InvalidConstraintException(msg, mpe);
+            throw new InvalidConstraintException(msg, e);
         }
     }
 
     /**
-     * Uses {@link PathFormat#format(Path, NamespaceResolver)} to convert the
+     * Uses {@link NamePathResolver#getJCRPath(Path)} to convert the
      * qualified <code>Path</code> into a JCR path.
      *
-     * @see ValueConstraint#getDefinition(NamespaceResolver)
+     * @see ValueConstraint#getDefinition(NamePathResolver)
+     * @param resolver
      */
-    public String getDefinition(NamespaceResolver nsResolver) {
+    public String getDefinition(NamePathResolver resolver) {
         try {
-            String p = PathFormat.format(path, nsResolver);
+            String p = resolver.getJCRPath(path);
             if (!deep) {
                 return p;
             } else if (path.denotesRoot()) {
@@ -666,7 +674,7 @@
             } else {
                 return p + "/*";
             }
-        } catch (NoPrefixDeclaredException npde) {
+        } catch (NamespaceException e) {
             // should never get here, return raw definition as fallback
             return getQualifiedDefinition();
         }
@@ -697,7 +705,7 @@
                 try {
                     p0 = path.getNormalizedPath();
                     p1 = p.getNormalizedPath();
-                } catch (MalformedPathException e) {
+                } catch (RepositoryException e) {
                     throw new ConstraintViolationException("path not valid: " + e);
                 }
                 if (deep) {
@@ -707,7 +715,7 @@
                                 + " does not satisfy the constraint '"
                                 + getQualifiedDefinition() + "'");
                         }
-                    } catch (MalformedPathException e) {
+                    } catch (RepositoryException e) {
                         // can't compare relative with absolute path
                         throw new ConstraintViolationException(p
                             + " does not satisfy the constraint '"
@@ -738,44 +746,45 @@
  */
 class NameConstraint extends ValueConstraint {
 
-    private final QName name;
+    private final Name name;
 
     NameConstraint(String qualifiedDefinition) {
         super(qualifiedDefinition);
         // constraint format: String representation of qualified name
-        name = QName.valueOf(qualifiedDefinition);
+        // TODO improve. don't rely on a specific factory impl
+        name = NameFactoryImpl.getInstance().create(qualifiedDefinition);
     }
 
-    NameConstraint(String definition, NamespaceResolver nsResolver)
+    NameConstraint(String definition, NameResolver resolver)
             throws InvalidConstraintException {
         super(definition);
         // constraint format: JCR name in prefix form
         try {
-            NameFormat.checkFormat(definition);
-            name = NameFormat.parse(definition, nsResolver);
-        } catch (IllegalNameException ine) {
+            name = resolver.getQName(definition);
+        } catch (NameException e) {
             String msg = "invalid name specified as value constraint: "
                     + definition;
             log.debug(msg);
-            throw new InvalidConstraintException(msg, ine);
-        } catch (NameException upe) {
+            throw new InvalidConstraintException(msg, e);
+        } catch (NamespaceException e) {
             String msg = "invalid name specified as value constraint: "
                     + definition;
             log.debug(msg);
-            throw new InvalidConstraintException(msg, upe);
+            throw new InvalidConstraintException(msg, e);
         }
     }
 
     /**
-     * Uses {@link NameFormat#format(QName, NamespaceResolver)} to convert the
-     * qualified <code>QName</code> into a JCR name.
+     * Uses {@link NamePathResolver#getJCRName(Name)} to convert the
+     * qualified <code>Name</code> into a JCR name.
      *
-     * @see ValueConstraint#getDefinition(NamespaceResolver)
+     * @see ValueConstraint#getDefinition(NamePathResolver)
+     * @param resolver
      */
-    public String getDefinition(NamespaceResolver nsResolver) {
+    public String getDefinition(NamePathResolver resolver) {
         try {
-            return NameFormat.format(name, nsResolver);
-        } catch (NoPrefixDeclaredException npde) {
+            return resolver.getJCRName(name);
+        } catch (NamespaceException e) {
             // should never get here, return raw definition as fallback
             return getQualifiedDefinition();
         }
@@ -800,7 +809,7 @@
         }
         switch (value.getType()) {
             case PropertyType.NAME:
-                QName n = value.getQName();
+                Name n = value.getName();
                 if (!name.equals(n)) {
                     throw new ConstraintViolationException(n
                             + " does not satisfy the constraint '"
@@ -823,43 +832,50 @@
  */
 class ReferenceConstraint extends ValueConstraint {
 
-    private final QName ntName;
+    private final Name ntName;
 
     ReferenceConstraint(String qualifiedDefinition) {
         super(qualifiedDefinition);
         // format: qualified node type name
-        ntName = QName.valueOf(qualifiedDefinition);
+        // TODO improve. don't rely on a specific factory impl
+        ntName = NameFactoryImpl.getInstance().create(qualifiedDefinition);
     }
 
-    ReferenceConstraint(String definition, NamespaceResolver nsResolver) throws InvalidConstraintException {
+    ReferenceConstraint(String definition, NamePathResolver resolver) throws InvalidConstraintException {
         super(definition);
 
         // format: node type name
         try {
-            ntName = NameFormat.parse(definition, nsResolver);
-        } catch (IllegalNameException ine) {
+            ntName = resolver.getQName(definition);
+        } catch (org.apache.jackrabbit.conversion.IllegalNameException ine) {
             String msg = "invalid node type name specified as value constraint: "
                     + definition;
             log.debug(msg);
             throw new InvalidConstraintException(msg, ine);
-        } catch (UnknownPrefixException upe) {
+        } catch (NameException e) {
+            String msg = "invalid node type name specified as value constraint: "
+                    + definition;
+            log.debug(msg);
+            throw new InvalidConstraintException(msg, e);
+        } catch (NamespaceException e) {
             String msg = "invalid node type name specified as value constraint: "
                     + definition;
             log.debug(msg);
-            throw new InvalidConstraintException(msg, upe);
+            throw new InvalidConstraintException(msg, e);
         }
     }
 
     /**
-     * Uses {@link NameFormat#format(QName, NamespaceResolver)} to convert the
+     * Uses {@link NamePathResolver#getJCRName(Name)} to convert the
      * qualified nodetype name into a JCR name.
      *
-     * @see ValueConstraint#getDefinition(NamespaceResolver)
+     * @see ValueConstraint#getDefinition(NamePathResolver)
+     * @param resolver
      */
-    public String getDefinition(NamespaceResolver nsResolver) {
+    public String getDefinition(NamePathResolver resolver) {
         try {
-            return NameFormat.format(ntName, nsResolver);
-        } catch (NoPrefixDeclaredException npde) {
+            return resolver.getJCRName(ntName);
+        } catch (NamespaceException npde) {
             // should never get here, return raw definition as fallback
             return getQualifiedDefinition();
         }

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/observation/EventImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/observation/EventImpl.java?rev=586065&r1=586064&r2=586065&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/observation/EventImpl.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/observation/EventImpl.java Thu Oct 18 11:41:45 2007
@@ -16,9 +16,7 @@
  */
 package org.apache.jackrabbit.jcr2spi.observation;
 
-import org.apache.jackrabbit.name.NoPrefixDeclaredException;
-import org.apache.jackrabbit.name.PathFormat;
-import org.apache.jackrabbit.name.NamespaceResolver;
+import org.apache.jackrabbit.conversion.NamePathResolver;
 import org.slf4j.LoggerFactory;
 import org.slf4j.Logger;
 
@@ -39,7 +37,7 @@
      * The session of the {@link javax.jcr.observation.EventListener} this
      * event will be delivered to.
      */
-    private final NamespaceResolver nsResolver;
+    private final NamePathResolver resolver;
 
     /**
      * The underlying SPI event.
@@ -55,13 +53,11 @@
      * Creates a new {@link javax.jcr.observation.Event} instance based on an
      * {@link org.apache.jackrabbit.spi.Event SPI Event}.
      *
-     * @param nsResolver <code>NamespaceResolver</code> attached to the session
-     * of the registerd <code>EventListener</code>, where this <code>Event</code>
-     * will be delivered to.
+     * @param resolver
      * @param event   the underlying SPI <code>Event</code>.
      */
-    EventImpl(NamespaceResolver nsResolver, org.apache.jackrabbit.spi.Event event) {
-        this.nsResolver = nsResolver;
+    EventImpl(NamePathResolver resolver, org.apache.jackrabbit.spi.Event event) {
+        this.resolver = resolver;
         this.event = event;
     }
 
@@ -76,13 +72,7 @@
      * {@inheritDoc}
      */
     public String getPath() throws RepositoryException {
-        try {
-            return PathFormat.format(event.getQPath(), nsResolver);
-        } catch (NoPrefixDeclaredException e) {
-            String msg = "internal error: encountered unregistered namespace in path";
-            log.debug(msg);
-            throw new RepositoryException(msg, e);
-        }
+        return resolver.getJCRPath(event.getPath());
     }
 
     /**

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/observation/FilteredEventIterator.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/observation/FilteredEventIterator.java?rev=586065&r1=586064&r2=586065&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/observation/FilteredEventIterator.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/observation/FilteredEventIterator.java Thu Oct 18 11:41:45 2007
@@ -20,7 +20,7 @@
 import org.slf4j.Logger;
 import org.apache.jackrabbit.spi.EventBundle;
 import org.apache.jackrabbit.spi.EventFilter;
-import org.apache.jackrabbit.name.NamespaceResolver;
+import org.apache.jackrabbit.conversion.NamePathResolver;
 
 import javax.jcr.observation.Event;
 import javax.jcr.observation.EventIterator;
@@ -56,7 +56,7 @@
     /**
      * The namespace resolver of the session that created this event iterator.
      */
-    private final NamespaceResolver nsResolver;
+    private final NamePathResolver resolver;
 
     /**
      * The next {@link javax.jcr.observation.Event} in this iterator
@@ -75,16 +75,15 @@
      *                   bundle.
      * @param filter     only event that pass the filter will be dispatched to
      *                   the event listener.
-     * @param nsResolver the namespace resolver of the session that created this
-     *                   <code>FilteredEventIterator</code>.
+     * @param resolver
      */
     public FilteredEventIterator(EventBundle events,
                                  EventFilter filter,
-                                 NamespaceResolver nsResolver) {
+                                 NamePathResolver resolver) {
         this.actualEvents = events.getEvents();
         this.filter = filter;
         this.isLocal = events.isLocal();
-        this.nsResolver = nsResolver;
+        this.resolver = resolver;
         fetchNext();
     }
 
@@ -162,7 +161,7 @@
         next = null;
         while (next == null && actualEvents.hasNext()) {
             event = (org.apache.jackrabbit.spi.Event) actualEvents.next();
-            next = filter.accept(event, isLocal) ? new EventImpl(nsResolver, event) : null;
+            next = filter.accept(event, isLocal) ? new EventImpl(resolver, event) : null;
         }
     }
 }

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/observation/ObservationManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/observation/ObservationManagerImpl.java?rev=586065&r1=586064&r2=586065&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/observation/ObservationManagerImpl.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/observation/ObservationManagerImpl.java Thu Oct 18 11:41:45 2007
@@ -18,16 +18,13 @@
 
 import org.apache.jackrabbit.jcr2spi.nodetype.NodeTypeRegistry;
 import org.apache.jackrabbit.jcr2spi.WorkspaceManager;
-import org.apache.jackrabbit.name.MalformedPathException;
-import org.apache.jackrabbit.name.NameException;
-import org.apache.jackrabbit.name.NameFormat;
-import org.apache.jackrabbit.name.NamespaceResolver;
-import org.apache.jackrabbit.name.Path;
-import org.apache.jackrabbit.name.PathFormat;
-import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.spi.Path;
+import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.EventBundle;
 import org.apache.jackrabbit.spi.EventFilter;
 import org.apache.jackrabbit.util.IteratorHelper;
+import org.apache.jackrabbit.conversion.NamePathResolver;
+import org.apache.jackrabbit.conversion.NameException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -60,7 +57,7 @@
     /**
      * The session this observation manager belongs to.
      */
-    private final NamespaceResolver nsResolver;
+    private final NamePathResolver resolver;
 
     /**
      * The <code>NodeTypeRegistry</code> of the session.
@@ -86,13 +83,13 @@
     /**
      * Creates a new observation manager for <code>session</code>.
      * @param wspManager the WorkspaceManager.
-     * @param nsResolver NamespaceResolver to be used by this observation manager
-     * is based on.
+     * @param resolver
      * @param ntRegistry The <code>NodeTypeRegistry</code> of the session.
      */
-    public ObservationManagerImpl(WorkspaceManager wspManager, NamespaceResolver nsResolver, NodeTypeRegistry ntRegistry) {
+    public ObservationManagerImpl(WorkspaceManager wspManager, NamePathResolver resolver,
+                                  NodeTypeRegistry ntRegistry) {
         this.wspManager = wspManager;
-        this.nsResolver = nsResolver;
+        this.resolver = resolver;
         this.ntRegistry = ntRegistry;
     }
 
@@ -112,31 +109,31 @@
         }
         Path path;
         try {
-            path = PathFormat.parse(absPath, nsResolver).getCanonicalPath();
-        } catch (MalformedPathException e) {
+            path = resolver.getQPath(absPath).getCanonicalPath();
+        } catch (NameException e) {
             throw new RepositoryException("Malformed path: " + absPath);
         }
 
         // create NodeType instances from names
-        QName[] nodeTypeQNames;
+        Name[] qNodeTypeNames;
         if (nodeTypeNames == null) {
-            nodeTypeQNames = null;
+            qNodeTypeNames = null;
         } else {
             try {
-                nodeTypeQNames = new QName[nodeTypeNames.length];
+                qNodeTypeNames = new Name[nodeTypeNames.length];
                 for (int i = 0; i < nodeTypeNames.length; i++) {
-                    QName ntName = NameFormat.parse(nodeTypeNames[i], nsResolver);
+                    Name ntName = resolver.getQName(nodeTypeNames[i]);
                     if (!ntRegistry.isRegistered(ntName)) {
                         throw new RepositoryException("unknown node type: " + nodeTypeNames[i]);
                     }
-                    nodeTypeQNames[i] = ntName;
+                    qNodeTypeNames[i] = ntName;
                 }
             } catch (NameException e) {
                 throw new RepositoryException(e.getMessage());
             }
         }
 
-        EventFilter filter = wspManager.createEventFilter(eventTypes, path, isDeep, uuids, nodeTypeQNames, noLocal);
+        EventFilter filter = wspManager.createEventFilter(eventTypes, path, isDeep, uuids, qNodeTypeNames, noLocal);
         synchronized (subscriptions) {
             subscriptions.put(listener, filter);
             readOnlySubscriptions = null;
@@ -188,7 +185,7 @@
             Map.Entry entry = (Map.Entry) it.next();
             EventListener listener = (EventListener) entry.getKey();
             EventFilter filter = (EventFilter) entry.getValue();
-            FilteredEventIterator eventIter = new FilteredEventIterator(eventBundle, filter, nsResolver);
+            FilteredEventIterator eventIter = new FilteredEventIterator(eventBundle, filter, resolver);
             if (eventIter.hasNext()) {
                 try {
                     listener.onEvent(eventIter);

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/AbstractCopy.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/AbstractCopy.java?rev=586065&r1=586064&r2=586065&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/AbstractCopy.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/AbstractCopy.java Thu Oct 18 11:41:45 2007
@@ -20,8 +20,8 @@
 import org.apache.jackrabbit.jcr2spi.state.NodeState;
 import org.apache.jackrabbit.jcr2spi.ManagerProvider;
 import org.apache.jackrabbit.jcr2spi.util.LogUtil;
-import org.apache.jackrabbit.name.Path;
-import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.spi.Path;
+import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.NodeId;
 import org.slf4j.LoggerFactory;
 import org.slf4j.Logger;
@@ -38,7 +38,7 @@
 
     final NodeState destParentState;
     private final NodeState srcState;
-    private final QName destName;
+    private final Name destName;
     private final String srcWorkspaceName;
 
     /**
@@ -53,13 +53,13 @@
 
         ItemState srcItemState = srcMgrProvider.getHierarchyManager().getItemState(srcPath);
         if (!srcItemState.isNode()) {
-            throw new PathNotFoundException("Source path " + LogUtil.safeGetJCRPath(srcPath, srcMgrProvider.getNamespaceResolver()) + " is not a valid path.");
+            throw new PathNotFoundException("Source path " + LogUtil.safeGetJCRPath(srcPath, srcMgrProvider.getPathResolver()) + " is not a valid path.");
         }
         this.srcState = (NodeState)srcItemState;
-        this.destParentState = getNodeState(destPath.getAncestor(1), destMgrProvider.getHierarchyManager(), destMgrProvider.getNamespaceResolver());
+        this.destParentState = getNodeState(destPath.getAncestor(1), destMgrProvider.getHierarchyManager(), destMgrProvider.getNamePathResolver());
 
         // check for illegal index present in destination path
-        Path.PathElement destElement = destPath.getNameElement();
+        Path.Element destElement = destPath.getNameElement();
         int index = destElement.getIndex();
         if (index > Path.INDEX_UNDEFINED) {
             // subscript in name element
@@ -96,7 +96,7 @@
         return destParentState.getNodeId();
     }
 
-    public QName getDestinationName() {
+    public Name getDestinationName() {
         return destName;
     }
 }

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/AbstractOperation.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/AbstractOperation.java?rev=586065&r1=586064&r2=586065&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/AbstractOperation.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/AbstractOperation.java Thu Oct 18 11:41:45 2007
@@ -16,12 +16,12 @@
  */
 package org.apache.jackrabbit.jcr2spi.operation;
 
-import org.apache.jackrabbit.name.Path;
-import org.apache.jackrabbit.name.NamespaceResolver;
+import org.apache.jackrabbit.spi.Path;
 import org.apache.jackrabbit.jcr2spi.hierarchy.HierarchyManager;
 import org.apache.jackrabbit.jcr2spi.state.ItemState;
 import org.apache.jackrabbit.jcr2spi.state.NodeState;
 import org.apache.jackrabbit.jcr2spi.util.LogUtil;
+import org.apache.jackrabbit.conversion.PathResolver;
 
 import javax.jcr.PathNotFoundException;
 import javax.jcr.RepositoryException;
@@ -69,15 +69,15 @@
      * 
      * @param nodePath
      * @param hierMgr
-     * @param nsResolver
+     * @param resolver
      * @return
      * @throws PathNotFoundException
      * @throws RepositoryException
      */
-    protected static NodeState getNodeState(Path nodePath, HierarchyManager hierMgr, NamespaceResolver nsResolver) throws PathNotFoundException, RepositoryException {
+    protected static NodeState getNodeState(Path nodePath, HierarchyManager hierMgr, PathResolver resolver) throws PathNotFoundException, RepositoryException {
         ItemState itemState = hierMgr.getItemState(nodePath);
         if (!itemState.isNode()) {
-            throw new PathNotFoundException(LogUtil.safeGetJCRPath(nodePath, nsResolver));
+            throw new PathNotFoundException(LogUtil.safeGetJCRPath(nodePath, resolver));
         }
         return (NodeState) itemState;
     }

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/AddLabel.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/AddLabel.java?rev=586065&r1=586064&r2=586065&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/AddLabel.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/AddLabel.java Thu Oct 18 11:41:45 2007
@@ -18,11 +18,12 @@
 
 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.jcr2spi.state.NodeState;
 import org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry;
 import org.apache.jackrabbit.spi.NodeId;
+import org.apache.jackrabbit.name.NameConstants;
 
 import javax.jcr.RepositoryException;
 import javax.jcr.AccessDeniedException;
@@ -41,10 +42,10 @@
 
     private final NodeState versionHistoryState;
     private final NodeState versionState;
-    private final QName label;
+    private final Name label;
     private final boolean moveLabel;
 
-    private AddLabel(NodeState versionHistoryState, NodeState versionState, QName label, boolean moveLabel) {
+    private AddLabel(NodeState versionHistoryState, NodeState versionState, Name label, boolean moveLabel) {
         this.versionHistoryState = versionHistoryState;
         this.versionState = versionState;
         this.label = label;
@@ -78,7 +79,7 @@
     public void persisted() {
         try {
             NodeEntry vhEntry = (NodeEntry) versionHistoryState.getHierarchyEntry();
-            NodeEntry lnEntry = vhEntry.getNodeEntry(QName.JCR_VERSIONLABELS, Path.INDEX_DEFAULT);
+            NodeEntry lnEntry = vhEntry.getNodeEntry(NameConstants.JCR_VERSIONLABELS, Path.INDEX_DEFAULT);
             if (lnEntry != null) {
                 lnEntry.invalidate(moveLabel);
             }
@@ -95,7 +96,7 @@
         return versionState.getNodeEntry().getWorkspaceId();
     }
 
-    public QName getLabel() {
+    public Name getLabel() {
         return label;
     }
 
@@ -112,7 +113,7 @@
      * @param moveLabel
      * @return
      */
-    public static Operation create(NodeState versionHistoryState, NodeState versionState, QName label, boolean moveLabel) {
+    public static Operation create(NodeState versionHistoryState, NodeState versionState, Name label, boolean moveLabel) {
         return new AddLabel(versionHistoryState, versionState, label, moveLabel);
     }
 }

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/AddNode.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/AddNode.java?rev=586065&r1=586064&r2=586065&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/AddNode.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/AddNode.java Thu Oct 18 11:41:45 2007
@@ -17,7 +17,7 @@
 package org.apache.jackrabbit.jcr2spi.operation;
 
 import org.apache.jackrabbit.jcr2spi.state.NodeState;
-import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.NodeId;
 import org.slf4j.LoggerFactory;
 import org.slf4j.Logger;
@@ -40,11 +40,11 @@
 
     private final NodeId parentId;
     private final NodeState parentState;
-    private final QName nodeName;
-    private final QName nodeTypeName;
+    private final Name nodeName;
+    private final Name nodeTypeName;
     private final String uuid;
 
-    private AddNode(NodeState parentState, QName nodeName, QName nodeTypeName, String uuid) {
+    private AddNode(NodeState parentState, Name nodeName, Name nodeTypeName, String uuid) {
         this.parentId = parentState.getNodeId();
         this.parentState = parentState;
         this.nodeName = nodeName;
@@ -80,11 +80,11 @@
         return parentState;
     }
 
-    public QName getNodeName() {
+    public Name getNodeName() {
         return nodeName;
     }
 
-    public QName getNodeTypeName() {
+    public Name getNodeTypeName() {
         return nodeTypeName;
     }
 
@@ -94,8 +94,8 @@
 
     //------------------------------------------------------------< Factory >---
 
-    public static Operation create(NodeState parentState, QName nodeName,
-                                   QName nodeTypeName, String uuid) {
+    public static Operation create(NodeState parentState, Name nodeName,
+                                   Name nodeTypeName, String uuid) {
         AddNode an = new AddNode(parentState, nodeName, nodeTypeName, uuid);
         return an;
     }

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/AddProperty.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/AddProperty.java?rev=586065&r1=586064&r2=586065&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/AddProperty.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/AddProperty.java Thu Oct 18 11:41:45 2007
@@ -19,7 +19,7 @@
 import org.apache.jackrabbit.spi.QPropertyDefinition;
 import org.apache.jackrabbit.spi.QValue;
 import org.apache.jackrabbit.spi.NodeId;
-import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.jcr2spi.state.NodeState;
 
 import javax.jcr.RepositoryException;
@@ -38,13 +38,13 @@
 
     private final NodeId parentId;
     private final NodeState parentState;
-    private final QName propertyName;
+    private final Name propertyName;
     private final int propertyType;
     private final QValue[] values;
 
     private final QPropertyDefinition definition;
 
-    private AddProperty(NodeState parentState, QName propName, int propertyType, QValue[] values, QPropertyDefinition definition) {
+    private AddProperty(NodeState parentState, Name propName, int propertyType, QValue[] values, QPropertyDefinition definition) {
         this.parentId = parentState.getNodeId();
         this.parentState = parentState;
         this.propertyName = propName;
@@ -81,7 +81,7 @@
         return parentState;
     }
 
-    public QName getPropertyName() {
+    public Name getPropertyName() {
         return propertyName;
     }
 
@@ -111,7 +111,7 @@
      * @param values
      * @return
      */
-    public static Operation create(NodeState parentState, QName propName, int propertyType,
+    public static Operation create(NodeState parentState, Name propName, int propertyType,
                                    QPropertyDefinition def, QValue[] values) {
         AddProperty ap = new AddProperty(parentState, propName, propertyType, values, def);
         return ap;

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Clone.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Clone.java?rev=586065&r1=586064&r2=586065&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Clone.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Clone.java Thu Oct 18 11:41:45 2007
@@ -18,7 +18,7 @@
 
 import org.apache.jackrabbit.jcr2spi.ManagerProvider;
 import org.apache.jackrabbit.jcr2spi.hierarchy.HierarchyEntry;
-import org.apache.jackrabbit.name.Path;
+import org.apache.jackrabbit.spi.Path;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Copy.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Copy.java?rev=586065&r1=586064&r2=586065&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Copy.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Copy.java Thu Oct 18 11:41:45 2007
@@ -17,7 +17,7 @@
 package org.apache.jackrabbit.jcr2spi.operation;
 
 import org.apache.jackrabbit.jcr2spi.ManagerProvider;
-import org.apache.jackrabbit.name.Path;
+import org.apache.jackrabbit.spi.Path;
 
 import javax.jcr.RepositoryException;
 import javax.jcr.AccessDeniedException;

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Move.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Move.java?rev=586065&r1=586064&r2=586065&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Move.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Move.java Thu Oct 18 11:41:45 2007
@@ -20,11 +20,10 @@
 import org.apache.jackrabbit.jcr2spi.hierarchy.HierarchyManager;
 import org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry;
 import org.apache.jackrabbit.jcr2spi.state.NodeState;
-import org.apache.jackrabbit.name.Path;
-import org.apache.jackrabbit.name.QName;
-import org.apache.jackrabbit.name.MalformedPathException;
-import org.apache.jackrabbit.name.NamespaceResolver;
+import org.apache.jackrabbit.spi.Path;
+import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.NodeId;
+import org.apache.jackrabbit.conversion.PathResolver;
 import org.slf4j.LoggerFactory;
 import org.slf4j.Logger;
 
@@ -47,7 +46,7 @@
 
     private final NodeId srcId;
     private final NodeId destParentId;
-    private final QName destName;
+    private final Name destName;
 
     private final NodeState srcState;
     private final NodeState srcParentState;
@@ -55,7 +54,8 @@
 
     private final boolean sessionMove;
 
-    private Move(NodeState srcNodeState, NodeState srcParentState, NodeState destParentState, QName destName, boolean sessionMove) {
+    private Move(NodeState srcNodeState, NodeState srcParentState, NodeState destParentState, Name destName, boolean sessionMove) {
+
         this.srcId = (NodeId) srcNodeState.getId();
         this.destParentId = destParentState.getNodeId();
         this.destName = destName;
@@ -124,48 +124,42 @@
         return destParentState;
     }
 
-    public QName getDestinationName() {
+    public Name getDestinationName() {
         return destName;
     }
 
     //------------------------------------------------------------< Factory >---
     public static Operation create(Path srcPath, Path destPath,
                                    HierarchyManager hierMgr,
-                                   NamespaceResolver nsResolver,
-                                   boolean sessionMove)
+                                                    PathResolver resolver,
+                                                    boolean sessionMove)
         throws ItemExistsException, NoSuchNodeTypeException, RepositoryException {
         // src must not be ancestor of destination
-        try {
-            if (srcPath.isAncestorOf(destPath)) {
-                String msg = "Invalid destination path: cannot be descendant of source path (" + LogUtil.safeGetJCRPath(destPath, nsResolver) + "," + LogUtil.safeGetJCRPath(srcPath, nsResolver) + ")";
-                log.debug(msg);
-                throw new RepositoryException(msg);
-            }
-        } catch (MalformedPathException e) {
-            String msg = "Invalid destination path: cannot be descendant of source path (" +LogUtil.safeGetJCRPath(destPath, nsResolver) + "," + LogUtil.safeGetJCRPath(srcPath, nsResolver) + ")";
+        if (srcPath.isAncestorOf(destPath)) {
+            String msg = "Invalid destination path: cannot be descendant of source path (" + LogUtil.safeGetJCRPath(destPath, resolver) + "," + LogUtil.safeGetJCRPath(srcPath, resolver) + ")";
             log.debug(msg);
-            throw new RepositoryException(msg, e);
+            throw new RepositoryException(msg);
         }
-        Path.PathElement destElement = destPath.getNameElement();
+        Path.Element destElement = destPath.getNameElement();
         // destination must not contain an index
         int index = destElement.getIndex();
         if (index > Path.INDEX_UNDEFINED) {
             // subscript in name element
-            String msg = "Invalid destination path: subscript in name element is not allowed (" + LogUtil.safeGetJCRPath(destPath, nsResolver) + ")";
+            String msg = "Invalid destination path: subscript in name element is not allowed (" + LogUtil.safeGetJCRPath(destPath, resolver) + ")";
             log.debug(msg);
             throw new RepositoryException(msg);
         }
         // root node cannot be moved:
-        if (Path.ROOT.equals(srcPath) || Path.ROOT.equals(destPath)) {
+        if (srcPath.denotesRoot() || destPath.denotesRoot()) {
             String msg = "Cannot move the root node.";
             log.debug(msg);
             throw new RepositoryException(msg);
         }
 
-        NodeState srcState = getNodeState(srcPath, hierMgr, nsResolver);
-        NodeState srcParentState = getNodeState(srcPath.getAncestor(1), hierMgr, nsResolver);
-        NodeState destParentState = getNodeState(destPath.getAncestor(1), hierMgr, nsResolver);
-        QName destName = destElement.getName();
+        NodeState srcState = getNodeState(srcPath, hierMgr, resolver);
+        NodeState srcParentState = getNodeState(srcPath.getAncestor(1), hierMgr, resolver);
+        NodeState destParentState = getNodeState(destPath.getAncestor(1), hierMgr, resolver);
+        Name destName = destElement.getName();
 
         // for session-move perform a lazy check for existing items at destination.
         // since the hierarchy may not be complete it is possible that an conflict

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/RemoveLabel.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/RemoveLabel.java?rev=586065&r1=586064&r2=586065&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/RemoveLabel.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/RemoveLabel.java Thu Oct 18 11:41:45 2007
@@ -18,11 +18,12 @@
 
 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.jcr2spi.state.NodeState;
 import org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry;
 import org.apache.jackrabbit.spi.NodeId;
+import org.apache.jackrabbit.name.NameConstants;
 
 import javax.jcr.RepositoryException;
 import javax.jcr.AccessDeniedException;
@@ -41,9 +42,9 @@
 
     private final NodeState versionHistoryState;
     private final NodeState versionState;
-    private final QName label;
+    private final Name label;
 
-    private RemoveLabel(NodeState versionHistoryState, NodeState versionState, QName label) {
+    private RemoveLabel(NodeState versionHistoryState, NodeState versionState, Name label) {
         this.versionHistoryState = versionHistoryState;
         this.versionState = versionState;
         this.label = label;
@@ -75,7 +76,7 @@
     public void persisted() {
         try {
             NodeEntry vhEntry = (NodeEntry) versionHistoryState.getHierarchyEntry();
-            NodeEntry lnEntry = vhEntry.getNodeEntry(QName.JCR_VERSIONLABELS, Path.INDEX_DEFAULT);
+            NodeEntry lnEntry = vhEntry.getNodeEntry(NameConstants.JCR_VERSIONLABELS, Path.INDEX_DEFAULT);
             if (lnEntry != null) {
                 lnEntry.invalidate(true);
             }
@@ -93,7 +94,7 @@
         return versionState.getNodeEntry().getWorkspaceId();
     }
 
-    public QName getLabel() {
+    public Name getLabel() {
         return label;
     }
 
@@ -105,7 +106,7 @@
      * @param label
      * @return
      */
-    public static Operation create(NodeState versionHistoryState, NodeState versionState, QName label) {
+    public static Operation create(NodeState versionHistoryState, NodeState versionState, Name label) {
         return new RemoveLabel(versionHistoryState, versionState, label);
     }
 }

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/ReorderNodes.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/ReorderNodes.java?rev=586065&r1=586064&r2=586065&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/ReorderNodes.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/ReorderNodes.java Thu Oct 18 11:41:45 2007
@@ -17,7 +17,7 @@
 package org.apache.jackrabbit.jcr2spi.operation;
 
 import org.apache.jackrabbit.jcr2spi.state.NodeState;
-import org.apache.jackrabbit.name.Path;
+import org.apache.jackrabbit.spi.Path;
 import org.apache.jackrabbit.spi.NodeId;
 
 import javax.jcr.nodetype.ConstraintViolationException;
@@ -97,8 +97,8 @@
 
     //------------------------------------------------------------< Factory >---
 
-    public static Operation create(NodeState parentState, Path.PathElement srcName,
-                                   Path.PathElement beforeName) throws ItemNotFoundException, RepositoryException {
+    public static Operation create(NodeState parentState, Path.Element srcName,
+                                   Path.Element beforeName) throws ItemNotFoundException, RepositoryException {
         NodeState insert = parentState.getChildNodeState(srcName.getName(), srcName.getNormalizedIndex());
         NodeState before = (beforeName == null) ? null : parentState.getChildNodeState(beforeName.getName(), beforeName.getNormalizedIndex());
         return new ReorderNodes(parentState, insert, before);

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Restore.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Restore.java?rev=586065&r1=586064&r2=586065&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Restore.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Restore.java Thu Oct 18 11:41:45 2007
@@ -18,7 +18,7 @@
 
 import org.apache.jackrabbit.jcr2spi.state.NodeState;
 import org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry;
-import org.apache.jackrabbit.name.Path;
+import org.apache.jackrabbit.spi.Path;
 import org.apache.jackrabbit.spi.NodeId;
 
 import javax.jcr.RepositoryException;

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/SetMixin.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/SetMixin.java?rev=586065&r1=586064&r2=586065&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/SetMixin.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/SetMixin.java Thu Oct 18 11:41:45 2007
@@ -16,9 +16,10 @@
  */
 package org.apache.jackrabbit.jcr2spi.operation;
 
-import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.jcr2spi.state.NodeState;
 import org.apache.jackrabbit.spi.NodeId;
+import org.apache.jackrabbit.name.NameConstants;
 
 import javax.jcr.RepositoryException;
 import javax.jcr.AccessDeniedException;
@@ -33,9 +34,9 @@
 
     private final NodeId nodeId;
     private final NodeState nodeState;
-    private final QName[] mixinNames;
+    private final Name[] mixinNames;
 
-    private SetMixin(NodeState nodeState, QName[] mixinNames) {
+    private SetMixin(NodeState nodeState, Name[] mixinNames) {
         this.nodeState = nodeState;
         this.nodeId = nodeState.getNodeId();
         this.mixinNames = mixinNames;
@@ -45,7 +46,7 @@
         // add the jcr:mixinTypes property state as affected if it already exists
         // and therefore gets modified by this operation.
         try {
-            addAffectedItemState(nodeState.getPropertyState(QName.JCR_MIXINTYPES));
+            addAffectedItemState(nodeState.getPropertyState(NameConstants.JCR_MIXINTYPES));
         } catch (RepositoryException e) {
             // jcr:mixinTypes does not exist -> ignore
         }
@@ -79,13 +80,13 @@
         return nodeId;
     }
     
-    public QName[] getMixinNames() {
+    public Name[] getMixinNames() {
         return mixinNames;
     }
 
     //------------------------------------------------------------< Factory >---
 
-    public static Operation create(NodeState nodeState, QName[] mixinNames) {
+    public static Operation create(NodeState nodeState, Name[] mixinNames) {
         SetMixin sm = new SetMixin(nodeState, mixinNames);
         return sm;
     }

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/QueryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/QueryImpl.java?rev=586065&r1=586064&r2=586065&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/QueryImpl.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/QueryImpl.java Thu Oct 18 11:41:45 2007
@@ -20,13 +20,10 @@
 import org.apache.jackrabbit.jcr2spi.WorkspaceManager;
 import org.apache.jackrabbit.jcr2spi.hierarchy.HierarchyManager;
 import org.apache.jackrabbit.jcr2spi.name.LocalNamespaceMappings;
-import org.apache.jackrabbit.name.MalformedPathException;
-import org.apache.jackrabbit.name.NoPrefixDeclaredException;
-import org.apache.jackrabbit.name.Path;
-import org.apache.jackrabbit.name.PathFormat;
-import org.apache.jackrabbit.name.QName;
-import org.apache.jackrabbit.name.NameFormat;
+import org.apache.jackrabbit.spi.Path;
+import org.apache.jackrabbit.name.NameConstants;
 import org.apache.jackrabbit.spi.QueryInfo;
+import org.apache.jackrabbit.conversion.NamePathResolver;
 
 import javax.jcr.ItemExistsException;
 import javax.jcr.ItemNotFoundException;
@@ -58,6 +55,11 @@
     private final LocalNamespaceMappings nsResolver;
 
     /**
+     * Name and Path resolver
+     */
+    private final NamePathResolver resolver;
+
+    /**
      * The item manager of the session that executes this query.
      */
     private final ItemManager itemManager;
@@ -93,6 +95,7 @@
      *
      * @param session          the session that created this query.
      * @param nsResolver       the namespace resolver to be used.
+     * @param resolver
      * @param itemMgr          the item manager of that session.
      * @param hierarchyManager the HierarchyManager of that session.
      * @param wspManager       the workspace manager that belongs to the
@@ -101,12 +104,13 @@
      * @param language         the language of the query statement.
      * @throws InvalidQueryException if the query is invalid.
      */
-    public QueryImpl(Session session, LocalNamespaceMappings nsResolver,
+    public QueryImpl(Session session, LocalNamespaceMappings nsResolver, NamePathResolver resolver,
                      ItemManager itemMgr, HierarchyManager hierarchyManager,
                      WorkspaceManager wspManager,
                      String statement, String language)
             throws InvalidQueryException, RepositoryException {
         this.session = session;
+        this.resolver = resolver;
         this.nsResolver = nsResolver;
         this.itemManager = itemMgr;
         this.hierarchyManager = hierarchyManager;
@@ -121,6 +125,7 @@
      *
      * @param session    the session that created this query.
      * @param nsResolver the namespace resolver to be used.
+     * @param resolver
      * @param itemMgr    the item manager of that session.
      * @param hierarchyManager
      * @param wspManager the workspace manager that belongs to the session.
@@ -129,32 +134,29 @@
      * @throws RepositoryException   if another error occurs while reading from
      *                               the node.
      */
-    public QueryImpl(Session session, LocalNamespaceMappings nsResolver,
+    public QueryImpl(Session session, LocalNamespaceMappings nsResolver, NamePathResolver resolver,
                      ItemManager itemMgr, HierarchyManager hierarchyManager,
                      WorkspaceManager wspManager, Node node)
         throws InvalidQueryException, RepositoryException {
 
         this.session = session;
+        this.resolver = resolver;
         this.nsResolver = nsResolver;
         this.itemManager = itemMgr;
         this.hierarchyManager = hierarchyManager;
         this.node = node;
         this.wspManager = wspManager;
 
-        try {
-            if (!node.isNodeType(NameFormat.format(QName.NT_QUERY, nsResolver))) {
-                throw new InvalidQueryException("Node is not of type nt:query");
-            }
-            if (node.getSession() != session) {
-                throw new InvalidQueryException("Node belongs to a different session.");
-            }
-            statement = node.getProperty(NameFormat.format(QName.JCR_STATEMENT, nsResolver)).getString();
-            language = node.getProperty(NameFormat.format(QName.JCR_LANGUAGE, nsResolver)).getString();
-            this.wspManager.checkQueryStatement(statement, language,
-                    nsResolver.getLocalNamespaceMappings());
-        } catch (NoPrefixDeclaredException e) {
-            throw new RepositoryException(e.getMessage(), e);
+        if (!node.isNodeType(resolver.getJCRName(NameConstants.NT_QUERY))) {
+            throw new InvalidQueryException("Node is not of type nt:query");
         }
+        if (node.getSession() != session) {
+            throw new InvalidQueryException("Node belongs to a different session.");
+        }
+        statement = node.getProperty(resolver.getJCRName(NameConstants.JCR_STATEMENT)).getString();
+        language = node.getProperty(resolver.getJCRName(NameConstants.JCR_LANGUAGE)).getString();
+        this.wspManager.checkQueryStatement(statement, language,
+                    nsResolver.getLocalNamespaceMappings());
     }
 
     /**
@@ -164,7 +166,7 @@
         QueryInfo qI = wspManager.executeQuery(statement, language,
                 nsResolver.getLocalNamespaceMappings());
         return new QueryResultImpl(itemManager, hierarchyManager,
-                qI, nsResolver, session.getValueFactory());
+                qI, resolver, session.getValueFactory());
     }
 
     /**
@@ -199,25 +201,23 @@
         LockException, UnsupportedRepositoryOperationException, RepositoryException {
 
         try {
-            Path p = PathFormat.parse(absPath, nsResolver).getNormalizedPath();
+            Path p = resolver.getQPath(absPath).getNormalizedPath();
             if (!p.isAbsolute()) {
                 throw new RepositoryException(absPath + " is not an absolute path");
             }
-            String jcrParent = PathFormat.format(p.getAncestor(1), nsResolver);
+            String jcrParent = resolver.getJCRPath(p.getAncestor(1));
             if (!session.itemExists(jcrParent)) {
                 throw new PathNotFoundException(jcrParent);
             }
-            String relPath = PathFormat.format(p, nsResolver).substring(1);
-            String ntName = NameFormat.format(QName.NT_QUERY, nsResolver);
+            String relPath = resolver.getJCRPath(p).substring(1);
+            String ntName = resolver.getJCRName(NameConstants.NT_QUERY);
             Node queryNode = session.getRootNode().addNode(relPath, ntName);
             // set properties
-            queryNode.setProperty(NameFormat.format(QName.JCR_LANGUAGE, nsResolver), language);
-            queryNode.setProperty(NameFormat.format(QName.JCR_STATEMENT, nsResolver), statement);
+            queryNode.setProperty(resolver.getJCRName(NameConstants.JCR_LANGUAGE), language);
+            queryNode.setProperty(resolver.getJCRName(NameConstants.JCR_STATEMENT), statement);
             node = queryNode;
             return node;
-        } catch (MalformedPathException e) {
-            throw new RepositoryException(e.getMessage(), e);
-        } catch (NoPrefixDeclaredException e) {
+        } catch (org.apache.jackrabbit.conversion.NameException e) {
             throw new RepositoryException(e.getMessage(), e);
         }
     }

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/QueryManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/QueryManagerImpl.java?rev=586065&r1=586064&r2=586065&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/QueryManagerImpl.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/QueryManagerImpl.java Thu Oct 18 11:41:45 2007
@@ -20,6 +20,7 @@
 import org.apache.jackrabbit.jcr2spi.WorkspaceManager;
 import org.apache.jackrabbit.jcr2spi.hierarchy.HierarchyManager;
 import org.apache.jackrabbit.jcr2spi.name.LocalNamespaceMappings;
+import org.apache.jackrabbit.conversion.NamePathResolver;
 
 import javax.jcr.Node;
 import javax.jcr.RepositoryException;
@@ -44,6 +45,11 @@
     private final LocalNamespaceMappings nsResolver;
 
     /**
+     * Name and Path resolver
+     */
+    private final NamePathResolver resolver;
+
+    /**
      * The <code>ItemManager</code> of for item retrieval in search results
      */
     private final ItemManager itemMgr;
@@ -70,11 +76,13 @@
      */
     public QueryManagerImpl(Session session,
                             LocalNamespaceMappings nsResolver,
+                            NamePathResolver resolver,
                             ItemManager itemMgr,
                             HierarchyManager hierarchyManager,
                             WorkspaceManager wspManager) {
         this.session = session;
         this.nsResolver = nsResolver;
+        this.resolver = resolver;
         this.itemMgr = itemMgr;
         this.hierarchyManager = hierarchyManager;
         this.wspManager = wspManager;
@@ -86,7 +94,7 @@
     public Query createQuery(String statement, String language)
             throws InvalidQueryException, RepositoryException {
         checkIsAlive();
-        QueryImpl query = new QueryImpl(session, nsResolver, itemMgr, hierarchyManager, wspManager, statement, language);
+        QueryImpl query = new QueryImpl(session, nsResolver, resolver, itemMgr, hierarchyManager, wspManager, statement, language);
         return query;
     }
 
@@ -96,7 +104,7 @@
     public Query getQuery(Node node)
             throws InvalidQueryException, RepositoryException {
         checkIsAlive();
-        QueryImpl query = new QueryImpl(session, nsResolver, itemMgr, hierarchyManager, wspManager, node);
+        QueryImpl query = new QueryImpl(session, nsResolver, resolver, itemMgr, hierarchyManager, wspManager, node);
         return query;
     }
 

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/QueryResultImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/QueryResultImpl.java?rev=586065&r1=586064&r2=586065&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/QueryResultImpl.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/QueryResultImpl.java Thu Oct 18 11:41:45 2007
@@ -18,11 +18,9 @@
 
 import org.apache.jackrabbit.jcr2spi.ItemManager;
 import org.apache.jackrabbit.jcr2spi.hierarchy.HierarchyManager;
-import org.apache.jackrabbit.name.NamespaceResolver;
-import org.apache.jackrabbit.name.NoPrefixDeclaredException;
-import org.apache.jackrabbit.name.QName;
-import org.apache.jackrabbit.name.NameFormat;
+import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.QueryInfo;
+import org.apache.jackrabbit.conversion.NamePathResolver;
 import org.slf4j.LoggerFactory;
 import org.slf4j.Logger;
 
@@ -58,9 +56,9 @@
     private final QueryInfo queryInfo;
 
     /**
-     * The namespace nsResolver of the session executing the query
+     * The namespace nameResolver of the session executing the query
      */
-    private final NamespaceResolver nsResolver;
+    private final NamePathResolver resolver;
 
     /**
      * The JCR value factory.
@@ -74,17 +72,16 @@
      * @param hierarchyMgr the HierarchyManager of the session executing the
      *                     query.
      * @param queryInfo    the spi query result.
-     * @param nsResolver   the namespace nsResolver of the session executing the
-     *                     query.
+     * @param resolver
      * @param valueFactory the JCR value factory.
      */
     QueryResultImpl(ItemManager itemMgr, HierarchyManager hierarchyMgr,
-                    QueryInfo queryInfo, NamespaceResolver nsResolver,
+                    QueryInfo queryInfo, NamePathResolver resolver,
                     ValueFactory valueFactory) {
         this.itemMgr = itemMgr;
         this.hierarchyMgr = hierarchyMgr;
         this.queryInfo = queryInfo;
-        this.nsResolver = nsResolver;
+        this.resolver = resolver;
         this.valueFactory = valueFactory;
     }
 
@@ -92,19 +89,12 @@
      * {@inheritDoc}
      */
     public String[] getColumnNames() throws RepositoryException {
-        try {
-            QName[] names = queryInfo.getColumnNames();
-            String[] propNames = new String[names.length];
-            for (int i = 0; i < names.length; i++) {
-                propNames[i] = NameFormat.format(names[i], nsResolver);
-            }
-            return propNames;
-        } catch (NoPrefixDeclaredException npde) {
-            String msg = "encountered invalid property name";
-            log.debug(msg);
-            throw new RepositoryException(msg, npde);
-
+        Name[] names = queryInfo.getColumnNames();
+        String[] propNames = new String[names.length];
+        for (int i = 0; i < names.length; i++) {
+            propNames[i] = resolver.getJCRName(names[i]);
         }
+        return propNames;
     }
 
     /**
@@ -118,7 +108,7 @@
      * {@inheritDoc}
      */
     public RowIterator getRows() throws RepositoryException {
-        return new RowIteratorImpl(queryInfo, nsResolver, valueFactory);
+        return new RowIteratorImpl(queryInfo, resolver, valueFactory);
     }
 
     /**



Mime
View raw message