jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r425032 - in /jackrabbit/trunk/contrib/spi: commons/src/main/java/org/apache/jackrabbit/value/ jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/name/ jcr2spi/src/main/java/org/apache/j...
Date Mon, 24 Jul 2006 12:57:22 GMT
Author: angela
Date: Mon Jul 24 05:57:21 2006
New Revision: 425032

URL: http://svn.apache.org/viewvc?rev=425032&view=rev
Log:
replacing deprecated calls in NamespaceResolver

Modified:
    jackrabbit/trunk/contrib/spi/commons/src/main/java/org/apache/jackrabbit/value/ValueFormat.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/PropertyImpl.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/name/CachingNamespaceResolver.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/name/LocalNamespaceMappings.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/name/NamespaceRegistryImpl.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/ItemDefinitionImpl.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeImpl.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeManagerImpl.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/ValueConstraint.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/QueryImpl.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/QueryResultImpl.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/RowIteratorImpl.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionHistoryImpl.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/AbstractSAXEventGenerator.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/DocViewImportHandler.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/DocViewSAXEventGenerator.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/SysViewImportHandler.java
    jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/ItemInfoImpl.java
    jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/NodeInfoImpl.java
    jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/QItemDefinitionImpl.java
    jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/QNodeDefinitionImpl.java
    jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/QNodeTypeDefinitionImpl.java
    jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/RepositoryServiceImpl.java

Modified: jackrabbit/trunk/contrib/spi/commons/src/main/java/org/apache/jackrabbit/value/ValueFormat.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/commons/src/main/java/org/apache/jackrabbit/value/ValueFormat.java?rev=425032&r1=425031&r2=425032&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/commons/src/main/java/org/apache/jackrabbit/value/ValueFormat.java (original)
+++ jackrabbit/trunk/contrib/spi/commons/src/main/java/org/apache/jackrabbit/value/ValueFormat.java Mon Jul 24 05:57:21 2006
@@ -22,6 +22,7 @@
 import org.apache.jackrabbit.name.QName;
 import org.apache.jackrabbit.name.Path;
 import org.apache.jackrabbit.name.PathFormat;
+import org.apache.jackrabbit.name.NameFormat;
 
 import javax.jcr.RepositoryException;
 import javax.jcr.PropertyType;
