jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r590014 [3/11] - in /jackrabbit/trunk: jackrabbit-core/ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/jou...
Date Tue, 30 Oct 2007 10:02:57 GMT
Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/AbstractRecord.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/AbstractRecord.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/AbstractRecord.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/AbstractRecord.java Tue Oct 30 03:02:41 2007
@@ -16,29 +16,28 @@
  */
 package org.apache.jackrabbit.core.journal;
 
-import org.apache.jackrabbit.name.NamespaceResolver;
-import org.apache.jackrabbit.name.QName;
-import org.apache.jackrabbit.name.NameFormat;
-import org.apache.jackrabbit.name.NoPrefixDeclaredException;
-import org.apache.jackrabbit.name.Path;
-import org.apache.jackrabbit.name.PathFormat;
-import org.apache.jackrabbit.name.UnknownPrefixException;
-import org.apache.jackrabbit.name.IllegalNameException;
-import org.apache.jackrabbit.name.MalformedPathException;
+import org.apache.jackrabbit.conversion.MalformedPathException;
+import org.apache.jackrabbit.conversion.NameException;
+import org.apache.jackrabbit.conversion.NamePathResolver;
 import org.apache.jackrabbit.core.NodeId;
 import org.apache.jackrabbit.core.PropertyId;
 import org.apache.jackrabbit.core.nodetype.NodeTypeDef;
-import org.apache.jackrabbit.core.nodetype.compact.CompactNodeTypeDefWriter;
 import org.apache.jackrabbit.core.nodetype.compact.CompactNodeTypeDefReader;
+import org.apache.jackrabbit.core.nodetype.compact.CompactNodeTypeDefWriter;
 import org.apache.jackrabbit.core.nodetype.compact.ParseException;
+import org.apache.jackrabbit.name.PathFactoryImpl;
+import org.apache.jackrabbit.namespace.NamespaceResolver;
+import org.apache.jackrabbit.spi.Name;
+import org.apache.jackrabbit.spi.Path;
 import org.apache.jackrabbit.uuid.Constants;
 import org.apache.jackrabbit.uuid.UUID;
 
-import java.util.ArrayList;
-import java.util.List;
-import java.io.StringWriter;
+import javax.jcr.NamespaceException;
 import java.io.IOException;
 import java.io.StringReader;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.List;
 
 /**
  * Base implementation for a record.
@@ -63,22 +62,28 @@
     /**
      * Namespace resolver.
      */
-    protected final NamespaceResolver resolver;
+    protected final NamespaceResolver nsResolver;
+
+    /**
+     * Name and Path resolver.
+     */
+    protected final NamePathResolver resolver;
 
     /**
      * Create a new instance of this class.
      */
