jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r590014 [4/11] - in /jackrabbit/trunk: jackrabbit-core/ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/jou...
Date Tue, 30 Oct 2007 10:02:57 GMT
Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeManagerImpl.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeManagerImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeManagerImpl.java Tue Oct 30 03:02:41 2007
@@ -17,13 +17,12 @@
 package org.apache.jackrabbit.core.nodetype;
 
 import org.apache.commons.collections.map.ReferenceMap;
-import org.apache.jackrabbit.name.NameException;
-import org.apache.jackrabbit.name.NamespaceResolver;
-import org.apache.jackrabbit.name.QName;
-import org.apache.jackrabbit.name.NameFormat;
-import org.apache.jackrabbit.name.UnknownPrefixException;
+import org.apache.jackrabbit.conversion.NameException;
+import org.apache.jackrabbit.spi.Name;
+import org.apache.jackrabbit.conversion.NamePathResolver;
 import org.apache.jackrabbit.util.IteratorHelper;
-import org.apache.jackrabbit.util.name.NamespaceMapping;
+import org.apache.jackrabbit.namespace.NamespaceMapping;
+import org.apache.jackrabbit.namespace.NamespaceResolver;
 import org.apache.jackrabbit.api.JackrabbitNodeTypeManager;
 import org.apache.jackrabbit.core.NamespaceRegistryImpl;
 import org.apache.jackrabbit.core.data.DataStore;
@@ -36,6 +35,7 @@
 
 import javax.jcr.RepositoryException;
 import javax.jcr.UnsupportedRepositoryOperationException;
+import javax.jcr.NamespaceException;
 import javax.jcr.nodetype.NoSuchNodeTypeException;
 import javax.jcr.nodetype.NodeType;
 import javax.jcr.nodetype.NodeTypeIterator;
@@ -81,11 +81,16 @@
     private final NodeDefinitionImpl rootNodeDef;
 
     /**
-     * The namespace resolver used to translate qualified names to JCR names.
+     * The namespace resolver
      */
     private final NamespaceResolver nsResolver;
 
     /**
+     * The resolver used to translate qualified names to JCR names.
+     */
+    private final NamePathResolver resolver;
+
+    /**
      * A cache for <code>NodeType</code> instances created by this
      * <code>NodeTypeManager</code>
      */
@@ -110,12 +115,13 @@
      *
      * @param ntReg      node type registry
      * @param nsReg      namespace registry
-     * @param nsResolver namespace resolver
+     * @param resolver
      */
     public NodeTypeManagerImpl(
             NodeTypeRegistry ntReg, NamespaceRegistryImpl nsReg,
-            NamespaceResolver nsResolver, DataStore store) {
+            NamespaceResolver nsResolver, NamePathResolver resolver, DataStore store) {
         this.nsResolver = nsResolver;
+        this.resolver = resolver;
         this.ntReg = ntReg;
         this.nsReg = nsReg;
         this.ntReg.addListener(this);
@@ -128,7 +134,7 @@
         ndCache = new ReferenceMap(ReferenceMap.HARD, ReferenceMap.SOFT);
 
         rootNodeDef = new NodeDefinitionImpl(ntReg.getRootNodeDef(), this,
-                nsResolver);
+                resolver);
         ndCache.put(rootNodeDef.unwrap().getId(), rootNodeDef);
     }
 
@@ -149,7 +155,7 @@
             if (ndi == null) {
                 NodeDef nd = ntReg.getNodeDef(id);
                 if (nd != null) {
-                    ndi = new NodeDefinitionImpl(nd, this, nsResolver);
+                    ndi = new NodeDefinitionImpl(nd, this, resolver);
                     ndCache.put(id, ndi);
                 }
             }
@@ -167,7 +173,7 @@
             if (pdi == null) {
                 PropDef pd = ntReg.getPropDef(id);
                 if (pd != null) {
-                    pdi = new PropertyDefinitionImpl(pd, this, nsResolver);
+                    pdi = new PropertyDefinitionImpl(pd, this, resolver);
                     pdCache.put(id, pdi);
                 }
             }
@@ -180,13 +186,13 @@
      * @return
      * @throws NoSuchNodeTypeException
      */