@@ -80,7 +81,7 @@
                 break;
             case PropertyType.NAME:
                 try {
-                    QName qName = nsResolver.getQName(jcrValue);
+                    QName qName = NameFormat.parse(jcrValue, nsResolver);
                     qValue = QValue.create(qName);
                 } catch (NameException e) {
                     throw new RepositoryException(e);
@@ -132,7 +133,7 @@
             case PropertyType.NAME:
                 try {
                     QName qName = QName.valueOf(qualifiedValue.getString());
-                    jcrValue = factory.createValue(nsResolver.getJCRName(qName), propertyType);
+                    jcrValue = factory.createValue(NameFormat.format(qName, nsResolver), propertyType);
                 } catch (NoPrefixDeclaredException npde) {
                     // should never get here...
                     throw new RepositoryException("internal error: encountered unregistered namespace", npde);

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java?rev=425032&r1=425031&r2=425032&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java Mon Jul 24 05:57:21 2006
@@ -29,6 +29,7 @@
 import org.apache.jackrabbit.name.QName;
 import org.apache.jackrabbit.name.Path;
 import org.apache.jackrabbit.name.PathFormat;
+import org.apache.jackrabbit.name.NameFormat;
 import org.apache.jackrabbit.jcr2spi.state.NodeState;
 import org.apache.jackrabbit.jcr2spi.state.ItemStateException;
 import org.apache.jackrabbit.jcr2spi.state.NodeReferences;
@@ -125,7 +126,7 @@
         checkStatus();
         QName name = session.getHierarchyManager().getQName(getId());
         try {
-            return session.getNamespaceResolver().getJCRName(name);
+            return NameFormat.format(name, session.getNamespaceResolver());
         } catch (NoPrefixDeclaredException npde) {
             // should never get here...
             String msg = "internal error: encountered unregistered namespace " + name.getNamespaceURI();
@@ -1383,7 +1384,7 @@
     private QName getQName(String jcrName) throws RepositoryException {
         QName qName;
         try {
-            qName = session.getNamespaceResolver().getQName(jcrName);
+            qName = NameFormat.parse(jcrName, session.getNamespaceResolver());
         } catch (IllegalNameException ine) {
             throw new RepositoryException("invalid name: " + jcrName, ine);
         } catch (UnknownPrefixException upe) {
@@ -1449,7 +1450,7 @@
     }
 
     /**
-     * 
+     *
      * @param relativePath
      * @return
      * @throws RepositoryException
@@ -1548,7 +1549,7 @@
              * have to build & resolve absolute path)
              */
             if (relPath.indexOf('/') == -1) {
-                QName propName = session.getNamespaceResolver().getQName(relPath);
+                QName propName = NameFormat.parse(relPath, session.getNamespaceResolver());
                 // check if property entry exists
                 if (getNodeState().hasPropertyName(propName)) {
                     return getNodeState().getPropertyId(propName);

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/PropertyImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/PropertyImpl.java?rev=425032&r1=425031&r2=425032&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/PropertyImpl.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/PropertyImpl.java Mon Jul 24 05:57:21 2006
@@ -21,6 +21,7 @@
 import org.apache.jackrabbit.jcr2spi.operation.Operation;
 import org.apache.jackrabbit.name.NoPrefixDeclaredException;
 import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.name.NameFormat;
 import org.apache.jackrabbit.spi.PropertyId;
 import org.apache.jackrabbit.value.QValue;
 import org.apache.jackrabbit.value.ValueFormat;
@@ -73,7 +74,7 @@
         PropertyId propId = getPropertyId();
         QName name = propId.getQName();
         try {
-            return session.getNamespaceResolver().getJCRName(name);
+            return NameFormat.format(name, session.getNamespaceResolver());
         } catch (NoPrefixDeclaredException npde) {
             // should never get here...
             String msg = "Internal error: encountered unregistered namespace " + name.getNamespaceURI();

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/name/CachingNamespaceResolver.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/name/CachingNamespaceResolver.java?rev=425032&r1=425031&r2=425032&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/name/CachingNamespaceResolver.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/name/CachingNamespaceResolver.java Mon Jul 24 05:57:21 2006
@@ -22,11 +22,9 @@
 import org.apache.jackrabbit.name.NamespaceResolver;
 import org.apache.jackrabbit.name.NamespaceListener;
 import org.apache.jackrabbit.name.AbstractNamespaceResolver;
-import org.apache.jackrabbit.name.MalformedPathException;
-import org.apache.jackrabbit.name.PathFormat;
 import org.apache.jackrabbit.name.NameFormat;
 import org.apache.jackrabbit.name.QName;
-import org.apache.jackrabbit.name.Path;
+import org.apache.jackrabbit.name.NameCache;
 import org.apache.commons.collections.map.LRUMap;
 
 import javax.jcr.NamespaceException;
@@ -38,7 +36,7 @@
  * and vice versa. The cache is invalidated when a namespace uri to prefix
  * mapping is changed.
  */
-class CachingNamespaceResolver implements NamespaceResolver, NamespaceListener {
+class CachingNamespaceResolver implements NamespaceResolver, NamespaceListener, NameCache {
 
     /**
      * The base namespace resolver.
@@ -70,21 +68,30 @@
     }
 
     /**
-     * @inheritDoc
+     * Disposes this <code>CachingNamespaceResolver</code>.
+     */
+    public void dispose() {
+        base.removeListener(this);
+    }
+
+    //--------------------------------------------------< NamespaceResolver >---
+    /**
+     * @see NamespaceResolver#getURI(String)
      */
     public String getURI(String prefix) throws NamespaceException {
         return base.getURI(prefix);
     }
 
     /**
-     * @inheritDoc
+     * @see NamespaceResolver#getPrefix(String)
      */
     public String getPrefix(String uri) throws NamespaceException {
         return base.getPrefix(uri);
     }
 
     /**
-     * @inheritDoc
+     * @see NamespaceResolver#getQName(String)
+     * @deprecated
      */
     public synchronized QName getQName(String jcrName)
             throws IllegalNameException, UnknownPrefixException {
@@ -97,7 +104,8 @@
     }
 
     /**
-     * @inheritDoc
+     * @see NamespaceResolver#getJCRName(QName)
+     * @deprecated
      */
     public synchronized String getJCRName(QName qName)
             throws NoPrefixDeclaredException {
@@ -110,54 +118,60 @@
         return jcrName;
     }
 
+    //----------------------------------------------------< NamespaceListener >
     /**
      * @inheritDoc
-     * As currently paths are not cached, the call is delegated to
-     * {@link PathFormat#parse(String, NamespaceResolver)}.
      */
-    public Path getQPath(String jcrPath) throws MalformedPathException {
-        return PathFormat.parse(jcrPath, this);
+    public void namespaceAdded(String prefix, String uri) {
+        // since it is a new namespace there's no need to flush the
+        // cached mappings
     }
 
     /**
      * @inheritDoc
-     * As currently paths are not cached, the call is delegated to
-     * {@link PathFormat#format(Path, NamespaceResolver)}.
+     * Invalidates all cached mappings.
      */
-    public String getJCRPath(Path qPath) throws NoPrefixDeclaredException {
-        return PathFormat.format(qPath, this);
+    public void namespaceRemapped(String oldPrefix, String newPrefix, String uri) {
+        qnameToJCRName.clear();
+        jcrNameToQName.clear();
     }
 
     /**
-     * Disposes this <code>CachingNamespaceResolver</code>.
+     * @inheritDoc
+     * Invalidates all cached mappings.
      */
-    public void dispose() {
-        base.removeListener(this);
+    public void namespaceRemoved(String uri) {
+        qnameToJCRName.clear();
+        jcrNameToQName.clear();
     }
 
-    //----------------------------------------------------< NamespaceListener >
+    //----------------------------------------------------------< NameCache >---
     /**
      * @inheritDoc
      */
-    public void namespaceAdded(String prefix, String uri) {
-        // since it is a new namespace there's no need to flush the
-        // cached mappings
+    public synchronized QName retrieveName(String jcrName) {
+        return (QName) jcrNameToQName.get(jcrName);
     }
 
     /**
      * @inheritDoc
-     * Invalidates all cached mappings.
      */
-    public void namespaceRemapped(String oldPrefix, String newPrefix, String uri) {
-        qnameToJCRName.clear();
-        jcrNameToQName.clear();
+    public synchronized String retrieveName(QName name) {
+        return (String) qnameToJCRName.get(name);
     }
 
     /**
      * @inheritDoc
-     * Invalidates all cached mappings.
      */
-    public void namespaceRemoved(String uri) {
+    public synchronized void cacheName(String jcrName, QName name) {
+        qnameToJCRName.put(name, jcrName);
+        jcrNameToQName.put(jcrName, name);
+    }
+
+    /**
+     * @inheritDoc
+     */
+    public synchronized void evictAllNames() {
         qnameToJCRName.clear();
         jcrNameToQName.clear();
     }

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/name/LocalNamespaceMappings.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/name/LocalNamespaceMappings.java?rev=425032&r1=425031&r2=425032&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/name/LocalNamespaceMappings.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/name/LocalNamespaceMappings.java Mon Jul 24 05:57:21 2006
@@ -17,9 +17,6 @@
 package org.apache.jackrabbit.jcr2spi.name;
 
 import org.apache.jackrabbit.name.NamespaceResolver;
-import org.apache.jackrabbit.name.IllegalNameException;
-import org.apache.jackrabbit.name.UnknownPrefixException;
-import org.apache.jackrabbit.name.NoPrefixDeclaredException;
 import org.apache.jackrabbit.name.AbstractNamespaceResolver;
 import org.apache.jackrabbit.name.NamespaceListener;
 import org.apache.jackrabbit.name.QName;
@@ -206,48 +203,6 @@
 
         // check global mappings
         return nsReg.getPrefix(uri);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public QName getQName(String name)
-            throws IllegalNameException, UnknownPrefixException {
-        if (prefixToURI.isEmpty()) {
-            // shortcut
-            return nsReg.getQName(name);
-        }
-        try {
-            // first try registry, this might result in a wrong QName because
-            // of locally overlayed mappings
-            QName candidate = nsReg.getQName(name);
-            // make sure global prefix is not hidden because of
-            // locally remapped uri
-            if (!uriToPrefix.containsKey(candidate.getNamespaceURI())) {
-                return candidate;
-            }
-        } catch (UnknownPrefixException e) {
-            // try using local mappings
-        }
-        return super.getQName(name);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public String getJCRName(QName name)
-            throws NoPrefixDeclaredException {
-        if (uriToPrefix.isEmpty()) {
-            // shortcut
-            return nsReg.getJCRName(name);
-        }
-        if (uriToPrefix.containsKey(name.getNamespaceURI())) {
-            // locally remappped
-            return super.getJCRName(name);
-        } else {
-            // use global mapping
-            return nsReg.getJCRName(name);
-        }
     }
 
     //--------------------------------------------------< NamespaceListener >---

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/name/NamespaceRegistryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/name/NamespaceRegistryImpl.java?rev=425032&r1=425031&r2=425032&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/name/NamespaceRegistryImpl.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/name/NamespaceRegistryImpl.java Mon Jul 24 05:57:21 2006
@@ -21,6 +21,8 @@
 import org.apache.jackrabbit.name.UnknownPrefixException;
 import org.apache.jackrabbit.name.NoPrefixDeclaredException;
 import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.name.NameCache;
+import org.apache.jackrabbit.name.NameFormat;
 import org.apache.jackrabbit.util.XMLChar;
 
 import javax.jcr.NamespaceRegistry;
@@ -35,7 +37,8 @@
 /**
  * <code>NamespaceRegistryImpl</code>...
  */
-public class NamespaceRegistryImpl extends AbstractNamespaceResolver implements NamespaceRegistry {
+public class NamespaceRegistryImpl extends AbstractNamespaceResolver
+    implements NamespaceRegistry, NameCache {
 
     private static final HashSet reservedPrefixes = new HashSet();
     private static final HashSet reservedURIs = new HashSet();
@@ -223,16 +226,42 @@
 
     /**
      * @see org.apache.jackrabbit.name.NamespaceResolver#getQName(String)
+     * @deprecated
      */
     public QName getQName(String name)
             throws IllegalNameException, UnknownPrefixException {
-        return resolver.getQName(name);
+        return NameFormat.parse(name, this);
     }
 
     /**
      * @see org.apache.jackrabbit.name.NamespaceResolver#getJCRName(QName)
+     * @deprecated
      */
     public String getJCRName(QName name) throws NoPrefixDeclaredException {
-        return resolver.getJCRName(name);
+        return NameFormat.format(name, this);
+    }
+
+    //----------------------------------------------------------< NameCache >---
+    /**
+     * {@inheritDoc}
+     */
+    public QName retrieveName(String jcrName) {
+        // just delegate to internal cache
+        return resolver.retrieveName(jcrName);
+    }
+
+    public String retrieveName(QName name) {
+        // just delegate to internal cache
+        return resolver.retrieveName(name);
+    }
+
+    public void cacheName(String jcrName, QName name) {
+        // just delegate to internal cache
+        resolver.cacheName(jcrName, name);
+    }
+
+    public void evictAllNames() {
+        // just delegate to internal cache
+        resolver.evictAllNames();
     }
 }

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/ItemDefinitionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/ItemDefinitionImpl.java?rev=425032&r1=425031&r2=425032&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/ItemDefinitionImpl.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/ItemDefinitionImpl.java Mon Jul 24 05:57:21 2006
@@ -18,6 +18,7 @@
 
 import org.apache.jackrabbit.name.NamespaceResolver;
 import org.apache.jackrabbit.name.NoPrefixDeclaredException;
+import org.apache.jackrabbit.name.NameFormat;
 import org.apache.jackrabbit.spi.QItemDefinition;
 import org.slf4j.LoggerFactory;
 import org.slf4j.Logger;
@@ -95,7 +96,7 @@
             return ANY_NAME;
         } else {
             try {
-                return nsResolver.getJCRName(itemDef.getQName());
+                return NameFormat.format(itemDef.getQName(), nsResolver);
             } catch (NoPrefixDeclaredException npde) {
                 // should never get here
                 log.error("encountered unregistered namespace in property name",

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeImpl.java?rev=425032&r1=425031&r2=425032&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeImpl.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeImpl.java Mon Jul 24 05:57:21 2006
@@ -22,6 +22,7 @@
 import org.apache.jackrabbit.name.UnknownPrefixException;
 import org.apache.jackrabbit.name.NameException;
 import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.name.NameFormat;
 import org.apache.jackrabbit.spi.QNodeDefinition;
 import org.apache.jackrabbit.spi.QPropertyDefinition;
 import org.apache.jackrabbit.spi.QNodeTypeDefinition;
@@ -277,7 +278,7 @@
      */
     public String getName() {
         try {
-            return nsResolver.getJCRName(ntd.getQName());
+            return NameFormat.format(ntd.getQName(), nsResolver);
         } catch (NoPrefixDeclaredException npde) {
             // should never get here
             log.error("encountered unregistered namespace in node type name", npde);
@@ -292,7 +293,7 @@
         try {
             QName piName = ntd.getPrimaryItemName();
             if (piName != null) {
-                return nsResolver.getJCRName(piName);
+                return NameFormat.format(piName, nsResolver);
             } else {
                 return null;
             }
@@ -316,7 +317,7 @@
     public boolean isNodeType(String nodeTypeName) {
         QName ntName;
         try {
-            ntName = nsResolver.getQName(nodeTypeName);
+            ntName = NameFormat.parse(nodeTypeName, nsResolver);
         } catch (IllegalNameException ine) {
             log.warn("invalid node type name: " + nodeTypeName, ine);
             return false;
@@ -415,7 +416,7 @@
             return canRemoveItem(propertyName);
         }
         try {
-            QName name = nsResolver.getQName(propertyName);
+            QName name = NameFormat.parse(propertyName, nsResolver);
             QPropertyDefinition def;
             try {
                 // try to get definition that matches the given value type
@@ -462,7 +463,7 @@
             return canRemoveItem(propertyName);
         }
         try {
-            QName name = nsResolver.getQName(propertyName);
+            QName name = NameFormat.parse(propertyName, nsResolver);
             // determine type of values
             int type = PropertyType.UNDEFINED;
             for (int i = 0; i < values.length; i++) {
@@ -530,7 +531,7 @@
      */
     public boolean canAddChildNode(String childNodeName) {
         try {
-            ent.checkAddNodeConstraints(nsResolver.getQName(childNodeName));
+            ent.checkAddNodeConstraints(NameFormat.parse(childNodeName, nsResolver));
             return true;
         } catch (NameException be) {
             // implementation specific exception, fall through
@@ -545,7 +546,7 @@
      */
     public boolean canAddChildNode(String childNodeName, String nodeTypeName) {
         try {
-            ent.checkAddNodeConstraints(nsResolver.getQName(childNodeName), nsResolver.getQName(nodeTypeName));
+            ent.checkAddNodeConstraints(NameFormat.parse(childNodeName, nsResolver), NameFormat.parse(nodeTypeName, nsResolver));
             return true;
         } catch (NameException be) {
             // implementation specific exception, fall through
@@ -560,7 +561,7 @@
      */
     public boolean canRemoveItem(String itemName) {
         try {
-            ent.checkRemoveItemConstraints(nsResolver.getQName(itemName));
+            ent.checkRemoveItemConstraints(NameFormat.parse(itemName, nsResolver));
             return true;
         } catch (NameException be) {
             // implementation specific exception, fall through

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeManagerImpl.java?rev=425032&r1=425031&r2=425032&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeManagerImpl.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeManagerImpl.java Mon Jul 24 05:57:21 2006
@@ -22,6 +22,7 @@
 import org.apache.jackrabbit.name.UnknownPrefixException;
 import org.apache.jackrabbit.name.NameException;
 import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.name.NameFormat;
 import org.apache.jackrabbit.util.IteratorHelper;
 import org.apache.jackrabbit.jcr2spi.state.NodeState;
 import org.apache.jackrabbit.jcr2spi.state.PropertyState;
@@ -241,7 +242,7 @@
         // flush all affected cache entries
         ntCache.remove(ntName);
         try {
-            String name = nsResolver.getJCRName(ntName);
+            String name = NameFormat.format(ntName, nsResolver);
             synchronized (pdCache) {
                 Iterator iter = pdCache.values().iterator();
                 while (iter.hasNext()) {
@@ -278,7 +279,7 @@
         // flush all affected cache entries
         ntCache.remove(ntName);
         try {
-            String name = nsResolver.getJCRName(ntName);
+            String name = NameFormat.format(ntName, nsResolver);
             synchronized (pdCache) {
                 Iterator iter = pdCache.values().iterator();
                 while (iter.hasNext()) {
@@ -357,7 +358,7 @@
     public NodeType getNodeType(String nodeTypeName)
             throws NoSuchNodeTypeException {
         try {
-            QName qName = nsResolver.getQName(nodeTypeName);
+            QName qName = NameFormat.parse(nodeTypeName, nsResolver);
             return getNodeType(qName);
         } catch (UnknownPrefixException upe) {
             throw new NoSuchNodeTypeException(nodeTypeName, upe);

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=425032&r1=425031&r2=425032&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 Mon Jul 24 05:57:21 2006
@@ -751,7 +751,7 @@
         // constraint format: JCR name in prefix form
         try {
             NameFormat.checkFormat(definition);
-            name = nsResolver.getQName(definition);
+            name = NameFormat.parse(definition, nsResolver);
         } catch (IllegalNameException ine) {
             String msg = "invalid name specified as value constraint: "
                     + definition;
@@ -767,7 +767,7 @@
 
     public String getDefinition(NamespaceResolver nsResolver) {
         try {
-            return nsResolver.getJCRName(name);
+            return NameFormat.format(name, nsResolver);
         } catch (NoPrefixDeclaredException npde) {
             // should never get here, return raw definition as fallback
             return qualifiedDefinition;
@@ -823,7 +823,7 @@
 
         // format: node type name
         try {
-            ntName = nsResolver.getQName(definition);
+            ntName = NameFormat.parse(definition, nsResolver);
         } catch (IllegalNameException ine) {
             String msg = "invalid node type name specified as value constraint: "
                     + definition;
@@ -839,7 +839,7 @@
 
     public String getDefinition(NamespaceResolver nsResolver) {
         try {
-            return nsResolver.getJCRName(ntName);
+            return NameFormat.format(ntName, nsResolver);
         } catch (NoPrefixDeclaredException npde) {
             // should never get here, return raw definition as fallback
             return qualifiedDefinition;

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=425032&r1=425031&r2=425032&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 Mon Jul 24 05:57:21 2006
@@ -25,6 +25,7 @@
 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 javax.jcr.ItemExistsException;
 import javax.jcr.ItemNotFoundException;
@@ -143,11 +144,11 @@
         this.wspManager = wspManager;
 
         try {
-            if (!node.isNodeType(resolver.getJCRName(QName.NT_QUERY))) {
+            if (!node.isNodeType(NameFormat.format(QName.NT_QUERY, resolver))) {
                 throw new InvalidQueryException("node is not of type nt:query");
             }
-            statement = node.getProperty(resolver.getJCRName(QName.JCR_STATEMENT)).getString();
-            language = node.getProperty(resolver.getJCRName(QName.JCR_LANGUAGE)).getString();
+            statement = node.getProperty(NameFormat.format(QName.JCR_STATEMENT, resolver)).getString();
+            language = node.getProperty(NameFormat.format(QName.JCR_LANGUAGE, resolver)).getString();
             // DIFF JR: todo validate statement
             //query = handler.createExecutableQuery(session, itemMgr, statement, language);
         } catch (NoPrefixDeclaredException e) {
@@ -219,11 +220,11 @@
                 throw new PathNotFoundException(jcrParent);
             }
             String relPath = PathFormat.format(p, resolver).substring(1);
-            String ntName = resolver.getJCRName(QName.NT_QUERY);
+            String ntName = NameFormat.format(QName.NT_QUERY, resolver);
             Node queryNode = session.getRootNode().addNode(relPath, ntName);
             // set properties
-            queryNode.setProperty(resolver.getJCRName(QName.JCR_LANGUAGE), language);
-            queryNode.setProperty(resolver.getJCRName(QName.JCR_STATEMENT), statement);
+            queryNode.setProperty(NameFormat.format(QName.JCR_LANGUAGE, resolver), language);
+            queryNode.setProperty(NameFormat.format(QName.JCR_STATEMENT, resolver), statement);
             node = queryNode;
             return node;
         } catch (MalformedPathException e) {

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=425032&r1=425031&r2=425032&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 Mon Jul 24 05:57:21 2006
@@ -21,6 +21,7 @@
 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.QueryInfo;
 import org.slf4j.LoggerFactory;
 import org.slf4j.Logger;
@@ -53,21 +54,21 @@
     /**
      * The namespace resolver of the session executing the query
      */
-    private final NamespaceResolver resolver;
+    private final NamespaceResolver nsResolver;
 
     /**
      * Creates a new query result.
      *
      * @param itemMgr     the item manager of the session executing the query.
      * @param queryInfo   the spi query result.
-     * @param resolver    the namespace resolver of the session executing the query.
+     * @param resolver    the namespace nsResolver of the session executing the query.
      */
     public QueryResultImpl(ItemManager itemMgr,
                            QueryInfo queryInfo,
                            NamespaceResolver resolver) {
         this.itemMgr = itemMgr;
         this.queryInfo = queryInfo;
-        this.resolver = resolver;
+        this.nsResolver = resolver;
     }
 
     /**
@@ -79,7 +80,7 @@
             QName[] names = queryInfo.getColumnNames();
             String[] propNames = new String[names.length];
             for (int i = 0; i < names.length; i++) {
-                propNames[i] = resolver.getJCRName(names[i]);
+                propNames[i] = NameFormat.format(names[i], nsResolver);
             }
             return propNames;
         } catch (NoPrefixDeclaredException npde) {
@@ -101,7 +102,7 @@
      * {@inheritDoc}
      */
     public RowIterator getRows() throws RepositoryException {
-        return new RowIteratorImpl(getNodeIterator(), queryInfo.getColumnNames(), resolver);
+        return new RowIteratorImpl(getNodeIterator(), queryInfo.getColumnNames(), nsResolver);
     }
 
     /**
@@ -109,6 +110,6 @@
      * @return a node iterator over the result nodes.
      */
     private ScoreNodeIterator getNodeIterator() throws RepositoryException {
-        return new NodeIteratorImpl(itemMgr, resolver, queryInfo);
+        return new NodeIteratorImpl(itemMgr, nsResolver, queryInfo);
     }
 }

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/RowIteratorImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/RowIteratorImpl.java?rev=425032&r1=425031&r2=425032&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/RowIteratorImpl.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/RowIteratorImpl.java Mon Jul 24 05:57:21 2006
@@ -22,6 +22,7 @@
 import org.apache.jackrabbit.name.UnknownPrefixException;
 import org.apache.jackrabbit.name.NoPrefixDeclaredException;
 import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.name.NameFormat;
 import org.apache.jackrabbit.value.LongValue;
 import org.apache.jackrabbit.value.PathValue;
 import org.apache.jackrabbit.value.StringValue;
@@ -58,7 +59,7 @@
     /**
      * The <code>NamespaceResolver</code> of the user <code>Session</code>.
      */
-    private final NamespaceResolver resolver;
+    private final NamespaceResolver nsResolver;
 
     /**
      * Creates a new <code>RowIteratorImpl</code> that iterates over the result
@@ -73,7 +74,7 @@
     RowIteratorImpl(ScoreNodeIterator nodes, QName[] properties, NamespaceResolver resolver) {
         this.nodes = nodes;
         this.properties = properties;
-        this.resolver = resolver;
+        this.nsResolver = resolver;
     }
 
     /**
@@ -205,7 +206,7 @@
                 for (int i = 0; i < properties.length; i++) {
                     String propName;
                     try {
-                        propName = resolver.getJCRName(properties[i]);
+                        propName = NameFormat.format(properties[i], nsResolver);
                     } catch (NoPrefixDeclaredException e) {
                         throw new RepositoryException(e.getMessage(), e);
                     }
@@ -260,7 +261,7 @@
                 propertySet = tmp;
             }
             try {
-                QName prop = resolver.getQName(propertyName);
+                QName prop = NameFormat.parse(propertyName, nsResolver);
                 if (!propertySet.contains(prop)) {
                     throw new ItemNotFoundException(propertyName);
                 }

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionHistoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionHistoryImpl.java?rev=425032&r1=425031&r2=425032&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionHistoryImpl.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionHistoryImpl.java Mon Jul 24 05:57:21 2006
@@ -34,6 +34,7 @@
 import org.apache.jackrabbit.name.NoPrefixDeclaredException;
 import org.apache.jackrabbit.spi.NodeId;
 import org.apache.jackrabbit.name.Path;
+import org.apache.jackrabbit.name.NameFormat;
 import org.apache.jackrabbit.spi.PropertyId;
 
 import javax.jcr.version.VersionHistory;
@@ -234,7 +235,7 @@
 
         for (int i = 0; i < qLabels.length; i++) {
             try {
-                labels[i] = session.getNamespaceResolver().getJCRName(qLabels[i]);
+                labels[i] = NameFormat.format(qLabels[i], session.getNamespaceResolver());
             } catch (NoPrefixDeclaredException e) {
                 // unexpected error. should not occur.
                 throw new RepositoryException(e);
@@ -261,7 +262,7 @@
             NodeId vId = getVersionIdByLabel(qLabels[i]);
             if (vUUID.equals(vId.getUUID())) {
                 try {
-                    vlabels.add(session.getNamespaceResolver().getJCRName(qLabels[i]));
+                    vlabels.add(NameFormat.format(qLabels[i], session.getNamespaceResolver()));
                 } catch (NoPrefixDeclaredException e) {
                     // should never occur
                     throw new RepositoryException("Unexpected error while accessing version label", e);
@@ -330,7 +331,7 @@
      */
     private NodeId getVersionId(String versionName) throws VersionException, RepositoryException {
         try {
-            QName vQName = session.getNamespaceResolver().getQName(versionName);
+            QName vQName = NameFormat.parse(versionName, session.getNamespaceResolver());
             NodeState.ChildNodeEntry vEntry = vhState.getChildNodeEntry(vQName, Path.INDEX_DEFAULT);
             if (vEntry == null) {
                 throw new VersionException("Version '" + versionName + "' does not exist in this version history.");
@@ -380,7 +381,7 @@
      */
     private QName getQLabel(String label) throws RepositoryException {
         try {
-            return session.getNamespaceResolver().getQName(label);
+            return NameFormat.parse(label, session.getNamespaceResolver());
         } catch (NameException e) {
             String error = "Invalid version label: " + e.getMessage();
             log.error(error);

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/AbstractSAXEventGenerator.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/AbstractSAXEventGenerator.java?rev=425032&r1=425031&r2=425032&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/AbstractSAXEventGenerator.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/AbstractSAXEventGenerator.java Mon Jul 24 05:57:21 2006
@@ -20,6 +20,7 @@
 import org.apache.jackrabbit.name.NamespaceResolver;
 import org.apache.jackrabbit.name.NameException;
 import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.name.NameFormat;
 import org.xml.sax.ContentHandler;
 import org.xml.sax.SAXException;
 import org.slf4j.LoggerFactory;
@@ -121,12 +122,12 @@
         // resolve the names of some wellknown properties
         // allowing for session-local prefix mappings
         try {
-            jcrPrimaryType = nsResolver.getJCRName(QName.JCR_PRIMARYTYPE);
-            jcrMixinTypes = nsResolver.getJCRName(QName.JCR_MIXINTYPES);
-            jcrUUID = nsResolver.getJCRName(QName.JCR_UUID);
-            jcrRoot = nsResolver.getJCRName(QName.JCR_ROOT);
-            jcrXMLText = nsResolver.getJCRName(QName.JCR_XMLTEXT);
-            jcrXMLCharacters = nsResolver.getJCRName(QName.JCR_XMLCHARACTERS);
+            jcrPrimaryType = NameFormat.format(QName.JCR_PRIMARYTYPE, nsResolver);
+            jcrMixinTypes = NameFormat.format(QName.JCR_MIXINTYPES, nsResolver);
+            jcrUUID = NameFormat.format(QName.JCR_UUID, nsResolver);
+            jcrRoot = NameFormat.format(QName.JCR_ROOT, nsResolver);
+            jcrXMLText = NameFormat.format(QName.JCR_XMLTEXT, nsResolver);
+            jcrXMLCharacters = NameFormat.format(QName.JCR_XMLCHARACTERS, nsResolver);
         } catch (NameException e) {
             // should never get here...
             String msg = "internal error: failed to resolve namespace mappings";

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/DocViewImportHandler.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/DocViewImportHandler.java?rev=425032&r1=425031&r2=425032&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/DocViewImportHandler.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/DocViewImportHandler.java Mon Jul 24 05:57:21 2006
@@ -19,6 +19,7 @@
 import org.apache.jackrabbit.name.NamespaceResolver;
 import org.apache.jackrabbit.name.NameException;
 import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.name.NameFormat;
 import org.apache.jackrabbit.util.ISO9075;
 import org.xml.sax.Attributes;
 import org.xml.sax.SAXException;
@@ -196,7 +197,7 @@
                     // jcr:primaryType
                     if (attrValue.length() > 0) {
                         try {
-                            nodeTypeName = nsContext.getQName(attrValue);
+                            nodeTypeName = NameFormat.parse(attrValue, nsContext);
                         } catch (NameException ne) {
                             throw new SAXException("illegal jcr:primaryType value: "
                                     + attrValue, ne);
@@ -209,7 +210,7 @@
                         for (int j = 0; j < propValues.length; j++) {
                             String val = ((StringValue) propValues[j]).retrieve();
                             try {
-                                mixinTypes[j] = nsContext.getQName(val);
+                                mixinTypes[j] = NameFormat.parse(val, nsContext);
                             } catch (NameException ne) {
                                 throw new SAXException("illegal jcr:mixinTypes value: "
                                         + val, ne);

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/DocViewSAXEventGenerator.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/DocViewSAXEventGenerator.java?rev=425032&r1=425031&r2=425032&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/DocViewSAXEventGenerator.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/DocViewSAXEventGenerator.java Mon Jul 24 05:57:21 2006
@@ -18,6 +18,7 @@
 
 import org.apache.jackrabbit.name.NameException;
 import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.name.NameFormat;
 import org.apache.jackrabbit.util.ISO9075;
 import org.apache.jackrabbit.value.ValueHelper;
 import org.xml.sax.ContentHandler;
@@ -70,7 +71,7 @@
 
     private QName getQName(String rawName) throws RepositoryException {
         try {
-            return nsResolver.getQName(rawName);
+            return NameFormat.parse(rawName, nsResolver);
         } catch (NameException e) {
             // should never get here...
             String msg = "internal error: failed to resolve namespace mappings";

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/SysViewImportHandler.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/SysViewImportHandler.java?rev=425032&r1=425031&r2=425032&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/SysViewImportHandler.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/SysViewImportHandler.java Mon Jul 24 05:57:21 2006
@@ -20,6 +20,7 @@
 import org.apache.jackrabbit.name.NamespaceResolver;
 import org.apache.jackrabbit.name.UnknownPrefixException;
 import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.name.NameFormat;
 import org.xml.sax.Attributes;
 import org.xml.sax.SAXException;
 
@@ -133,7 +134,7 @@
             // push new ImportState instance onto the stack
             ImportState state = new ImportState();
             try {
-                state.nodeName = nsContext.getQName(name);
+                state.nodeName = NameFormat.parse(name, nsContext);
             } catch (IllegalNameException ine) {
                 throw new SAXException(new InvalidSerializedDataException("illegal node name: " + name, ine));
             } catch (UnknownPrefixException upe) {
@@ -153,7 +154,7 @@
                         "missing mandatory sv:name attribute of element sv:property"));
             }
             try {
-                currentPropName = nsContext.getQName(name);
+                currentPropName = NameFormat.parse(name, nsContext);
             } catch (IllegalNameException ine) {
                 throw new SAXException(new InvalidSerializedDataException("illegal property name: " + name, ine));
             } catch (UnknownPrefixException upe) {
@@ -241,7 +242,7 @@
                 String s = null;
                 try {
                     s = val.retrieve();
-                    state.nodeTypeName = nsContext.getQName(s);
+                    state.nodeTypeName = NameFormat.parse(s, nsContext);
                 } catch (IOException ioe) {
                     throw new SAXException("error while retrieving value", ioe);
                 } catch (IllegalNameException ine) {
@@ -259,7 +260,7 @@
                     String s = null;
                     try {
                         s = val.retrieve();
-                        QName mixin = nsContext.getQName(s);
+                        QName mixin = NameFormat.parse(s, nsContext);
                         state.mixinNames.add(mixin);
                     } catch (IOException ioe) {
                         throw new SAXException("error while retrieving value", ioe);

Modified: jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/ItemInfoImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/ItemInfoImpl.java?rev=425032&r1=425031&r2=425032&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/ItemInfoImpl.java (original)
+++ jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/ItemInfoImpl.java Mon Jul 24 05:57:21 2006
@@ -24,6 +24,7 @@
 import org.apache.jackrabbit.webdav.property.DavPropertySet;
 import org.apache.jackrabbit.name.NameException;
 import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.name.NameFormat;
 import org.apache.jackrabbit.spi.ItemInfo;
 import org.apache.jackrabbit.spi.NodeId;
 import org.apache.jackrabbit.spi.SessionInfo;
@@ -51,7 +52,7 @@
             // TODO: jcrName is transported from jackrabbit-webdav impl
             String jcrName = nameProp.getValue().toString();
             try {
-                name = uriResolver.getQName(jcrName);
+                name = NameFormat.parse(jcrName, uriResolver);
             } catch (NameException e) {
                 throw new RepositoryException("Unable to build ItemInfo object, invalid name found: " + jcrName);
             }

Modified: jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/NodeInfoImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/NodeInfoImpl.java?rev=425032&r1=425031&r2=425032&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/NodeInfoImpl.java (original)
+++ jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/NodeInfoImpl.java Mon Jul 24 05:57:21 2006
@@ -26,6 +26,7 @@
 import org.apache.jackrabbit.webdav.property.DavPropertyName;
 import org.apache.jackrabbit.name.NameException;
 import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.name.NameFormat;
 import org.apache.jackrabbit.spi.NodeInfo;
 import org.apache.jackrabbit.spi.IdIterator;
 import org.apache.jackrabbit.spi.NodeId;
@@ -66,7 +67,7 @@
                 Iterator it = new NodeTypeProperty(propSet.get(ItemResourceConstants.JCR_PRIMARYNODETYPE)).getNodeTypeNames().iterator();
                 if (it.hasNext()) {
                     String jcrName = it.next().toString();
-                    primaryNodeTypeName = uriResolver.getQName(jcrName);
+                    primaryNodeTypeName = NameFormat.parse(jcrName, uriResolver);
                 } else {
                     throw new RepositoryException("Missing primary nodetype for node " + id + ".");
                 }
@@ -80,7 +81,7 @@
                 int i = 0;
                 while(it.hasNext()) {
                     String jcrName = it.next().toString();
-                    mixinNodeTypeNames[i] = uriResolver.getQName(jcrName);
+                    mixinNodeTypeNames[i] = NameFormat.parse(jcrName, uriResolver);
                     i++;
                 }
             }

Modified: jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/QItemDefinitionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/QItemDefinitionImpl.java?rev=425032&r1=425031&r2=425032&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/QItemDefinitionImpl.java (original)
+++ jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/QItemDefinitionImpl.java Mon Jul 24 05:57:21 2006
@@ -20,6 +20,7 @@
 import org.apache.jackrabbit.name.NamespaceResolver;
 import org.apache.jackrabbit.name.NameException;
 import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.name.NameFormat;
 import org.apache.jackrabbit.spi.QItemDefinition;
 import org.apache.jackrabbit.spi.QNodeDefinition;
 import org.apache.jackrabbit.spi.QPropertyDefinition;
@@ -98,7 +99,7 @@
         try {
             // TODO: webdav server sends jcr names -> nsResolver required. improve this.
             if (DomUtil.hasChildElement(itemDefElement, DECLARINGNODETYPE_ATTRIBUTE, null)) {
-                QName dnt = nsResolver.getQName(itemDefElement.getAttribute(DECLARINGNODETYPE_ATTRIBUTE));
+                QName dnt = NameFormat.parse(itemDefElement.getAttribute(DECLARINGNODETYPE_ATTRIBUTE), nsResolver);
                 if (declaringNodeType != null && !declaringNodeType.equals(dnt)) {
                     throw new RepositoryException("Declaring nodetype mismatch: In element = '" + dnt + "', Declaring nodetype = '" + declaringNodeType + "'");
                 }
@@ -110,7 +111,7 @@
             if (itemDefElement.hasAttribute(NAME_ATTRIBUTE)) {
                 String nAttr = itemDefElement.getAttribute(NAME_ATTRIBUTE);
                 if (nAttr.length() > 0) {
-                    name = (isAnyName(nAttr)) ? ANY_NAME : nsResolver.getQName(nAttr);
+                    name = (isAnyName(nAttr)) ? ANY_NAME : NameFormat.parse(nAttr, nsResolver);
                 } else {
                     name = QName.ROOT;
                 }

Modified: jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/QNodeDefinitionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/QNodeDefinitionImpl.java?rev=425032&r1=425031&r2=425032&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/QNodeDefinitionImpl.java (original)
+++ jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/QNodeDefinitionImpl.java Mon Jul 24 05:57:21 2006
@@ -21,6 +21,7 @@
 import org.apache.jackrabbit.name.NameException;
 import org.apache.jackrabbit.spi.QNodeDefinition;
 import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.name.NameFormat;
 import org.apache.jackrabbit.webdav.xml.DomUtil;
 import org.apache.jackrabbit.webdav.xml.ElementIterator;
 
@@ -67,7 +68,7 @@
         try {
 
             if (ndefElement.hasAttribute(DEFAULTPRIMARYTYPE_ATTRIBUTE)) {
-                defaultPrimaryType = nsResolver.getQName(ndefElement.getAttribute(DEFAULTPRIMARYTYPE_ATTRIBUTE));
+                defaultPrimaryType = NameFormat.parse(ndefElement.getAttribute(DEFAULTPRIMARYTYPE_ATTRIBUTE), nsResolver);
             } else {
                 defaultPrimaryType = null;
             }
@@ -77,7 +78,7 @@
                 List qNames = new ArrayList();
                 ElementIterator it = DomUtil.getChildren(reqPrimaryTypes, REQUIREDPRIMARYTYPE_ELEMENT, null);
                 while (it.hasNext()) {
-                    qNames.add(nsResolver.getQName(DomUtil.getTextTrim(it.nextElement())));
+                    qNames.add(NameFormat.parse(DomUtil.getTextTrim(it.nextElement()), nsResolver));
                 }
                 requiredPrimaryTypes = (QName[]) qNames.toArray(new QName[qNames.size()]);
             } else {

Modified: jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/QNodeTypeDefinitionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/QNodeTypeDefinitionImpl.java?rev=425032&r1=425031&r2=425032&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/QNodeTypeDefinitionImpl.java (original)
+++ jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/QNodeTypeDefinitionImpl.java Mon Jul 24 05:57:21 2006
@@ -24,6 +24,7 @@
 import org.apache.jackrabbit.name.NameException;
 import org.apache.jackrabbit.spi.QNodeTypeDefinition;
 import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.name.NameFormat;
 import org.apache.jackrabbit.spi.QPropertyDefinition;
 import org.apache.jackrabbit.spi.QNodeDefinition;
 import org.slf4j.LoggerFactory;
@@ -63,13 +64,13 @@
         // NOTE: the server should send the namespace-mappings as addition ns-defininitions
         try {
         if (ntdElement.hasAttribute(NAME_ATTRIBUTE)) {
-            name = nsResolver.getQName(ntdElement.getAttribute(NAME_ATTRIBUTE));
+            name = NameFormat.parse(ntdElement.getAttribute(NAME_ATTRIBUTE), nsResolver);
         } else {
             name = null;
         }
 
         if (ntdElement.hasAttribute(PRIMARYITEMNAME_ATTRIBUTE)) {
-            primaryItemName = nsResolver.getQName(ntdElement.getAttribute(PRIMARYITEMNAME_ATTRIBUTE));
+            primaryItemName = NameFormat.parse(ntdElement.getAttribute(PRIMARYITEMNAME_ATTRIBUTE), nsResolver);
         } else {
             primaryItemName = null;
         }
@@ -79,7 +80,7 @@
             ElementIterator stIter = DomUtil.getChildren(child, SUPERTYPE_ELEMENT, null);
             List qNames = new ArrayList();
             while (stIter.hasNext()) {
-                QName st = nsResolver.getQName(DomUtil.getTextTrim(stIter.nextElement()));
+                QName st = NameFormat.parse(DomUtil.getTextTrim(stIter.nextElement()), nsResolver);
                 qNames.add(st);
             }
             supertypes = (QName[]) qNames.toArray(new QName[qNames.size()]);

Modified: jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/RepositoryServiceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/RepositoryServiceImpl.java?rev=425032&r1=425031&r2=425032&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/RepositoryServiceImpl.java (original)
+++ jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/RepositoryServiceImpl.java Mon Jul 24 05:57:21 2006
@@ -98,6 +98,7 @@
 import org.apache.jackrabbit.name.Path;
 import org.apache.jackrabbit.name.MalformedPathException;
 import org.apache.jackrabbit.name.PathFormat;
+import org.apache.jackrabbit.name.NameFormat;
 import org.apache.jackrabbit.BaseException;
 import org.apache.jackrabbit.spi.Batch;
 import org.apache.jackrabbit.spi.RepositoryService;
@@ -295,7 +296,7 @@
     private String getItemUri(NodeId parentId, QName childName, SessionInfo sessionInfo) throws RepositoryException {
         String parentUri = getItemUri(parentId, sessionInfo);
         try {
-            return parentUri + getJCRName(childName);
+            return parentUri + NameFormat.format(childName, getNamespaceResolver());
         } catch (NoPrefixDeclaredException e) {
             throw new RepositoryException(e);
         }
@@ -1150,7 +1151,7 @@
         LabelMethod method = null;
         try {
             String uri = getItemUri(versionId, sessionInfo);
-            method = new LabelMethod(uri, getJCRName(label), (moveLabel) ? LabelInfo.TYPE_SET : LabelInfo.TYPE_ADD);
+            method = new LabelMethod(uri, NameFormat.format(label, getNamespaceResolver()), (moveLabel) ? LabelInfo.TYPE_SET : LabelInfo.TYPE_ADD);
             initMethod(method, sessionInfo, true);
 
             getClient(sessionInfo).executeMethod(method);
@@ -1178,7 +1179,7 @@
         LabelMethod method = null;
         try {
             String uri = getItemUri(versionId, sessionInfo);
-            method = new LabelMethod(uri, getJCRName(label), LabelInfo.TYPE_REMOVE);
+            method = new LabelMethod(uri, NameFormat.format(label, getNamespaceResolver()), LabelInfo.TYPE_REMOVE);
             initMethod(method, sessionInfo, true);
 
             getClient(sessionInfo).executeMethod(method);
@@ -1267,7 +1268,7 @@
         }
         for (int i = 0; i < nodeTypeIds.length; i++) {
             try {
-                String ntName = getJCRName(nodeTypeIds[i]);
+                String ntName = NameFormat.format(nodeTypeIds[i], getNamespaceResolver());
                 filters.add(new Filter(ObservationConstants.XML_NODETYPE_NAME, ObservationConstants.NAMESPACE, ntName));
             } catch (NoPrefixDeclaredException e) {
                 throw new RepositoryException(e);
@@ -1527,7 +1528,7 @@
                     index = Integer.parseInt(indexProp.getValue().toString());
                 }
                 try {
-                    QName qName = getQName(jcrName);
+                    QName qName = NameFormat.parse(jcrName, getNamespaceResolver());
                     nodeId = idFactory.createNodeId(parentId, Path.create(qName, index));
                 } catch (NameException e) {
                     throw new RepositoryException(e);
@@ -1574,7 +1575,7 @@
     public PropertyId getPropertyId(NodeId parentId, MultiStatusResponse response) throws RepositoryException {
         try {
             DavPropertySet propSet = response.getProperties(DavServletResponse.SC_OK);
-            QName name = getQName(propSet.get(ItemResourceConstants.JCR_NAME).getValue().toString());
+            QName name = NameFormat.parse(propSet.get(ItemResourceConstants.JCR_NAME).getValue().toString(), getNamespaceResolver());
             PropertyId propertyId = idFactory.createPropertyId(parentId, name);
             return propertyId;
         } catch (BaseException e) {
@@ -1595,7 +1596,7 @@
         NodeId parentId = getNodeId(parentUri, sessionInfo);
         // build property id
         try {
-            PropertyId propertyId = idFactory.createPropertyId(parentId, getQName(propName));
+            PropertyId propertyId = idFactory.createPropertyId(parentId, NameFormat.parse(propName, getNamespaceResolver()));
             return propertyId;
         } catch (NameException e) {
             throw new RepositoryException(e);
@@ -1734,13 +1735,13 @@
 
                     if (nodetypeName != null) {
                         Element propElement = DomUtil.addChildElement(nodeElement, PROPERTY_ELEMENT, SV_NAMESPACE);
-                        DomUtil.setAttribute(propElement, NAME_ATTRIBUTE, SV_NAMESPACE, getJCRName(QName.JCR_PRIMARYTYPE));
+                        DomUtil.setAttribute(propElement, NAME_ATTRIBUTE, SV_NAMESPACE, NameFormat.format(QName.JCR_PRIMARYTYPE, getNamespaceResolver()));
                         DomUtil.setAttribute(propElement, TYPE_ATTRIBUTE, SV_NAMESPACE, PropertyType.nameFromValue(PropertyType.NAME));
-                        DomUtil.addChildElement(propElement, VALUE_ELEMENT, SV_NAMESPACE, getJCRName(nodetypeName));
+                        DomUtil.addChildElement(propElement, VALUE_ELEMENT, SV_NAMESPACE, NameFormat.format(nodetypeName, getNamespaceResolver()));
                     }
                     if (uuid != null) {
                         Element propElement = DomUtil.addChildElement(nodeElement, PROPERTY_ELEMENT, SV_NAMESPACE);
-                        DomUtil.setAttribute(propElement, NAME_ATTRIBUTE, SV_NAMESPACE, getJCRName(QName.JCR_UUID));
+                        DomUtil.setAttribute(propElement, NAME_ATTRIBUTE, SV_NAMESPACE, NameFormat.format(QName.JCR_UUID, getNamespaceResolver()));
                         DomUtil.setAttribute(propElement, TYPE_ATTRIBUTE, SV_NAMESPACE, PropertyType.nameFromValue(PropertyType.STRING));
                         DomUtil.addChildElement(propElement, VALUE_ELEMENT, SV_NAMESPACE, uuid);
                     }
@@ -1991,7 +1992,7 @@
                 } else {
                     String[] ntNames = new String[mixinNodeTypeIds.length];
                     for (int i = 0; i < mixinNodeTypeIds.length; i++) {
-                        ntNames[i] = getJCRName(mixinNodeTypeIds[i]);
+                        ntNames[i] = NameFormat.format(mixinNodeTypeIds[i], getNamespaceResolver());
                     }
                     setProperties = new DavPropertySet();
                     setProperties.add(new NodeTypeProperty(ItemResourceConstants.JCR_MIXINNODETYPES, ntNames, false));



Mime
View raw message