-    public AbstractRecord(NamespaceResolver resolver) {
+    public AbstractRecord(NamespaceResolver nsResolver, NamePathResolver resolver) {
+        this.nsResolver = nsResolver;
         this.resolver = resolver;
     }
 
     /**
      * {@inheritDoc}
      */
-    public void writeQName(QName name) throws JournalException {
+    public void writeQName(Name name) throws JournalException {
         try {
-            writeString(NameFormat.format(name, resolver));
-        } catch (NoPrefixDeclaredException e) {
+            writeString(resolver.getJCRName(name));
+        } catch (NamespaceException e) {
             String msg = "Undeclared prefix error while writing name.";
             throw new JournalException(msg, e);
         }
@@ -87,7 +92,7 @@
     /**
      * {@inheritDoc}
      */
-    public void writePathElement(Path.PathElement element) throws JournalException {
+    public void writePathElement(Path.Element element) throws JournalException {
         writeQName(element.getName());
         writeInt(element.getIndex());
     }
@@ -97,8 +102,8 @@
      */
     public void writePath(Path path) throws JournalException {
         try {
-            writeString(PathFormat.format(path, resolver));
-        } catch (NoPrefixDeclaredException e) {
+            writeString(resolver.getJCRPath(path));
+        } catch (NamespaceException e) {
             String msg = "Undeclared prefix error while writing path.";
             throw new JournalException(msg, e);
         }
@@ -137,7 +142,7 @@
     public void writeNodeTypeDef(NodeTypeDef ntd) throws JournalException {
         try {
             StringWriter sw = new StringWriter();
-            CompactNodeTypeDefWriter writer = new CompactNodeTypeDefWriter(sw, resolver, true);
+            CompactNodeTypeDefWriter writer = new CompactNodeTypeDefWriter(sw, nsResolver, resolver, true);
             writer.write(ntd);
             writer.close();
 
@@ -151,13 +156,13 @@
     /**
      * {@inheritDoc}
      */
-    public QName readQName() throws JournalException {
+    public Name readQName() throws JournalException {
         try {
-            return NameFormat.parse(readString(), resolver);
-        } catch (UnknownPrefixException e) {
+            return resolver.getQName(readString());
+        } catch (NameException e) {
             String msg = "Unknown prefix error while reading name.";
             throw new JournalException(msg, e);
-        } catch (IllegalNameException e) {
+        } catch (NamespaceException e) {
             String msg = "Illegal name error while reading name.";
             throw new JournalException(msg, e);
         }
@@ -166,19 +171,19 @@
     /**
      * {@inheritDoc}
      */
-    public Path.PathElement readPathElement() throws JournalException {
+    public Path.Element readPathElement() throws JournalException {
         try {
-            QName name = NameFormat.parse(readString(), resolver);
+            Name name = resolver.getQName(readString());
             int index = readInt();
             if (index != 0) {
-                return Path.PathElement.create(name, index);
+                return PathFactoryImpl.getInstance().createElement(name, index);
             } else {
-                return Path.PathElement.create(name);
+                return PathFactoryImpl.getInstance().createElement(name);
             }
-        } catch (UnknownPrefixException e) {
+        } catch (NameException e) {
             String msg = "Unknown prefix error while reading path element.";
             throw new JournalException(msg, e);
-        } catch (IllegalNameException e) {
+        } catch (NamespaceException e) {
             String msg = "Illegal name error while reading path element.";
             throw new JournalException(msg, e);
         }
@@ -189,8 +194,14 @@
      */
     public Path readPath() throws JournalException {
         try {
-            return PathFormat.parse(readString(), resolver);
+            return resolver.getQPath(readString());
         } catch (MalformedPathException e) {
+            String msg = "Malformed path error while reading path.";
+            throw new JournalException(msg, e);
+        } catch (NamespaceException e) {
+            String msg = "Malformed path error while reading path.";
+            throw new JournalException(msg, e);
+        } catch (NameException e) {
             String msg = "Malformed path error while reading path.";
             throw new JournalException(msg, e);
         }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/AppendRecord.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/AppendRecord.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/AppendRecord.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/AppendRecord.java Tue Oct 30 03:02:41 2007
@@ -16,8 +16,8 @@
  */
 package org.apache.jackrabbit.core.journal;
 
-import org.slf4j.LoggerFactory;
 import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
@@ -26,8 +26,8 @@
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
-import java.io.InputStream;
 import java.io.IOException;
+import java.io.InputStream;
 
 /**
  * Default temporary record used for appending to some journal.
@@ -106,7 +106,7 @@
      * @param producerId producer identifier
      */
     public AppendRecord(AbstractJournal journal, String producerId) {
-        super(journal.getResolver());
+        super(journal.getResolver(), journal.getNamePathResolver());
 
         this.journal = journal;
         this.producerId = producerId;

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/DatabaseJournal.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/DatabaseJournal.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/DatabaseJournal.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/DatabaseJournal.java Tue Oct 30 03:02:41 2007
@@ -16,21 +16,21 @@
  */
 package org.apache.jackrabbit.core.journal;
 
-import org.apache.jackrabbit.name.NamespaceResolver;
+import org.apache.jackrabbit.namespace.NamespaceResolver;
 import org.apache.jackrabbit.util.Text;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStream;
-import java.io.BufferedReader;
 import java.io.InputStreamReader;
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import java.sql.DriverManager;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.SQLException;
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.DatabaseMetaData;
 import java.sql.Statement;
 
 /**
@@ -292,7 +292,7 @@
             selectRevisionsStmt.execute();
 
             return new DatabaseRecordIterator(
-                    selectRevisionsStmt.getResultSet(), getResolver());
+                    selectRevisionsStmt.getResultSet(), getResolver(), getNamePathResolver());
         } catch (SQLException e) {
             close(true);
 

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/DatabaseRecordIterator.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/DatabaseRecordIterator.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/DatabaseRecordIterator.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/DatabaseRecordIterator.java Tue Oct 30 03:02:41 2007
@@ -16,15 +16,16 @@
  */
 package org.apache.jackrabbit.core.journal;
 
+import org.apache.jackrabbit.conversion.NamePathResolver;
+import org.apache.jackrabbit.namespace.NamespaceResolver;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.apache.jackrabbit.name.NamespaceResolver;
 
-import java.util.NoSuchElementException;
-import java.sql.ResultSet;
-import java.sql.SQLException;
 import java.io.DataInputStream;
 import java.io.IOException;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.NoSuchElementException;
 
 /**
  * RecordIterator interface.
@@ -47,6 +48,11 @@
     private final NamespaceResolver resolver;
 
     /**
+     * Name and Path resolver.
+     */
+    private final NamePathResolver npResolver;
+
+    /**
      * Current record.
      */
     private ReadRecord record;
@@ -64,9 +70,10 @@
     /**
      * Create a new instance of this class.
      */
-    public DatabaseRecordIterator(ResultSet rs, NamespaceResolver resolver) {
+    public DatabaseRecordIterator(ResultSet rs, NamespaceResolver resolver, NamePathResolver npResolver) {
         this.rs = rs;
         this.resolver = resolver;
+        this.npResolver = npResolver;
     }
 
     /**
@@ -131,7 +138,7 @@
             String journalId = rs.getString(2);
             String producerId = rs.getString(3);
             DataInputStream dataIn = new DataInputStream(rs.getBinaryStream(4));
-            record = new ReadRecord(journalId, producerId, revision, dataIn, 0, resolver);
+            record = new ReadRecord(journalId, producerId, revision, dataIn, 0, resolver, npResolver);
         } else {
             isEOF = true;
         }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/FileJournal.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/FileJournal.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/FileJournal.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/FileJournal.java Tue Oct 30 03:02:41 2007
@@ -16,16 +16,16 @@
  */
 package org.apache.jackrabbit.core.journal;
 
+import org.apache.jackrabbit.namespace.NamespaceResolver;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.apache.jackrabbit.name.NamespaceResolver;
 
-import java.util.Arrays;
-import java.util.Comparator;
 import java.io.File;
 import java.io.FilenameFilter;
-import java.io.InputStream;
 import java.io.IOException;
+import java.io.InputStream;
+import java.util.Arrays;
+import java.util.Comparator;
 
 /**
  * File-based journal implementation that appends journal records to a single
@@ -156,7 +156,7 @@
                 }
             });
         }
-        return new FileRecordIterator(logFiles, startRevision, stopRevision, getResolver());
+        return new FileRecordIterator(logFiles, startRevision, stopRevision, getResolver(), getNamePathResolver());
     }
 
     /**

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/FileRecordIterator.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/FileRecordIterator.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/FileRecordIterator.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/FileRecordIterator.java Tue Oct 30 03:02:41 2007
@@ -16,7 +16,8 @@
  */
 package org.apache.jackrabbit.core.journal;
 
-import org.apache.jackrabbit.name.NamespaceResolver;
+import org.apache.jackrabbit.conversion.NamePathResolver;
+import org.apache.jackrabbit.namespace.NamespaceResolver;
 
 import java.io.File;
 import java.io.IOException;
@@ -49,6 +50,11 @@
     private NamespaceResolver resolver;
 
     /**
+     * Name and Path resolver.
+     */
+    private NamePathResolver npResolver;
+
+    /**
      * Current record log, containing file records.
      */
     private FileRecordLog recordLog;
@@ -66,11 +72,12 @@
      * @param stopRevision stop point (inclusive)
      */
     public FileRecordIterator(File[] logFiles, long startRevision, long stopRevision,
-                              NamespaceResolver resolver) {
+                              NamespaceResolver resolver, NamePathResolver npResolver) {
         this.logFiles = logFiles;
         this.revision = startRevision;
         this.stopRevision = stopRevision;
         this.resolver = resolver;
+        this.npResolver = npResolver;
     }
 
 
@@ -117,7 +124,7 @@
         }
 
         try {
-            record = recordLog.read(resolver);
+            record = recordLog.read(resolver, npResolver);
             revision = record.getRevision();
             return record;
         } catch (IOException e) {

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/FileRecordLog.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/FileRecordLog.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/FileRecordLog.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/FileRecordLog.java Tue Oct 30 03:02:41 2007
@@ -16,17 +16,18 @@
  */
 package org.apache.jackrabbit.core.journal;
 
+import org.apache.jackrabbit.conversion.NamePathResolver;
+import org.apache.jackrabbit.namespace.NamespaceResolver;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.apache.jackrabbit.name.NamespaceResolver;
 
-import java.io.File;
-import java.io.DataInputStream;
-import java.io.IOException;
-import java.io.FileInputStream;
 import java.io.BufferedInputStream;
+import java.io.DataInputStream;
 import java.io.DataOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
 import java.io.FileOutputStream;
+import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 
@@ -223,7 +224,7 @@
      * @return file record
      * @throws java.io.IOException if an I/O error occurs
      */
-    public ReadRecord read(NamespaceResolver resolver) throws IOException {
+    public ReadRecord read(NamespaceResolver resolver, NamePathResolver npResolver) throws IOException {
         String journalId = in.readUTF();
         String producerId = in.readUTF();
         int length = in.readInt();
@@ -233,7 +234,7 @@
                 4 + length;
 
         long revision = previousRevision + position;
-        return new ReadRecord(journalId, producerId, revision, in, length, resolver);
+        return new ReadRecord(journalId, producerId, revision, in, length, resolver, npResolver);
     }
 
     /**

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/FileRevision.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/FileRevision.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/FileRevision.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/FileRevision.java Tue Oct 30 03:02:41 2007
@@ -16,8 +16,8 @@
  */
 package org.apache.jackrabbit.core.journal;
 
-import org.slf4j.LoggerFactory;
 import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import java.io.File;
 import java.io.IOException;

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/Journal.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/Journal.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/Journal.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/Journal.java Tue Oct 30 03:02:41 2007
@@ -16,7 +16,7 @@
  */
 package org.apache.jackrabbit.core.journal;
 
-import org.apache.jackrabbit.name.NamespaceResolver;
+import org.apache.jackrabbit.namespace.NamespaceResolver;
 
 /**
  * Generic journal interface.

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/LockableFileRevision.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/LockableFileRevision.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/LockableFileRevision.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/LockableFileRevision.java Tue Oct 30 03:02:41 2007
@@ -16,8 +16,8 @@
  */
 package org.apache.jackrabbit.core.journal;
 
-import org.slf4j.LoggerFactory;
 import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import java.io.File;
 import java.io.IOException;

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/ReadRecord.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/ReadRecord.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/ReadRecord.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/ReadRecord.java Tue Oct 30 03:02:41 2007
@@ -16,11 +16,12 @@
  */
 package org.apache.jackrabbit.core.journal;
 
-import org.apache.jackrabbit.name.QName;
-import org.apache.jackrabbit.name.NamespaceResolver;
+import org.apache.jackrabbit.conversion.NamePathResolver;
+import org.apache.jackrabbit.namespace.NamespaceResolver;
+import org.apache.jackrabbit.spi.Name;
 
-import java.io.IOException;
 import java.io.DataInputStream;
+import java.io.IOException;
 
 /**
  * Record used for reading.
@@ -62,9 +63,9 @@
      */
     public ReadRecord(String journalId, String producerId,
                       long revision, DataInputStream dataIn, int length,
-                      NamespaceResolver resolver) {
+                      NamespaceResolver resolver, NamePathResolver npResolver) {
 
-        super(resolver);
+        super(resolver, npResolver);
 
         this.journalId = journalId;
         this.producerId = producerId;
@@ -244,7 +245,7 @@
         throw unsupported();
     }
 
-    public void writeQName(QName name) throws JournalException {
+    public void writeQName(Name name) throws JournalException {
         throw unsupported();
     }
 

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/Record.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/Record.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/Record.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/Record.java Tue Oct 30 03:02:41 2007
@@ -19,8 +19,8 @@
 import org.apache.jackrabbit.core.NodeId;
 import org.apache.jackrabbit.core.PropertyId;
 import org.apache.jackrabbit.core.nodetype.NodeTypeDef;
-import org.apache.jackrabbit.name.QName;
-import org.apache.jackrabbit.name.Path;
+import org.apache.jackrabbit.spi.Name;
+import org.apache.jackrabbit.spi.Path;
 
 /**
  * Record interface.
@@ -97,20 +97,20 @@
     public void readFully(byte[] b) throws JournalException;
 
     /**
-     * Read a <code>QName</code> frmo the underlying stream.
+     * Read a <code>Name</code> frmo the underlying stream.
      *
      * @return name name
      * @throws JournalException if an error occurs
      */
-    public QName readQName() throws JournalException;
+    public Name readQName() throws JournalException;
 
     /**
-     * Read a <code>Path.PathElement</code> from the underlying stream.
+     * Read a <code>Path.Element</code> from the underlying stream.
      *
      * @return path element
      * @throws JournalException if an error occurs
      */
-    public Path.PathElement readPathElement() throws JournalException;
+    public Path.Element readPathElement() throws JournalException;
 
     /**
      * Read a <code>Path</code> from the underlying stream.
@@ -193,20 +193,20 @@
     public void write(byte[] b) throws JournalException;
 
     /**
-     * Write a <code>QName</code> to the underlying stream.
+     * Write a <code>Name</code> to the underlying stream.
      *
      * @param name name
      * @throws JournalException if an error occurs
      */
-    public void writeQName(QName name) throws JournalException;
+    public void writeQName(Name name) throws JournalException;
 
     /**
-     * Write a <code>Path.PathElement</code> to the underlying stream.
+     * Write a <code>Path.Element</code> to the underlying stream.
      *
      * @param element path element
      * @throws JournalException if an error occurs
      */
-    public void writePathElement(Path.PathElement element) throws JournalException;
+    public void writePathElement(Path.Element element) throws JournalException;
 
     /**
      * Write a <code>Path</code> to the underlying stream.

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/LockManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/LockManager.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/LockManager.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/LockManager.java Tue Oct 30 03:02:41 2007
@@ -18,7 +18,7 @@
 
 import org.apache.jackrabbit.core.NodeImpl;
 import org.apache.jackrabbit.core.SessionImpl;
-import org.apache.jackrabbit.name.Path;
+import org.apache.jackrabbit.spi.Path;
 
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/LockManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/LockManagerImpl.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/LockManagerImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/LockManagerImpl.java Tue Oct 30 03:02:41 2007
@@ -18,26 +18,25 @@
 
 import EDU.oswego.cs.dl.util.concurrent.ReentrantLock;
 import org.apache.commons.collections.map.LinkedMap;
+import org.apache.jackrabbit.conversion.MalformedPathException;
+import org.apache.jackrabbit.conversion.NamePathResolver;
 import org.apache.jackrabbit.core.ItemId;
 import org.apache.jackrabbit.core.NodeId;
 import org.apache.jackrabbit.core.NodeImpl;
-import org.apache.jackrabbit.util.PathMap;
 import org.apache.jackrabbit.core.SessionImpl;
 import org.apache.jackrabbit.core.SessionListener;
-import org.apache.jackrabbit.core.util.Dumpable;
+import org.apache.jackrabbit.core.cluster.ClusterOperation;
 import org.apache.jackrabbit.core.cluster.LockEventChannel;
 import org.apache.jackrabbit.core.cluster.LockEventListener;
-import org.apache.jackrabbit.core.cluster.ClusterOperation;
 import org.apache.jackrabbit.core.fs.FileSystem;
 import org.apache.jackrabbit.core.fs.FileSystemException;
 import org.apache.jackrabbit.core.fs.FileSystemResource;
 import org.apache.jackrabbit.core.observation.EventImpl;
 import org.apache.jackrabbit.core.observation.SynchronousEventListener;
-import org.apache.jackrabbit.name.MalformedPathException;
-import org.apache.jackrabbit.name.NamespaceResolver;
-import org.apache.jackrabbit.name.Path;
-import org.apache.jackrabbit.name.QName;
-import org.apache.jackrabbit.name.PathFormat;
+import org.apache.jackrabbit.core.util.Dumpable;
+import org.apache.jackrabbit.name.NameConstants;
+import org.apache.jackrabbit.name.PathMap;
+import org.apache.jackrabbit.spi.Path;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -101,9 +100,9 @@
     private boolean savingDisabled;
 
     /**
-     * Namespace resolver
+     * Name and Path resolver
      */
-    private final NamespaceResolver nsResolver;
+    private final NamePathResolver resolver;
 
     /**
      * Lock event channel.
@@ -121,7 +120,7 @@
             throws RepositoryException {
 
         this.session = session;
-        this.nsResolver = session.getNamespaceResolver();
+        this.resolver = session.getNamePathResolver();
         this.locksFile = new FileSystemResource(fs, FileSystem.SEPARATOR + LOCKS_FILE);
 
         session.getWorkspace().getObservationManager().
@@ -185,8 +184,8 @@
             Path path = getPath(lockToken.id);
 
             LockInfo info = new LockInfo(lockToken, false,
-                    node.getProperty(QName.JCR_LOCKISDEEP).getBoolean(),
-                    node.getProperty(QName.JCR_LOCKOWNER).getString());
+                    node.getProperty(NameConstants.JCR_LOCKISDEEP).getBoolean(),
+                    node.getProperty(NameConstants.JCR_LOCKOWNER).getString());
             info.setLive(true);
             lockMap.put(path, info);
         } catch (RepositoryException e) {
@@ -826,7 +825,7 @@
 
             try {
                 he = new HierarchyEvent(event.getChildId(),
-                        PathFormat.parse(event.getPath(), nsResolver).getNormalizedPath(),
+                        resolver.getQPath(event.getPath()).getNormalizedPath(),
                         event.getType());
             } catch (MalformedPathException e) {
                 log.info("Unable to get event's path: " + e.getMessage());
@@ -954,7 +953,7 @@
 
     /**
      * Contains information about a lock and gets placed inside the child
-     * information of a {@link org.apache.jackrabbit.util.PathMap}.
+     * information of a {@link org.apache.jackrabbit.name.PathMap}.
      */
     class LockInfo extends AbstractLockInfo implements SessionListener {
 

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/XALockManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/XALockManager.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/XALockManager.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/XALockManager.java Tue Oct 30 03:02:41 2007
@@ -21,7 +21,7 @@
 import org.apache.jackrabbit.core.SessionImpl;
 import org.apache.jackrabbit.core.TransactionContext;
 import org.apache.jackrabbit.core.TransactionException;
-import org.apache.jackrabbit.name.Path;
+import org.apache.jackrabbit.spi.Path;
 
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;

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

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/EffectiveNodeType.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/EffectiveNodeType.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/EffectiveNodeType.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/EffectiveNodeType.java Tue Oct 30 03:02:41 2007
@@ -17,7 +17,7 @@
 package org.apache.jackrabbit.core.nodetype;
 
 import org.apache.jackrabbit.core.value.InternalValue;
-import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.spi.Name;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -88,7 +88,7 @@
             throws NodeTypeConflictException, NoSuchNodeTypeException {
         // create empty effective node type instance
         EffectiveNodeType ent = new EffectiveNodeType();
-        QName ntName = ntd.getName();
+        Name ntName = ntd.getName();
 
         // prepare new instance
         ent.mergedNodeTypes.add(ntName);
@@ -122,7 +122,7 @@
                 ent.unnamedItemDefs.add(cnda[i]);
             } else {
                 // named node definition
-                QName name = cnda[i].getName();
+                Name name = cnda[i].getName();
                 List defs = (List) ent.namedItemDefs.get(name);
                 if (defs == null) {
                     defs = new ArrayList();
@@ -170,7 +170,7 @@
                 ent.unnamedItemDefs.add(pda[i]);
             } else {
                 // named property definition
-                QName name = pda[i].getName();
+                Name name = pda[i].getName();
                 List defs = (List) ent.namedItemDefs.get(name);
                 if (defs == null) {
                     defs = new ArrayList();
@@ -197,7 +197,7 @@
         }
 
         // resolve supertypes recursively
-        QName[] supertypes = ntd.getSupertypes();
+        Name[] supertypes = ntd.getSupertypes();
         if (supertypes.length > 0) {
             EffectiveNodeType base =
                     NodeTypeRegistry.getEffectiveNodeType(supertypes, entCache, ntdCache);
@@ -218,16 +218,16 @@
         return new EffectiveNodeType();
     }
 
-    public QName[] getMergedNodeTypes() {
-        return (QName[]) mergedNodeTypes.toArray(new QName[mergedNodeTypes.size()]);
+    public Name[] getMergedNodeTypes() {
+        return (Name[]) mergedNodeTypes.toArray(new Name[mergedNodeTypes.size()]);
     }
 
-    public QName[] getInheritedNodeTypes() {
-        return (QName[]) inheritedNodeTypes.toArray(new QName[inheritedNodeTypes.size()]);
+    public Name[] getInheritedNodeTypes() {
+        return (Name[]) inheritedNodeTypes.toArray(new Name[inheritedNodeTypes.size()]);
     }
 
-    public QName[] getAllNodeTypes() {
-        return (QName[]) allNodeTypes.toArray(new QName[allNodeTypes.size()]);
+    public Name[] getAllNodeTypes() {
+        return (Name[]) allNodeTypes.toArray(new Name[allNodeTypes.size()]);
     }
 
     public ItemDef[] getAllItemDefs() {
@@ -268,11 +268,11 @@
         return (ItemDef[]) unnamedItemDefs.toArray(new ItemDef[unnamedItemDefs.size()]);
     }
 
-    public boolean hasNamedItemDef(QName name) {
+    public boolean hasNamedItemDef(Name name) {
         return namedItemDefs.containsKey(name);
     }
 
-    public ItemDef[] getNamedItemDefs(QName name) {
+    public ItemDef[] getNamedItemDefs(Name name) {
         List defs = (List) namedItemDefs.get(name);
         if (defs == null || defs.size() == 0) {
             return ItemDef.EMPTY_ARRAY;
@@ -331,7 +331,7 @@
         return (NodeDef[]) defs.toArray(new NodeDef[defs.size()]);
     }
 
-    public NodeDef[] getNamedNodeDefs(QName name) {
+    public NodeDef[] getNamedNodeDefs(Name name) {
         List list = (List) namedItemDefs.get(name);
         if (list == null || list.size() == 0) {
             return NodeDef.EMPTY_ARRAY;
@@ -443,7 +443,7 @@
         return (PropDef[]) defs.toArray(new PropDef[defs.size()]);
     }
 
-    public PropDef[] getNamedPropDefs(QName name) {
+    public PropDef[] getNamedPropDefs(Name name) {
         List list = (List) namedItemDefs.get(name);
         if (list == null || list.size() == 0) {
             return PropDef.EMPTY_ARRAY;
@@ -560,7 +560,7 @@
      * @return <code>true</code> if the given node type is included, otherwise
      *         <code>false</code>
      */
-    public boolean includesNodeType(QName nodeTypeName) {
+    public boolean includesNodeType(Name nodeTypeName) {
         return allNodeTypes.contains(nodeTypeName);
     }
 
@@ -572,7 +572,7 @@
      * @return <code>true</code> if all of the given node types are included,
      *         otherwise <code>false</code>
      */
-    public boolean includesNodeTypes(QName[] nodeTypeNames) {
+    public boolean includesNodeTypes(Name[] nodeTypeNames) {
         return allNodeTypes.containsAll(Arrays.asList(nodeTypeNames));
     }
 
@@ -631,7 +631,7 @@
      * @param name
      * @throws ConstraintViolationException
      */
-    public void checkAddNodeConstraints(QName name)
+    public void checkAddNodeConstraints(Name name)
             throws ConstraintViolationException {
         try {
             getApplicableChildNodeDef(name, null, null);
@@ -649,7 +649,7 @@
      * @throws ConstraintViolationException
      * @throws NoSuchNodeTypeException
      */
-    public void checkAddNodeConstraints(QName name, QName nodeTypeName,
+    public void checkAddNodeConstraints(Name name, Name nodeTypeName,
                                         NodeTypeRegistry ntReg)
             throws ConstraintViolationException, NoSuchNodeTypeException {
         NodeDef nd = getApplicableChildNodeDef(name, nodeTypeName, ntReg);
@@ -674,7 +674,7 @@
      * @throws ConstraintViolationException if no applicable child node definition
      *                                      could be found
      */
-    public NodeDef getApplicableChildNodeDef(QName name, QName nodeTypeName,
+    public NodeDef getApplicableChildNodeDef(Name name, Name nodeTypeName,
                                              NodeTypeRegistry ntReg)
             throws NoSuchNodeTypeException, ConstraintViolationException {
         EffectiveNodeType entTarget;
@@ -752,7 +752,7 @@
      * @throws ConstraintViolationException if no applicable property definition
      *                                      could be found
      */
-    public PropDef getApplicablePropertyDef(QName name, int type,
+    public PropDef getApplicablePropertyDef(Name name, int type,
                                             boolean multiValued)
             throws ConstraintViolationException {
         // try named property definitions first
@@ -777,7 +777,7 @@
      * Returns the applicable property definition for a property with the
      * specified name and type. The multiValued flag is not taken into account
      * in the selection algorithm. Other than
-     * <code>{@link #getApplicablePropertyDef(QName, int, boolean)}</code>
+     * <code>{@link #getApplicablePropertyDef(Name, int, boolean)}</code>
      * this method does not take the multiValued flag into account in the
      * selection algorithm. If there more than one applicable definitions then
      * the following rules are applied:
@@ -794,7 +794,7 @@
      * @throws ConstraintViolationException if no applicable property definition
      *                                      could be found
      */
-    public PropDef getApplicablePropertyDef(QName name, int type)
+    public PropDef getApplicablePropertyDef(Name name, int type)
             throws ConstraintViolationException {
         // try named property definitions first
         PropDef match = getMatchingPropDef(getNamedPropDefs(name), type);
@@ -886,7 +886,7 @@
      * @param name
      * @throws ConstraintViolationException
      */
-    public void checkRemoveItemConstraints(QName name) throws ConstraintViolationException {
+    public void checkRemoveItemConstraints(Name name) throws ConstraintViolationException {
         /**
          * as there might be multiple definitions with the same name and we
          * don't know which one is applicable, we check all of them
@@ -908,7 +908,7 @@
      * @param name
      * @throws ConstraintViolationException
      */
-    public void checkRemoveNodeConstraints(QName name) throws ConstraintViolationException {
+    public void checkRemoveNodeConstraints(Name name) throws ConstraintViolationException {
         /**
          * as there might be multiple definitions with the same name and we
          * don't know which one is applicable, we check all of them
@@ -930,7 +930,7 @@
      * @param name
      * @throws ConstraintViolationException
      */
-    public void checkRemovePropertyConstraints(QName name) throws ConstraintViolationException {
+    public void checkRemovePropertyConstraints(Name name) throws ConstraintViolationException {
         /**
          * as there might be multiple definitions with the same name and we
          * don't know which one is applicable, we check all of them
@@ -982,7 +982,7 @@
      */
     private synchronized void internalMerge(EffectiveNodeType other, boolean supertype)
             throws NodeTypeConflictException {
-        QName[] nta = other.getAllNodeTypes();
+        Name[] nta = other.getAllNodeTypes();
         int includedCount = 0;
         for (int i = 0; i < nta.length; i++) {
             if (includesNodeType(nta[i])) {
@@ -1004,7 +1004,7 @@
                 // ignore redundant definitions
                 continue;
             }
-            QName name = def.getName();
+            Name name = def.getName();
             List existingDefs = (List) namedItemDefs.get(name);
             if (existingDefs != null) {
                 if (existingDefs.size() > 0) {

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/EffectiveNodeTypeCache.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/EffectiveNodeTypeCache.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/EffectiveNodeTypeCache.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/EffectiveNodeTypeCache.java Tue Oct 30 03:02:41 2007
@@ -17,7 +17,7 @@
 package org.apache.jackrabbit.core.nodetype;
 
 import org.apache.jackrabbit.core.util.Dumpable;
-import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.spi.Name;
 
 /**
  * <code>EffectiveNodeTypeCache</code> defines the interface for a cache for
@@ -61,14 +61,14 @@
      * @param ntNames the array of node type names for the effective node type
      * @return the key to an effective node type.
      */
-    Key getKey(QName[] ntNames);
+    Key getKey(Name[] ntNames);
 
     /**
      * Removes all effective node types that are aggregated with the node type
      * of the given name.
      * @param name the name of the node type.
      */
-    void invalidate(QName name);
+    void invalidate(Name name);
 
     /**
      * {@inheritDoc}
@@ -96,7 +96,7 @@
          * Returns the node type names of this key.
          * @return the node type names of this key.
          */
-        QName[] getNames();
+        Name[] getNames();
 
         /**
          * Checks if the <code>otherKey</code> is contained in this one. I.e. if

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/EffectiveNodeTypeCacheImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/EffectiveNodeTypeCacheImpl.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/EffectiveNodeTypeCacheImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/EffectiveNodeTypeCacheImpl.java Tue Oct 30 03:02:41 2007
@@ -16,7 +16,7 @@
  */
 package org.apache.jackrabbit.core.nodetype;
 
-import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.spi.Name;
 
 import java.io.PrintStream;
 import java.util.Arrays;
@@ -55,7 +55,7 @@
     /**
      * {@inheritDoc}
      */
-    public Key getKey(QName[] ntNames) {
+    public Key getKey(Name[] ntNames) {
         return new WeightedKey(ntNames);
     }
 
@@ -124,7 +124,7 @@
     /**
      * {@inheritDoc}
      */
-    public void invalidate(QName name) {
+    public void invalidate(Name name) {
         // remove all affected effective node types from aggregates cache
         // (copy keys first to prevent ConcurrentModificationException)
         ArrayList keys = new ArrayList(sortedKeys);
@@ -220,7 +220,7 @@
         /**
          * array of node type names, sorted in ascending order
          */
-        private final QName[] names;
+        private final Name[] names;
 
         /**
          * the weight of this key
@@ -230,7 +230,7 @@
         /**
          * @param ntNames
          */
-        WeightedKey(QName[] ntNames) {
+        WeightedKey(Name[] ntNames) {
             this(ntNames, ntNames.length);
         }
 
@@ -238,9 +238,9 @@
          * @param ntNames
          * @param weight
          */
-        WeightedKey(QName[] ntNames, int weight) {
+        WeightedKey(Name[] ntNames, int weight) {
             this.weight = weight;
-            names = new QName[ntNames.length];
+            names = new Name[ntNames.length];
             System.arraycopy(ntNames, 0, names, 0, names.length);
             Arrays.sort(names);
         }
@@ -257,13 +257,13 @@
          * @param weight
          */
         WeightedKey(Collection ntNames, int weight) {
-            this((QName[]) ntNames.toArray(new QName[ntNames.size()]), weight);
+            this((Name[]) ntNames.toArray(new Name[ntNames.size()]), weight);
         }
 
         /**
          * @return the node type names of this key
          */
-        public QName[] getNames() {
+        public Name[] getNames() {
             return names;
         }
 
@@ -316,8 +316,8 @@
             int len = Math.min(len1, len2);
 
             for (int i = 0; i < len; i++) {
-                QName name1 = names[i];
-                QName name2 = other.names[i];
+                Name name1 = names[i];
+                Name name2 = other.names[i];
                 int result = name1.compareTo(name2);
                 if (result != 0) {
                     return result;

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/ItemDef.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/ItemDef.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/ItemDef.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/ItemDef.java Tue Oct 30 03:02:41 2007
@@ -16,11 +16,12 @@
  */
 package org.apache.jackrabbit.core.nodetype;
 
-import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.spi.Name;
+import org.apache.jackrabbit.name.NameConstants;
 
 /**
  * <code>ItemDef</code> is the internal representation of
- * an item definition. It refers to <code>QName</code>s only
+ * an item definition. It refers to <code>Name</code>s only
  * and is thus isolated from session-specific namespace mappings.
  *
  * @see javax.jcr.nodetype.ItemDefinition
@@ -32,21 +33,21 @@
     /**
      * The special wildcard name used as the name of residual item definitions.
      */
-    QName ANY_NAME = new QName("", "*");
+    Name ANY_NAME = NameConstants.ANY_NAME;
 
     /**
      * Gets the name of the child item.
      *
      * @return the name of the child item.
      */
-    QName getName();
+    Name getName();
 
     /**
      * Gets the name of the declaring node type.
      *
      * @return the name of the declaring node type.
      */
-    QName getDeclaringNodeType();
+    Name getDeclaringNodeType();
 
     /**
      * Determines whether the item is 'autoCreated'.

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/ItemDefImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/ItemDefImpl.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/ItemDefImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/ItemDefImpl.java Tue Oct 30 03:02:41 2007
@@ -16,7 +16,7 @@
  */
 package org.apache.jackrabbit.core.nodetype;
 
-import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.spi.Name;
 
 import javax.jcr.version.OnParentVersionAction;
 
@@ -30,12 +30,12 @@
     /**
      * The name of the child item.
      */
-    private QName name = ItemDef.ANY_NAME;
+    private Name name = ItemDef.ANY_NAME;
 
     /**
      * The name of the declaring node type.
      */
-    protected QName declaringNodeType = null;
+    protected Name declaringNodeType = null;
 
     /**
      * The 'autoCreated' flag.
@@ -69,7 +69,7 @@
      * @param declaringNodeType name of the declaring node type (must not be
      *                          <code>null</code>)
      */
-    public void setDeclaringNodeType(QName declaringNodeType) {
+    public void setDeclaringNodeType(Name declaringNodeType) {
         if (declaringNodeType == null) {
             throw new IllegalArgumentException("declaringNodeType can not be null");
         }
@@ -81,7 +81,7 @@
      *
      * @param name name of child item (must not be  <code>null</code>)
      */
-    public void setName(QName name) {
+    public void setName(Name name) {
         if (name == null) {
             throw new IllegalArgumentException("name can not be null");
         }
@@ -136,14 +136,14 @@
     /**
      * {@inheritDoc}
      */
-    public QName getDeclaringNodeType() {
+    public Name getDeclaringNodeType() {
         return declaringNodeType;
     }
 
     /**
      * {@inheritDoc}
      */
-    public QName getName() {
+    public Name getName() {
         return name;
     }
 

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/ItemDefinitionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/ItemDefinitionImpl.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/ItemDefinitionImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/ItemDefinitionImpl.java Tue Oct 30 03:02:41 2007
@@ -16,21 +16,20 @@
  */
 package org.apache.jackrabbit.core.nodetype;
 
-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.conversion.NamePathResolver;
+import org.apache.jackrabbit.spi.Name;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import javax.jcr.nodetype.ItemDefinition;
 import javax.jcr.nodetype.NoSuchNodeTypeException;
 import javax.jcr.nodetype.NodeType;
+import javax.jcr.NamespaceException;
 
 /**
  * This class implements the <code>ItemDefinition</code> interface.
  * All method calls are delegated to the wrapped {@link ItemDef},
- * performing the translation from <code>QName</code>s to JCR names
+ * performing the translation from <code>Name</code>s to JCR names
  * (and vice versa) where necessary.
  */
 abstract class ItemDefinitionImpl implements ItemDefinition {
@@ -51,9 +50,9 @@
     protected final NodeTypeManagerImpl ntMgr;
 
     /**
-     * The namespace resolver used to translate qualified names to JCR names.
+     * The name/path resolver used to translate qualified names to JCR names.
      */
-    protected final NamespaceResolver nsResolver;
+    protected final NamePathResolver resolver;
 
     /**
      * The wrapped item definition.
@@ -65,13 +64,13 @@
      *
      * @param itemDef    item definition
      * @param ntMgr      node type manager
-     * @param nsResolver namespace resolver
+     * @param resolver
      */
     ItemDefinitionImpl(ItemDef itemDef, NodeTypeManagerImpl ntMgr,
-                       NamespaceResolver nsResolver) {
+                       NamePathResolver resolver) {
         this.itemDef = itemDef;
         this.ntMgr = ntMgr;
-        this.nsResolver = nsResolver;
+        this.resolver = resolver;
     }
 
     /**
@@ -84,13 +83,13 @@
     }
 
     /**
-     * Gets the <code>QName</code> of the child item. It is an error to
+     * Gets the <code>Name</code> of the child item. It is an error to
      * call this method if this is a residual item definition.
      *
-     * @return the <code>QName</code> of the child item.
+     * @return the <code>Name</code> of the child item.
      * @see #getName()
      */
-    public QName getQName() {
+    public Name getQName() {
         return itemDef.getName();
     }
 
@@ -116,11 +115,11 @@
             return ANY_NAME;
         } else {
             try {
-                return NameFormat.format(itemDef.getName(), nsResolver);
-            } catch (NoPrefixDeclaredException npde) {
+                return resolver.getJCRName(itemDef.getName());
+            } catch (NamespaceException e) {
                 // should never get here
                 log.error("encountered unregistered namespace in item name",
-                        npde);
+                        e);
                 // not correct, but an acceptable fallback
                 return itemDef.getName().toString();
             }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeDef.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeDef.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeDef.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeDef.java Tue Oct 30 03:02:41 2007
@@ -16,11 +16,11 @@
  */
 package org.apache.jackrabbit.core.nodetype;
 
-import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.spi.Name;
 
 /**
  * <code>NodeDef</code> is the internal representation of
- * a node definition. It refers to <code>QName</code>s only
+ * a node definition. It refers to <code>Name</code>s only
  * and is thus isolated from session-specific namespace mappings.
  *
  * @see javax.jcr.nodetype.NodeDefinition
@@ -41,14 +41,14 @@
      *
      * @return the name of the default primary type.
      */
-    QName getDefaultPrimaryType();
+    Name getDefaultPrimaryType();
 
     /**
      * Returns the array of names of the required primary types.
      *
      * @return the array of names of the required primary types.
      */
-    QName[] getRequiredPrimaryTypes();
+    Name[] getRequiredPrimaryTypes();
 
     /**
      * Reports whether this node can have same-name siblings.

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeDefId.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeDefId.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeDefId.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeDefId.java Tue Oct 30 03:02:41 2007
@@ -16,7 +16,7 @@
  */
 package org.apache.jackrabbit.core.nodetype;
 
-import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.spi.Name;
 
 import java.io.Serializable;
 import java.util.Arrays;
@@ -63,7 +63,7 @@
 
         // required node type names, sorted in ascending order
         // format: "[name1, name2, name3]", see AbstractCollection#toString()
-        QName[] names = def.getRequiredPrimaryTypes();
+        Name[] names = def.getRequiredPrimaryTypes();
         Arrays.sort(names);
         sb.append('[');
         for (int i = 0; i < names.length; i++) {

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeDefImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeDefImpl.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeDefImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeDefImpl.java Tue Oct 30 03:02:41 2007
@@ -16,7 +16,8 @@
  */
 package org.apache.jackrabbit.core.nodetype;
 
-import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.spi.Name;
+import org.apache.jackrabbit.name.NameConstants;
 
 import java.util.Arrays;
 import java.util.HashSet;
@@ -30,7 +31,7 @@
     /**
      * The name of the default primary type.
      */
-    private QName defaultPrimaryType;
+    private Name defaultPrimaryType;
 
     /**
      * The names of the required primary types.
@@ -55,7 +56,7 @@
     public NodeDefImpl() {
         defaultPrimaryType = null;
         requiredPrimaryTypes = new HashSet();
-        requiredPrimaryTypes.add(QName.NT_BASE);
+        requiredPrimaryTypes.add(NameConstants.NT_BASE);
         allowsSameNameSiblings = false;
         id = null;
     }
@@ -65,7 +66,7 @@
      *
      * @param defaultNodeType
      */
-    public void setDefaultPrimaryType(QName defaultNodeType) {
+    public void setDefaultPrimaryType(Name defaultNodeType) {
         // reset id field in order to force lazy recomputation of identifier
         id = null;
         this.defaultPrimaryType = defaultNodeType;
@@ -76,7 +77,7 @@
      *
      * @param requiredPrimaryTypes
      */
-    public void setRequiredPrimaryTypes(QName[] requiredPrimaryTypes) {
+    public void setRequiredPrimaryTypes(Name[] requiredPrimaryTypes) {
         if (requiredPrimaryTypes == null) {
             throw new IllegalArgumentException("requiredPrimaryTypes can not be null");
         }
@@ -101,7 +102,7 @@
     /**
      * {@inheritDoc}
      */
-    public void setDeclaringNodeType(QName declaringNodeType) {
+    public void setDeclaringNodeType(Name declaringNodeType) {
         // reset id field in order to force lazy recomputation of identifier
         id = null;
         super.setDeclaringNodeType(declaringNodeType);
@@ -110,7 +111,7 @@
     /**
      * {@inheritDoc}
      */
-    public void setName(QName name) {
+    public void setName(Name name) {
         // reset id field in order to force lazy recomputation of identifier
         id = null;
         super.setName(name);
@@ -171,19 +172,19 @@
     /**
      * {@inheritDoc}
      */
-    public QName getDefaultPrimaryType() {
+    public Name getDefaultPrimaryType() {
         return defaultPrimaryType;
     }
 
     /**
      * {@inheritDoc}
      */
-    public QName[] getRequiredPrimaryTypes() {
+    public Name[] getRequiredPrimaryTypes() {
         if (requiredPrimaryTypes.isEmpty()) {
-            return QName.EMPTY_ARRAY;
+            return Name.EMPTY_ARRAY;
         }
-        return (QName[]) requiredPrimaryTypes.toArray(
-                new QName[requiredPrimaryTypes.size()]);
+        return (Name[]) requiredPrimaryTypes.toArray(
+                new Name[requiredPrimaryTypes.size()]);
     }
 
     /**

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeDefinitionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeDefinitionImpl.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeDefinitionImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeDefinitionImpl.java Tue Oct 30 03:02:41 2007
@@ -16,21 +16,21 @@
  */
 package org.apache.jackrabbit.core.nodetype;
 
-import org.apache.jackrabbit.name.NamespaceResolver;
-import org.apache.jackrabbit.name.QName;
-import org.apache.jackrabbit.name.NameFormat;
-import org.apache.jackrabbit.name.NoPrefixDeclaredException;
+import org.apache.jackrabbit.spi.Name;
+import org.apache.jackrabbit.name.NameConstants;
+import org.apache.jackrabbit.conversion.NamePathResolver;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import javax.jcr.nodetype.NoSuchNodeTypeException;
 import javax.jcr.nodetype.NodeDefinition;
 import javax.jcr.nodetype.NodeType;
+import javax.jcr.NamespaceException;
 
 /**
  * This class implements the <code>NodeDefinition</code> interface.
  * All method calls are delegated to the wrapped {@link NodeDef},
- * performing the translation from <code>QName</code>s to JCR names
+ * performing the translation from <code>Name</code>s to JCR names
  * (and vice versa) where necessary.
  */
 public class NodeDefinitionImpl extends ItemDefinitionImpl implements NodeDefinition {
@@ -45,11 +45,11 @@
      *
      * @param nodeDef    child node definition
      * @param ntMgr      node type manager
-     * @param nsResolver namespace resolver
+     * @param resolver
      */
     NodeDefinitionImpl(NodeDef nodeDef, NodeTypeManagerImpl ntMgr,
-                NamespaceResolver nsResolver) {
-        super(nodeDef, ntMgr, nsResolver);
+                       NamePathResolver resolver) {
+        super(nodeDef, ntMgr, resolver);
     }
 
     /**
@@ -66,7 +66,7 @@
      * {@inheritDoc}
      */
     public NodeType getDefaultPrimaryType() {
-        QName ntName = ((NodeDef) itemDef).getDefaultPrimaryType();
+        Name ntName = ((NodeDef) itemDef).getDefaultPrimaryType();
         if (ntName == null) {
             return null;
         }
@@ -83,11 +83,11 @@
      * {@inheritDoc}
      */
     public NodeType[] getRequiredPrimaryTypes() {
-        QName[] ntNames = ((NodeDef) itemDef).getRequiredPrimaryTypes();
+        Name[] ntNames = ((NodeDef) itemDef).getRequiredPrimaryTypes();
         try {
             if (ntNames == null || ntNames.length == 0) {
                 // return "nt:base"
-                return new NodeType[] {ntMgr.getNodeType(QName.NT_BASE)};
+                return new NodeType[] {ntMgr.getNodeType(NameConstants.NT_BASE)};
             } else {
                 NodeType[] nodeTypes = new NodeType[ntNames.length];
                 for (int i = 0; i < ntNames.length; i++) {
@@ -128,19 +128,19 @@
      * @since JCR 2.0
      */
     public String[] getRequiredPrimaryTypeNames() {
-        QName[] ntNames = ((NodeDef) itemDef).getRequiredPrimaryTypes();
+        Name[] ntNames = ((NodeDef) itemDef).getRequiredPrimaryTypes();
         try {
             if (ntNames == null || ntNames.length == 0) {
                 // return "nt:base"
-                return new String[] {NameFormat.format(QName.NT_BASE, nsResolver)};
+                return new String[] {resolver.getJCRName(NameConstants.NT_BASE)};
             } else {
                 String[] names = new String[ntNames.length];
                 for (int i = 0; i < ntNames.length; i++) {
-                    names[i] = NameFormat.format(ntNames[i], nsResolver);
+                    names[i] = resolver.getJCRName(ntNames[i]);
                 }
                 return names;
             }
-        } catch (NoPrefixDeclaredException npde) {
+        } catch (NamespaceException npde) {
             // should never get here
             log.error("encountered unregistered namespace in node type name",
                     npde);
@@ -165,14 +165,14 @@
      * @since JCR 2.0
      */
     public String getDefaultPrimaryTypeName() {
-        QName ntName = ((NodeDef) itemDef).getDefaultPrimaryType();
+        Name ntName = ((NodeDef) itemDef).getDefaultPrimaryType();
         if (ntName == null) {
             return null;
         }
 
         try {
-            return NameFormat.format(ntName, nsResolver);
-        } catch (NoPrefixDeclaredException npde) {
+            return resolver.getJCRName(ntName);
+        } catch (NamespaceException npde) {
             // should never get here
             log.error("encountered unregistered namespace in node type name",
                     npde);

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeDef.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeDef.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeDef.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeDef.java Tue Oct 30 03:02:41 2007
@@ -16,7 +16,8 @@
  */
 package org.apache.jackrabbit.core.nodetype;
 
-import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.spi.Name;
+import org.apache.jackrabbit.name.NameConstants;
 
 import javax.jcr.PropertyType;
 import java.util.Arrays;
@@ -32,18 +33,20 @@
  */
 public class NodeTypeDef implements Cloneable {
 
-    private QName name;
+    private Name name;
 
     /**
      * Ordered array of supertype names. Empty if no supertypes have been
      * specified. Never <code>null</code>.
      */
-    private QName[] supertypes;
+    private Name[] supertypes;
 
     private boolean mixin;
     private boolean orderableChildNodes;
+    
     private boolean abstractStatus;
-    private QName primaryItemName;
+    private Name primaryItemName;
+
     private HashSet propDefs;
     private HashSet nodeDefs;
     private Set dependencies;
@@ -57,14 +60,14 @@
         primaryItemName = null;
         nodeDefs = new HashSet();
         propDefs = new HashSet();
-        supertypes = QName.EMPTY_ARRAY;
+        supertypes = Name.EMPTY_ARRAY;
         mixin = false;
         orderableChildNodes = false;
         abstractStatus = false;
     }
 
     /**
-     * Returns a collection of node type <code>QName</code>s that are being
+     * Returns a collection of node type <code>Name</code>s that are being
      * referenced by <i>this</i> node type definition (e.g. as supertypes, as
      * required/default primary types in child node definitions, as REFERENCE
      * value constraints in property definitions).
@@ -73,7 +76,7 @@
      * the declaring node type as the default primary type) are not considered
      * dependencies.
      *
-     * @return a collection of node type <code>QName</code>s
+     * @return a collection of node type <code>Name</code>s
      */
     public Collection getDependencies() {
         if (dependencies == null) {
@@ -84,12 +87,12 @@
             for (Iterator iter = nodeDefs.iterator(); iter.hasNext();) {
                 NodeDef nd = (NodeDef) iter.next();
                 // default primary type
-                QName ntName = nd.getDefaultPrimaryType();
+                Name ntName = nd.getDefaultPrimaryType();
                 if (ntName != null && !name.equals(ntName)) {
                     dependencies.add(ntName);
                 }
                 // required primary type
-                QName[] ntNames = nd.getRequiredPrimaryTypes();
+                Name[] ntNames = nd.getRequiredPrimaryTypes();
                 for (int j = 0; j < ntNames.length; j++) {
                     if (ntNames[j] != null && !name.equals(ntNames[j])) {
                         dependencies.add(ntNames[j]);
@@ -126,7 +129,7 @@
      *
      * @param name The name of the node type.
      */
-    public void setName(QName name) {
+    public void setName(Name name) {
         this.name = name;
     }
 
@@ -135,18 +138,18 @@
      *
      * @param names the names of the supertypes.
      */
-    public void setSupertypes(QName[] names) {
+    public void setSupertypes(Name[] names) {
         resetDependencies();
         // Optimize common cases (zero or one supertypes)
         if (names.length == 0) {
-            supertypes = QName.EMPTY_ARRAY;
+            supertypes = Name.EMPTY_ARRAY;
         } else if (names.length == 1) {
-            supertypes = new QName[] { names[0] };
+            supertypes = new Name[] { names[0] };
         } else {
             // Sort and remove duplicates
             SortedSet types = new TreeSet();
             types.addAll(Arrays.asList(names));
-            supertypes = (QName[]) types.toArray(new QName[types.size()]);
+            supertypes = (Name[]) types.toArray(new Name[types.size()]);
         }
     }
 
@@ -183,7 +186,7 @@
      *
      * @param primaryItemName The name of the primary item.
      */
-    public void setPrimaryItemName(QName primaryItemName) {
+    public void setPrimaryItemName(Name primaryItemName) {
         this.primaryItemName = primaryItemName;
     }
 
@@ -215,7 +218,7 @@
      *
      * @return the name of the node type or <code>null</code> if not set.
      */
-    public QName getName() {
+    public Name getName() {
         return name;
     }
 
@@ -229,12 +232,12 @@
      *
      * @return a sorted array of supertype names
      */
-    public QName[] getSupertypes() {
+    public Name[] getSupertypes() {
         if (supertypes.length > 0
-                || isMixin() || QName.NT_BASE.equals(getName())) {
+                || isMixin() || NameConstants.NT_BASE.equals(getName())) {
             return supertypes;
         } else {
-            return new QName[] { QName.NT_BASE };
+            return new Name[] { NameConstants.NT_BASE };
         }
     }
 
@@ -271,7 +274,7 @@
      *
      * @return the name of the primary item or <code>null</code> if not set.
      */
-    public QName getPrimaryItemName() {
+    public Name getPrimaryItemName() {
         return primaryItemName;
     }
 

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeDefStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeDefStore.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeDefStore.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeDefStore.java Tue Oct 30 03:02:41 2007
@@ -18,7 +18,7 @@
 
 import org.apache.jackrabbit.core.nodetype.xml.NodeTypeReader;
 import org.apache.jackrabbit.core.nodetype.xml.NodeTypeWriter;
-import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.spi.Name;
 
 import javax.jcr.NamespaceRegistry;
 import javax.jcr.RepositoryException;
@@ -82,7 +82,7 @@
      * @param name
      * @return
      */
-    public boolean remove(QName name) {
+    public boolean remove(Name name) {
         return (ntDefs.remove(name) != null);
     }
 
@@ -97,7 +97,7 @@
      * @param name
      * @return
      */
-    public boolean contains(QName name) {
+    public boolean contains(Name name) {
         return ntDefs.containsKey(name);
     }
 
@@ -105,7 +105,7 @@
      * @param name
      * @return
      */
-    public NodeTypeDef get(QName name) {
+    public NodeTypeDef get(Name name) {
         return (NodeTypeDef) ntDefs.get(name);
     }
 

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeImpl.java?rev=590014&r1=590013&r2=590014&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeImpl.java Tue Oct 30 03:02:41 2007
@@ -18,11 +18,9 @@
 
 import org.apache.jackrabbit.core.data.DataStore;
 import org.apache.jackrabbit.core.value.InternalValue;
-import org.apache.jackrabbit.name.NameException;
-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.conversion.NameException;
+import org.apache.jackrabbit.conversion.NamePathResolver;
+import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.value.ValueHelper;
 import org.apache.jackrabbit.value.ValueFactoryImpl;
 import org.slf4j.Logger;
@@ -31,6 +29,7 @@
 import javax.jcr.PropertyType;
 import javax.jcr.RepositoryException;
 import javax.jcr.Value;
+import javax.jcr.NamespaceException;
 import javax.jcr.nodetype.ConstraintViolationException;
 import javax.jcr.nodetype.NoSuchNodeTypeException;
 import javax.jcr.nodetype.NodeDefinition;
@@ -49,8 +48,8 @@
     private final NodeTypeDef ntd;
     private final EffectiveNodeType ent;
     private final NodeTypeManagerImpl ntMgr;
-    // namespace resolver used to translate qualified names to JCR names
-    private final NamespaceResolver nsResolver;
+    // resolver used to translate qualified names to JCR names
+    private final NamePathResolver resolver;
     private final DataStore store;    
 
     /**
@@ -63,13 +62,13 @@
      * @param ent        the effective (i.e. merged and resolved) node type representation
      * @param ntd        the definition of this node type
      * @param ntMgr      the node type manager associated with this node type
-     * @param nsResolver namespace resolver
+     * @param resolver
      */
     NodeTypeImpl(EffectiveNodeType ent, NodeTypeDef ntd,
-                 NodeTypeManagerImpl ntMgr, NamespaceResolver nsResolver, DataStore store) {
+                 NodeTypeManagerImpl ntMgr, NamePathResolver resolver, DataStore store) {
         this.ent = ent;
         this.ntMgr = ntMgr;
-        this.nsResolver = nsResolver;
+        this.resolver = resolver;
         this.ntd = ntd;
         this.store = store;
     }
@@ -82,7 +81,7 @@
      * @return true if this node type is directly or indirectly derived from the
      *         specified node type, otherwise false.
      */
-    public boolean isDerivedFrom(QName nodeTypeName) {
+    public boolean isDerivedFrom(Name nodeTypeName) {
         return !nodeTypeName.equals(ntd.getName()) && ent.includesNodeType(nodeTypeName);
     }
 
@@ -173,7 +172,7 @@
      *
      * @return the qualified name
      */
-    public QName getQName() {
+    public Name getQName() {
         return ntd.getName();
     }
 
@@ -186,7 +185,7 @@
      */
     public NodeType[] getInheritedSupertypes() {
         // declared supertypes
-        QName[] ntNames = ntd.getSupertypes();
+        Name[] ntNames = ntd.getSupertypes();
         HashSet declared = new HashSet();
         for (int i = 0; i < ntNames.length; i++) {
             declared.add(ntNames[i]);
@@ -217,10 +216,10 @@
      */
     public String getName() {
         try {
-            return NameFormat.format(ntd.getName(), nsResolver);
-        } catch (NoPrefixDeclaredException npde) {
+            return resolver.getJCRName(ntd.getName());
+        } catch (NamespaceException e) {
             // should never get here
-            log.error("encountered unregistered namespace in node type name", npde);
+            log.error("encountered unregistered namespace in node type name", e);
             return ntd.getName().toString();
         }
     }
@@ -230,15 +229,15 @@
      */
     public String getPrimaryItemName() {
         try {
-            QName piName = ntd.getPrimaryItemName();
+            Name piName = ntd.getPrimaryItemName();
             if (piName != null) {
-                return NameFormat.format(piName, nsResolver);
+                return resolver.getJCRName(piName);
             } else {
                 return null;
             }
-        } catch (NoPrefixDeclaredException npde) {
+        } catch (NamespaceException e) {
             // should never get here
-            log.error("encountered unregistered namespace in name of primary item", npde);
+            log.error("encountered unregistered namespace in name of primary item", e);
             return ntd.getName().toString();
         }
     }
@@ -254,9 +253,12 @@
      * {@inheritDoc}
      */
     public boolean isNodeType(String nodeTypeName) {
-        QName ntName;
+        Name ntName;
         try {
-            ntName = NameFormat.parse(nodeTypeName, nsResolver);
+            ntName = resolver.getQName(nodeTypeName);
+        } catch (NamespaceException e) {
+            log.warn("invalid node type name: " + nodeTypeName, e);
+            return false;
         } catch (NameException e) {
             log.warn("invalid node type name: " + nodeTypeName, e);
             return false;
@@ -275,7 +277,7 @@
      * {@inheritDoc}
      */
     public NodeType[] getSupertypes() {
-        QName[] ntNames = ent.getInheritedNodeTypes();
+        Name[] ntNames = ent.getInheritedNodeTypes();
         NodeType[] supertypes = new NodeType[ntNames.length];
         for (int i = 0; i < ntNames.length; i++) {
             try {
@@ -317,7 +319,7 @@
      * {@inheritDoc}
      */
     public NodeType[] getDeclaredSupertypes() {
-        QName[] ntNames = ntd.getSupertypes();
+        Name[] ntNames = ntd.getSupertypes();
         NodeType[] supertypes = new NodeType[ntNames.length];
         for (int i = 0; i < ntNames.length; i++) {
             try {
@@ -352,7 +354,7 @@
             return canRemoveItem(propertyName);
         }
         try {
-            QName name = NameFormat.parse(propertyName, nsResolver);
+            Name name = resolver.getQName(propertyName);
             PropDef def;
             try {
                 // try to get definition that matches the given value type
@@ -384,10 +386,10 @@
                 Value targetVal = ValueHelper.convert(
                         value, targetType,
                         ValueFactoryImpl.getInstance());
-                internalValue = InternalValue.create(targetVal, nsResolver, store);
+                internalValue = InternalValue.create(targetVal, resolver, store);
             } else {
                 // no type conversion required
-                internalValue = InternalValue.create(value, nsResolver, store);
+                internalValue = InternalValue.create(value, resolver, store);
             }
             EffectiveNodeType.checkSetPropertyValueConstraints(
                     def, new InternalValue[]{internalValue});
@@ -409,7 +411,7 @@
             return canRemoveItem(propertyName);
         }
         try {
-            QName name = NameFormat.parse(propertyName, nsResolver);
+            Name name = resolver.getQName(propertyName);
             // determine type of values
             int type = PropertyType.UNDEFINED;
             for (int i = 0; i < values.length; i++) {
@@ -462,10 +464,10 @@
                         Value targetVal = ValueHelper.convert(
                                 values[i], targetType,
                                 ValueFactoryImpl.getInstance());
-                        internalValue = InternalValue.create(targetVal, nsResolver, store);
+                        internalValue = InternalValue.create(targetVal, resolver, store);
                     } else {
                         // no type conversion required
-                        internalValue = InternalValue.create(values[i], nsResolver, store);
+                        internalValue = InternalValue.create(values[i], resolver, store);
                     }
                     list.add(internalValue);
                 }
@@ -487,7 +489,7 @@
      */
     public boolean canAddChildNode(String childNodeName) {
         try {
-            ent.checkAddNodeConstraints(NameFormat.parse(childNodeName, nsResolver));
+            ent.checkAddNodeConstraints(resolver.getQName(childNodeName));
             return true;
         } catch (NameException be) {
             // implementation specific exception, fall through
@@ -503,8 +505,8 @@
     public boolean canAddChildNode(String childNodeName, String nodeTypeName) {
         try {
             ent.checkAddNodeConstraints(
-                    NameFormat.parse(childNodeName, nsResolver),
-                    NameFormat.parse(nodeTypeName, nsResolver),
+                    resolver.getQName(childNodeName),
+                    resolver.getQName(nodeTypeName),
                     ntMgr.getNodeTypeRegistry());
             return true;
         } catch (NameException be) {
@@ -520,7 +522,7 @@
      */
     public boolean canRemoveItem(String itemName) {
         try {
-            ent.checkRemoveItemConstraints(NameFormat.parse(itemName, nsResolver));
+            ent.checkRemoveItemConstraints(resolver.getQName(itemName));
             return true;
         } catch (NameException be) {
             // implementation specific exception, fall through
@@ -554,7 +556,7 @@
      */
     public boolean canRemoveNode(String nodeName) {
         try {
-            ent.checkRemoveNodeConstraints(NameFormat.parse(nodeName, nsResolver));
+            ent.checkRemoveNodeConstraints(resolver.getQName(nodeName));
             return true;
         } catch (NameException be) {
             // implementation specific exception, fall through
@@ -575,7 +577,7 @@
      */
     public boolean canRemoveProperty(String propertyName) {
         try {
-            ent.checkRemovePropertyConstraints(NameFormat.parse(propertyName, nsResolver));
+            ent.checkRemovePropertyConstraints(resolver.getQName(propertyName));
             return true;
         } catch (NameException be) {
             // implementation specific exception, fall through



Mime
View raw message