-    public NodeTypeImpl getNodeType(QName name) throws NoSuchNodeTypeException {
+    public NodeTypeImpl getNodeType(Name name) throws NoSuchNodeTypeException {
         synchronized (ntCache) {
             NodeTypeImpl nt = (NodeTypeImpl) ntCache.get(name);
             if (nt == null) {
                 EffectiveNodeType ent = ntReg.getEffectiveNodeType(name);
                 NodeTypeDef def = ntReg.getNodeTypeDef(name);
-                nt = new NodeTypeImpl(ent, def, this, nsResolver, store);
+                nt = new NodeTypeImpl(ent, def, this, resolver, store);
                 ntCache.put(name, nt);
             }
             return nt;
@@ -307,14 +313,14 @@
     /**
      * {@inheritDoc}
      */
-    public void nodeTypeRegistered(QName ntName) {
+    public void nodeTypeRegistered(Name ntName) {
         // not interested, ignore
     }
 
     /**
      * {@inheritDoc}
      */
-    public void nodeTypeReRegistered(QName ntName) {
+    public void nodeTypeReRegistered(Name ntName) {
         // flush all affected cache entries
         ntCache.remove(ntName);
         synchronized (pdCache) {
@@ -340,7 +346,7 @@
     /**
      * {@inheritDoc}
      */
-    public void nodeTypeUnregistered(QName ntName) {
+    public void nodeTypeUnregistered(Name ntName) {
         // flush all affected cache entries
         ntCache.remove(ntName);
         synchronized (pdCache) {
@@ -368,7 +374,7 @@
      * {@inheritDoc}
      */
     public NodeTypeIterator getAllNodeTypes() throws RepositoryException {
-        QName[] ntNames = ntReg.getRegisteredNodeTypes();
+        Name[] ntNames = ntReg.getRegisteredNodeTypes();
         ArrayList list = new ArrayList(ntNames.length);
         for (int i = 0; i < ntNames.length; i++) {
             list.add(getNodeType(ntNames[i]));
@@ -380,7 +386,7 @@
      * {@inheritDoc}
      */
     public NodeTypeIterator getPrimaryNodeTypes() throws RepositoryException {
-        QName[] ntNames = ntReg.getRegisteredNodeTypes();
+        Name[] ntNames = ntReg.getRegisteredNodeTypes();
         ArrayList list = new ArrayList(ntNames.length);
         for (int i = 0; i < ntNames.length; i++) {
             NodeType nt = getNodeType(ntNames[i]);
@@ -395,7 +401,7 @@
      * {@inheritDoc}
      */
     public NodeTypeIterator getMixinNodeTypes() throws RepositoryException {
-        QName[] ntNames = ntReg.getRegisteredNodeTypes();
+        Name[] ntNames = ntReg.getRegisteredNodeTypes();
         ArrayList list = new ArrayList(ntNames.length);
         for (int i = 0; i < ntNames.length; i++) {
             NodeType nt = getNodeType(ntNames[i]);
@@ -412,9 +418,11 @@
     public NodeType getNodeType(String nodeTypeName)
             throws NoSuchNodeTypeException {
         try {
-            return getNodeType(NameFormat.parse(nodeTypeName, nsResolver));
+            return getNodeType(resolver.getQName(nodeTypeName));
         } catch (NameException e) {
             throw new NoSuchNodeTypeException(nodeTypeName, e);
+        } catch (NamespaceException e) {
+            throw new NoSuchNodeTypeException(nodeTypeName, e);
         }
     }
 
@@ -490,9 +498,9 @@
      */
     public boolean hasNodeType(String name) throws RepositoryException {
         try {
-            QName qname = NameFormat.parse(name, nsResolver);
+            Name qname = resolver.getQName(name);
             return getNodeTypeRegistry().isRegistered(qname);
-        } catch (UnknownPrefixException e) {
+        } catch (NamespaceException e) {
             return false;
         } catch (NameException e) {
            throw new RepositoryException("Invalid name: " + name, e);

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java Tue Oct 30 03:02:41 2007
@@ -25,7 +25,8 @@
 import org.apache.jackrabbit.core.fs.FileSystemResource;
 import org.apache.jackrabbit.core.util.Dumpable;
 import org.apache.jackrabbit.core.value.InternalValue;
-import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.spi.Name;
+import org.apache.jackrabbit.name.NameConstants;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -126,8 +127,8 @@
      *
      * @return the names of all registered node types.
      */
-    public QName[] getRegisteredNodeTypes() {
-        return (QName[]) registeredNTDefs.keySet().toArray(new QName[registeredNTDefs.size()]);
+    public Name[] getRegisteredNodeTypes() {
+        return (Name[]) registeredNTDefs.keySet().toArray(new Name[registeredNTDefs.size()]);
     }
 
     /**
@@ -239,18 +240,18 @@
     }
 
     /**
-     * Same as <code>{@link #unregisterNodeType(QName)}</code> except
+     * Same as <code>{@link #unregisterNodeType(Name)}</code> except
      * that a set of node types is unregistered instead of just one.
      * <p/>
      * This method can be used to unregister a set of node types that depend on
      * each other.
      *
-     * @param ntNames a collection of <code>QName</code> objects denoting the
+     * @param ntNames a collection of <code>Name</code> objects denoting the
      *                node types to be unregistered
      * @throws NoSuchNodeTypeException if any of the specified names does not
      *                                 denote a registered node type.
      * @throws RepositoryException if another error occurs
-     * @see #unregisterNodeType(QName)
+     * @see #unregisterNodeType(Name)
      */
     public void unregisterNodeTypes(Collection ntNames)
             throws NoSuchNodeTypeException, RepositoryException {
@@ -261,7 +262,7 @@
     /**
      * Internal implementation of {@link #unregisterNodeTypes(Collection)}
      *
-     * @param ntNames a collection of <code>QName</code> objects denoting the
+     * @param ntNames a collection of <code>Name</code> objects denoting the
      *                node types to be unregistered
      * @param external whether this invocation should be considered external
      * @throws NoSuchNodeTypeException if any of the specified names does not
@@ -273,7 +274,7 @@
 
         // do some preliminary checks
         for (Iterator iter = ntNames.iterator(); iter.hasNext();) {
-            QName ntName = (QName) iter.next();
+            Name ntName = (Name) iter.next();
             if (!registeredNTDefs.containsKey(ntName)) {
                 throw new NoSuchNodeTypeException(ntName.toString());
             }
@@ -298,7 +299,7 @@
 
         // make sure node types are not currently in use
         for (Iterator iter = ntNames.iterator(); iter.hasNext();) {
-            QName ntName = (QName) iter.next();
+            Name ntName = (Name) iter.next();
             checkForReferencesInContent(ntName);
         }
 
@@ -312,7 +313,7 @@
 
         // persist removal of node type definitions & notify listeners
         for (Iterator iter = ntNames.iterator(); iter.hasNext();) {
-            QName ntName = (QName) iter.next();
+            Name ntName = (Name) iter.next();
             customNTDefs.remove(ntName);
             notifyUnregistered(ntName);
         }
@@ -336,7 +337,7 @@
      * @throws RepositoryException if another error occurs.
      * @see #unregisterNodeTypes(Collection)
      */
-    public void unregisterNodeType(QName ntName)
+    public void unregisterNodeType(Name ntName)
             throws NoSuchNodeTypeException, RepositoryException {
         HashSet ntNames = new HashSet();
         ntNames.add(ntName);
@@ -377,7 +378,7 @@
             throws NoSuchNodeTypeException, InvalidNodeTypeDefException,
             RepositoryException {
 
-        QName name = ntd.getName();
+        Name name = ntd.getName();
         if (!registeredNTDefs.containsKey(name)) {
             throw new NoSuchNodeTypeException(name.toString());
         }
@@ -461,7 +462,7 @@
      * @return
      * @throws NoSuchNodeTypeException
      */
-    public EffectiveNodeType getEffectiveNodeType(QName ntName)
+    public EffectiveNodeType getEffectiveNodeType(Name ntName)
             throws NoSuchNodeTypeException {
         return getEffectiveNodeType(ntName, entCache, registeredNTDefs);
     }
@@ -472,7 +473,7 @@
      * @throws NodeTypeConflictException
      * @throws NoSuchNodeTypeException
      */
-    public EffectiveNodeType getEffectiveNodeType(QName[] ntNames)
+    public EffectiveNodeType getEffectiveNodeType(Name[] ntNames)
             throws NodeTypeConflictException, NoSuchNodeTypeException {
         return getEffectiveNodeType(ntNames, entCache, registeredNTDefs);
     }
@@ -482,10 +483,10 @@
      * dependencies on the given node type.
      *
      * @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
      */
-    public Set getDependentNodeTypes(QName nodeTypeName)
+    public Set getDependentNodeTypes(Name nodeTypeName)
             throws NoSuchNodeTypeException {
         if (!registeredNTDefs.containsKey(nodeTypeName)) {
             throw new NoSuchNodeTypeException(nodeTypeName.toString());
@@ -514,7 +515,7 @@
      * @throws NoSuchNodeTypeException if a node type with the given name
      *                                 does not exist
      */
-    public NodeTypeDef getNodeTypeDef(QName nodeTypeName)
+    public NodeTypeDef getNodeTypeDef(Name nodeTypeName)
             throws NoSuchNodeTypeException {
         NodeTypeDef def = (NodeTypeDef) registeredNTDefs.get(nodeTypeName);
         if (def == null) {
@@ -529,7 +530,7 @@
      * @return <code>true</code> if the specified node type is registered;
      *         <code>false</code> otherwise.
      */
-    public boolean isRegistered(QName nodeTypeName) {
+    public boolean isRegistered(Name nodeTypeName) {
         return registeredNTDefs.containsKey(nodeTypeName);
     }
 
@@ -538,7 +539,7 @@
      * @return <code>true</code> if the specified node type is built-in;
      *         <code>false</code> otherwise.
      */
-    public boolean isBuiltIn(QName nodeTypeName) {
+    public boolean isBuiltIn(Name nodeTypeName) {
         return builtInNTDefs.contains(nodeTypeName);
     }
 
@@ -592,7 +593,7 @@
         while (iter.hasNext()) {
             NodeTypeDef ntd = (NodeTypeDef) iter.next();
             ps.println(ntd.getName());
-            QName[] supertypes = ntd.getSupertypes();
+            Name[] supertypes = ntd.getSupertypes();
             ps.println("\tSupertypes");
             for (int i = 0; i < supertypes.length; i++) {
                 ps.println("\t\t" + supertypes[i]);
@@ -644,13 +645,13 @@
                 ps.print("\tNodeDefinition");
                 ps.println(" (declared in " + nd[i].getDeclaringNodeType() + ") id=" + nd[i].getId());
                 ps.println("\t\tName\t\t" + (nd[i].definesResidual() ? "*" : nd[i].getName().toString()));
-                QName[] reqPrimaryTypes = nd[i].getRequiredPrimaryTypes();
+                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);
                 }
@@ -959,7 +960,7 @@
      *                             being referenced or if the check failed for
      *                             some other reason.
      */
-    protected void checkForReferencesInContent(QName nodeTypeName)
+    protected void checkForReferencesInContent(Name nodeTypeName)
             throws RepositoryException {
         throw new RepositoryException("not yet implemented");
     }
@@ -994,12 +995,12 @@
      * @throws NoSuchNodeTypeException if a node type reference (e.g. a supertype)
      *                                 could not be resolved.
      */
-    static EffectiveNodeType getEffectiveNodeType(QName ntName,
+    static 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;
@@ -1040,7 +1041,7 @@
      * @throws NoSuchNodeTypeException if a node type reference (e.g. a supertype)
      *                                 could not be resolved.
      */
-    static EffectiveNodeType getEffectiveNodeType(QName[] ntNames,
+    static EffectiveNodeType getEffectiveNodeType(Name[] ntNames,
                                                   EffectiveNodeTypeCache entCache,
                                                   Map ntdCache)
             throws NodeTypeConflictException, NoSuchNodeTypeException {
@@ -1083,7 +1084,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++) {
                         NodeTypeDef ntd = (NodeTypeDef) ntdCache.get(remainder[i]);
                         EffectiveNodeType ent =
@@ -1111,12 +1112,12 @@
         return result;
     }
 
-    static void checkForCircularInheritance(QName[] supertypes,
+    static void checkForCircularInheritance(Name[] supertypes,
                                             Stack inheritanceChain,
                                             Map ntDefCache)
             throws InvalidNodeTypeDefException, RepositoryException {
         for (int i = 0; i < supertypes.length; i++) {
-            QName nt = supertypes[i];
+            Name nt = supertypes[i];
             int pos = inheritanceChain.lastIndexOf(nt);
             if (pos >= 0) {
                 StringBuffer buf = new StringBuffer();
@@ -1135,7 +1136,7 @@
             try {
 
                 NodeTypeDef ntd = (NodeTypeDef) ntDefCache.get(nt);
-                QName[] sta = ntd.getSupertypes();
+                Name[] sta = ntd.getSupertypes();
                 if (sta.length > 0) {
                     // check recursively
                     inheritanceChain.push(nt);
@@ -1157,9 +1158,9 @@
             throws InvalidNodeTypeDefException {
         // check for circularity through default node types of auto-created child nodes
         // (node type 'a' defines auto-created child node with default node type 'a')
-        QName[] childNodeNTs = childNodeENT.getAllNodeTypes();
+        Name[] childNodeNTs = childNodeENT.getAllNodeTypes();
         for (int i = 0; i < childNodeNTs.length; i++) {
-            QName nt = childNodeNTs[i];
+            Name nt = childNodeNTs[i];
             int pos = definingParentNTs.lastIndexOf(nt);
             if (pos >= 0) {
                 StringBuffer buf = new StringBuffer();
@@ -1181,8 +1182,8 @@
 
         NodeDef[] nodeDefs = childNodeENT.getAutoCreateNodeDefs();
         for (int i = 0; i < nodeDefs.length; i++) {
-            QName dnt = nodeDefs[i].getDefaultPrimaryType();
-            QName definingNT = nodeDefs[i].getDeclaringNodeType();
+            Name dnt = nodeDefs[i].getDefaultPrimaryType();
+            Name definingNT = nodeDefs[i].getDeclaringNodeType();
             try {
                 if (dnt != null) {
                     // check recursively
@@ -1202,7 +1203,7 @@
 
     private EffectiveNodeType internalRegister(NodeTypeDef ntd)
             throws InvalidNodeTypeDefException, RepositoryException {
-        QName name = ntd.getName();
+        Name name = ntd.getName();
         if (name != null && registeredNTDefs.containsKey(name)) {
             String msg = name + " already exists";
             log.debug(msg);
@@ -1273,7 +1274,7 @@
         // and do some preliminary checks
         for (Iterator iter = ntDefs.iterator(); iter.hasNext();) {
             NodeTypeDef ntd = (NodeTypeDef) iter.next();
-            QName name = ntd.getName();
+            Name name = ntd.getName();
             if (name != null && registeredNTDefs.containsKey(name)) {
                 String msg = name + " already exists";
                 log.debug(msg);
@@ -1317,7 +1318,7 @@
         entCache = tmpENTCache;
     }
 
-    private void internalUnregister(QName name) throws NoSuchNodeTypeException {
+    private void internalUnregister(Name name) throws NoSuchNodeTypeException {
         NodeTypeDef ntd = (NodeTypeDef) registeredNTDefs.get(name);
         if (ntd == null) {
             throw new NoSuchNodeTypeException(name.toString());
@@ -1339,13 +1340,13 @@
     private void internalUnregister(Collection ntNames)
             throws NoSuchNodeTypeException {
         for (Iterator iter = ntNames.iterator(); iter.hasNext();) {
-            QName name = (QName) iter.next();
+            Name name = (Name) iter.next();
             internalUnregister(name);
         }
     }
 
     /**
-     * Utility method for verifying that the namespace of a <code>QName</code>
+     * Utility method for verifying that the namespace of a <code>Name</code>
      * is registered; a <code>null</code> argument is silently ignored.
      *
      * @param name name whose namespace is to be checked
@@ -1353,7 +1354,7 @@
      * @throws RepositoryException if the namespace of the given name is not
      *                             registered or if an unspecified error occured
      */
-    private static void checkNamespace(QName name, NamespaceRegistry nsReg)
+    private static void checkNamespace(Name name, NamespaceRegistry nsReg)
             throws RepositoryException {
         if (name != null) {
             // make sure namespace uri denotes a registered namespace
@@ -1391,7 +1392,7 @@
          */
         EffectiveNodeType ent = null;
 
-        QName name = ntd.getName();
+        Name name = ntd.getName();
         if (name == null) {
             String msg = "no name specified";
             log.debug(msg);
@@ -1400,7 +1401,7 @@
         checkNamespace(name, nsReg);
 
         // validate supertypes
-        QName[] supertypes = ntd.getSupertypes();
+        Name[] supertypes = ntd.getSupertypes();
         if (supertypes.length > 0) {
             for (int i = 0; i < supertypes.length; i++) {
                 checkNamespace(supertypes[i], nsReg);
@@ -1446,8 +1447,8 @@
             try {
                 EffectiveNodeType est = getEffectiveNodeType(supertypes, entCache, ntdCache);
                 // make sure that all primary types except nt:base extend from nt:base
-                if (!ntd.isMixin() && !QName.NT_BASE.equals(ntd.getName())
-                        && !est.includesNodeType(QName.NT_BASE)) {
+                if (!ntd.isMixin() && !NameConstants.NT_BASE.equals(ntd.getName())
+                        && !est.includesNodeType(NameConstants.NT_BASE)) {
                     String msg = "[" + name + "] all primary node types except"
                             + " nt:base itself must be (directly or indirectly) derived from nt:base";
                     log.debug(msg);
@@ -1566,7 +1567,7 @@
                 if (pd.getRequiredType() == PropertyType.REFERENCE) {
                     for (int j = 0; j < constraints.length; j++) {
                         ReferenceConstraint rc = (ReferenceConstraint) constraints[j];
-                        QName ntName = rc.getNodeTypeName();
+                        Name ntName = rc.getNodeTypeName();
                         if (!name.equals(ntName) && !ntdCache.containsKey(ntName)) {
                             String msg = "[" + name + "#" + pd.getName()
                                     + "] invalid REFERENCE value constraint '"
@@ -1610,7 +1611,7 @@
                 throw new InvalidNodeTypeDefException(msg);
             }
             // check default primary type
-            QName dpt = cnd.getDefaultPrimaryType();
+            Name dpt = cnd.getDefaultPrimaryType();
             checkNamespace(dpt, nsReg);
             boolean referenceToSelf = false;
             EffectiveNodeType defaultENT = null;
@@ -1669,10 +1670,10 @@
             }
 
             // check required primary types
-            QName[] reqTypes = cnd.getRequiredPrimaryTypes();
+            Name[] reqTypes = cnd.getRequiredPrimaryTypes();
             if (reqTypes != null && reqTypes.length > 0) {
                 for (int n = 0; n < reqTypes.length; n++) {
-                    QName rpt = reqTypes[n];
+                    Name rpt = reqTypes[n];
                     checkNamespace(rpt, nsReg);
                     referenceToSelf = false;
                     /**
@@ -1761,9 +1762,9 @@
 
         // FIXME need a fake declaring node type:
         // rep:root is not quite correct but better than a non-existing node type
-        def.setDeclaringNodeType(QName.REP_ROOT);
-        def.setRequiredPrimaryTypes(new QName[]{QName.REP_ROOT});
-        def.setDefaultPrimaryType(QName.REP_ROOT);
+        def.setDeclaringNodeType(NameConstants.REP_ROOT);
+        def.setRequiredPrimaryTypes(new Name[]{NameConstants.REP_ROOT});
+        def.setDefaultPrimaryType(NameConstants.REP_ROOT);
         def.setMandatory(true);
         def.setProtected(false);
         def.setOnParentVersion(OnParentVersionAction.VERSION);
@@ -1775,7 +1776,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 =
                 (NodeTypeRegistryListener[]) listeners.values().toArray(
@@ -1790,7 +1791,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 =
                 (NodeTypeRegistryListener[]) listeners.values().toArray(
@@ -1805,7 +1806,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 =
                 (NodeTypeRegistryListener[]) listeners.values().toArray(

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistryListener.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistryListener.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistryListener.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistryListener.java Tue Oct 30 03:02:41 2007
@@ -16,7 +16,7 @@
  */
 package org.apache.jackrabbit.core.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/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/PropDef.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/PropDef.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/PropDef.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/PropDef.java Tue Oct 30 03:02:41 2007
@@ -20,7 +20,7 @@
 
 /**
  * <code>PropDef</code> is the internal representation of
- * a property definition. It refers to <code>QName</code>s only
+ * a property definition. It refers to <code>Name</code>s only
  * and is thus isolated from session-specific namespace mappings.
  *
  * @see javax.jcr.nodetype.PropertyDefinition

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/PropDefImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/PropDefImpl.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/PropDefImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/PropDefImpl.java Tue Oct 30 03:02:41 2007
@@ -17,7 +17,7 @@
 package org.apache.jackrabbit.core.nodetype;
 
 import org.apache.jackrabbit.core.value.InternalValue;
-import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.spi.Name;
 
 import javax.jcr.PropertyType;
 import java.util.Arrays;
@@ -117,7 +117,7 @@
     /**
      * {@inheritDoc}
      */
-    public void setDeclaringNodeType(QName declaringNodeType) {
+    public void setDeclaringNodeType(Name declaringNodeType) {
         // reset id field in order to force lazy recomputation of identifier
         id = null;
         super.setDeclaringNodeType(declaringNodeType);
@@ -126,7 +126,7 @@
     /**
      * {@inheritDoc}
      */
-    public void setName(QName name) {
+    public void setName(Name name) {
         // reset id field in order to force lazy recomputation of identifier
         id = null;
         super.setName(name);

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/PropertyDefinitionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/PropertyDefinitionImpl.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/PropertyDefinitionImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/PropertyDefinitionImpl.java Tue Oct 30 03:02:41 2007
@@ -17,7 +17,7 @@
 package org.apache.jackrabbit.core.nodetype;
 
 import org.apache.jackrabbit.core.value.InternalValue;
-import org.apache.jackrabbit.name.NamespaceResolver;
+import org.apache.jackrabbit.conversion.NamePathResolver;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -28,7 +28,7 @@
 /**
  * This class implements the <code>PropertyDefinition</code> interface.
  * All method calls are delegated to the wrapped {@link PropDef},
- * 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
@@ -44,11 +44,11 @@
      *
      * @param propDef    property definition
      * @param ntMgr      node type manager
-     * @param nsResolver namespace resolver
+     * @param resolver
      */
     PropertyDefinitionImpl(PropDef propDef, NodeTypeManagerImpl ntMgr,
-                           NamespaceResolver nsResolver) {
-        super(propDef, ntMgr, nsResolver);
+                           NamePathResolver resolver) {
+        super(propDef, ntMgr, resolver);
     }
 
     /**
@@ -72,7 +72,7 @@
         Value[] values = new Value[defVals.length];
         for (int i = 0; i < defVals.length; i++) {
             try {
-                values[i] = defVals[i].toJCRValue(nsResolver);
+                values[i] = defVals[i].toJCRValue(resolver);
             } catch (RepositoryException re) {
                 // should never get here
                 String propName = (getName() == null) ? "[null]" : getName();
@@ -102,7 +102,7 @@
         }
         String[] vca = new String[constraints.length];
         for (int i = 0; i < constraints.length; i++) {
-            vca[i] = constraints[i].getDefinition(nsResolver);
+            vca[i] = constraints[i].getDefinition(resolver);
         }
         return vca;
     }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/ValueConstraint.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/ValueConstraint.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/ValueConstraint.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/ValueConstraint.java Tue Oct 30 03:02:41 2007
@@ -18,14 +18,11 @@
 
 import org.apache.jackrabbit.core.value.BLOBFileValue;
 import org.apache.jackrabbit.core.value.InternalValue;
-import org.apache.jackrabbit.name.MalformedPathException;
-import org.apache.jackrabbit.name.NameException;
-import org.apache.jackrabbit.name.NamespaceResolver;
-import org.apache.jackrabbit.name.NoPrefixDeclaredException;
-import org.apache.jackrabbit.name.Path;
-import org.apache.jackrabbit.name.QName;
-import org.apache.jackrabbit.name.PathFormat;
-import org.apache.jackrabbit.name.NameFormat;
+import org.apache.jackrabbit.conversion.MalformedPathException;
+import org.apache.jackrabbit.conversion.NameException;
+import org.apache.jackrabbit.conversion.NamePathResolver;
+import org.apache.jackrabbit.spi.Path;
+import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.value.DateValue;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -33,6 +30,7 @@
 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;
@@ -75,13 +73,14 @@
      * to reflect the current mapping in the returned value.
      *
      * @return the definition of this constraint.
+     * @param resolver
      */
-    public String getDefinition(NamespaceResolver nsResolver) {
+    public String getDefinition(NamePathResolver resolver) {
         return definition;
     }
 
     public static ValueConstraint create(int type, String definition,
-                                         NamespaceResolver nsResolver)
+                                         NamePathResolver resolver)
             throws InvalidConstraintException {
         if (definition == null) {
             throw new IllegalArgumentException("illegal definition (null)");
@@ -104,13 +103,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: "
@@ -499,7 +498,7 @@
     final Path path;
     final boolean deep;
 
-    PathConstraint(String definition, NamespaceResolver nsResolver)
+    PathConstraint(String definition, NamePathResolver resolver)
             throws InvalidConstraintException {
         super(definition);
 
@@ -510,18 +509,23 @@
             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, mpe);
+            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, e);
         }
     }
 
-    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()) {
@@ -529,7 +533,7 @@
             } else {
                 return p + "/*";
             }
-        } catch (NoPrefixDeclaredException npde) {
+        } catch (NamespaceException e) {
             // should never get here, return raw definition as fallback
             return definition;
         }
@@ -587,28 +591,32 @@
  * <code>NameConstraint</code> ...
  */
 class NameConstraint extends ValueConstraint {
-    final QName name;
+    final Name name;
 
-    NameConstraint(String definition, NamespaceResolver nsResolver)
+    NameConstraint(String definition, NamePathResolver resolver)
             throws InvalidConstraintException {
         super(definition);
 
         // constraint format: JCR name in prefix form
         try {
-            NameFormat.checkFormat(definition);
-            name = NameFormat.parse(definition, nsResolver);
+            name = resolver.getQName(definition);
         } catch (NameException e) {
             String msg = "invalid name specified as value constraint: "
                     + definition;
             log.debug(msg);
             throw new InvalidConstraintException(msg, e);
+        } catch (NamespaceException e) {
+            String msg = "invalid name specified as value constraint: "
+                    + definition;
+            log.debug(msg);
+            throw new InvalidConstraintException(msg, e);
         }
     }
 
-    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 definition;
         }
@@ -621,7 +629,7 @@
         }
         switch (value.getType()) {
             case PropertyType.NAME:
-                QName n = value.getQName();
+                Name n = value.getQName();
                 if (!name.equals(n)) {
                     throw new ConstraintViolationException(n
                             + " does not satisfy the constraint '"
@@ -642,32 +650,37 @@
  * <code>ReferenceConstraint</code> ...
  */
 class ReferenceConstraint extends ValueConstraint {
-    final QName ntName;
+    final Name ntName;
 
-    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);
+            ntName = resolver.getQName(definition);
         } 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, e);
         }
     }
 
-    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 e) {
             // should never get here, return raw definition as fallback
             return definition;
         }
     }
 
-    QName getNodeTypeName() {
+    Name getNodeTypeName() {
         return ntName;
     }
 

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/compact/CompactNodeTypeDefReader.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/compact/CompactNodeTypeDefReader.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/compact/CompactNodeTypeDefReader.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/compact/CompactNodeTypeDefReader.java Tue Oct 30 03:02:41 2007
@@ -25,11 +25,13 @@
 import org.apache.jackrabbit.core.nodetype.PropDefImpl;
 import org.apache.jackrabbit.core.nodetype.ValueConstraint;
 import org.apache.jackrabbit.core.value.InternalValue;
-import org.apache.jackrabbit.name.NameException;
-import org.apache.jackrabbit.name.NoPrefixDeclaredException;
-import org.apache.jackrabbit.name.QName;
-import org.apache.jackrabbit.name.NameFormat;
-import org.apache.jackrabbit.util.name.NamespaceMapping;
+import org.apache.jackrabbit.conversion.NameException;
+import org.apache.jackrabbit.conversion.NamePathResolver;
+import org.apache.jackrabbit.conversion.DefaultNamePathResolver;
+import org.apache.jackrabbit.spi.Name;
+import org.apache.jackrabbit.name.NameConstants;
+import org.apache.jackrabbit.name.NameFactoryImpl;
+import org.apache.jackrabbit.namespace.NamespaceMapping;
 import org.apache.jackrabbit.util.ISO9075;
 import org.apache.jackrabbit.value.ValueHelper;
 import org.apache.jackrabbit.value.ValueFactoryImpl;
@@ -38,6 +40,7 @@
 import javax.jcr.PropertyType;
 import javax.jcr.RepositoryException;
 import javax.jcr.ValueFormatException;
+import javax.jcr.Value;
 import javax.jcr.version.OnParentVersionAction;
 import java.io.Reader;
 import java.util.ArrayList;
@@ -135,6 +138,11 @@
     private NamespaceMapping nsMapping;
 
     /**
+     * Name and Path resolver
+     */
+    private NamePathResolver resolver;
+
+    /**
      * the underlying lexer
      */
     private Lexer lexer;
@@ -165,6 +173,7 @@
             throws ParseException {
         lexer = new Lexer(r, systemId);
         this.nsMapping = mapping;
+        this.resolver = new DefaultNamePathResolver(nsMapping);
         nextToken();
         parse();
     }
@@ -281,7 +290,7 @@
             supertypes.add(toQName(currentToken));
             nextToken();
         } while (currentTokenEquals(Lexer.LIST_DELIMITER));
-        ntd.setSupertypes((QName[]) supertypes.toArray(new QName[0]));
+        ntd.setSupertypes((Name[]) supertypes.toArray(new Name[0]));
     }
 
     /**
@@ -345,7 +354,7 @@
                 ndi.setOnParentVersion(OnParentVersionAction.COPY);
                 ndi.setProtected(false);
                 ndi.setDefaultPrimaryType(null);
-                ndi.setRequiredPrimaryTypes(new QName[]{QName.NT_BASE});
+                ndi.setRequiredPrimaryTypes(new Name[]{NameConstants.NT_BASE});
 
                 nextToken();
                 doChildNodeDefinition(ndi, ntd);
@@ -437,8 +446,8 @@
                 if (ntd.getPrimaryItemName() != null) {
                     String name = null;
                     try {
-                        name = NameFormat.format(ntd.getName(), nsMapping);
-                    } catch (NoPrefixDeclaredException e) {
+                        name = resolver.getJCRName(ntd.getName());
+                    } catch (NamespaceException e) {
                         // Should never happen, checked earlier
                     }
                     lexer.fail("More than one primary item specified in node type '" + name + "'");
@@ -484,9 +493,10 @@
             nextToken();
             InternalValue value = null;
             try {
-                value = InternalValue.create(ValueHelper.convert(
+                Value v = ValueHelper.convert(
                         currentToken, pdi.getRequiredType(),
-                        ValueFactoryImpl.getInstance()), nsMapping);
+                        ValueFactoryImpl.getInstance());
+                value = InternalValue.create(v, resolver);
             } catch (ValueFormatException e) {
                 lexer.fail("'" + currentToken + "' is not a valid string representation of a value of type " + pdi.getRequiredType());
             } catch (RepositoryException e) {
@@ -513,7 +523,7 @@
             nextToken();
             ValueConstraint constraint = null;
             try {
-                constraint = ValueConstraint.create(pdi.getRequiredType(), currentToken, nsMapping);
+                constraint = ValueConstraint.create(pdi.getRequiredType(), currentToken, resolver);
             } catch (InvalidConstraintException e) {
                 lexer.fail("'" + currentToken + "' is not a valid constraint expression for a value of type " + pdi.getRequiredType());
             }
@@ -559,7 +569,7 @@
             types.add(toQName(currentToken));
             nextToken();
         } while (currentTokenEquals(Lexer.LIST_DELIMITER));
-        ndi.setRequiredPrimaryTypes((QName[]) types.toArray(new QName[0]));
+        ndi.setRequiredPrimaryTypes((Name[]) types.toArray(new Name[0]));
         nextToken();
     }
 
@@ -591,8 +601,8 @@
                 if (ntd.getPrimaryItemName() != null) {
                     String name = null;
                     try {
-                        name = NameFormat.format(ntd.getName(), nsMapping);
-                    } catch (NoPrefixDeclaredException e) {
+                        name = resolver.getJCRName(ntd.getName());
+                    } catch (NamespaceException e) {
                         // Should never happen, checked earlier
                     }
                     lexer.fail("More than one primary item specified in node type '" + name + "'");
@@ -631,10 +641,15 @@
      * @return the qualified name
      * @throws ParseException if the conversion fails
      */
-    private QName toQName(String stringName) throws ParseException {
+    private Name toQName(String stringName) throws ParseException {
         try {
-            return ISO9075.decode(NameFormat.parse(stringName, nsMapping));
+            Name n = resolver.getQName(stringName);
+            String decodedLocalName = ISO9075.decode(n.getLocalName());
+            return NameFactoryImpl.getInstance().create(n.getNamespaceURI(), decodedLocalName);
         } catch (NameException e) {
+            lexer.fail("Error while parsing '" + stringName + "'", e);
+            return null;
+        } catch (NamespaceException e) {
             lexer.fail("Error while parsing '" + stringName + "'", e);
             return null;
         }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/compact/CompactNodeTypeDefWriter.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/compact/CompactNodeTypeDefWriter.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/compact/CompactNodeTypeDefWriter.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/compact/CompactNodeTypeDefWriter.java Tue Oct 30 03:02:41 2007
@@ -34,9 +34,10 @@
 import org.apache.jackrabbit.core.nodetype.ValueConstraint;
 import org.apache.jackrabbit.core.nodetype.ItemDef;
 import org.apache.jackrabbit.core.value.InternalValue;
-import org.apache.jackrabbit.name.NamespaceResolver;
-import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.namespace.NamespaceResolver;
+import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.util.ISO9075;
+import org.apache.jackrabbit.conversion.NamePathResolver;
 
 /**
  * Prints node type defs in a compact notation
@@ -63,6 +64,11 @@
     private final NamespaceResolver resolver;
 
     /**
+     * the current name/path resolver
+     */
+    private final NamePathResolver npResolver;
+
+    /**
      * the underlying writer
      */
     private Writer out;
@@ -82,9 +88,10 @@
      *
      * @param out the underlying writer
      * @param r the namespace resolver
+     * @param npResolver
      */
-    public CompactNodeTypeDefWriter(Writer out, NamespaceResolver r) {
-        this(out, r, false);
+    public CompactNodeTypeDefWriter(Writer out, NamespaceResolver r, NamePathResolver npResolver) {
+        this(out, r, npResolver, false);
     }
 
     /**
@@ -92,11 +99,12 @@
      *
      * @param out the underlaying writer
      * @param r the naespace resolver
+     * @param npResolver
      * @param includeNS if <code>true</code> all used namespace decl. are also
-     *        written.
      */
-    public CompactNodeTypeDefWriter(Writer out, NamespaceResolver r, boolean includeNS) {
+    public CompactNodeTypeDefWriter(Writer out, NamespaceResolver r, NamePathResolver npResolver, boolean includeNS) {
         this.resolver = r;
+        this.npResolver = npResolver;
         if (includeNS) {
             this.out = new StringWriter();
             this.nsWriter = out;
@@ -112,12 +120,13 @@
      *
      * @param l
      * @param r
+     * @param npResolver
      * @param out
      * @throws IOException
      */
-    public static void write(List l, NamespaceResolver r, Writer out)
+    public static void write(List l, NamespaceResolver r, NamePathResolver npResolver, Writer out)
             throws IOException {
-        CompactNodeTypeDefWriter w = new CompactNodeTypeDefWriter(out, r, true);
+        CompactNodeTypeDefWriter w = new CompactNodeTypeDefWriter(out, r, npResolver, true);
         Iterator iter = l.iterator();
         while (iter.hasNext()) {
             NodeTypeDef def = (NodeTypeDef) iter.next();
@@ -172,7 +181,7 @@
      * write supertypes
      */
     private void writeSupertypes(NodeTypeDef ntd) throws IOException {
-        QName[] sta = ntd.getSupertypes();
+        Name[] sta = ntd.getSupertypes();
         String delim = " > ";
         for (int i = 0; i < sta.length; i++) {
             out.write(delim);
@@ -260,7 +269,7 @@
             for (int i = 0; i < dva.length; i++) {
                 out.write(delim);
                 try {
-                    out.write(escape(dva[i].toJCRValue(resolver).getString()));
+                    out.write(escape(dva[i].toJCRValue(npResolver).getString()));
                 } catch (RepositoryException e) {
                     out.write(escape(dva[i].toString()));
                 }
@@ -276,12 +285,12 @@
      */
     private void writeValueConstraints(ValueConstraint[] vca) throws IOException {
         if (vca != null && vca.length > 0) {
-            String vc = vca[0].getDefinition(resolver);
+            String vc = vca[0].getDefinition(npResolver);
             out.write(" < '");
             out.write(escape(vc));
             out.write("'");
             for (int i = 1; i < vca.length; i++) {
-                vc = vca[i].getDefinition(resolver);
+                vc = vca[i].getDefinition(npResolver);
                 out.write(", '");
                 out.write(escape(vc));
                 out.write("'");
@@ -296,7 +305,7 @@
     private void writeNodeDef(NodeTypeDef ntd, NodeDef nd) throws IOException {
         out.write("\n" + INDENT + "+ ");
 
-        QName name = nd.getName();
+        Name name = nd.getName();
         if (name.equals(ItemDef.ANY_NAME)) {
             out.write('*');
         } else {
@@ -328,14 +337,14 @@
      * @param name
      * @throws IOException
      */
-    private void writeItemDefName(QName name) throws IOException {
+    private void writeItemDefName(Name name) throws IOException {
         out.write(resolve(name));
     }
     /**
      * write required types
      * @param reqTypes
      */
-    private void writeRequiredTypes(QName[] reqTypes) throws IOException {
+    private void writeRequiredTypes(Name[] reqTypes) throws IOException {
         if (reqTypes != null && reqTypes.length > 0) {
             String delim = " (";
             for (int i = 0; i < reqTypes.length; i++) {
@@ -351,7 +360,7 @@
      * write default types
      * @param defType
      */
-    private void writeDefaultType(QName defType) throws IOException {
+    private void writeDefaultType(Name defType) throws IOException {
         if (defType != null && !defType.getLocalName().equals("*")) {
             out.write(" = ");
             out.write(resolve(defType));
@@ -363,13 +372,13 @@
      * @param qname
      * @return the resolved name
      */
-    private String resolve(QName qname) throws IOException {
+    private String resolve(Name qname) throws IOException {
         if (qname == null) {
             return "";
         }
         try {
             String prefix = resolver.getPrefix(qname.getNamespaceURI());
-            if (prefix != null && !prefix.equals(QName.NS_EMPTY_PREFIX)) {
+            if (prefix != null && !prefix.equals(Name.NS_EMPTY_PREFIX)) {
                 // check for writing namespaces
                 if (nsWriter != null) {
                     if (!usedNamespaces.contains(prefix)) {
@@ -384,7 +393,8 @@
                 prefix += ":";
             }
 
-            String resolvedName = prefix + ISO9075.encode(qname).getLocalName();
+            String encLocalName = ISO9075.encode(qname.getLocalName());
+            String resolvedName = prefix + encLocalName;
 
             // check for '-' and '+'
             if (resolvedName.indexOf('-') >= 0 || resolvedName.indexOf('+') >= 0) {

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/virtual/VirtualNodeTypeStateManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/virtual/VirtualNodeTypeStateManager.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/virtual/VirtualNodeTypeStateManager.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/virtual/VirtualNodeTypeStateManager.java Tue Oct 30 03:02:41 2007
@@ -26,9 +26,11 @@
 import org.apache.jackrabbit.core.observation.DelegatingObservationDispatcher;
 import org.apache.jackrabbit.core.observation.EventState;
 import org.apache.jackrabbit.core.virtual.VirtualItemStateProvider;
-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.name.NameConstants;
+import org.apache.jackrabbit.name.PathBuilder;
+import org.apache.jackrabbit.conversion.MalformedPathException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -57,10 +59,10 @@
 
     static {
         try {
-            Path.PathBuilder builder = new Path.PathBuilder();
+            PathBuilder builder = new PathBuilder();
             builder.addRoot();
-            builder.addLast(QName.JCR_SYSTEM);
-            builder.addLast(QName.JCR_NODETYPES);
+            builder.addLast(NameConstants.JCR_SYSTEM);
+            builder.addLast(NameConstants.JCR_NODETYPES);
             NODE_TYPES_PATH = builder.getPath();
         } catch (MalformedPathException e) {
             // will not happen. path is always valid
@@ -141,7 +143,7 @@
     /**
      * {@inheritDoc}
      */
-    public void nodeTypeRegistered(QName ntName) {
+    public void nodeTypeRegistered(Name ntName) {
         try {
             if (virtProvider != null) {
                 // allow provider to update
@@ -163,7 +165,7 @@
     /**
      * {@inheritDoc}
      */
-    public void nodeTypeReRegistered(QName ntName) {
+    public void nodeTypeReRegistered(Name ntName) {
         // lazy implementation
         nodeTypeUnregistered(ntName);
         nodeTypeRegistered(ntName);
@@ -172,7 +174,7 @@
     /**
      * {@inheritDoc}
      */
-    public void nodeTypeUnregistered(QName ntName) {
+    public void nodeTypeUnregistered(Name ntName) {
         try {
             if (systemSession != null) {
                 // generated observation events

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/virtual/VirtualNodeTypeStateProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/virtual/VirtualNodeTypeStateProvider.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/virtual/VirtualNodeTypeStateProvider.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/virtual/VirtualNodeTypeStateProvider.java Tue Oct 30 03:02:41 2007
@@ -29,8 +29,9 @@
 import org.apache.jackrabbit.core.value.InternalValue;
 import org.apache.jackrabbit.core.virtual.AbstractVISProvider;
 import org.apache.jackrabbit.core.virtual.VirtualNodeState;
-import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.uuid.UUID;
+import org.apache.jackrabbit.name.NameConstants;
 
 import javax.jcr.PropertyType;
 import javax.jcr.RepositoryException;
@@ -72,10 +73,10 @@
      * currently we have no dynamic ones, we just recreate the entire nodetypes tree
      */
     protected VirtualNodeState createRootNodeState() throws RepositoryException {
-        VirtualNodeState root = new VirtualNodeState(this, parentId, rootNodeId, QName.REP_NODETYPES, null);
-        NodeDefId id = ntReg.getEffectiveNodeType(QName.REP_SYSTEM).getApplicableChildNodeDef(QName.JCR_NODETYPES, QName.REP_NODETYPES, ntReg).getId();
+        VirtualNodeState root = new VirtualNodeState(this, parentId, rootNodeId, NameConstants.REP_NODETYPES, null);
+        NodeDefId id = ntReg.getEffectiveNodeType(NameConstants.REP_SYSTEM).getApplicableChildNodeDef(NameConstants.JCR_NODETYPES, NameConstants.REP_NODETYPES, ntReg).getId();
         root.setDefinitionId(id);
-        QName[] ntNames = ntReg.getRegisteredNodeTypes();
+        Name[] ntNames = ntReg.getRegisteredNodeTypes();
         for (int i = 0; i < ntNames.length; i++) {
             NodeTypeDef ntDef = ntReg.getNodeTypeDef(ntNames[i]);
             VirtualNodeState ntState = createNodeTypeState(root, ntDef);
@@ -103,7 +104,7 @@
     /**
      * {@inheritDoc}
      */
-    public void onNodeTypeAdded(QName ntName) throws RepositoryException {
+    public void onNodeTypeAdded(Name ntName) throws RepositoryException {
         try {
             VirtualNodeState root = (VirtualNodeState) getRootState();
             NodeTypeDef ntDef = ntReg.getNodeTypeDef(ntName);
@@ -121,7 +122,7 @@
     /**
      * {@inheritDoc}
      */
-    public void onNodeTypeModified(QName ntName) throws RepositoryException {
+    public void onNodeTypeModified(Name ntName) throws RepositoryException {
         // todo: do more efficient reloading
         try {
             getRootState().discard();
@@ -133,7 +134,7 @@
     /**
      * {@inheritDoc}
      */
-    public void onNodeTypeRemoved(QName ntName) throws RepositoryException {
+    public void onNodeTypeRemoved(Name ntName) throws RepositoryException {
         // todo: do more efficient reloading
         try {
             getRootState().discard();
@@ -154,22 +155,22 @@
                                                  NodeTypeDef ntDef)
             throws RepositoryException {
         NodeId id = new NodeId(calculateStableUUID(ntDef.getName().toString()));
-        VirtualNodeState ntState = createNodeState(parent, ntDef.getName(), id, QName.NT_NODETYPE);
+        VirtualNodeState ntState = createNodeState(parent, ntDef.getName(), id, NameConstants.NT_NODETYPE);
 
         // add properties
-        ntState.setPropertyValue(QName.JCR_NODETYPENAME, InternalValue.create(ntDef.getName()));
-        ntState.setPropertyValues(QName.JCR_SUPERTYPES, PropertyType.NAME, InternalValue.create(ntDef.getSupertypes()));
-        ntState.setPropertyValue(QName.JCR_ISMIXIN, InternalValue.create(ntDef.isMixin()));
-        ntState.setPropertyValue(QName.JCR_HASORDERABLECHILDNODES, InternalValue.create(ntDef.hasOrderableChildNodes()));
+        ntState.setPropertyValue(NameConstants.JCR_NODETYPENAME, InternalValue.create(ntDef.getName()));
+        ntState.setPropertyValues(NameConstants.JCR_SUPERTYPES, PropertyType.NAME, InternalValue.create(ntDef.getSupertypes()));
+        ntState.setPropertyValue(NameConstants.JCR_ISMIXIN, InternalValue.create(ntDef.isMixin()));
+        ntState.setPropertyValue(NameConstants.JCR_HASORDERABLECHILDNODES, InternalValue.create(ntDef.hasOrderableChildNodes()));
         if (ntDef.getPrimaryItemName() != null) {
-            ntState.setPropertyValue(QName.JCR_PRIMARYITEMNAME, InternalValue.create(ntDef.getPrimaryItemName()));
+            ntState.setPropertyValue(NameConstants.JCR_PRIMARYITEMNAME, InternalValue.create(ntDef.getPrimaryItemName()));
         }
 
         // add property defs
         PropDef[] propDefs = ntDef.getPropertyDefs();
         for (int i = 0; i < propDefs.length; i++) {
             VirtualNodeState pdState = createPropertyDefState(ntState, propDefs[i], ntDef, i);
-            ntState.addChildNodeEntry(QName.JCR_PROPERTYDEFINITION, pdState.getNodeId());
+            ntState.addChildNodeEntry(NameConstants.JCR_PROPERTYDEFINITION, pdState.getNodeId());
             // add as hard reference
             ntState.addStateReference(pdState);
         }
@@ -178,7 +179,7 @@
         NodeDef[] cnDefs = ntDef.getChildNodeDefs();
         for (int i = 0; i < cnDefs.length; i++) {
             VirtualNodeState cnState = createChildNodeDefState(ntState, cnDefs[i], ntDef, i);
-            ntState.addChildNodeEntry(QName.JCR_CHILDNODEDEFINITION, cnState.getNodeId());
+            ntState.addChildNodeEntry(NameConstants.JCR_CHILDNODEDEFINITION, cnState.getNodeId());
             // add as hard reference
             ntState.addStateReference(cnState);
         }
@@ -199,26 +200,26 @@
                                                     NodeTypeDef ntDef, int n)
             throws RepositoryException {
         NodeId id = new NodeId(calculateStableUUID(
-                ntDef.getName().toString() + "/" + QName.JCR_PROPERTYDEFINITION.toString() + "/" + n));
-        VirtualNodeState pState = createNodeState(parent, QName.JCR_PROPERTYDEFINITION, id, QName.NT_PROPERTYDEFINITION);
+                ntDef.getName().toString() + "/" + NameConstants.JCR_PROPERTYDEFINITION.toString() + "/" + n));
+        VirtualNodeState pState = createNodeState(parent, NameConstants.JCR_PROPERTYDEFINITION, id, NameConstants.NT_PROPERTYDEFINITION);
         // add properties
         if (!propDef.definesResidual()) {
-            pState.setPropertyValue(QName.JCR_NAME, InternalValue.create(propDef.getName()));
+            pState.setPropertyValue(NameConstants.JCR_NAME, InternalValue.create(propDef.getName()));
         }
-        pState.setPropertyValue(QName.JCR_AUTOCREATED, InternalValue.create(propDef.isAutoCreated()));
-        pState.setPropertyValue(QName.JCR_MANDATORY, InternalValue.create(propDef.isMandatory()));
-        pState.setPropertyValue(QName.JCR_ONPARENTVERSION,
+        pState.setPropertyValue(NameConstants.JCR_AUTOCREATED, InternalValue.create(propDef.isAutoCreated()));
+        pState.setPropertyValue(NameConstants.JCR_MANDATORY, InternalValue.create(propDef.isMandatory()));
+        pState.setPropertyValue(NameConstants.JCR_ONPARENTVERSION,
                 InternalValue.create(OnParentVersionAction.nameFromValue(propDef.getOnParentVersion())));
-        pState.setPropertyValue(QName.JCR_PROTECTED, InternalValue.create(propDef.isProtected()));
-        pState.setPropertyValue(QName.JCR_MULTIPLE, InternalValue.create(propDef.isMultiple()));
-        pState.setPropertyValue(QName.JCR_REQUIREDTYPE, InternalValue.create(PropertyType.nameFromValue(propDef.getRequiredType()).toUpperCase()));
-        pState.setPropertyValues(QName.JCR_DEFAULTVALUES, PropertyType.STRING, propDef.getDefaultValues());
+        pState.setPropertyValue(NameConstants.JCR_PROTECTED, InternalValue.create(propDef.isProtected()));
+        pState.setPropertyValue(NameConstants.JCR_MULTIPLE, InternalValue.create(propDef.isMultiple()));
+        pState.setPropertyValue(NameConstants.JCR_REQUIREDTYPE, InternalValue.create(PropertyType.nameFromValue(propDef.getRequiredType()).toUpperCase()));
+        pState.setPropertyValues(NameConstants.JCR_DEFAULTVALUES, PropertyType.STRING, propDef.getDefaultValues());
         ValueConstraint[] vc = propDef.getValueConstraints();
         InternalValue[] vals = new InternalValue[vc.length];
         for (int i = 0; i < vc.length; i++) {
             vals[i] = InternalValue.create(vc[i].getDefinition());
         }
-        pState.setPropertyValues(QName.JCR_VALUECONSTRAINTS, PropertyType.STRING, vals);
+        pState.setPropertyValues(NameConstants.JCR_VALUECONSTRAINTS, PropertyType.STRING, vals);
         return pState;
     }
 
@@ -235,23 +236,23 @@
                                                      NodeTypeDef ntDef, int n)
             throws RepositoryException {
         NodeId id = new NodeId(calculateStableUUID(
-                ntDef.getName().toString() + "/" + QName.JCR_CHILDNODEDEFINITION.toString() + "/" + n));
-        VirtualNodeState pState = createNodeState(parent, QName.JCR_CHILDNODEDEFINITION, id, QName.NT_CHILDNODEDEFINITION);
+                ntDef.getName().toString() + "/" + NameConstants.JCR_CHILDNODEDEFINITION.toString() + "/" + n));
+        VirtualNodeState pState = createNodeState(parent, NameConstants.JCR_CHILDNODEDEFINITION, id, NameConstants.NT_CHILDNODEDEFINITION);
         // add properties
         if (!cnDef.definesResidual()) {
-            pState.setPropertyValue(QName.JCR_NAME, InternalValue.create(cnDef.getName()));
+            pState.setPropertyValue(NameConstants.JCR_NAME, InternalValue.create(cnDef.getName()));
         }
-        pState.setPropertyValue(QName.JCR_AUTOCREATED, InternalValue.create(cnDef.isAutoCreated()));
-        pState.setPropertyValue(QName.JCR_MANDATORY, InternalValue.create(cnDef.isMandatory()));
-        pState.setPropertyValue(QName.JCR_ONPARENTVERSION,
+        pState.setPropertyValue(NameConstants.JCR_AUTOCREATED, InternalValue.create(cnDef.isAutoCreated()));
+        pState.setPropertyValue(NameConstants.JCR_MANDATORY, InternalValue.create(cnDef.isMandatory()));
+        pState.setPropertyValue(NameConstants.JCR_ONPARENTVERSION,
                 InternalValue.create(OnParentVersionAction.nameFromValue(cnDef.getOnParentVersion())));
-        pState.setPropertyValue(QName.JCR_PROTECTED, InternalValue.create(cnDef.isProtected()));
-        pState.setPropertyValues(QName.JCR_REQUIREDPRIMARYTYPES,
+        pState.setPropertyValue(NameConstants.JCR_PROTECTED, InternalValue.create(cnDef.isProtected()));
+        pState.setPropertyValues(NameConstants.JCR_REQUIREDPRIMARYTYPES,
                 PropertyType.NAME, InternalValue.create(cnDef.getRequiredPrimaryTypes()));
         if (cnDef.getDefaultPrimaryType() != null) {
-            pState.setPropertyValue(QName.JCR_DEFAULTPRIMARYTYPE, InternalValue.create(cnDef.getDefaultPrimaryType()));
+            pState.setPropertyValue(NameConstants.JCR_DEFAULTPRIMARYTYPE, InternalValue.create(cnDef.getDefaultPrimaryType()));
         }
-        pState.setPropertyValue(QName.JCR_SAMENAMESIBLINGS, InternalValue.create(cnDef.allowsSameNameSiblings()));
+        pState.setPropertyValue(NameConstants.JCR_SAMENAMESIBLINGS, InternalValue.create(cnDef.allowsSameNameSiblings()));
         return pState;
     }
 

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/xml/AdditionalNamespaceResolver.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/xml/AdditionalNamespaceResolver.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/xml/AdditionalNamespaceResolver.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/xml/AdditionalNamespaceResolver.java Tue Oct 30 03:02:41 2007
@@ -16,7 +16,7 @@
  */
 package org.apache.jackrabbit.core.nodetype.xml;
 
-import org.apache.jackrabbit.name.AbstractNamespaceResolver;
+import org.apache.jackrabbit.namespace.AbstractNamespaceResolver;
 
 import javax.jcr.NamespaceException;
 import javax.jcr.NamespaceRegistry;

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/xml/NodeTypeReader.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/xml/NodeTypeReader.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/xml/NodeTypeReader.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/xml/NodeTypeReader.java Tue Oct 30 03:02:41 2007
@@ -27,15 +27,17 @@
 import org.apache.jackrabbit.core.nodetype.ValueConstraint;
 import org.apache.jackrabbit.core.util.DOMWalker;
 import org.apache.jackrabbit.core.value.InternalValue;
-import org.apache.jackrabbit.name.NameException;
-import org.apache.jackrabbit.name.NamespaceResolver;
-import org.apache.jackrabbit.name.QName;
-import org.apache.jackrabbit.name.NameFormat;
+import org.apache.jackrabbit.conversion.NameException;
+import org.apache.jackrabbit.conversion.NamePathResolver;
+import org.apache.jackrabbit.conversion.DefaultNamePathResolver;
+import org.apache.jackrabbit.namespace.NamespaceResolver;
+import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.value.ValueHelper;
 import org.apache.jackrabbit.value.ValueFactoryImpl;
 
 import javax.jcr.PropertyType;
 import javax.jcr.RepositoryException;
+import javax.jcr.NamespaceException;
 import javax.jcr.version.OnParentVersionAction;
 import java.io.IOException;
 import java.io.InputStream;
@@ -68,6 +70,9 @@
         } catch (NameException e) {
             throw new InvalidNodeTypeDefException(
                     "Invalid namespace reference in a node type definition", e);
+        } catch (NamespaceException e) {
+            throw new InvalidNodeTypeDefException(
+                    "Invalid namespace reference in a node type definition", e);
         }
     }
 
@@ -77,8 +82,8 @@
     /** The namespaces associated with the node type XML document. */
     private final Properties namespaces;
 
-    /** The namespace resolver. */
-    private final NamespaceResolver resolver;
+    /** The name, path resolver. */
+    private final NamePathResolver resolver;
 
     /**
      * Creates a node type definition file reader.
@@ -89,7 +94,8 @@
     public NodeTypeReader(InputStream xml) throws IOException {
         walker = new DOMWalker(xml);
         namespaces = walker.getNamespaces();
-        resolver = new AdditionalNamespaceResolver(namespaces);
+        NamespaceResolver nsResolver = new AdditionalNamespaceResolver(namespaces);
+        resolver = new DefaultNamePathResolver(nsResolver);
     }
 
     /**
@@ -110,7 +116,7 @@
      *                                     illegal name
      */
     public NodeTypeDef[] getNodeTypeDefs()
-            throws InvalidNodeTypeDefException, NameException {
+            throws InvalidNodeTypeDefException, NameException, NamespaceException {
         Vector defs = new Vector();
         while (walker.iterateElements(Constants.NODETYPE_ELEMENT)) {
             defs.add(getNodeTypeDef());
@@ -127,11 +133,11 @@
      *                                     illegal name
      */
     private NodeTypeDef getNodeTypeDef()
-            throws InvalidNodeTypeDefException, NameException {
+            throws InvalidNodeTypeDefException, NameException, NamespaceException {
         NodeTypeDef type = new NodeTypeDef();
 
-        type.setName(NameFormat.parse(
-                walker.getAttribute(Constants.NAME_ATTRIBUTE), resolver));
+        type.setName(resolver.getQName(
+                walker.getAttribute(Constants.NAME_ATTRIBUTE)));
         type.setMixin(Boolean.valueOf(
                 walker.getAttribute(Constants.ISMIXIN_ATTRIBUTE))
                 .booleanValue());
@@ -142,7 +148,7 @@
             walker.getAttribute(Constants.PRIMARYITEMNAME_ATTRIBUTE);
         if (primaryItemName != null && primaryItemName.length() > 0) {
             type.setPrimaryItemName(
-                    NameFormat.parse(primaryItemName, resolver));
+                    resolver.getQName(primaryItemName));
         }
 
         // supertype declarations
@@ -150,10 +156,10 @@
             Vector supertypes = new Vector();
             while (walker.iterateElements(Constants.SUPERTYPE_ELEMENT)) {
                 supertypes.add(
-                        NameFormat.parse(walker.getContent(), resolver));
+                        resolver.getQName(walker.getContent()));
             }
-            type.setSupertypes((QName[])
-                    supertypes.toArray(new QName[supertypes.size()]));
+            type.setSupertypes((Name[])
+                    supertypes.toArray(new Name[supertypes.size()]));
             walker.leaveElement();
         }
 
@@ -189,13 +195,13 @@
      *                                     illegal name
      */
     private PropDefImpl getPropDef()
-            throws InvalidNodeTypeDefException, NameException {
+            throws InvalidNodeTypeDefException, NameException, NamespaceException {
         PropDefImpl def = new PropDefImpl();
         String name = walker.getAttribute(Constants.NAME_ATTRIBUTE);
         if (name.equals("*")) {
             def.setName(ItemDef.ANY_NAME);
         } else {
-            def.setName(NameFormat.parse(name, resolver));
+            def.setName(resolver.getQName(name));
         }
 
         // simple attributes
@@ -266,13 +272,13 @@
      * @return child node definition
      * @throws NameException if the definition contains an illegal name
      */
-    private NodeDefImpl getChildNodeDef() throws NameException {
+    private NodeDefImpl getChildNodeDef() throws NameException, NamespaceException {
         NodeDefImpl def = new NodeDefImpl();
         String name = walker.getAttribute(Constants.NAME_ATTRIBUTE);
         if (name.equals("*")) {
             def.setName(ItemDef.ANY_NAME);
         } else {
-            def.setName(NameFormat.parse(name, resolver));
+            def.setName(resolver.getQName(name));
         }
 
         // simple attributes
@@ -295,17 +301,17 @@
         String type =
             walker.getAttribute(Constants.DEFAULTPRIMARYTYPE_ATTRIBUTE);
         if (type != null && type.length() > 0) {
-            def.setDefaultPrimaryType(NameFormat.parse(type, resolver));
+            def.setDefaultPrimaryType(resolver.getQName(type));
         }
 
         // required primary types
         if (walker.enterElement(Constants.REQUIREDPRIMARYTYPES_ELEMENT)) {
             Vector types = new Vector();
             while (walker.iterateElements(Constants.REQUIREDPRIMARYTYPE_ELEMENT)) {
-                types.add(NameFormat.parse(walker.getContent(), resolver));
+                types.add(resolver.getQName(walker.getContent()));
             }
             def.setRequiredPrimaryTypes(
-                    (QName[]) types.toArray(new QName[types.size()]));
+                    (Name[]) types.toArray(new Name[types.size()]));
             walker.leaveElement();
         } else {
             /* Default to nt:base?

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/xml/NodeTypeWriter.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/xml/NodeTypeWriter.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/xml/NodeTypeWriter.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/xml/NodeTypeWriter.java Tue Oct 30 03:02:41 2007
@@ -22,14 +22,15 @@
 import org.apache.jackrabbit.core.nodetype.ValueConstraint;
 import org.apache.jackrabbit.core.util.DOMBuilder;
 import org.apache.jackrabbit.core.value.InternalValue;
-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.namespace.NamespaceResolver;
+import org.apache.jackrabbit.conversion.NamePathResolver;
+import org.apache.jackrabbit.conversion.DefaultNamePathResolver;
+import org.apache.jackrabbit.spi.Name;
 
 import javax.jcr.NamespaceRegistry;
 import javax.jcr.PropertyType;
 import javax.jcr.RepositoryException;
+import javax.jcr.NamespaceException;
 import javax.jcr.version.OnParentVersionAction;
 import javax.xml.parsers.ParserConfigurationException;
 import java.io.IOException;
@@ -65,7 +66,7 @@
             writer.write(xml);
         } catch (ParserConfigurationException e) {
             throw new IOException(e.getMessage());
-        } catch (NoPrefixDeclaredException e) {
+        } catch (NamespaceException e) {
             throw new RepositoryException(
                     "Invalid namespace reference in a node type definition", e);
         }
@@ -75,7 +76,7 @@
     private final DOMBuilder builder;
 
     /** The namespace resolver. */
-    private final NamespaceResolver resolver;
+    private final NamePathResolver resolver;
 
     /**
      * Creates a node type definition file writer. The given namespace
@@ -99,7 +100,8 @@
             }
         }
 
-        resolver = new AdditionalNamespaceResolver(registry);
+        NamespaceResolver nsResolver = new AdditionalNamespaceResolver(registry);
+        resolver = new DefaultNamePathResolver(nsResolver);
     }
 
     /**
@@ -108,16 +110,16 @@
      * @param def node type definition
      * @throws RepositoryException       if the default property values
      *                                   cannot be serialized
-     * @throws NoPrefixDeclaredException if the node type definition contains
+     * @throws NamespaceException if the node type definition contains
      *                                   invalid namespace references
      */
     private void addNodeTypeDef(NodeTypeDef def)
-            throws RepositoryException, NoPrefixDeclaredException {
+            throws NamespaceException, RepositoryException {
         builder.startElement(Constants.NODETYPE_ELEMENT);
 
         // simple attributes
         builder.setAttribute(
-                Constants.NAME_ATTRIBUTE, NameFormat.format(def.getName(), resolver));
+                Constants.NAME_ATTRIBUTE, resolver.getJCRName(def.getName()));
         builder.setAttribute(
                 Constants.ISMIXIN_ATTRIBUTE, def.isMixin());
         builder.setAttribute(
@@ -125,23 +127,23 @@
                 def.hasOrderableChildNodes());
 
         // primary item name
-        QName item = def.getPrimaryItemName();
+        Name item = def.getPrimaryItemName();
         if (item != null) {
             builder.setAttribute(
                     Constants.PRIMARYITEMNAME_ATTRIBUTE,
-                    NameFormat.format(item, resolver));
+                    resolver.getJCRName(item));
         } else {
             builder.setAttribute(Constants.PRIMARYITEMNAME_ATTRIBUTE, "");
         }
 
         // supertype declarations
-        QName[] supertypes = def.getSupertypes();
+        Name[] supertypes = def.getSupertypes();
         if (supertypes.length > 0) {
             builder.startElement(Constants.SUPERTYPES_ELEMENT);
             for (int i = 0; i < supertypes.length; i++) {
                 builder.addContentElement(
                         Constants.SUPERTYPE_ELEMENT,
-                        NameFormat.format(supertypes[i], resolver));
+                        resolver.getJCRName(supertypes[i]));
             }
             builder.endElement();
         }
@@ -167,16 +169,16 @@
      * @param def property definition
      * @throws RepositoryException       if the default values cannot
      *                                   be serialized
-     * @throws NoPrefixDeclaredException if the property definition contains
+     * @throws NamespaceException if the property definition contains
      *                                   invalid namespace references
      */
     private void addPropDef(PropDef def)
-            throws RepositoryException, NoPrefixDeclaredException {
+            throws NamespaceException, RepositoryException {
         builder.startElement(Constants.PROPERTYDEFINITION_ELEMENT);
 
         // simple attributes
         builder.setAttribute(
-                Constants.NAME_ATTRIBUTE, NameFormat.format(def.getName(), resolver));
+                Constants.NAME_ATTRIBUTE, resolver.getJCRName(def.getName()));
         builder.setAttribute(
                 Constants.AUTOCREATED_ATTRIBUTE, def.isAutoCreated());
         builder.setAttribute(
@@ -223,16 +225,16 @@
      * Builds a child node definition element under the current element.
      *
      * @param def child node definition
-     * @throws NoPrefixDeclaredException if the child node definition contains
+     * @throws NamespaceException if the child node definition contains
      *                                   invalid namespace references
      */
     private void addChildNodeDef(NodeDef def)
-            throws NoPrefixDeclaredException {
+            throws NamespaceException {
         builder.startElement(Constants.CHILDNODEDEFINITION_ELEMENT);
 
         // simple attributes
         builder.setAttribute(
-                Constants.NAME_ATTRIBUTE, NameFormat.format(def.getName(), resolver));
+                Constants.NAME_ATTRIBUTE, resolver.getJCRName(def.getName()));
         builder.setAttribute(
                 Constants.AUTOCREATED_ATTRIBUTE, def.isAutoCreated());
         builder.setAttribute(
@@ -246,22 +248,22 @@
                 Constants.SAMENAMESIBLINGS_ATTRIBUTE, def.allowsSameNameSiblings());
 
         // default primary type
-        QName type = def.getDefaultPrimaryType();
+        Name type = def.getDefaultPrimaryType();
         if (type != null) {
             builder.setAttribute(
                     Constants.DEFAULTPRIMARYTYPE_ATTRIBUTE,
-                    NameFormat.format(type, resolver));
+                    resolver.getJCRName(type));
         } else {
             builder.setAttribute(Constants.DEFAULTPRIMARYTYPE_ATTRIBUTE, "");
         }
 
         // required primary types
-        QName[] requiredTypes = def.getRequiredPrimaryTypes();
+        Name[] requiredTypes = def.getRequiredPrimaryTypes();
         builder.startElement(Constants.REQUIREDPRIMARYTYPES_ELEMENT);
         for (int i = 0; i < requiredTypes.length; i++) {
             builder.addContentElement(
                     Constants.REQUIREDPRIMARYTYPE_ELEMENT,
-                    NameFormat.format(requiredTypes[i], resolver));
+                    resolver.getJCRName(requiredTypes[i]));
         }
         builder.endElement();
 

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/ChangeLogBasedHierarchyMgr.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/ChangeLogBasedHierarchyMgr.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/ChangeLogBasedHierarchyMgr.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/ChangeLogBasedHierarchyMgr.java Tue Oct 30 03:02:41 2007
@@ -28,8 +28,8 @@
 import org.apache.jackrabbit.core.state.NoSuchItemStateException;
 import org.apache.jackrabbit.core.state.NodeReferences;
 import org.apache.jackrabbit.core.state.NodeReferencesId;
-import org.apache.jackrabbit.name.Path;
-import org.apache.jackrabbit.name.PathResolver;
+import org.apache.jackrabbit.spi.Path;
+import org.apache.jackrabbit.conversion.PathResolver;
 
 import javax.jcr.ItemNotFoundException;
 import javax.jcr.RepositoryException;

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/DelegatingObservationDispatcher.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/DelegatingObservationDispatcher.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/DelegatingObservationDispatcher.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/DelegatingObservationDispatcher.java Tue Oct 30 03:02:41 2007
@@ -18,7 +18,7 @@
 
 import org.apache.jackrabbit.core.SessionImpl;
 import org.apache.jackrabbit.core.state.ChangeLog;
-import org.apache.jackrabbit.name.Path;
+import org.apache.jackrabbit.spi.Path;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 



Mime
View raw message