jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r590014 [10/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/jo...
Date Tue, 30 Oct 2007 10:02:57 GMT
Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/AbstractSAXEventGenerator.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/AbstractSAXEventGenerator.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/AbstractSAXEventGenerator.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/AbstractSAXEventGenerator.java Tue Oct 30 03:02:41 2007
@@ -19,11 +19,12 @@
 import java.util.HashMap;
 import java.util.Map;
 
-import org.apache.jackrabbit.name.NameException;
-import org.apache.jackrabbit.name.QName;
-import org.apache.jackrabbit.name.SessionNamespaceResolver;
-import org.apache.jackrabbit.name.NamespaceResolver;
-import org.apache.jackrabbit.name.NameFormat;
+import org.apache.jackrabbit.conversion.NamePathResolver;
+import org.apache.jackrabbit.conversion.DefaultNamePathResolver;
+import org.apache.jackrabbit.spi.Name;
+import org.apache.jackrabbit.namespace.SessionNamespaceResolver;
+import org.apache.jackrabbit.namespace.NamespaceResolver;
+import org.apache.jackrabbit.name.NameConstants;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.xml.sax.ContentHandler;
@@ -36,6 +37,7 @@
 import javax.jcr.PropertyIterator;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
+import javax.jcr.NamespaceException;
 
 /**
  * <code>AbstractSAXEventGenerator</code> serves as the base class for
@@ -66,6 +68,8 @@
      */
     protected final NamespaceResolver nsResolver;
 
+    protected final NamePathResolver resolver;
+
     /**
      * the content handler to feed the SAX events to
      */
@@ -130,16 +134,18 @@
         // start with an empty set of known prefixes
         this.namespaces = new NamespaceStack(null);
 
+        resolver = new DefaultNamePathResolver(nsResolver);
+
         // resolve the names of some wellknown properties
         // allowing for session-local prefix mappings
         try {
-            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) {
+            jcrPrimaryType = resolver.getJCRName(NameConstants.JCR_PRIMARYTYPE);
+            jcrMixinTypes = resolver.getJCRName(NameConstants.JCR_MIXINTYPES);
+            jcrUUID = resolver.getJCRName(NameConstants.JCR_UUID);
+            jcrRoot = resolver.getJCRName(NameConstants.JCR_ROOT);
+            jcrXMLText = resolver.getJCRName(NameConstants.JCR_XMLTEXT);
+            jcrXMLCharacters = resolver.getJCRName(NameConstants.JCR_XMLCHARACTERS);
+        } catch (NamespaceException e) {
             // should never get here...
             String msg = "internal error: failed to resolve namespace mappings";
             log.error(msg, e);
@@ -177,7 +183,7 @@
         String[] prefixes = session.getNamespacePrefixes();
         for (int i = 0; i < prefixes.length; i++) {
             String prefix = prefixes[i];
-            if (QName.NS_XML_PREFIX.equals(prefix)) {
+            if (Name.NS_XML_PREFIX.equals(prefix)) {
                 // skip 'xml' prefix as this would be an illegal namespace declaration
                 continue;
             }
@@ -196,7 +202,7 @@
         String[] prefixes = session.getNamespacePrefixes();
         for (int i = 0; i < prefixes.length; i++) {
             String prefix = prefixes[i];
-            if (QName.NS_XML_PREFIX.equals(prefix)) {
+            if (Name.NS_XML_PREFIX.equals(prefix)) {
                 // skip 'xml' prefix as this would be an illegal namespace declaration
                 continue;
             }
@@ -224,7 +230,7 @@
             String prefix = prefixes[i];
 
             if (prefix.length() > 0
-                    && !QName.NS_XML_PREFIX.equals(prefix)) {
+                    && !Name.NS_XML_PREFIX.equals(prefix)) {
                 String uri = session.getNamespaceURI(prefix);
 
                 // get the matching namespace from previous declarations
@@ -233,9 +239,9 @@
                 if (!uri.equals(mappedToNs)) {
                     // when not the same, add a declaration
                     attributes.addAttribute(
-                        QName.NS_XMLNS_URI,
+                        Name.NS_XMLNS_URI,
                         prefix,
-                        QName.NS_XMLNS_PREFIX + ":" + prefix,
+                        Name.NS_XMLNS_PREFIX + ":" + prefix,
                         "CDATA",
                         uri);
 

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/BufferedStringValue.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/BufferedStringValue.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/BufferedStringValue.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/BufferedStringValue.java Tue Oct 30 03:02:41 2007
@@ -17,11 +17,11 @@
 package org.apache.jackrabbit.core.xml;
 
 import org.apache.jackrabbit.core.value.InternalValue;
-import org.apache.jackrabbit.name.NamespaceResolver;
 import org.apache.jackrabbit.util.Base64;
 import org.apache.jackrabbit.util.TransientFileFactory;
 import org.apache.jackrabbit.value.ValueHelper;
 import org.apache.jackrabbit.value.ValueFactoryImpl;
+import org.apache.jackrabbit.conversion.NamePathResolver;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -81,12 +81,13 @@
      */
     private Writer writer;
 
-    private final NamespaceResolver nsContext;
+    private final NamePathResolver nsContext;
 
     /**
      * Constructs a new empty <code>BufferedStringValue</code>.
+     * @param nsContext
      */
-    protected BufferedStringValue(NamespaceResolver nsContext) {
+    protected BufferedStringValue(NamePathResolver nsContext) {
         buffer = new char[0x2000];
         bufferPos = 0;
         tmpFile = null;
@@ -229,7 +230,7 @@
 
     //--------------------------------------------------------< TextValue >
 
-    public Value getValue(int targetType, NamespaceResolver resolver)
+    public Value getValue(int targetType, NamePathResolver resolver)
             throws ValueFormatException, RepositoryException {
         try {
             if (targetType == PropertyType.NAME

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/DocViewImportHandler.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/DocViewImportHandler.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/DocViewImportHandler.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/DocViewImportHandler.java Tue Oct 30 03:02:41 2007
@@ -17,10 +17,12 @@
 package org.apache.jackrabbit.core.xml;
 
 import org.apache.jackrabbit.core.NodeId;
-import org.apache.jackrabbit.name.NameException;
-import org.apache.jackrabbit.name.NameFormat;
-import org.apache.jackrabbit.name.QName;
-import org.apache.jackrabbit.name.IllegalNameException;
+import org.apache.jackrabbit.conversion.NameException;
+import org.apache.jackrabbit.conversion.NameParser;
+import org.apache.jackrabbit.conversion.IllegalNameException;
+import org.apache.jackrabbit.name.NameConstants;
+import org.apache.jackrabbit.name.NameFactoryImpl;
+import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.util.ISO9075;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -29,6 +31,7 @@
 
 import javax.jcr.PropertyType;
 import javax.jcr.RepositoryException;
+import javax.jcr.NamespaceException;
 import java.io.IOException;
 import java.io.Reader;
 import java.util.ArrayList;
@@ -70,14 +73,16 @@
      * @return the parsed names
      * @throws SAXException if an invalid name was encountered
      */
-    private QName[] parseNames(String value) throws SAXException {
+    private Name[] parseNames(String value) throws SAXException {
         String[] names = value.split("\\p{Space}+");
-        QName[] qnames = new QName[names.length];
+        Name[] qnames = new Name[names.length];
         for (int i = 0; i < names.length; i++) {
             try {
-                qnames[i] = NameFormat.parse(names[i], nsContext);
+                qnames[i] = resolver.getQName(names[i]);
             } catch (NameException ne) {
                 throw new SAXException("Invalid name: " + names[i], ne);
+            } catch (NamespaceException e) {
+                throw new SAXException("Invalid name: " + names[i], e);
             }
         }
         return qnames;
@@ -97,7 +102,7 @@
     private void appendCharacters(char[] ch, int start, int length)
             throws SAXException {
         if (textHandler == null) {
-            textHandler = new BufferedStringValue(nsContext);
+            textHandler = new BufferedStringValue(resolver);
         }
         try {
             textHandler.append(ch, start, length);
@@ -147,12 +152,12 @@
                 }
 
                 NodeInfo node =
-                        new NodeInfo(QName.JCR_XMLTEXT, null, null, null);
+                        new NodeInfo(NameConstants.JCR_XMLTEXT, null, null, null);
                 TextValue[] values =
                         new TextValue[]{textHandler};
                 ArrayList props = new ArrayList();
                 PropInfo prop = new PropInfo(
-                        QName.JCR_XMLCHARACTERS, PropertyType.STRING, values);
+                        NameConstants.JCR_XMLCHARACTERS, PropertyType.STRING, values);
                 props.add(prop);
                 // call Importer
                 importer.startNode(node, props);
@@ -179,14 +184,15 @@
      * @return the decoded and valid jcr name or the original name if it is
      *         not encoded or if the resulting decoded name would be illegal.
      */
-    private QName processName(QName name) {
-        QName decoded = ISO9075.decode(name);
-        if (decoded != name) {
+    private Name processName(Name name) {
+        String decodedLocalName = ISO9075.decode(name.getLocalName());
+        Name decoded = NameFactoryImpl.getInstance().create(name.getNamespaceURI(), decodedLocalName);
+        if (!decoded.equals(name)) {
             // only need to check format of decoded name since
             // an xml name is always a legal jcr name
             // (http://issues.apache.org/jira/browse/JCR-821)
             try {
-                NameFormat.checkFormat(decoded.getLocalName());
+                NameParser.checkFormat(decoded.getLocalName());
                 return decoded;
             } catch (IllegalNameException ine) {
                 // decoded name would be illegal according to jsr 170,
@@ -214,23 +220,23 @@
         processCharacters();
 
         try {
-            QName nodeName = new QName(namespaceURI, localName);
+            Name nodeName = NameFactoryImpl.getInstance().create(namespaceURI, localName);
             // process node name
             nodeName = processName(nodeName);
 
             // properties
             NodeId id = null;
-            QName nodeTypeName = null;
-            QName[] mixinTypes = null;
+            Name nodeTypeName = null;
+            Name[] mixinTypes = null;
 
             ArrayList props = new ArrayList(atts.getLength());
             for (int i = 0; i < atts.getLength(); i++) {
-                if (atts.getURI(i).equals(QName.NS_XMLNS_URI)) {
+                if (atts.getURI(i).equals(Name.NS_XMLNS_URI)) {
                     // skip namespace declarations reported as attributes
                     // see http://issues.apache.org/jira/browse/JCR-620#action_12448164
                     continue;
                 }
-                QName propName = new QName(atts.getURI(i), atts.getLocalName(i));
+                Name propName = NameFactoryImpl.getInstance().create(atts.getURI(i), atts.getLocalName(i));
                 // process property name
                 propName = processName(propName);
 
@@ -244,22 +250,22 @@
                 // see also DocViewSAXEventGenerator#leavingProperties(Node, int)
                 // todo proper multi-value serialization support
                 propValues = new TextValue[1];
-                propValues[0] = new StringValue(attrValue, nsContext);
+                propValues[0] = new StringValue(attrValue, resolver);
 
-                if (propName.equals(QName.JCR_PRIMARYTYPE)) {
+                if (propName.equals(NameConstants.JCR_PRIMARYTYPE)) {
                     // jcr:primaryType
                     if (attrValue.length() > 0) {
                         try {
-                            nodeTypeName = NameFormat.parse(attrValue, nsContext);
+                            nodeTypeName = resolver.getQName(attrValue);
                         } catch (NameException ne) {
                             throw new SAXException("illegal jcr:primaryType value: "
                                     + attrValue, ne);
                         }
                     }
-                } else if (propName.equals(QName.JCR_MIXINTYPES)) {
+                } else if (propName.equals(NameConstants.JCR_MIXINTYPES)) {
                     // jcr:mixinTypes
                     mixinTypes = parseNames(attrValue);
-                } else if (propName.equals(QName.JCR_UUID)) {
+                } else if (propName.equals(NameConstants.JCR_UUID)) {
                     // jcr:uuid
                     if (attrValue.length() > 0) {
                         id = NodeId.valueOf(attrValue);

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/DocViewSAXEventGenerator.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/DocViewSAXEventGenerator.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/DocViewSAXEventGenerator.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/DocViewSAXEventGenerator.java Tue Oct 30 03:02:41 2007
@@ -16,9 +16,8 @@
  */
 package org.apache.jackrabbit.core.xml;
 
-import org.apache.jackrabbit.name.NameException;
-import org.apache.jackrabbit.name.QName;
-import org.apache.jackrabbit.name.NameFormat;
+import org.apache.jackrabbit.conversion.NameException;
+import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.util.ISO9075;
 import org.apache.jackrabbit.value.ValueHelper;
 import org.slf4j.Logger;
@@ -69,9 +68,9 @@
         props = new ArrayList();
     }
 
-    private QName getQName(String rawName) throws RepositoryException {
+    private Name getQName(String rawName) throws RepositoryException {
         try {
-            return NameFormat.parse(rawName, nsResolver);
+            return resolver.getQName(rawName);
         } catch (NameException e) {
             // should never get here...
             String msg = "internal error: failed to resolve namespace mappings";
@@ -154,7 +153,7 @@
 
                 // attribute name (encode property name to make sure it's a valid xml name)
                 String attrName = ISO9075.encode(propName);
-                QName qName = getQName(attrName);
+                Name qName = getQName(attrName);
 
                 // attribute value
                 if (prop.getType() == PropertyType.BINARY && skipBinary) {
@@ -172,7 +171,7 @@
             }
 
             // start element (node)
-            QName qName = getQName(elemName);
+            Name qName = getQName(elemName);
             contentHandler.startElement(qName.getNamespaceURI(),
                     qName.getLocalName(), elemName, attrs);
         }
@@ -200,7 +199,7 @@
         }
 
         // end element (node)
-        QName qName = getQName(elemName);
+        Name qName = getQName(elemName);
         contentHandler.endElement(qName.getNamespaceURI(), qName.getLocalName(),
                 elemName);
     }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/ImportHandler.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/ImportHandler.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/ImportHandler.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/ImportHandler.java Tue Oct 30 03:02:41 2007
@@ -22,8 +22,8 @@
 import javax.jcr.RepositoryException;
 
 import org.apache.jackrabbit.core.NamespaceRegistryImpl;
-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.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.xml.sax.Attributes;
@@ -175,7 +175,7 @@
         if (targetHandler == null) {
             // the namespace of the first element determines the type of XML
             // (system view/document view)
-            if (QName.NS_SV_URI.equals(namespaceURI)) {
+            if (Name.NS_SV_URI.equals(namespaceURI)) {
                 targetHandler = new SysViewImportHandler(importer);
             } else {
                 targetHandler = new DocViewImportHandler(importer);

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/NamespaceContext.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/NamespaceContext.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/NamespaceContext.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/NamespaceContext.java Tue Oct 30 03:02:41 2007
@@ -16,12 +16,7 @@
  */
 package org.apache.jackrabbit.core.xml;
 
-import org.apache.jackrabbit.name.IllegalNameException;
-import org.apache.jackrabbit.name.NameFormat;
-import org.apache.jackrabbit.name.NamespaceResolver;
-import org.apache.jackrabbit.name.NoPrefixDeclaredException;
-import org.apache.jackrabbit.name.QName;
-import org.apache.jackrabbit.name.UnknownPrefixException;
+import org.apache.jackrabbit.namespace.NamespaceResolver;
 
 import javax.jcr.NamespaceException;
 import java.util.HashMap;
@@ -122,16 +117,4 @@
             throw new NamespaceException("Unknown URI: " + uri);
         }
     }
-
-    /** {@inheritDoc} */
-    public String getJCRName(QName name) throws NoPrefixDeclaredException {
-        return NameFormat.format(name, this);
-    }
-
-    /** {@inheritDoc} */
-    public QName getQName(String name)
-            throws IllegalNameException, UnknownPrefixException {
-        return NameFormat.parse(name, this);
-    }
-
 }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/NodeInfo.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/NodeInfo.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/NodeInfo.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/NodeInfo.java Tue Oct 30 03:02:41 2007
@@ -17,7 +17,7 @@
 package org.apache.jackrabbit.core.xml;
 
 import org.apache.jackrabbit.core.NodeId;
-import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.spi.Name;
 
 /**
  * Information about a node being imported. This class is used
@@ -33,17 +33,17 @@
     /**
      * Name of the node being imported.
      */
-    private final QName name;
+    private final Name name;
 
     /**
      * Name of the primary type of the node being imported.
      */
-    private final QName nodeTypeName;
+    private final Name nodeTypeName;
 
     /**
      * Names of the mixin types of the node being imported.
      */
-    private final QName[] mixinNames;
+    private final Name[] mixinNames;
 
     /**
      * Identifier of the node being imported.
@@ -58,7 +58,7 @@
      * @param mixinNames names of the mixin types of the node being imported
      * @param id identifier of the node being imported
      */
-    public NodeInfo(QName name, QName nodeTypeName, QName[] mixinNames,
+    public NodeInfo(Name name, Name nodeTypeName, Name[] mixinNames,
                     NodeId id) {
         this.name = name;
         this.nodeTypeName = nodeTypeName;
@@ -71,7 +71,7 @@
      *
      * @return node name
      */
-    public QName getName() {
+    public Name getName() {
         return name;
     }
 
@@ -80,7 +80,7 @@
      *
      * @return primary type name
      */
-    public QName getNodeTypeName() {
+    public Name getNodeTypeName() {
         return nodeTypeName;
     }
 
@@ -89,7 +89,7 @@
      *
      * @return mixin type names
      */
-    public QName[] getMixinNames() {
+    public Name[] getMixinNames() {
         return mixinNames;
     }
 

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/PropInfo.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/PropInfo.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/PropInfo.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/PropInfo.java Tue Oct 30 03:02:41 2007
@@ -33,8 +33,8 @@
 import org.apache.jackrabbit.core.state.PropertyState;
 import org.apache.jackrabbit.core.util.ReferenceChangeTracker;
 import org.apache.jackrabbit.core.value.InternalValue;
-import org.apache.jackrabbit.name.NamespaceResolver;
-import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.spi.Name;
+import org.apache.jackrabbit.conversion.NamePathResolver;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -58,7 +58,7 @@
     /**
      * Name of the property being imported.
      */
-    private final QName name;
+    private final Name name;
 
     /**
      * Type of the property being imported.
@@ -77,7 +77,7 @@
      * @param type type of the property being imported
      * @param values value(s) of the property being imported
      */
-    public PropInfo(QName name, int type, TextValue[] values) {
+    public PropInfo(Name name, int type, TextValue[] values) {
         this.name = name;
         this.type = type;
         this.values = values;
@@ -115,7 +115,7 @@
     }
 
     public void apply(
-            NodeImpl node, NamespaceResolver resolver,
+            NodeImpl node, NamePathResolver resolver,
             ReferenceChangeTracker refTracker) throws RepositoryException {
         // find applicable definition
         PropDef def = getApplicablePropertyDef(node.getEffectiveNodeType());

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/SessionImporter.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/SessionImporter.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/SessionImporter.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/SessionImporter.java Tue Oct 30 03:02:41 2007
@@ -20,9 +20,11 @@
 import org.apache.jackrabbit.core.SessionImpl;
 import org.apache.jackrabbit.core.NodeId;
 import org.apache.jackrabbit.core.util.ReferenceChangeTracker;
-import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.value.ReferenceValue;
 import org.apache.jackrabbit.uuid.UUID;
+import org.apache.jackrabbit.name.NameFactoryImpl;
+import org.apache.jackrabbit.name.NameConstants;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -81,9 +83,9 @@
     }
 
     protected NodeImpl createNode(NodeImpl parent,
-                                  QName nodeName,
-                                  QName nodeTypeName,
-                                  QName[] mixinNames,
+                                  Name nodeName,
+                                  Name nodeTypeName,
+                                  Name[] mixinNames,
                                   NodeId id)
             throws RepositoryException {
         NodeImpl node;
@@ -102,9 +104,9 @@
                 // assume this property has been imported as well;
                 // rename conflicting property
                 // @todo use better reversible escaping scheme to create unique name
-                QName newName = new QName(nodeName.getNamespaceURI(), nodeName.getLocalName() + "_");
+                Name newName = NameFactoryImpl.getInstance().create(nodeName.getNamespaceURI(), nodeName.getLocalName() + "_");
                 if (parent.hasProperty(newName)) {
-                    newName = new QName(newName.getNamespaceURI(), newName.getLocalName() + "_");
+                    newName = NameFactoryImpl.getInstance().create(newName.getNamespaceURI(), newName.getLocalName() + "_");
                 }
 
                 if (conflicting.getDefinition().isMultiple()) {
@@ -138,7 +140,7 @@
             node = createNode(parent, nodeInfo.getName(),
                     nodeInfo.getNodeTypeName(), nodeInfo.getMixinNames(), null);
             // remember uuid mapping
-            if (node.isNodeType(QName.MIX_REFERENCEABLE)) {
+            if (node.isNodeType(NameConstants.MIX_REFERENCEABLE)) {
                 refTracker.mappedUUID(nodeInfo.getId().getUUID(), node.getNodeId().getUUID());
             }
         } else if (uuidBehavior == ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW) {
@@ -197,9 +199,9 @@
 
         NodeImpl node = null;
         NodeId id = nodeInfo.getId();
-        QName nodeName = nodeInfo.getName();
-        QName ntName = nodeInfo.getNodeTypeName();
-        QName[] mixins = nodeInfo.getMixinNames();
+        Name nodeName = nodeInfo.getName();
+        Name ntName = nodeInfo.getNodeTypeName();
+        Name[] mixins = nodeInfo.getMixinNames();
 
         if (parent == null) {
             // parent node was skipped, skip this child node too
@@ -264,7 +266,7 @@
         Iterator iter = propInfos.iterator();
         while (iter.hasNext()) {
             PropInfo pi = (PropInfo) iter.next();
-            pi.apply(node, session.getNamespaceResolver(), refTracker);
+            pi.apply(node, session.getNamePathResolver(), refTracker);
         }
 
         parents.push(node);

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/StringValue.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/StringValue.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/StringValue.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/StringValue.java Tue Oct 30 03:02:41 2007
@@ -17,10 +17,10 @@
 package org.apache.jackrabbit.core.xml;
 
 import org.apache.jackrabbit.core.value.InternalValue;
-import org.apache.jackrabbit.name.NamespaceResolver;
 import org.apache.jackrabbit.util.Base64;
 import org.apache.jackrabbit.value.ValueHelper;
 import org.apache.jackrabbit.value.ValueFactoryImpl;
+import org.apache.jackrabbit.conversion.NamePathResolver;
 
 import javax.jcr.PropertyType;
 import javax.jcr.RepositoryException;
@@ -36,7 +36,7 @@
 
     private final String value;
 
-    private final NamespaceResolver nsContext;
+    private final NamePathResolver nsContext;
 
     /**
      * Constructs a new <code>StringValue</code> representing the given
@@ -44,14 +44,14 @@
      *
      * @param value
      */
-    protected StringValue(String value, NamespaceResolver nsContext) {
+    protected StringValue(String value, NamePathResolver nsContext) {
         this.value = value;
         this.nsContext = nsContext;
     }
 
     //--------------------------------------------------------< TextValue >
 
-    public Value getValue(int type, NamespaceResolver resolver)
+    public Value getValue(int type, NamePathResolver resolver)
             throws ValueFormatException, RepositoryException {
         if (type == PropertyType.NAME || type == PropertyType.PATH) {
             // NAME and PATH require special treatment because

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/SysViewImportHandler.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/SysViewImportHandler.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/SysViewImportHandler.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/SysViewImportHandler.java Tue Oct 30 03:02:41 2007
@@ -16,9 +16,10 @@
  */
 package org.apache.jackrabbit.core.xml;
 
-import org.apache.jackrabbit.name.NameException;
-import org.apache.jackrabbit.name.QName;
-import org.apache.jackrabbit.name.NameFormat;
+import org.apache.jackrabbit.conversion.NameException;
+import org.apache.jackrabbit.spi.Name;
+import org.apache.jackrabbit.name.NameFactoryImpl;
+import org.apache.jackrabbit.name.NameConstants;
 import org.apache.jackrabbit.core.NodeId;
 import org.xml.sax.Attributes;
 import org.xml.sax.SAXException;
@@ -26,6 +27,7 @@
 import javax.jcr.InvalidSerializedDataException;
 import javax.jcr.PropertyType;
 import javax.jcr.RepositoryException;
+import javax.jcr.NamespaceException;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Iterator;
@@ -47,7 +49,7 @@
     /**
      * fields used temporarily while processing sv:property and sv:value elements
      */
-    private QName currentPropName;
+    private Name currentPropName;
     private int currentPropType = PropertyType.UNDEFINED;
     // list of AppendableValue objects
     private ArrayList currentPropValues = new ArrayList();
@@ -57,7 +59,6 @@
      * Constructs a new <code>SysViewImportHandler</code>.
      *
      * @param importer
-     * @param nsContext
      */
     SysViewImportHandler(Importer importer) {
         super(importer);
@@ -68,10 +69,10 @@
         if (!start && !end) {
             return;
         }
-        QName[] mixinNames = null;
+        Name[] mixinNames = null;
         if (state.mixinNames != null) {
-            mixinNames = (QName[]) state.mixinNames.toArray(
-                    new QName[state.mixinNames.size()]);
+            mixinNames = (Name[]) state.mixinNames.toArray(
+                    new Name[state.mixinNames.size()]);
         }
         NodeId id = null;
         if (state.uuid != null) {
@@ -106,13 +107,13 @@
     public void startElement(String namespaceURI, String localName,
                              String qName, Attributes atts)
             throws SAXException {
-        QName name = new QName(namespaceURI, localName);
+        Name name = NameFactoryImpl.getInstance().create(namespaceURI, localName);
         // check element name
-        if (name.equals(QName.SV_NODE)) {
+        if (name.equals(NameConstants.SV_NODE)) {
             // sv:node element
 
             // node name (value of sv:name attribute)
-            String svName = getAttribute(atts, QName.SV_NAME);
+            String svName = getAttribute(atts, NameConstants.SV_NAME);
             if (name == null) {
                 throw new SAXException(new InvalidSerializedDataException(
                         "missing mandatory sv:name attribute of element sv:node"));
@@ -131,30 +132,34 @@
             // push new ImportState instance onto the stack
             ImportState state = new ImportState();
             try {
-                state.nodeName = NameFormat.parse(svName, nsContext);
+                state.nodeName = resolver.getQName(svName);
             } catch (NameException e) {
                 throw new SAXException(new InvalidSerializedDataException("illegal node name: " + name, e));
+            } catch (NamespaceException e) {
+                throw new SAXException(new InvalidSerializedDataException("illegal node name: " + name, e));
             }
             stack.push(state);
-        } else if (name.equals(QName.SV_PROPERTY)) {
+        } else if (name.equals(NameConstants.SV_PROPERTY)) {
             // sv:property element
 
             // reset temp fields
             currentPropValues.clear();
 
             // property name (value of sv:name attribute)
-            String svName = getAttribute(atts, QName.SV_NAME);
+            String svName = getAttribute(atts, NameConstants.SV_NAME);
             if (name == null) {
                 throw new SAXException(new InvalidSerializedDataException(
                         "missing mandatory sv:name attribute of element sv:property"));
             }
             try {
-                currentPropName = NameFormat.parse(svName, nsContext);
+                currentPropName = resolver.getQName(svName);
             } catch (NameException e) {
                 throw new SAXException(new InvalidSerializedDataException("illegal property name: " + name, e));
+            } catch (NamespaceException e) {
+                throw new SAXException(new InvalidSerializedDataException("illegal property name: " + name, e));
             }
             // property type (sv:type attribute)
-            String type = getAttribute(atts, QName.SV_TYPE);
+            String type = getAttribute(atts, NameConstants.SV_TYPE);
             if (type == null) {
                 throw new SAXException(new InvalidSerializedDataException(
                         "missing mandatory sv:type attribute of element sv:property"));
@@ -165,11 +170,11 @@
                 throw new SAXException(new InvalidSerializedDataException(
                         "Unknown property type: " + type, e));
             }
-        } else if (name.equals(QName.SV_VALUE)) {
+        } else if (name.equals(NameConstants.SV_VALUE)) {
             // sv:value element
 
             // reset temp fields
-            currentPropValue = new BufferedStringValue(nsContext);
+            currentPropValue = new BufferedStringValue(resolver);
         } else {
             throw new SAXException(new InvalidSerializedDataException(
                     "Unexpected element in system view xml document: " + name));
@@ -216,10 +221,10 @@
      */
     public void endElement(String namespaceURI, String localName, String qName)
             throws SAXException {
-        QName name = new QName(namespaceURI, localName);
+        Name name = NameFactoryImpl.getInstance().create(namespaceURI, localName);
         // check element name
         ImportState state = (ImportState) stack.peek();
-        if (name.equals(QName.SV_NODE)) {
+        if (name.equals(NameConstants.SV_NODE)) {
             // sv:node element
             if (!state.started) {
                 // need to start & end current node
@@ -231,23 +236,25 @@
             }
             // pop current state from stack
             stack.pop();
-        } else if (name.equals(QName.SV_PROPERTY)) {
+        } else if (name.equals(NameConstants.SV_PROPERTY)) {
             // sv:property element
 
             // check if all system properties (jcr:primaryType, jcr:uuid etc.)
             // have been collected and create node as necessary
-            if (currentPropName.equals(QName.JCR_PRIMARYTYPE)) {
+            if (currentPropName.equals(NameConstants.JCR_PRIMARYTYPE)) {
                 BufferedStringValue val = (BufferedStringValue) currentPropValues.get(0);
                 String s = null;
                 try {
                     s = val.retrieve();
-                    state.nodeTypeName = NameFormat.parse(s, nsContext);
+                    state.nodeTypeName = resolver.getQName(s);
                 } catch (IOException ioe) {
                     throw new SAXException("error while retrieving value", ioe);
                 } catch (NameException e) {
                     throw new SAXException(new InvalidSerializedDataException("illegal node type name: " + s, e));
+                } catch (NamespaceException e) {
+                    throw new SAXException(new InvalidSerializedDataException("illegal node type name: " + s, e));
                 }
-            } else if (currentPropName.equals(QName.JCR_MIXINTYPES)) {
+            } else if (currentPropName.equals(NameConstants.JCR_MIXINTYPES)) {
                 if (state.mixinNames == null) {
                     state.mixinNames = new ArrayList(currentPropValues.size());
                 }
@@ -257,15 +264,17 @@
                     String s = null;
                     try {
                         s = val.retrieve();
-                        QName mixin = NameFormat.parse(s, nsContext);
+                        Name mixin = resolver.getQName(s);
                         state.mixinNames.add(mixin);
                     } catch (IOException ioe) {
                         throw new SAXException("error while retrieving value", ioe);
                     } catch (NameException e) {
                         throw new SAXException(new InvalidSerializedDataException("illegal mixin type name: " + s, e));
+                    } catch (NamespaceException e) {
+                        throw new SAXException(new InvalidSerializedDataException("illegal mixin type name: " + s, e));
                     }
                 }
-            } else if (currentPropName.equals(QName.JCR_UUID)) {
+            } else if (currentPropName.equals(NameConstants.JCR_UUID)) {
                 BufferedStringValue val = (BufferedStringValue) currentPropValues.get(0);
                 try {
                     state.uuid = val.retrieve();
@@ -281,7 +290,7 @@
             }
             // reset temp fields
             currentPropValues.clear();
-        } else if (name.equals(QName.SV_VALUE)) {
+        } else if (name.equals(NameConstants.SV_VALUE)) {
             // sv:value element
             currentPropValues.add(currentPropValue);
             // reset temp fields
@@ -296,11 +305,11 @@
         /**
          * name of current node
          */
-        QName nodeName;
+        Name nodeName;
         /**
          * primary type of current node
          */
-        QName nodeTypeName;
+        Name nodeTypeName;
         /**
          * list of mixin types of current node
          */
@@ -331,7 +340,7 @@
      * @return attribute value,
      *         or <code>null</code> if the named attribute is not found
      */
-    private static String getAttribute(Attributes attributes, QName name) {
+    private static String getAttribute(Attributes attributes, Name name) {
         return attributes.getValue(name.getNamespaceURI(), name.getLocalName());
     }
 

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/SysViewSAXEventGenerator.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/SysViewSAXEventGenerator.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/SysViewSAXEventGenerator.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/SysViewSAXEventGenerator.java Tue Oct 30 03:02:41 2007
@@ -16,10 +16,12 @@
  */
 package org.apache.jackrabbit.core.xml;
 
-import org.apache.jackrabbit.name.NameResolver;
-import org.apache.jackrabbit.name.ParsingNameResolver;
-import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.conversion.NameResolver;
+import org.apache.jackrabbit.conversion.ParsingNameResolver;
+import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.value.ValueHelper;
+import org.apache.jackrabbit.name.NameFactoryImpl;
+import org.apache.jackrabbit.name.NameConstants;
 import org.xml.sax.Attributes;
 import org.xml.sax.ContentHandler;
 import org.xml.sax.SAXException;
@@ -52,8 +54,8 @@
     private static final Attributes ATTRS_BINARY_ENCODED_VALUE;
     static {
         AttributesImpl attrs = new AttributesImpl();
-        attrs.addAttribute(QName.NS_XMLNS_URI, NS_XMLSCHEMA_INSTANCE_PREFIX, "xmlns:" + NS_XMLSCHEMA_INSTANCE_PREFIX, CDATA_TYPE, NS_XMLSCHEMA_INSTANCE_URI);
-        attrs.addAttribute(QName.NS_XMLNS_URI, NS_XMLSCHEMA_PREFIX, "xmlns:" + NS_XMLSCHEMA_PREFIX, CDATA_TYPE, NS_XMLSCHEMA_URI);
+        attrs.addAttribute(Name.NS_XMLNS_URI, NS_XMLSCHEMA_INSTANCE_PREFIX, "xmlns:" + NS_XMLSCHEMA_INSTANCE_PREFIX, CDATA_TYPE, NS_XMLSCHEMA_INSTANCE_URI);
+        attrs.addAttribute(Name.NS_XMLNS_URI, NS_XMLSCHEMA_PREFIX, "xmlns:" + NS_XMLSCHEMA_PREFIX, CDATA_TYPE, NS_XMLSCHEMA_URI);
         attrs.addAttribute(NS_XMLSCHEMA_INSTANCE_URI, "type", NS_XMLSCHEMA_INSTANCE_PREFIX + ":type", "CDATA", NS_XMLSCHEMA_PREFIX + ":base64Binary");
         ATTRS_BINARY_ENCODED_VALUE = attrs;
     }
@@ -79,7 +81,7 @@
                                     ContentHandler contentHandler)
             throws RepositoryException {
         super(node, noRecurse, skipBinary, contentHandler);
-        resolver = new ParsingNameResolver(nsResolver);
+        resolver = new ParsingNameResolver(NameFactoryImpl.getInstance(), nsResolver);
     }
 
     /**
@@ -99,9 +101,9 @@
             nodeName = node.getName();
         }
 
-        addAttribute(attrs, QName.SV_NAME, CDATA_TYPE, nodeName);
+        addAttribute(attrs, NameConstants.SV_NAME, CDATA_TYPE, nodeName);
         // start node element
-        startElement(QName.SV_NODE, attrs);
+        startElement(NameConstants.SV_NODE, attrs);
     }
 
     /**
@@ -126,7 +128,7 @@
     protected void leaving(Node node, int level)
             throws RepositoryException, SAXException {
         // end node element
-        endElement(QName.SV_NODE);
+        endElement(NameConstants.SV_NODE);
     }
 
     /**
@@ -136,11 +138,11 @@
             throws RepositoryException, SAXException {
         AttributesImpl attrs = new AttributesImpl();
         // name attribute
-        addAttribute(attrs, QName.SV_NAME, CDATA_TYPE, prop.getName());
+        addAttribute(attrs, NameConstants.SV_NAME, CDATA_TYPE, prop.getName());
         // type attribute
         try {
             String typeName = PropertyType.nameFromValue(prop.getType());
-            addAttribute(attrs, QName.SV_TYPE, ENUMERATION_TYPE, typeName);
+            addAttribute(attrs, NameConstants.SV_TYPE, ENUMERATION_TYPE, typeName);
         } catch (IllegalArgumentException e) {
             // should never be getting here
             throw new RepositoryException(
@@ -148,13 +150,13 @@
         }
 
         // start property element
-        startElement(QName.SV_PROPERTY, attrs);
+        startElement(NameConstants.SV_PROPERTY, attrs);
 
         // values
         if (prop.getType() == PropertyType.BINARY && skipBinary) {
             // empty value element
-            startElement(QName.SV_VALUE, new AttributesImpl());
-            endElement(QName.SV_VALUE);
+            startElement(NameConstants.SV_VALUE, new AttributesImpl());
+            endElement(NameConstants.SV_VALUE);
         } else {
             boolean multiValued = prop.getDefinition().isMultiple();
             Value[] vals;
@@ -186,7 +188,7 @@
                 }
 
                 // start value element
-                startElement(QName.SV_VALUE, attributes);
+                startElement(NameConstants.SV_VALUE, attributes);
 
                 // characters
                 Writer writer = new Writer() {
@@ -220,7 +222,7 @@
                 }
 
                 // end value element
-                endElement(QName.SV_VALUE);
+                endElement(NameConstants.SV_VALUE);
 
                 if (mustSendBinary) {
                     contentHandler.endPrefixMapping(NS_XMLSCHEMA_INSTANCE_PREFIX);
@@ -235,14 +237,14 @@
      */
     protected void leaving(Property prop, int level)
             throws RepositoryException, SAXException {
-        endElement(QName.SV_PROPERTY);
+        endElement(NameConstants.SV_PROPERTY);
     }
 
     //-------------------------------------------------------------< private >
 
     /**
      * Adds an attribute to the given XML attribute set. The local part of
-     * the given {@link QName} is assumed to be a valid XML NCName, i.e. it
+     * the given {@link Name} is assumed to be a valid XML NCName, i.e. it
      * won't be encoded.
      *
      * @param attributes the XML attribute set
@@ -252,7 +254,7 @@
      * @throws NamespaceException if the namespace of the attribute is not found
      */
     private void addAttribute(
-            AttributesImpl attributes, QName name, String type, String value)
+            AttributesImpl attributes, Name name, String type, String value)
             throws NamespaceException {
         attributes.addAttribute(
                 name.getNamespaceURI(), name.getLocalName(),
@@ -260,14 +262,14 @@
     }
 
     /**
-     * Starts an XML element. The local part of the given {@link QName} is
+     * Starts an XML element. The local part of the given {@link Name} is
      * assumed to be a valid XML NCName, i.e. it won't be encoded.
      *
      * @param name name of the element
      * @param attributes XML attributes
      * @throws NamespaceException if the namespace of the element is not found
      */
-    private void startElement(QName name, Attributes attributes)
+    private void startElement(Name name, Attributes attributes)
             throws NamespaceException, SAXException {
         contentHandler.startElement(
                 name.getNamespaceURI(), name.getLocalName(),
@@ -275,13 +277,13 @@
     }
 
     /**
-     * Ends an XML element. The local part of the given {@link QName} is
+     * Ends an XML element. The local part of the given {@link Name} is
      * assumed to be a valid XML NCName, i.e. it won't be encoded.
      *
      * @param name name of the element
      * @throws NamespaceException if the namespace of the element is not found
      */
-    private void endElement(QName name)
+    private void endElement(Name name)
             throws NamespaceException, SAXException {
         contentHandler.endElement(
                 name.getNamespaceURI(), name.getLocalName(),

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/TargetImportHandler.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/TargetImportHandler.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/TargetImportHandler.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/TargetImportHandler.java Tue Oct 30 03:02:41 2007
@@ -18,6 +18,8 @@
 
 import org.xml.sax.SAXException;
 import org.xml.sax.helpers.DefaultHandler;
+import org.apache.jackrabbit.conversion.NamePathResolver;
+import org.apache.jackrabbit.conversion.DefaultNamePathResolver;
 
 import java.util.Map;
 
@@ -41,6 +43,8 @@
      */
     protected NamespaceContext nsContext;
 
+    protected NamePathResolver resolver;
+
     protected TargetImportHandler(Importer importer) {
         this.importer = importer;
     }
@@ -87,6 +91,7 @@
      */
     public final void startNamespaceContext(Map mappings) {
         nsContext = new NamespaceContext(nsContext, mappings);
+        resolver = new DefaultNamePathResolver(nsContext);
     }
 
     /**

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/TextValue.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/TextValue.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/TextValue.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/TextValue.java Tue Oct 30 03:02:41 2007
@@ -21,7 +21,7 @@
 import javax.jcr.ValueFormatException;
 
 import org.apache.jackrabbit.core.value.InternalValue;
-import org.apache.jackrabbit.name.NamespaceResolver;
+import org.apache.jackrabbit.conversion.NamePathResolver;
 
 /**
  * <code>TextValue</code> represents a serialized property value read
@@ -29,7 +29,7 @@
  */
 public interface TextValue {
 
-    Value getValue(int type, NamespaceResolver resolver)
+    Value getValue(int type, NamePathResolver resolver)
         throws ValueFormatException, RepositoryException;
 
     InternalValue getInternalValue(int type)

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/WorkspaceImporter.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/WorkspaceImporter.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/WorkspaceImporter.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/WorkspaceImporter.java Tue Oct 30 03:02:41 2007
@@ -32,10 +32,12 @@
 import org.apache.jackrabbit.core.util.ReferenceChangeTracker;
 import org.apache.jackrabbit.core.value.InternalValue;
 import org.apache.jackrabbit.core.version.VersionManager;
-import org.apache.jackrabbit.name.MalformedPathException;
-import org.apache.jackrabbit.name.Path;
-import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.conversion.MalformedPathException;
+import org.apache.jackrabbit.spi.Path;
+import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.uuid.UUID;
+import org.apache.jackrabbit.name.NameFactoryImpl;
+import org.apache.jackrabbit.name.NameConstants;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -156,7 +158,7 @@
                     nodeInfo.getNodeTypeName(), nodeInfo.getMixinNames(), null);
             // remember uuid mapping
             EffectiveNodeType ent = itemOps.getEffectiveNodeType(node);
-            if (ent.includesNodeType(QName.MIX_REFERENCEABLE)) {
+            if (ent.includesNodeType(NameConstants.MIX_REFERENCEABLE)) {
                 refTracker.mappedUUID(nodeInfo.getId().getUUID(), node.getNodeId().getUUID());
             }
         } else if (uuidBehavior == ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW) {
@@ -293,7 +295,7 @@
          * todo FIXME delegate to 'node type instance handler'
          */
         EffectiveNodeType ent = itemOps.getEffectiveNodeType(node);
-        if (ent.includesNodeType(QName.MIX_VERSIONABLE)) {
+        if (ent.includesNodeType(NameConstants.MIX_VERSIONABLE)) {
             /**
              * check if there's already a version history for that
              * node; this would e.g. be the case if a versionable node
@@ -310,22 +312,22 @@
 
             // jcr:versionHistory
             conditionalAddProperty(
-                    node, QName.JCR_VERSIONHISTORY, PropertyType.REFERENCE, false,
+                    node, NameConstants.JCR_VERSIONHISTORY, PropertyType.REFERENCE, false,
                     InternalValue.create(new UUID(history.getUUID())));
 
             // jcr:baseVersion
             conditionalAddProperty(
-                    node, QName.JCR_BASEVERSION, PropertyType.REFERENCE, false,
+                    node, NameConstants.JCR_BASEVERSION, PropertyType.REFERENCE, false,
                     InternalValue.create(new UUID(rootVersion.getUUID())));
 
             // jcr:predecessors
             conditionalAddProperty(
-                    node, QName.JCR_PREDECESSORS, PropertyType.REFERENCE, true,
+                    node, NameConstants.JCR_PREDECESSORS, PropertyType.REFERENCE, true,
                     InternalValue.create(new UUID(rootVersion.getUUID())));
 
             // jcr:isCheckedOut
             conditionalAddProperty(
-                    node, QName.JCR_ISCHECKEDOUT, PropertyType.BOOLEAN, false,
+                    node, NameConstants.JCR_ISCHECKEDOUT, PropertyType.BOOLEAN, false,
                     InternalValue.create(true));
         }
     }
@@ -342,7 +344,7 @@
      * @throws RepositoryException if the property could not be added
      */
     private void conditionalAddProperty(
-            NodeState node, QName name, int type, boolean multiple,
+            NodeState node, Name name, int type, boolean multiple,
             InternalValue value)
             throws RepositoryException {
         if (!node.hasPropertyName(name)) {
@@ -392,9 +394,9 @@
 
             NodeState node = null;
             NodeId id = nodeInfo.getId();
-            QName nodeName = nodeInfo.getName();
-            QName ntName = nodeInfo.getNodeTypeName();
-            QName[] mixins = nodeInfo.getMixinNames();
+            Name nodeName = nodeInfo.getName();
+            Name ntName = nodeInfo.getNodeTypeName();
+            Name[] mixins = nodeInfo.getMixinNames();
 
             if (parent == null) {
                 // parent node was skipped, skip this child node too
@@ -534,7 +536,7 @@
      * @param name name of the node being imported
      * @throws RepositoryException
      */
-    private void resolvePropertyNameConflict(NodeState parent, QName name)
+    private void resolvePropertyNameConflict(NodeState parent, Name name)
             throws RepositoryException {
         PropertyId propId = new PropertyId(parent.getNodeId(), name);
         PropertyState conflicting = itemOps.getPropertyState(propId);
@@ -542,9 +544,9 @@
             // assume this property has been imported as well;
             // rename conflicting property
             // @todo use better reversible escaping scheme to create unique name
-            QName newName = new QName(name.getNamespaceURI(), name.getLocalName() + "_");
+            Name newName = NameFactoryImpl.getInstance().create(name.getNamespaceURI(), name.getLocalName() + "_");
             while (parent.hasPropertyName(newName)) {
-                newName = new QName(newName.getNamespaceURI(), newName.getLocalName() + "_");
+                newName = NameFactoryImpl.getInstance().create(newName.getNamespaceURI(), newName.getLocalName() + "_");
             }
             InternalValue[] values = conflicting.getValues();
             PropertyState newProp = itemOps.createPropertyState(

Modified: jackrabbit/trunk/jackrabbit-core/src/main/javacc/sql/JCRSQL.jjt
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/javacc/sql/JCRSQL.jjt?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/javacc/sql/JCRSQL.jjt (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/javacc/sql/JCRSQL.jjt Tue Oct 30 03:02:41 2007
@@ -41,31 +41,33 @@
  */
 package org.apache.jackrabbit.core.query.sql;
 
-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.NameResolver;
 import org.apache.jackrabbit.core.query.QueryConstants;
+import org.apache.jackrabbit.name.NameFactoryImpl;
+import org.apache.jackrabbit.spi.Name;
+
+import javax.jcr.NamespaceException;
 
 public class JCRSQLParser {
 
   private String statement;
 
-  private NamespaceResolver resolver;
+  private NameResolver resolver;
 
   public static void main(String args[]) throws ParseException {
   	JCRSQLParser parser = new JCRSQLParser(System.in);
   	parser.Query().dump("");
   }
 
-  public static ASTQuery parse(String statement, NamespaceResolver resolver) throws ParseException {
+  public static ASTQuery parse(String statement, NameResolver resolver) throws ParseException {
   	java.io.StringReader sReader = new java.io.StringReader(statement);
   	JCRSQLParser parser = new JCRSQLParser(sReader);
-  	parser.setNamespaceResolver(resolver);
+  	parser.setNameResolver(resolver);
   	return parser.Query();
   }
 
-  void setNamespaceResolver(NamespaceResolver resolver) {
+  void setNameResolver(NameResolver resolver) {
         this.resolver = resolver;
   }
 
@@ -307,7 +309,7 @@
 void Predicate() :
 {
   int operationType;
-  QName identifier;
+  Name identifier;
   String value;
   String escapeString;
 }
@@ -394,9 +396,9 @@
   )
 }
 
-QName PropertyFunction() #void :
+Name PropertyFunction() #void :
 {
-  QName identifier;
+  Name identifier;
 }
 {
   (
@@ -408,9 +410,9 @@
   }
 }
 
-QName LowerFunction() :
+Name LowerFunction() :
 {
-  QName identifier;
+  Name identifier;
 }
 {
   (
@@ -421,9 +423,9 @@
   }
 }
 
-QName UpperFunction() :
+Name UpperFunction() :
 {
-  QName identifier;
+  Name identifier;
 }
 {
   (
@@ -513,7 +515,7 @@
 void ContainsExpression() :
 {
   Token t = null;
-  QName name = null;
+  Name name = null;
 }
 {
   <CONTAINS>
@@ -585,10 +587,10 @@
   }
 }
 
-QName Identifier() :
+Name Identifier() :
 {
   Token t = null;
-  QName name = null;
+  Name name = null;
   boolean pseudoProperty = false;
 }
 {
@@ -600,18 +602,22 @@
           if (pseudoProperty) {
             jcrName += "()";
           }
-          jjtThis.setName(NameFormat.parse(jcrName, resolver));
+          jjtThis.setName(resolver.getQName(jcrName));
         } catch (NameException e) {
           throw new ParseException(e.getMessage());
+        } catch (NamespaceException e) {
+          throw new ParseException(e.getMessage());
         }
       }
   |
     t = <DELIMITED_IDENTIFIER>
       {
         try {
-          jjtThis.setName(NameFormat.parse(t.image.substring(1, t.image.length()-1), resolver));
+          jjtThis.setName(resolver.getQName(t.image.substring(1, t.image.length()-1)));
         } catch (NameException e) {
           throw new ParseException(e.getMessage());
+        } catch (NamespaceException e) {
+          throw new ParseException(e.getMessage());
         }
       }
   |
@@ -634,9 +640,11 @@
       )
       {
         try {
-          jjtThis.setName(NameFormat.parse(t.image, resolver));
+          jjtThis.setName(resolver.getQName(t.image));
         } catch (NameException e) {
           throw new ParseException(e.getMessage());
+        } catch (NamespaceException e) {
+          throw new ParseException(e.getMessage());
         }
       }
     )
@@ -646,12 +654,12 @@
   }
 }
 
-QName ExcerptFunction() :
+Name ExcerptFunction() :
 {}
 {
   <EXCERPT> "(" <PERIOD> ")"
   {
-    return new QName(QName.NS_REP_URI, "excerpt(.)");
+    return NameFactoryImpl.getInstance().create(Name.NS_REP_URI, "excerpt(.)");
   }
 }
 

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/JackrabbitRepositoryStub.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/JackrabbitRepositoryStub.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/JackrabbitRepositoryStub.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/JackrabbitRepositoryStub.java Tue Oct 30 03:02:41 2007
@@ -109,6 +109,7 @@
 
                 repository = (Repository) ctx.lookup(repName);
             } catch (Exception e) {
+                e.printStackTrace();
                 throw new RepositoryStubException(e.toString());
             }
         }

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/NamespaceRegistryImplTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/NamespaceRegistryImplTest.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/NamespaceRegistryImplTest.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/NamespaceRegistryImplTest.java Tue Oct 30 03:02:41 2007
@@ -20,7 +20,7 @@
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 
-import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.spi.Name;
 
 import junit.framework.TestCase;
 
@@ -96,7 +96,7 @@
             fail("safeRegisterNamespace() fails to reregister a namespace");
         }
         try {
-            registry.safeRegisterNamespace(QName.NS_XML_PREFIX, URI3);
+            registry.safeRegisterNamespace(Name.NS_XML_PREFIX, URI3);
         } catch (NamespaceException e) {
             fail("safeRegisterNamespace() fails to handle a reserved prefix");
         }

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/NodeTypeTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/NodeTypeTest.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/NodeTypeTest.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/NodeTypeTest.java Tue Oct 30 03:02:41 2007
@@ -19,8 +19,8 @@
 import org.apache.jackrabbit.core.nodetype.NodeTypeManagerImpl;
 import org.apache.jackrabbit.core.nodetype.NodeTypeRegistry;
 import org.apache.jackrabbit.core.nodetype.compact.CompactNodeTypeDefReader;
-import org.apache.jackrabbit.name.QName;
 import org.apache.jackrabbit.test.AbstractJCRTest;
+import org.apache.jackrabbit.name.NameFactoryImpl;
 
 import java.io.InputStream;
 import java.io.Reader;
@@ -63,7 +63,7 @@
             List ntdList = cndReader.getNodeTypeDefs();
             NodeTypeManagerImpl ntmgr = (NodeTypeManagerImpl) ws.getNodeTypeManager();
             NodeTypeRegistry ntreg = ntmgr.getNodeTypeRegistry();
-            if (!ntreg.isRegistered(new QName("http://namespace.com/ns", "foo" + len))) {
+            if (!ntreg.isRegistered(NameFactoryImpl.getInstance().create("http://namespace.com/ns", "foo" + len))) {
                 ntreg.registerNodeTypes(ntdList);
             }
             Node root = session.getRootNode();

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/nodetype/CyclicNodeTypeRegistrationTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/nodetype/CyclicNodeTypeRegistrationTest.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/nodetype/CyclicNodeTypeRegistrationTest.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/nodetype/CyclicNodeTypeRegistrationTest.java Tue Oct 30 03:02:41 2007
@@ -16,8 +16,11 @@
  */
 package org.apache.jackrabbit.core.nodetype;
 
-import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.name.NameFactoryImpl;
+import org.apache.jackrabbit.name.NameConstants;
 import org.apache.jackrabbit.test.AbstractJCRTest;
+import org.apache.jackrabbit.spi.NameFactory;
+import org.apache.jackrabbit.spi.Name;
 
 import javax.jcr.PropertyType;
 import javax.jcr.RepositoryException;
@@ -54,6 +57,11 @@
     private Collection ntDefCollection;
 
     /**
+     * The name factory
+     */
+    private NameFactory nameFactory;
+
+    /**
      * Sets up the fixture for the test cases.
      */
     protected void setUp() throws Exception {
@@ -62,6 +70,7 @@
 
         session = helper.getReadOnlySession();
         manager = session.getWorkspace().getNodeTypeManager();
+        nameFactory = NameFactoryImpl.getInstance();
 
         // Get the NodeTypeManager from the Workspace.
         // Note that it must be cast from the generic JCR NodeTypeManager to the
@@ -98,21 +107,21 @@
          * + myFooInBar (foo)
          */
         final NodeTypeDef foo = new NodeTypeDef();
-        foo.setName(new QName("", "foo"));
-        foo.setSupertypes(new QName[]{QName.NT_BASE});
+        foo.setName(nameFactory.create("", "foo"));
+        foo.setSupertypes(new Name[]{NameConstants.NT_BASE});
 
         final NodeTypeDef bar = new NodeTypeDef();
-        bar.setName(new QName("", "bar"));
-        bar.setSupertypes(new QName[]{QName.NT_BASE});
+        bar.setName(nameFactory.create("", "bar"));
+        bar.setSupertypes(new Name[]{NameConstants.NT_BASE});
 
         NodeDefImpl myBarInFoo = new NodeDefImpl();
-        myBarInFoo.setRequiredPrimaryTypes(new QName[]{bar.getName()});
-        myBarInFoo.setName(new QName("", "myBarInFoo"));
+        myBarInFoo.setRequiredPrimaryTypes(new Name[]{bar.getName()});
+        myBarInFoo.setName(nameFactory.create("", "myBarInFoo"));
         myBarInFoo.setDeclaringNodeType(foo.getName());
 
         NodeDefImpl myFooInBar = new NodeDefImpl();
-        myFooInBar.setRequiredPrimaryTypes(new QName[]{foo.getName()});
-        myFooInBar.setName(new QName("", "myFooInBar"));
+        myFooInBar.setRequiredPrimaryTypes(new Name[]{foo.getName()});
+        myFooInBar.setName(nameFactory.create("", "myFooInBar"));
         myFooInBar.setDeclaringNodeType(bar.getName());
 
         foo.setChildNodeDefs(new NodeDefImpl[]{myBarInFoo});
@@ -146,13 +155,13 @@
          *
          */
         final NodeTypeDef foo = new NodeTypeDef();
-        foo.setName(new QName("", "foo"));
-        foo.setSupertypes(new QName[]{QName.NT_BASE});
+        foo.setName(nameFactory.create("", "foo"));
+        foo.setSupertypes(new Name[]{NameConstants.NT_BASE});
 
 
         NodeDefImpl myBarInFoo = new NodeDefImpl();
-        myBarInFoo.setRequiredPrimaryTypes(new QName[]{new QName("", "I_am_an_invalid_required_primary_type")});
-        myBarInFoo.setName(new QName("", "myNTInFoo"));
+        myBarInFoo.setRequiredPrimaryTypes(new Name[]{nameFactory.create("", "I_am_an_invalid_required_primary_type")});
+        myBarInFoo.setName(nameFactory.create("", "myNTInFoo"));
         myBarInFoo.setDeclaringNodeType(foo.getName());
 
         foo.setChildNodeDefs(new NodeDefImpl[]{myBarInFoo});
@@ -190,38 +199,38 @@
          */
 
         final NodeTypeDef folder = new NodeTypeDef();
-        folder.setName(new QName("", "Folder"));
+        folder.setName(nameFactory.create("", "Folder"));
 
         final NodeTypeDef cmsObject = new NodeTypeDef();
-        cmsObject.setName(new QName("", "CmsObject"));
-        cmsObject.setSupertypes(new QName[]{QName.NT_BASE});
+        cmsObject.setName(nameFactory.create("", "CmsObject"));
+        cmsObject.setSupertypes(new Name[]{NameConstants.NT_BASE});
         NodeDefImpl parentFolder = new NodeDefImpl();
-        parentFolder.setRequiredPrimaryTypes(new QName[]{folder.getName()});
-        parentFolder.setName(new QName("", "parentFolder"));
+        parentFolder.setRequiredPrimaryTypes(new Name[]{folder.getName()});
+        parentFolder.setName(nameFactory.create("", "parentFolder"));
         parentFolder.setDeclaringNodeType(cmsObject.getName());
         cmsObject.setChildNodeDefs(new NodeDefImpl[]{parentFolder});
 
 
         final NodeTypeDef document = new NodeTypeDef();
-        document.setName(new QName("", "Document"));
-        document.setSupertypes(new QName[]{cmsObject.getName()});
+        document.setName(nameFactory.create("", "Document"));
+        document.setSupertypes(new Name[]{cmsObject.getName()});
         PropDefImpl sizeProp = new PropDefImpl();
-        sizeProp.setName(new QName("", "size"));
+        sizeProp.setName(nameFactory.create("", "size"));
         sizeProp.setRequiredType(PropertyType.LONG);
         sizeProp.setDeclaringNodeType(document.getName());
         document.setPropertyDefs(new PropDef[]{sizeProp});
 
 
-        folder.setSupertypes(new QName[]{cmsObject.getName()});
+        folder.setSupertypes(new Name[]{cmsObject.getName()});
 
         NodeDefImpl folders = new NodeDefImpl();
-        folders.setRequiredPrimaryTypes(new QName[]{folder.getName()});
-        folders.setName(new QName("", "folders"));
+        folders.setRequiredPrimaryTypes(new Name[]{folder.getName()});
+        folders.setName(nameFactory.create("", "folders"));
         folders.setDeclaringNodeType(folder.getName());
 
         NodeDefImpl documents = new NodeDefImpl();
-        documents.setRequiredPrimaryTypes(new QName[]{document.getName()});
-        documents.setName(new QName("", "documents"));
+        documents.setRequiredPrimaryTypes(new Name[]{document.getName()});
+        documents.setName(nameFactory.create("", "documents"));
         documents.setDeclaringNodeType(folder.getName());
 
         folder.setChildNodeDefs(new NodeDefImpl[]{folders, documents});

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/nodetype/compact/CompactNodeTypeDefTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/nodetype/compact/CompactNodeTypeDefTest.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/nodetype/compact/CompactNodeTypeDefTest.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/nodetype/compact/CompactNodeTypeDefTest.java Tue Oct 30 03:02:41 2007
@@ -25,8 +25,12 @@
 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.QName;
-import org.apache.jackrabbit.util.name.NamespaceMapping;
+import org.apache.jackrabbit.name.NameFactoryImpl;
+import org.apache.jackrabbit.namespace.NamespaceMapping;
+import org.apache.jackrabbit.spi.Name;
+import org.apache.jackrabbit.spi.NameFactory;
+import org.apache.jackrabbit.conversion.NamePathResolver;
+import org.apache.jackrabbit.conversion.DefaultNamePathResolver;
 
 import javax.jcr.PropertyType;
 import javax.jcr.version.OnParentVersionAction;
@@ -40,21 +44,22 @@
     private static final String TEST_FILE = "cnd-reader-test-input.cnd";
     private static final String NS_PREFIX = "ex";
     private static final String NS_URI = "http://example.org/jackrabbit/example";
+    private static final NameFactory FACTORY = NameFactoryImpl.getInstance();
 
-    private static final QName NODE_TYPE_NAME = new QName(NS_URI, "NodeType");
-    private static final QName PARENT_NODE_TYPE_1 = new QName(NS_URI, "ParentNodeType1");
-    private static final QName PARENT_NODE_TYPE_2 = new QName(NS_URI, "ParentNodeType2");
-    private static final QName[] SUPERTYPES = new QName[]{PARENT_NODE_TYPE_1, PARENT_NODE_TYPE_2};
+    private static final Name NODE_TYPE_NAME = FACTORY.create(NS_URI, "NodeType");
+    private static final Name PARENT_NODE_TYPE_1 = FACTORY.create(NS_URI, "ParentNodeType1");
+    private static final Name PARENT_NODE_TYPE_2 = FACTORY.create(NS_URI, "ParentNodeType2");
+    private static final Name[] SUPERTYPES = new Name[]{PARENT_NODE_TYPE_1, PARENT_NODE_TYPE_2};
 
-    private static final QName PROPERTY_NAME = new QName(NS_URI, "property");
+    private static final Name PROPERTY_NAME = FACTORY.create(NS_URI, "property");
     private static final long DEFAULT_VALUE_1 = 1;
     private static final long DEFAULT_VALUE_2 = 2;
     private static final String VALUE_CONSTRAINT = "[1,10]";
 
-    private static final QName CHILD_NODE_NAME = new QName(NS_URI, "node");
-    private static final QName REQUIRED_NODE_TYPE_1 = new QName(NS_URI, "RequiredNodeType1");
-    private static final QName REQUIRED_NODE_TYPE_2 = new QName(NS_URI, "RequiredNodeType2");
-    private static final QName[] REQUIRED_NODE_TYPES = new QName[]{REQUIRED_NODE_TYPE_1, REQUIRED_NODE_TYPE_2};
+    private static final Name CHILD_NODE_NAME = FACTORY.create(NS_URI, "node");
+    private static final Name REQUIRED_NODE_TYPE_1 = FACTORY.create(NS_URI, "RequiredNodeType1");
+    private static final Name REQUIRED_NODE_TYPE_2 = FACTORY.create(NS_URI, "RequiredNodeType2");
+    private static final Name[] REQUIRED_NODE_TYPES = new Name[]{REQUIRED_NODE_TYPE_1, REQUIRED_NODE_TYPE_2};
 
     private NodeTypeDef modelNodeTypeDef;
 
@@ -63,7 +68,9 @@
         namespaceMapping.setMapping(NS_PREFIX, NS_URI);
         InternalValue dv1 = InternalValue.create(DEFAULT_VALUE_1);
         InternalValue dv2 = InternalValue.create(DEFAULT_VALUE_2);
-        ValueConstraint vc = ValueConstraint.create(PropertyType.LONG, VALUE_CONSTRAINT, namespaceMapping);
+
+        NamePathResolver resolver = new DefaultNamePathResolver(namespaceMapping);
+        ValueConstraint vc = ValueConstraint.create(PropertyType.LONG, VALUE_CONSTRAINT, resolver);
         InternalValue[] defaultValues = new InternalValue[]{dv1, dv2};
         ValueConstraint[] valueConstraints = new ValueConstraint[]{vc};
 
@@ -109,6 +116,7 @@
             new CompactNodeTypeDefReader(reader, TEST_FILE);
         List ntdList = cndReader.getNodeTypeDefs();
         NamespaceMapping nsm = cndReader.getNamespaceMapping();
+        NamePathResolver resolver = new DefaultNamePathResolver(nsm);
         NodeTypeDef ntd = (NodeTypeDef)ntdList.get(0);
 
         // Test CND Reader by comparing imported NTD with model NTD.
@@ -119,7 +127,7 @@
 
         // Put imported node type def back into CND form with CND writer
         StringWriter sw = new StringWriter();
-        CompactNodeTypeDefWriter.write(ntdList, nsm, sw);
+        CompactNodeTypeDefWriter.write(ntdList, nsm, resolver, sw);
 
         // Rerun the reader on the product of the writer
         cndReader = new CompactNodeTypeDefReader(new StringReader(sw.toString()), TEST_FILE);

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/nodetype/xml/SimpleNamespaceRegistry.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/nodetype/xml/SimpleNamespaceRegistry.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/nodetype/xml/SimpleNamespaceRegistry.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/nodetype/xml/SimpleNamespaceRegistry.java Tue Oct 30 03:02:41 2007
@@ -20,7 +20,7 @@
 
 import javax.jcr.NamespaceRegistry;
 
-import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.spi.Name;
 
 /**
  * Simple utility implementation of the NamespaceRegistry interface.
@@ -38,11 +38,11 @@
      * Creates a simple namespace registry.
      */
     public SimpleNamespaceRegistry() {
-        registerNamespace(QName.NS_JCR_PREFIX, QName.NS_JCR_URI);
-        registerNamespace(QName.NS_MIX_PREFIX, QName.NS_MIX_URI);
-        registerNamespace(QName.NS_NT_PREFIX, QName.NS_NT_URI);
-        registerNamespace(QName.NS_REP_PREFIX, QName.NS_REP_URI);
-        registerNamespace(QName.NS_EMPTY_PREFIX, QName.NS_EMPTY_PREFIX);
+        registerNamespace(Name.NS_JCR_PREFIX, Name.NS_JCR_URI);
+        registerNamespace(Name.NS_MIX_PREFIX, Name.NS_MIX_URI);
+        registerNamespace(Name.NS_NT_PREFIX, Name.NS_NT_URI);
+        registerNamespace(Name.NS_REP_PREFIX, Name.NS_REP_URI);
+        registerNamespace(Name.NS_EMPTY_PREFIX, Name.NS_EMPTY_PREFIX);
     }
 
     /** {@inheritDoc} */

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/nodetype/xml/TestAll.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/nodetype/xml/TestAll.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/nodetype/xml/TestAll.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/nodetype/xml/TestAll.java Tue Oct 30 03:02:41 2007
@@ -26,8 +26,12 @@
 import org.apache.jackrabbit.core.nodetype.NodeTypeDef;
 import org.apache.jackrabbit.core.nodetype.PropDef;
 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.spi.NameFactory;
+import org.apache.jackrabbit.conversion.DefaultNamePathResolver;
+import org.apache.jackrabbit.conversion.NamePathResolver;
+import org.apache.jackrabbit.name.NameFactoryImpl;
 
 import javax.jcr.NamespaceException;
 import javax.jcr.NamespaceRegistry;
@@ -61,6 +65,8 @@
     private static final String TEST_NS_CND_NODETYPES =
         "test_ns_cnd_nodetypes.cnd";
 
+    private static final NameFactory FACTORY = NameFactoryImpl.getInstance();
+
     /** Test node types definitions. */
     private NodeTypeDef[] types;
 
@@ -90,7 +96,7 @@
      * @return node type definition
      */
     private NodeTypeDef getNodeType(String name) {
-        QName qname = new QName(TEST_NAMESPACE, name);
+        Name qname = FACTORY.create(TEST_NAMESPACE, name);
         for (int i = 0; i < types.length; i++) {
             if (qname.equals(types[i].getName())) {
                 return types[i];
@@ -112,9 +118,9 @@
      * @return property definition
      */
     private PropDef getProperty(String typeName, String propertyName) {
-        QName name;
+        Name name;
         if (propertyName != null) {
-            name = new QName(TEST_NAMESPACE, propertyName);
+            name = FACTORY.create(TEST_NAMESPACE, propertyName);
         } else {
             name = PropDef.ANY_NAME;
         }
@@ -141,7 +147,8 @@
     private String getDefaultValue(PropDef def, int index) {
         try {
             InternalValue[] values = def.getDefaultValues();
-            NamespaceResolver resolver = new AdditionalNamespaceResolver(registry);
+            NamespaceResolver nsResolver = new AdditionalNamespaceResolver(registry);
+            NamePathResolver resolver = new DefaultNamePathResolver(nsResolver);
             return values[index].toJCRValue(resolver).getString();
         } catch (RepositoryException e) {
             throw new AssertionFailedError(e.getMessage());
@@ -158,7 +165,7 @@
      * @return child node definition
      */
     private NodeDef getChildNode(String typeName, String nodeName) {
-        QName name = new QName(TEST_NAMESPACE, nodeName);
+        Name name = FACTORY.create(TEST_NAMESPACE, nodeName);
 
         NodeTypeDef def = getNodeType(typeName);
         NodeDef[] defs = def.getChildNodeDefs();
@@ -215,7 +222,7 @@
     public void testItemNodeType() {
         NodeTypeDef def = getNodeType("itemNodeType");
         assertEquals("itemNodeType primaryItemName",
-                new QName(TEST_NAMESPACE, "emptyItem"),
+                FACTORY.create(TEST_NAMESPACE, "emptyItem"),
                 def.getPrimaryItemName());
         assertEquals("itemNodeType propertyDefs",
                 10, def.getPropertyDefs().length);
@@ -537,7 +544,7 @@
     public void testDefaultTypeNode() {
         NodeDef def = getChildNode("childNodeType", "defaultTypeNode");
         assertEquals("defaultTypeNode defaultPrimaryType",
-                new QName(TEST_NAMESPACE, "testType"),
+                FACTORY.create(TEST_NAMESPACE, "testType"),
                 def.getDefaultPrimaryType());
     }
 
@@ -546,12 +553,12 @@
         NodeDef def = getChildNode("childNodeType", "requiredTypeNode");
         assertEquals("requiredTypeNode requiredPrimaryTypes",
                 2, def.getRequiredPrimaryTypes().length);
-        QName[] types = def.getRequiredPrimaryTypes();
+        Name[] types = def.getRequiredPrimaryTypes();
         Arrays.sort(types);
         assertEquals("requiredTypeNode requiredPrimaryTypes[0]",
-                new QName(TEST_NAMESPACE, "baseType"), types[0]);
+                FACTORY.create(TEST_NAMESPACE, "baseType"), types[0]);
         assertEquals("requiredTypeNode requiredPrimaryTypes[1]",
-                new QName(TEST_NAMESPACE, "testType"), types[1]);
+                FACTORY.create(TEST_NAMESPACE, "testType"), types[1]);
     }
 
     /**

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/PathQueryNodeTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/PathQueryNodeTest.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/PathQueryNodeTest.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/PathQueryNodeTest.java Tue Oct 30 03:02:41 2007
@@ -21,36 +21,32 @@
 import junit.framework.TestCase;
 
 import org.apache.jackrabbit.core.query.xpath.XPathQueryBuilder;
-import org.apache.jackrabbit.name.NamespaceResolver;
-import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.namespace.NamespaceResolver;
+import org.apache.jackrabbit.name.NameConstants;
+import org.apache.jackrabbit.spi.Name;
+import org.apache.jackrabbit.conversion.NameResolver;
+import org.apache.jackrabbit.conversion.DefaultNamePathResolver;
 
 public class PathQueryNodeTest extends TestCase {
 
     private static final DefaultQueryNodeFactory QUERY_NODE_FACTORY = new DefaultQueryNodeFactory(
-            Arrays.asList(new QName[] { QName.NT_NODETYPE }));
-    
-    private static final NamespaceResolver JCR_RESOLVER = new NamespaceResolver() {
-        public String getJCRName(QName qName) {
-            throw new UnsupportedOperationException();
-        }
+            Arrays.asList(new Name[] { NameConstants.NT_NODETYPE }));
 
-        public String getPrefix(String uri) {
-            throw new UnsupportedOperationException();
-        }
+    private static final NameResolver JCR_RESOLVER = new DefaultNamePathResolver(new NamespaceResolver() {
 
-        public QName getQName(String jcrName) {
+        public String getPrefix(String uri) {
             throw new UnsupportedOperationException();
         }
-
+        
         public String getURI(String prefix) {
-            if (QName.NS_JCR_PREFIX.equals(prefix))
-                return QName.NS_JCR_URI;
-            if (QName.NS_NT_PREFIX.equals(prefix))
-                return QName.NS_NT_URI;
+            if (Name.NS_JCR_PREFIX.equals(prefix))
+                return Name.NS_JCR_URI;
+            if (Name.NS_NT_PREFIX.equals(prefix))
+                return Name.NS_NT_URI;
             return "";
         }
-    };    
-    
+    });
+
     public void testNeedsSystemTree() throws Exception {
         QueryRootNode queryRootNode = XPathQueryBuilder.createQuery("/jcr:root/*", JCR_RESOLVER, QUERY_NODE_FACTORY);
         assertTrue(queryRootNode.needsSystemTree());
@@ -66,11 +62,11 @@
 
         queryRootNode = XPathQueryBuilder.createQuery("test//*", JCR_RESOLVER, QUERY_NODE_FACTORY);
         assertFalse(queryRootNode.needsSystemTree());
-        
+
         queryRootNode = XPathQueryBuilder.createQuery("//test/*", JCR_RESOLVER, QUERY_NODE_FACTORY);
-        assertTrue(queryRootNode.needsSystemTree());         
+        assertTrue(queryRootNode.needsSystemTree());
     }
-    
+
     public void testNeedsSystemTreeForAllNodesByNodeType() throws Exception {
         QueryRootNode queryRootNode = XPathQueryBuilder.createQuery("//element(*, nt:resource)", JCR_RESOLVER, QUERY_NODE_FACTORY);
         assertFalse(queryRootNode.needsSystemTree());

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/state/ChangeLogTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/state/ChangeLogTest.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/state/ChangeLogTest.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/state/ChangeLogTest.java Tue Oct 30 03:02:41 2007
@@ -17,10 +17,11 @@
 package org.apache.jackrabbit.core.state;
 
 import org.apache.jackrabbit.test.AbstractJCRTest;
-import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.name.NameFactoryImpl;
 import org.apache.jackrabbit.core.PropertyId;
 import org.apache.jackrabbit.core.NodeId;
 import org.apache.jackrabbit.uuid.UUID;
+import org.apache.jackrabbit.spi.NameFactory;
 
 import java.util.Iterator;
 
@@ -30,13 +31,20 @@
  */
 public class ChangeLogTest extends AbstractJCRTest {
 
+    private NameFactory factory;
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        factory = NameFactoryImpl.getInstance();
+    }
+
     /**
      * Add an item state and then delete it. Make sure there is no
      * entry in either the added nor the removed states
      */
     public void testAddDelete() throws Exception {
         PropertyId id = new PropertyId(
-                new NodeId(UUID.randomUUID()), new QName("", "a"));
+                new NodeId(UUID.randomUUID()), factory.create("", "a"));
         ItemState state = new PropertyState(id, ItemState.STATUS_NEW, false);
 
         ChangeLog log = new ChangeLog();
@@ -56,7 +64,7 @@
      */
     public void testAddModify() throws Exception {
         PropertyId id = new PropertyId(
-                new NodeId(UUID.randomUUID()), new QName("", "a"));
+                new NodeId(UUID.randomUUID()), factory.create("", "a"));
         ItemState state = new PropertyState(id, ItemState.STATUS_NEW, false);
 
         ChangeLog log = new ChangeLog();
@@ -78,7 +86,7 @@
         ItemState[] states = new ItemState[10];
         for (int i = 0; i < states.length; i++) {
             PropertyId id = new PropertyId(
-                    new NodeId(UUID.randomUUID()), new QName("", "a" + i));
+                    new NodeId(UUID.randomUUID()), factory.create("", "a" + i));
             states[i] = new PropertyState(id, ItemState.STATUS_NEW, false);
         }
 

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/util/RepositoryLockTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/util/RepositoryLockTest.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/util/RepositoryLockTest.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/util/RepositoryLockTest.java Tue Oct 30 03:02:41 2007
@@ -21,8 +21,6 @@
 
 import javax.jcr.RepositoryException;
 
-import org.apache.jackrabbit.core.util.RepositoryLock;
-
 import junit.framework.TestCase;
 
 /**



Mime
View raw message