jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tri...@apache.org
Subject svn commit: r421219 [1/2] - in /jackrabbit/trunk/jackrabbit/src: main/java/org/apache/jackrabbit/core/ main/java/org/apache/jackrabbit/core/lock/ main/java/org/apache/jackrabbit/core/nodetype/ main/java/org/apache/jackrabbit/core/nodetype/compact/ main...
Date Wed, 12 Jul 2006 10:15:19 GMT
Author: tripod
Date: Wed Jul 12 03:15:17 2006
New Revision: 421219

URL: http://svn.apache.org/viewvc?rev=421219&view=rev
Log:
JCR-473 Some enhancements to jackrabbit commons (fixed some deprecated calls)

Modified:
    jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/CachingNamespaceResolver.java
    jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/HierarchyManagerImpl.java
    jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/ItemImpl.java
    jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/ItemManager.java
    jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/ItemValidator.java
    jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/NodeImpl.java
    jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/PropertyImpl.java
    jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java
    jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/SearchManager.java
    jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/SessionImpl.java
    jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/WorkspaceImpl.java
    jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/lock/LockManagerImpl.java
    jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/nodetype/ItemDefinitionImpl.java
    jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeImpl.java
    jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeManagerImpl.java
    jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/nodetype/ValueConstraint.java
    jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/nodetype/compact/CompactNodeTypeDefReader.java
    jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/nodetype/xml/NodeTypeReader.java
    jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/nodetype/xml/NodeTypeWriter.java
    jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/observation/EventImpl.java
    jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/observation/ObservationManagerImpl.java
    jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/QueryImpl.java
    jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/lucene/LuceneQueryBuilder.java
    jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/lucene/NamespaceMappings.java
    jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/lucene/NodeIndexer.java
    jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/lucene/QueryResultImpl.java
    jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/lucene/RowIteratorImpl.java
    jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java
    jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/lucene/WorkspaceTraversalResult.java
    jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/sql/JCRSQLQueryBuilder.java
    jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/sql/QueryFormat.java
    jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/xpath/QueryFormat.java
    jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/xpath/XPathQueryBuilder.java
    jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/value/InternalValue.java
    jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/AbstractVersionHistory.java
    jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/AbstractSAXEventGenerator.java
    jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/BufferedStringValue.java
    jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/DocViewImportHandler.java
    jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/DocViewSAXEventGenerator.java
    jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/NamespaceContext.java
    jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/SysViewImportHandler.java
    jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/name/Path.java
    jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/name/QName.java
    jackrabbit/trunk/jackrabbit/src/main/javacc/sql/JCRSQL.jjt
    jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/name/PathTest.java
    jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/name/QNameTest.java
    jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/util/TextTest.java

Modified: jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/CachingNamespaceResolver.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/CachingNamespaceResolver.java?rev=421219&r1=421218&r2=421219&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/CachingNamespaceResolver.java (original)
+++ jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/CachingNamespaceResolver.java Wed Jul 12 03:15:17 2006
@@ -26,6 +26,7 @@
 import org.apache.jackrabbit.name.Path;
 import org.apache.jackrabbit.name.MalformedPathException;
 import org.apache.jackrabbit.name.PathFormat;
+import org.apache.jackrabbit.name.NameFormat;
 import org.apache.commons.collections.map.LRUMap;
 
 import javax.jcr.NamespaceException;
@@ -89,7 +90,7 @@
             throws IllegalNameException, UnknownPrefixException {
         QName qName = (QName) jcrNameToQName.get(name);
         if (qName == null) {
-            qName = QName.fromJCRName(name, this);
+            qName = NameFormat.parse(name, this);
             jcrNameToQName.put(name, qName);
         }
         return qName;
@@ -102,7 +103,7 @@
             throws NoPrefixDeclaredException {
         String jcrName = (String) qnameToJCRName.get(name);
         if (jcrName == null) {
-            jcrName = name.toJCRName(this);
+            jcrName = NameFormat.format(name, this);
             qnameToJCRName.put(name, jcrName);
         }
         return jcrName;

Modified: jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/HierarchyManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/HierarchyManagerImpl.java?rev=421219&r1=421218&r2=421219&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/HierarchyManagerImpl.java (original)
+++ jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/HierarchyManagerImpl.java Wed Jul 12 03:15:17 2006
@@ -27,6 +27,7 @@
 import org.apache.jackrabbit.name.NoPrefixDeclaredException;
 import org.apache.jackrabbit.name.Path;
 import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.name.PathFormat;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -78,7 +79,7 @@
      */
     public String safeGetJCRPath(Path path) {
         try {
-            return path.toJCRPath(nsResolver);
+            return PathFormat.format(path, nsResolver);
         } catch (NoPrefixDeclaredException npde) {
             log.error("failed to convert " + path.toString() + " to JCR path.");
             // return string representation of internal path as a fallback

Modified: jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/ItemImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/ItemImpl.java?rev=421219&r1=421218&r2=421219&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/ItemImpl.java (original)
+++ jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/ItemImpl.java Wed Jul 12 03:15:17 2006
@@ -35,6 +35,7 @@
 import org.apache.jackrabbit.core.version.VersionManager;
 import org.apache.jackrabbit.name.NoPrefixDeclaredException;
 import org.apache.jackrabbit.name.Path;
+import org.apache.jackrabbit.name.PathFormat;
 import org.apache.jackrabbit.name.QName;
 import org.apache.jackrabbit.uuid.UUID;
 import org.slf4j.Logger;
@@ -1374,7 +1375,7 @@
         sanityCheck();
 
         try {
-            return getPrimaryPath().toJCRPath(session.getNamespaceResolver());
+            return PathFormat.format(getPrimaryPath(), session.getNamespaceResolver());
         } catch (NoPrefixDeclaredException npde) {
             // should never get here...
             String msg = "internal error: encountered unregistered namespace";

Modified: jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/ItemManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/ItemManager.java?rev=421219&r1=421218&r2=421219&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/ItemManager.java (original)
+++ jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/ItemManager.java Wed Jul 12 03:15:17 2006
@@ -28,15 +28,16 @@
 import org.apache.jackrabbit.core.state.NoSuchItemStateException;
 import org.apache.jackrabbit.core.state.NodeState;
 import org.apache.jackrabbit.core.state.PropertyState;
+import org.apache.jackrabbit.core.util.Dumpable;
+import org.apache.jackrabbit.core.version.AbstractVersion;
+import org.apache.jackrabbit.core.version.AbstractVersionHistory;
 import org.apache.jackrabbit.core.version.InternalVersion;
 import org.apache.jackrabbit.core.version.InternalVersionHistory;
 import org.apache.jackrabbit.core.version.VersionHistoryImpl;
 import org.apache.jackrabbit.core.version.VersionImpl;
-import org.apache.jackrabbit.core.version.AbstractVersion;
-import org.apache.jackrabbit.core.version.AbstractVersionHistory;
-import org.apache.jackrabbit.core.util.Dumpable;
 import org.apache.jackrabbit.name.NoPrefixDeclaredException;
 import org.apache.jackrabbit.name.Path;
+import org.apache.jackrabbit.name.PathFormat;
 import org.apache.jackrabbit.name.QName;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -612,7 +613,7 @@
      */
     String safeGetJCRPath(Path path) {
         try {
-            return path.toJCRPath(session.getNamespaceResolver());
+            return PathFormat.format(path, session.getNamespaceResolver());
         } catch (NoPrefixDeclaredException npde) {
             log.error("failed to convert " + path.toString() + " to JCR path.");
             // return string representation of internal path as a fallback

Modified: jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/ItemValidator.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/ItemValidator.java?rev=421219&r1=421218&r2=421219&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/ItemValidator.java (original)
+++ jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/ItemValidator.java Wed Jul 12 03:15:17 2006
@@ -28,6 +28,7 @@
 import org.apache.jackrabbit.name.NoPrefixDeclaredException;
 import org.apache.jackrabbit.name.Path;
 import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.name.PathFormat;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -218,7 +219,7 @@
      */
     public String safeGetJCRPath(Path path) {
         try {
-            return path.toJCRPath(nsResolver);
+            return PathFormat.format(path, nsResolver);
         } catch (NoPrefixDeclaredException npde) {
             log.error("failed to convert " + path.toString() + " to JCR path.");
             // return string representation of internal path as a fallback

Modified: jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/NodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/NodeImpl.java?rev=421219&r1=421218&r2=421219&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/NodeImpl.java (original)
+++ jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/NodeImpl.java Wed Jul 12 03:15:17 2006
@@ -48,6 +48,7 @@
 import org.apache.jackrabbit.name.Path;
 import org.apache.jackrabbit.name.QName;
 import org.apache.jackrabbit.name.UnknownPrefixException;
+import org.apache.jackrabbit.name.PathFormat;
 import org.apache.jackrabbit.util.ChildrenCollectorFilter;
 import org.apache.jackrabbit.util.IteratorHelper;
 import org.apache.jackrabbit.uuid.UUID;
@@ -175,7 +176,8 @@
             /**
              * build and resolve absolute path
              */
-            Path p = Path.create(getPrimaryPath(), relPath, session.getNamespaceResolver(), true);
+            Path p = PathFormat.parse(getPrimaryPath(), relPath,
+                    session.getNamespaceResolver()).getCanonicalPath();
             try {
                 ItemId id = session.getHierarchyManager().resolvePath(p);
                 if (!id.denotesNode()) {
@@ -213,7 +215,7 @@
              * first check if relPath is just a name (in which case we don't
              * have to build & resolve absolute path)
              */
-            Path p = Path.create(relPath, session.getNamespaceResolver(), false);
+            Path p = PathFormat.parse(relPath, session.getNamespaceResolver());
             if (p.getLength() == 1) {
                 Path.PathElement pe = p.getNameElement();
                 if (pe.denotesName()) {
@@ -697,8 +699,8 @@
         Path parentPath;
         try {
             nodePath =
-                    Path.create(getPrimaryPath(), relPath,
-                            session.getNamespaceResolver(), true);
+                    PathFormat.parse(getPrimaryPath(), relPath,
+                            session.getNamespaceResolver()).getCanonicalPath();
             if (nodePath.getNameElement().getIndex() != 0) {
                 String msg = "illegal subscript specified: " + nodePath;
                 log.debug(msg);
@@ -1940,7 +1942,7 @@
 
         Path.PathElement insertName;
         try {
-            Path p = Path.create(srcName, session.getNamespaceResolver(), false);
+            Path p = PathFormat.parse(srcName, session.getNamespaceResolver());
             // p must be a relative path of length==depth==1 (to eliminate e.g. "..")
             if (p.isAbsolute() || p.getLength() != 1 || p.getDepth() != 1) {
                 throw new RepositoryException("invalid name: " + srcName);
@@ -1955,7 +1957,7 @@
         Path.PathElement beforeName;
         if (destName != null) {
             try {
-                Path p = Path.create(destName, session.getNamespaceResolver(), false);
+                Path p = PathFormat.parse(destName, session.getNamespaceResolver());
                 // p must be a relative path of length==depth==1 (to eliminate e.g. "..")
                 if (p.isAbsolute() || p.getLength() != 1 || p.getDepth() != 1) {
                     throw new RepositoryException("invalid name: " + destName);
@@ -2854,7 +2856,7 @@
             try {
                 Path p = m1.getPrimaryPath().computeRelativePath(getPrimaryPath());
                 // use prefix mappings of srcSession
-                relPath = p.toJCRPath(srcSession.getNamespaceResolver());
+                relPath = PathFormat.format(p, srcSession.getNamespaceResolver());
             } catch (NameException be) {
                 // should never get here...
                 String msg = "internal error: failed to determine relative path";
@@ -3087,9 +3089,10 @@
                 node = (NodeImpl) session.getNodeByUUID(fn.getFrozenUUID());
                 if (removeExisting) {
                     try {
-                        Path dstPath = Path.create(getPrimaryPath(), relPath, session.getNamespaceResolver(), true);
+                        Path dstPath = PathFormat.parse(getPrimaryPath(),
+                                relPath, session.getNamespaceResolver()).getCanonicalPath();
                         // move to respective location
-                        session.move(node.getPath(), dstPath.toJCRPath(session.getNamespaceResolver()));
+                        session.move(node.getPath(), PathFormat.format(dstPath, session.getNamespaceResolver()));
                         // need to refetch ?
                         node = (NodeImpl) session.getNodeByUUID(fn.getFrozenUUID());
                     } catch (MalformedPathException e) {
@@ -3251,7 +3254,7 @@
             try {
                 Path p = m1.getPrimaryPath().computeRelativePath(getPrimaryPath());
                 // use prefix mappings of srcSession
-                relPath = p.toJCRPath(srcSession.getNamespaceResolver());
+                relPath = PathFormat.format(p, srcSession.getNamespaceResolver());
             } catch (NameException be) {
                 // should never get here...
                 String msg = "internal error: failed to determine relative path";

Modified: jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/PropertyImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/PropertyImpl.java?rev=421219&r1=421218&r2=421219&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/PropertyImpl.java (original)
+++ jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/PropertyImpl.java Wed Jul 12 03:15:17 2006
@@ -24,6 +24,7 @@
 import org.apache.jackrabbit.name.NoPrefixDeclaredException;
 import org.apache.jackrabbit.name.Path;
 import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.name.PathFormat;
 import org.apache.jackrabbit.uuid.UUID;
 import org.apache.jackrabbit.value.BooleanValue;
 import org.apache.jackrabbit.value.DateValue;
@@ -190,7 +191,7 @@
             case PropertyType.PATH:
                 Path path = (Path) value.internalValue();
                 try {
-                    return path.toJCRPath(session.getNamespaceResolver()).length();
+                    return PathFormat.format(path, session.getNamespaceResolver()).length();
                 } catch (NoPrefixDeclaredException npde) {
                     // should never happen...
                     String msg = safeGetJCRPath()

Modified: jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java?rev=421219&r1=421218&r2=421219&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java (original)
+++ jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java Wed Jul 12 03:15:17 2006
@@ -50,6 +50,7 @@
 import org.apache.jackrabbit.core.version.VersionManagerImpl;
 import org.apache.jackrabbit.name.NoPrefixDeclaredException;
 import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.name.NameFormat;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.xml.sax.InputSource;
@@ -571,7 +572,7 @@
                     obsMgr.addEventListener(systemSearchMgr, Event.NODE_ADDED
                             | Event.NODE_REMOVED | Event.PROPERTY_ADDED
                             | Event.PROPERTY_CHANGED | Event.PROPERTY_REMOVED,
-                            "/" + QName.JCR_SYSTEM.toJCRName(defSysSession.getNamespaceResolver()),
+                            "/" + NameFormat.format(QName.JCR_SYSTEM, defSysSession.getNamespaceResolver()),
                             true, null, null, false);
                 } else {
                     systemSearchMgr = null;
@@ -1851,12 +1852,11 @@
      * Some operations are needed to initiate the RepositoryBackup object properly before performing
      * the backup or restore operation.
      *
-     * @param BackupConfig conf: BackupConfig object containing all the parameters.
+     * @param conf BackupConfig object containing all the parameters.
      * @return RepositoryBackup configured
      * @throws RepositoryException
      * @throws AccessDeniedException
-     * @throws IoException
-     * @author: Nicolas Toper <ntoper@gmail.com>
+     * @throws IOException
      */
     public RepositoryBackup getBackupRepository(BackupConfig conf, BackupIOHandler h) throws RepositoryException, IOException, AccessDeniedException {
         conf.setRepo(this);
@@ -1866,7 +1866,7 @@
     /**
      * For restore operations since the
      * @return RepositoryBackup to configure
-     * @param BackupIOHandler is a pointer to the file to restore
+     * @param source is a pointer to the file to restore
      * @throws RepositoryException
      * @throws IOException
      * @throws AccessDeniedException

Modified: jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/SearchManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/SearchManager.java?rev=421219&r1=421218&r2=421219&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/SearchManager.java (original)
+++ jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/SearchManager.java Wed Jul 12 03:15:17 2006
@@ -34,11 +34,11 @@
 import org.apache.jackrabbit.name.NamespaceResolver;
 import org.apache.jackrabbit.name.NoPrefixDeclaredException;
 import org.apache.jackrabbit.name.Path;
+import org.apache.jackrabbit.name.PathFormat;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import javax.jcr.NamespaceException;
-import javax.jcr.NamespaceRegistry;
 import javax.jcr.Node;
 import javax.jcr.RepositoryException;
 import javax.jcr.observation.Event;
@@ -364,7 +364,7 @@
         String exclude = "";
         if (excludePath != null) {
             try {
-                exclude = excludePath.toJCRPath(nsResolver);
+                exclude = PathFormat.format(excludePath, nsResolver);
             } catch (NoPrefixDeclaredException e) {
                 log.error("Error filtering events.", e);
             }

Modified: jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/SessionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/SessionImpl.java?rev=421219&r1=421218&r2=421219&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/SessionImpl.java (original)
+++ jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/SessionImpl.java Wed Jul 12 03:15:17 2006
@@ -42,6 +42,7 @@
 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.uuid.UUID;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -76,9 +77,7 @@
 import javax.jcr.version.VersionException;
 import javax.security.auth.Subject;
 import javax.xml.transform.OutputKeys;
-import javax.xml.transform.Result;
 import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.sax.SAXTransformerFactory;
 import javax.xml.transform.sax.TransformerHandler;
 import javax.xml.transform.stream.StreamResult;
@@ -591,7 +590,7 @@
 
         Path targetPath;
         try {
-            targetPath = Path.create(absPath, getNamespaceResolver(), true);
+            targetPath = PathFormat.parse(absPath, getNamespaceResolver()).getNormalizedPath();
         } catch (MalformedPathException mpe) {
             String msg = "invalid path: " + absPath;
             log.debug(msg, mpe);
@@ -764,7 +763,7 @@
         sanityCheck();
 
         try {
-            Path p = Path.create(absPath, getNamespaceResolver(), true);
+            Path p = PathFormat.parse(absPath, getNamespaceResolver()).getNormalizedPath();
             if (!p.isAbsolute()) {
                 throw new RepositoryException("not an absolute path: " + absPath);
             }
@@ -786,7 +785,7 @@
         sanityCheck();
 
         try {
-            Path p = Path.create(absPath, getNamespaceResolver(), true);
+            Path p = PathFormat.parse(absPath, getNamespaceResolver()).getNormalizedPath();
             if (!p.isAbsolute()) {
                 throw new RepositoryException("not an absolute path: " + absPath);
             }
@@ -855,7 +854,7 @@
         NodeImpl targetNode;
         NodeImpl srcParentNode;
         try {
-            srcPath = Path.create(srcAbsPath, getNamespaceResolver(), true);
+            srcPath = PathFormat.parse(srcAbsPath, getNamespaceResolver()).getNormalizedPath();
             if (!srcPath.isAbsolute()) {
                 throw new RepositoryException("not an absolute path: " + srcAbsPath);
             }
@@ -880,7 +879,7 @@
         Path destParentPath;
         NodeImpl destParentNode;
         try {
-            destPath = Path.create(destAbsPath, getNamespaceResolver(), true);
+            destPath = PathFormat.parse(destAbsPath, getNamespaceResolver()).getNormalizedPath();
             if (!destPath.isAbsolute()) {
                 throw new RepositoryException("not an absolute path: " + destAbsPath);
             }
@@ -1018,7 +1017,7 @@
 
         Item item;
         try {
-            Path p = Path.create(parentAbsPath, getNamespaceResolver(), true);
+            Path p = PathFormat.parse(parentAbsPath, getNamespaceResolver()).getNormalizedPath();
             if (!p.isAbsolute()) {
                 throw new RepositoryException("not an absolute path: " + parentAbsPath);
             }

Modified: jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/WorkspaceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/WorkspaceImpl.java?rev=421219&r1=421218&r2=421219&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/WorkspaceImpl.java (original)
+++ jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/WorkspaceImpl.java Wed Jul 12 03:15:17 2006
@@ -34,6 +34,7 @@
 import org.apache.jackrabbit.core.xml.WorkspaceImporter;
 import org.apache.jackrabbit.name.MalformedPathException;
 import org.apache.jackrabbit.name.Path;
+import org.apache.jackrabbit.name.PathFormat;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.xml.sax.ContentHandler;
@@ -253,7 +254,7 @@
 
         Path srcPath;
         try {
-            srcPath = Path.create(srcAbsPath, session.getNamespaceResolver(), true);
+            srcPath = PathFormat.parse(srcAbsPath, session.getNamespaceResolver()).getNormalizedPath();
         } catch (MalformedPathException mpe) {
             String msg = "invalid path: " + srcAbsPath;
             log.debug(msg);
@@ -265,7 +266,7 @@
 
         Path destPath;
         try {
-            destPath = Path.create(destAbsPath, session.getNamespaceResolver(), true);
+            destPath = PathFormat.parse(destAbsPath, session.getNamespaceResolver()).getNormalizedPath();
         } catch (MalformedPathException mpe) {
             String msg = "invalid path: " + destAbsPath;
             log.debug(msg);
@@ -480,7 +481,7 @@
 
         Path srcPath;
         try {
-            srcPath = Path.create(srcAbsPath, session.getNamespaceResolver(), true);
+            srcPath = PathFormat.parse(srcAbsPath, session.getNamespaceResolver()).getNormalizedPath();
         } catch (MalformedPathException mpe) {
             String msg = "invalid path: " + srcAbsPath;
             log.debug(msg);
@@ -492,7 +493,7 @@
 
         Path destPath;
         try {
-            destPath = Path.create(destAbsPath, session.getNamespaceResolver(), true);
+            destPath = PathFormat.parse(destAbsPath, session.getNamespaceResolver()).getNormalizedPath();
         } catch (MalformedPathException mpe) {
             String msg = "invalid path: " + destAbsPath;
             log.debug(msg);
@@ -692,7 +693,7 @@
 
         Path parentPath;
         try {
-            parentPath = Path.create(parentAbsPath, session.getNamespaceResolver(), true);
+            parentPath = PathFormat.parse(parentAbsPath, session.getNamespaceResolver()).getNormalizedPath();
         } catch (MalformedPathException mpe) {
             String msg = "invalid path: " + parentAbsPath;
             log.debug(msg);

Modified: jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/lock/LockManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/lock/LockManagerImpl.java?rev=421219&r1=421218&r2=421219&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/lock/LockManagerImpl.java (original)
+++ jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/lock/LockManagerImpl.java Wed Jul 12 03:15:17 2006
@@ -33,6 +33,7 @@
 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.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -724,7 +725,7 @@
 
             try {
                 he = new HierarchyEvent(event.getChildId(),
-                        Path.create(event.getPath(), nsResolver, true),
+                        PathFormat.parse(event.getPath(), nsResolver).getNormalizedPath(),
                         event.getType());
             } catch (MalformedPathException e) {
                 log.info("Unable to get event's path: " + e.getMessage());

Modified: jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/nodetype/ItemDefinitionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/nodetype/ItemDefinitionImpl.java?rev=421219&r1=421218&r2=421219&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/nodetype/ItemDefinitionImpl.java (original)
+++ jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/nodetype/ItemDefinitionImpl.java Wed Jul 12 03:15:17 2006
@@ -19,6 +19,7 @@
 import org.apache.jackrabbit.name.NamespaceResolver;
 import org.apache.jackrabbit.name.NoPrefixDeclaredException;
 import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.name.NameFormat;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -115,7 +116,7 @@
             return ANY_NAME;
         } else {
             try {
-                return itemDef.getName().toJCRName(nsResolver);
+                return NameFormat.format(itemDef.getName(), nsResolver);
             } catch (NoPrefixDeclaredException npde) {
                 // should never get here
                 log.error("encountered unregistered namespace in property name",

Modified: jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeImpl.java?rev=421219&r1=421218&r2=421219&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeImpl.java (original)
+++ jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeImpl.java Wed Jul 12 03:15:17 2006
@@ -23,6 +23,7 @@
 import org.apache.jackrabbit.name.NoPrefixDeclaredException;
 import org.apache.jackrabbit.name.QName;
 import org.apache.jackrabbit.name.UnknownPrefixException;
+import org.apache.jackrabbit.name.NameFormat;
 import org.apache.jackrabbit.value.ValueHelper;
 import org.apache.jackrabbit.value.ValueFactoryImpl;
 import org.slf4j.Logger;
@@ -215,7 +216,7 @@
      */
     public String getName() {
         try {
-            return ntd.getName().toJCRName(nsResolver);
+            return NameFormat.format(ntd.getName(), nsResolver);
         } catch (NoPrefixDeclaredException npde) {
             // should never get here
             log.error("encountered unregistered namespace in node type name", npde);
@@ -230,7 +231,7 @@
         try {
             QName piName = ntd.getPrimaryItemName();
             if (piName != null) {
-                return piName.toJCRName(nsResolver);
+                return NameFormat.format(piName, nsResolver);
             } else {
                 return null;
             }
@@ -254,7 +255,7 @@
     public boolean isNodeType(String nodeTypeName) {
         QName ntName;
         try {
-            ntName = QName.fromJCRName(nodeTypeName, nsResolver);
+            ntName = NameFormat.parse(nodeTypeName, nsResolver);
         } catch (IllegalNameException ine) {
             log.warn("invalid node type name: " + nodeTypeName, ine);
             return false;
@@ -353,7 +354,7 @@
             return canRemoveItem(propertyName);
         }
         try {
-            QName name = QName.fromJCRName(propertyName, nsResolver);
+            QName name = NameFormat.parse(propertyName, nsResolver);
             PropDef def;
             try {
                 // try to get definition that matches the given value type
@@ -410,7 +411,7 @@
             return canRemoveItem(propertyName);
         }
         try {
-            QName name = QName.fromJCRName(propertyName, nsResolver);
+            QName name = NameFormat.parse(propertyName, nsResolver);
             // determine type of values
             int type = PropertyType.UNDEFINED;
             for (int i = 0; i < values.length; i++) {
@@ -488,7 +489,7 @@
      */
     public boolean canAddChildNode(String childNodeName) {
         try {
-            ent.checkAddNodeConstraints(QName.fromJCRName(childNodeName, nsResolver));
+            ent.checkAddNodeConstraints(NameFormat.parse(childNodeName, nsResolver));
             return true;
         } catch (NameException be) {
             // implementation specific exception, fall through
@@ -504,8 +505,8 @@
     public boolean canAddChildNode(String childNodeName, String nodeTypeName) {
         try {
             ent.checkAddNodeConstraints(
-                    QName.fromJCRName(childNodeName, nsResolver),
-                    QName.fromJCRName(nodeTypeName, nsResolver),
+                    NameFormat.parse(childNodeName, nsResolver),
+                    NameFormat.parse(nodeTypeName, nsResolver),
                     ntMgr.getNodeTypeRegistry());
             return true;
         } catch (NameException be) {
@@ -521,7 +522,7 @@
      */
     public boolean canRemoveItem(String itemName) {
         try {
-            ent.checkRemoveItemConstraints(QName.fromJCRName(itemName, nsResolver));
+            ent.checkRemoveItemConstraints(NameFormat.parse(itemName, nsResolver));
             return true;
         } catch (NameException be) {
             // implementation specific exception, fall through

Modified: jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeManagerImpl.java?rev=421219&r1=421218&r2=421219&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeManagerImpl.java (original)
+++ jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeManagerImpl.java Wed Jul 12 03:15:17 2006
@@ -21,6 +21,7 @@
 import org.apache.jackrabbit.name.NamespaceResolver;
 import org.apache.jackrabbit.name.QName;
 import org.apache.jackrabbit.name.UnknownPrefixException;
+import org.apache.jackrabbit.name.NameFormat;
 import org.apache.jackrabbit.util.IteratorHelper;
 import org.apache.jackrabbit.util.name.NamespaceMapping;
 import org.apache.jackrabbit.api.JackrabbitNodeTypeManager;
@@ -133,7 +134,7 @@
     }
 
     /**
-     * @return
+     * @return the root node definition
      */
     public NodeDefinitionImpl getRootNodeDefinition() {
         return rootNodeDef;
@@ -141,7 +142,7 @@
 
     /**
      * @param id
-     * @return
+     * @return the node definition
      */
     public NodeDefinitionImpl getNodeDefinition(NodeDefId id) {
         synchronized (ndCache) {
@@ -159,7 +160,7 @@
 
     /**
      * @param id
-     * @return
+     * @return the property definition
      */
     public PropertyDefinitionImpl getPropertyDefinition(PropDefId id) {
         synchronized (pdCache) {
@@ -194,7 +195,7 @@
     }
 
     /**
-     * @return
+     * @return the node type registry
      */
     public NodeTypeRegistry getNodeTypeRegistry() {
         return ntReg;
@@ -309,7 +310,7 @@
     public NodeType getNodeType(String nodeTypeName)
             throws NoSuchNodeTypeException {
         try {
-            return getNodeType(QName.fromJCRName(nodeTypeName, nsResolver));
+            return getNodeType(NameFormat.parse(nodeTypeName, nsResolver));
         } catch (UnknownPrefixException upe) {
             throw new NoSuchNodeTypeException(nodeTypeName, upe);
         } catch (IllegalNameException ine) {

Modified: jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/nodetype/ValueConstraint.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/nodetype/ValueConstraint.java?rev=421219&r1=421218&r2=421219&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/nodetype/ValueConstraint.java (original)
+++ jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/nodetype/ValueConstraint.java Wed Jul 12 03:15:17 2006
@@ -25,6 +25,8 @@
 import org.apache.jackrabbit.name.Path;
 import org.apache.jackrabbit.name.QName;
 import org.apache.jackrabbit.name.UnknownPrefixException;
+import org.apache.jackrabbit.name.PathFormat;
+import org.apache.jackrabbit.name.NameFormat;
 import org.apache.jackrabbit.value.DateValue;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -533,7 +535,7 @@
             definition = definition.substring(0, definition.length() - 1);
         }
         try {
-            path = Path.create(definition, nsResolver, false);
+            path = PathFormat.parse(definition, nsResolver);
         } catch (MalformedPathException mpe) {
             String msg = "invalid path expression specified as value constraint: "
                     + definition;
@@ -544,7 +546,7 @@
 
     public String getDefinition(NamespaceResolver nsResolver) {
         try {
-            String p = path.toJCRPath(nsResolver);
+            String p = PathFormat.format(path, nsResolver);
             if (!deep) {
                 return p;
             } else if (path.denotesRoot()) {
@@ -618,8 +620,8 @@
 
         // constraint format: JCR name in prefix form
         try {
-            QName.checkFormat(definition);
-            name = QName.fromJCRName(definition, nsResolver);
+            NameFormat.checkFormat(definition);
+            name = NameFormat.parse(definition, nsResolver);
         } catch (IllegalNameException ine) {
             String msg = "invalid name specified as value constraint: "
                     + definition;
@@ -635,7 +637,7 @@
 
     public String getDefinition(NamespaceResolver nsResolver) {
         try {
-            return name.toJCRName(nsResolver);
+            return NameFormat.format(name, nsResolver);
         } catch (NoPrefixDeclaredException npde) {
             // should never get here, return raw definition as fallback
             return definition;
@@ -677,7 +679,7 @@
 
         // format: node type name
         try {
-            ntName = QName.fromJCRName(definition, nsResolver);
+            ntName = NameFormat.parse(definition, nsResolver);
         } catch (IllegalNameException ine) {
             String msg = "invalid node type name specified as value constraint: "
                     + definition;
@@ -693,7 +695,7 @@
 
     public String getDefinition(NamespaceResolver nsResolver) {
         try {
-            return ntName.toJCRName(nsResolver);
+            return NameFormat.format(ntName, nsResolver);
         } catch (NoPrefixDeclaredException npde) {
             // should never get here, return raw definition as fallback
             return definition;

Modified: jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/nodetype/compact/CompactNodeTypeDefReader.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/nodetype/compact/CompactNodeTypeDefReader.java?rev=421219&r1=421218&r2=421219&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/nodetype/compact/CompactNodeTypeDefReader.java (original)
+++ jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/nodetype/compact/CompactNodeTypeDefReader.java Wed Jul 12 03:15:17 2006
@@ -29,6 +29,7 @@
 import org.apache.jackrabbit.name.NoPrefixDeclaredException;
 import org.apache.jackrabbit.name.QName;
 import org.apache.jackrabbit.name.UnknownPrefixException;
+import org.apache.jackrabbit.name.NameFormat;
 import org.apache.jackrabbit.util.name.NamespaceMapping;
 import org.apache.jackrabbit.value.ValueHelper;
 import org.apache.jackrabbit.value.ValueFactoryImpl;
@@ -635,7 +636,7 @@
      */
     private QName toQName(String stringName) throws ParseException {
         try {
-            return QName.fromJCRName(stringName, nsMapping);
+            return NameFormat.parse(stringName, nsMapping);
         } catch (IllegalNameException e) {
             lexer.fail("Error while parsing '" + stringName + "'", e);
             return null;

Modified: jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/nodetype/xml/NodeTypeReader.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/nodetype/xml/NodeTypeReader.java?rev=421219&r1=421218&r2=421219&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/nodetype/xml/NodeTypeReader.java (original)
+++ jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/nodetype/xml/NodeTypeReader.java Wed Jul 12 03:15:17 2006
@@ -31,6 +31,7 @@
 import org.apache.jackrabbit.name.NamespaceResolver;
 import org.apache.jackrabbit.name.QName;
 import org.apache.jackrabbit.name.UnknownPrefixException;
+import org.apache.jackrabbit.name.NameFormat;
 import org.apache.jackrabbit.value.ValueHelper;
 import org.apache.jackrabbit.value.ValueFactoryImpl;
 
@@ -139,7 +140,7 @@
             UnknownPrefixException {
         NodeTypeDef type = new NodeTypeDef();
 
-        type.setName(QName.fromJCRName(
+        type.setName(NameFormat.parse(
                 walker.getAttribute(Constants.NAME_ATTRIBUTE), resolver));
         type.setMixin(Boolean.valueOf(
                 walker.getAttribute(Constants.ISMIXIN_ATTRIBUTE))
@@ -151,7 +152,7 @@
             walker.getAttribute(Constants.PRIMARYITEMNAME_ATTRIBUTE);
         if (primaryItemName != null && primaryItemName.length() > 0) {
             type.setPrimaryItemName(
-                    QName.fromJCRName(primaryItemName, resolver));
+                    NameFormat.parse(primaryItemName, resolver));
         }
 
         // supertype declarations
@@ -159,7 +160,7 @@
             Vector supertypes = new Vector();
             while (walker.iterateElements(Constants.SUPERTYPE_ELEMENT)) {
                 supertypes.add(
-                        QName.fromJCRName(walker.getContent(), resolver));
+                        NameFormat.parse(walker.getContent(), resolver));
             }
             type.setSupertypes((QName[])
                     supertypes.toArray(new QName[supertypes.size()]));
@@ -207,7 +208,7 @@
         if (name.equals("*")) {
             def.setName(ItemDef.ANY_NAME);
         } else {
-            def.setName(QName.fromJCRName(name, resolver));
+            def.setName(NameFormat.parse(name, resolver));
         }
 
         // simple attributes
@@ -288,7 +289,7 @@
         if (name.equals("*")) {
             def.setName(ItemDef.ANY_NAME);
         } else {
-            def.setName(QName.fromJCRName(name, resolver));
+            def.setName(NameFormat.parse(name, resolver));
         }
 
         // simple attributes
@@ -311,14 +312,14 @@
         String type =
             walker.getAttribute(Constants.DEFAULTPRIMARYTYPE_ATTRIBUTE);
         if (type != null && type.length() > 0) {
-            def.setDefaultPrimaryType(QName.fromJCRName(type, resolver));
+            def.setDefaultPrimaryType(NameFormat.parse(type, resolver));
         }
 
         // required primary types
         if (walker.enterElement(Constants.REQUIREDPRIMARYTYPES_ELEMENT)) {
             Vector types = new Vector();
             while (walker.iterateElements(Constants.REQUIREDPRIMARYTYPE_ELEMENT)) {
-                types.add(QName.fromJCRName(walker.getContent(), resolver));
+                types.add(NameFormat.parse(walker.getContent(), resolver));
             }
             def.setRequiredPrimaryTypes(
                     (QName[]) types.toArray(new QName[types.size()]));

Modified: jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/nodetype/xml/NodeTypeWriter.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/nodetype/xml/NodeTypeWriter.java?rev=421219&r1=421218&r2=421219&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/nodetype/xml/NodeTypeWriter.java (original)
+++ jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/nodetype/xml/NodeTypeWriter.java Wed Jul 12 03:15:17 2006
@@ -25,6 +25,7 @@
 import org.apache.jackrabbit.name.NamespaceResolver;
 import org.apache.jackrabbit.name.NoPrefixDeclaredException;
 import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.name.NameFormat;
 
 import javax.jcr.NamespaceRegistry;
 import javax.jcr.PropertyType;
@@ -116,7 +117,7 @@
 
         // simple attributes
         builder.setAttribute(
-                Constants.NAME_ATTRIBUTE, def.getName().toJCRName(resolver));
+                Constants.NAME_ATTRIBUTE, NameFormat.format(def.getName(), resolver));
         builder.setAttribute(
                 Constants.ISMIXIN_ATTRIBUTE, def.isMixin());
         builder.setAttribute(
@@ -128,7 +129,7 @@
         if (item != null) {
             builder.setAttribute(
                     Constants.PRIMARYITEMNAME_ATTRIBUTE,
-                    item.toJCRName(resolver));
+                    NameFormat.format(item, resolver));
         } else {
             builder.setAttribute(Constants.PRIMARYITEMNAME_ATTRIBUTE, "");
         }
@@ -140,7 +141,7 @@
             for (int i = 0; i < supertypes.length; i++) {
                 builder.addContentElement(
                         Constants.SUPERTYPE_ELEMENT,
-                        supertypes[i].toJCRName(resolver));
+                        NameFormat.format(supertypes[i], resolver));
             }
             builder.endElement();
         }
@@ -175,7 +176,7 @@
 
         // simple attributes
         builder.setAttribute(
-                Constants.NAME_ATTRIBUTE, def.getName().toJCRName(resolver));
+                Constants.NAME_ATTRIBUTE, NameFormat.format(def.getName(), resolver));
         builder.setAttribute(
                 Constants.AUTOCREATED_ATTRIBUTE, def.isAutoCreated());
         builder.setAttribute(
@@ -231,7 +232,7 @@
 
         // simple attributes
         builder.setAttribute(
-                Constants.NAME_ATTRIBUTE, def.getName().toJCRName(resolver));
+                Constants.NAME_ATTRIBUTE, NameFormat.format(def.getName(), resolver));
         builder.setAttribute(
                 Constants.AUTOCREATED_ATTRIBUTE, def.isAutoCreated());
         builder.setAttribute(
@@ -249,7 +250,7 @@
         if (type != null) {
             builder.setAttribute(
                     Constants.DEFAULTPRIMARYTYPE_ATTRIBUTE,
-                    type.toJCRName(resolver));
+                    NameFormat.format(type, resolver));
         } else {
             builder.setAttribute(Constants.DEFAULTPRIMARYTYPE_ATTRIBUTE, "");
         }
@@ -260,7 +261,7 @@
         for (int i = 0; i < requiredTypes.length; i++) {
             builder.addContentElement(
                     Constants.REQUIREDPRIMARYTYPE_ELEMENT,
-                    requiredTypes[i].toJCRName(resolver));
+                    NameFormat.format(requiredTypes[i], resolver));
         }
         builder.endElement();
 

Modified: jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/observation/EventImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/observation/EventImpl.java?rev=421219&r1=421218&r2=421219&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/observation/EventImpl.java (original)
+++ jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/observation/EventImpl.java Wed Jul 12 03:15:17 2006
@@ -16,11 +16,12 @@
  */
 package org.apache.jackrabbit.core.observation;
 
-import org.apache.jackrabbit.core.SessionImpl;
 import org.apache.jackrabbit.core.NodeId;
+import org.apache.jackrabbit.core.SessionImpl;
 import org.apache.jackrabbit.name.MalformedPathException;
 import org.apache.jackrabbit.name.NoPrefixDeclaredException;
 import org.apache.jackrabbit.name.Path;
+import org.apache.jackrabbit.name.PathFormat;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -90,7 +91,7 @@
             } else {
                 p = Path.create(eventState.getParentPath(), eventState.getChildRelPath().getName(), false);
             }
-            return p.toJCRPath(session.getNamespaceResolver());
+            return PathFormat.format(p, session.getNamespaceResolver());
         } catch (MalformedPathException e) {
             String msg = "internal error: malformed path for event";
             log.debug(msg);

Modified: jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/observation/ObservationManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/observation/ObservationManagerImpl.java?rev=421219&r1=421218&r2=421219&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/observation/ObservationManagerImpl.java (original)
+++ jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/observation/ObservationManagerImpl.java Wed Jul 12 03:15:17 2006
@@ -20,6 +20,7 @@
 import org.apache.jackrabbit.core.nodetype.NodeTypeManagerImpl;
 import org.apache.jackrabbit.name.MalformedPathException;
 import org.apache.jackrabbit.name.Path;
+import org.apache.jackrabbit.name.PathFormat;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -112,7 +113,7 @@
 
         Path path;
         try {
-            path = Path.create(absPath, session.getNamespaceResolver(), true);
+            path = PathFormat.parse(absPath, session.getNamespaceResolver()).getNormalizedPath();
         } catch (MalformedPathException mpe) {
             String msg = "invalid path syntax: " + absPath;
             log.debug(msg);

Modified: jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/QueryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/QueryImpl.java?rev=421219&r1=421218&r2=421219&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/QueryImpl.java (original)
+++ jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/QueryImpl.java Wed Jul 12 03:15:17 2006
@@ -23,6 +23,8 @@
 import org.apache.jackrabbit.name.NoPrefixDeclaredException;
 import org.apache.jackrabbit.name.Path;
 import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.name.NameFormat;
+import org.apache.jackrabbit.name.PathFormat;
 
 import javax.jcr.ItemExistsException;
 import javax.jcr.ItemNotFoundException;
@@ -108,11 +110,11 @@
         this.handler = handler;
 
         try {
-            if (!node.isNodeType(QName.NT_QUERY.toJCRName(session.getNamespaceResolver()))) {
+            if (!node.isNodeType(NameFormat.format(QName.NT_QUERY, session.getNamespaceResolver()))) {
                 throw new InvalidQueryException("node is not of type nt:query");
             }
-            statement = node.getProperty(QName.JCR_STATEMENT.toJCRName(session.getNamespaceResolver())).getString();
-            language = node.getProperty(QName.JCR_LANGUAGE.toJCRName(session.getNamespaceResolver())).getString();
+            statement = node.getProperty(NameFormat.format(QName.JCR_STATEMENT, session.getNamespaceResolver())).getString();
+            language = node.getProperty(NameFormat.format(QName.JCR_LANGUAGE, session.getNamespaceResolver())).getString();
             query = handler.createExecutableQuery(session, itemMgr, statement, language);
         } catch (NoPrefixDeclaredException e) {
             throw new RepositoryException(e.getMessage(), e);
@@ -174,17 +176,17 @@
         checkInitialized();
         try {
             NamespaceResolver resolver = session.getNamespaceResolver();
-            Path p = Path.create(absPath, resolver, true);
+            Path p = PathFormat.parse(absPath, resolver).getNormalizedPath();
             if (!p.isAbsolute()) {
                 throw new RepositoryException(absPath + " is not an absolute path");
             }
 
-            String relPath = p.toJCRPath(resolver).substring(1);
+            String relPath = PathFormat.format(p, resolver).substring(1);
             Node queryNode = session.getRootNode().addNode(relPath,
-                    QName.NT_QUERY.toJCRName(resolver));
+                    NameFormat.format(QName.NT_QUERY, resolver));
             // set properties
-            queryNode.setProperty(QName.JCR_LANGUAGE.toJCRName(resolver), language);
-            queryNode.setProperty(QName.JCR_STATEMENT.toJCRName(resolver), statement);
+            queryNode.setProperty(NameFormat.format(QName.JCR_LANGUAGE, resolver), language);
+            queryNode.setProperty(NameFormat.format(QName.JCR_STATEMENT, resolver), statement);
             node = queryNode;
             return node;
         } catch (MalformedPathException e) {

Modified: jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/lucene/LuceneQueryBuilder.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/lucene/LuceneQueryBuilder.java?rev=421219&r1=421218&r2=421219&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/lucene/LuceneQueryBuilder.java (original)
+++ jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/lucene/LuceneQueryBuilder.java Wed Jul 12 03:15:17 2006
@@ -42,6 +42,8 @@
 import org.apache.jackrabbit.name.Path;
 import org.apache.jackrabbit.name.QName;
 import org.apache.jackrabbit.name.UnknownPrefixException;
+import org.apache.jackrabbit.name.NameFormat;
+import org.apache.jackrabbit.name.PathFormat;
 import org.apache.jackrabbit.util.ISO8601;
 import org.apache.jackrabbit.util.XMLChar;
 import org.slf4j.Logger;
@@ -236,8 +238,8 @@
         String field = "";
         String value = "";
         try {
-            field = node.getPropertyName().toJCRName(nsMappings);
-            value = node.getValue().toJCRName(nsMappings);
+            field = NameFormat.format(node.getPropertyName(), nsMappings);
+            value = NameFormat.format(node.getValue(), nsMappings);
         } catch (NoPrefixDeclaredException e) {
             // will never happen, prefixes are created when unknown
         }
@@ -248,23 +250,23 @@
 
         List terms = new ArrayList();
         try {
-            String mixinTypesField = QName.JCR_MIXINTYPES.toJCRName(nsMappings);
-            String primaryTypeField = QName.JCR_PRIMARYTYPE.toJCRName(nsMappings);
+            String mixinTypesField = NameFormat.format(QName.JCR_MIXINTYPES, nsMappings);
+            String primaryTypeField = NameFormat.format(QName.JCR_PRIMARYTYPE, nsMappings);
 
             NodeTypeManager ntMgr = session.getWorkspace().getNodeTypeManager();
-            NodeType base = ntMgr.getNodeType(node.getValue().toJCRName(session.getNamespaceResolver()));
+            NodeType base = ntMgr.getNodeType(NameFormat.format(node.getValue(), session.getNamespaceResolver()));
 
             if (base.isMixin()) {
                 // search for nodes where jcr:mixinTypes is set to this mixin
                 Term t = new Term(FieldNames.PROPERTIES,
                         FieldNames.createNamedValue(mixinTypesField,
-                                node.getValue().toJCRName(nsMappings)));
+                                NameFormat.format(node.getValue(), nsMappings)));
                 terms.add(t);
             } else {
                 // search for nodes where jcr:primaryType is set to this type
                 Term t = new Term(FieldNames.PROPERTIES,
                         FieldNames.createNamedValue(primaryTypeField,
-                                node.getValue().toJCRName(nsMappings)));
+                                NameFormat.format(node.getValue(), nsMappings)));
                 terms.add(t);
             }
 
@@ -386,7 +388,7 @@
                     // will never match anything!
                     String name = "";
                     try {
-                        name = nameTest.toJCRName(nsMappings);
+                        name = NameFormat.format(nameTest, nsMappings);
                     } catch (NoPrefixDeclaredException e) {
                         exceptions.add(e);
                     }
@@ -448,7 +450,7 @@
         TermQuery nameTest = null;
         if (node.getNameTest() != null) {
             try {
-                String internalName = node.getNameTest().toJCRName(nsMappings);
+                String internalName = NameFormat.format(node.getNameTest(), nsMappings);
                 nameTest = new TermQuery(new Term(FieldNames.LABEL, internalName));
             } catch (NoPrefixDeclaredException e) {
                 // should never happen
@@ -477,7 +479,7 @@
                     // todo this will traverse the whole index, optimize!
                     Query subQuery = null;
                     try {
-                        subQuery = new MatchAllQuery(QName.JCR_PRIMARYTYPE.toJCRName(nsMappings));
+                        subQuery = new MatchAllQuery(NameFormat.format(QName.JCR_PRIMARYTYPE, nsMappings));
                     } catch (NoPrefixDeclaredException e) {
                         // will never happen, prefixes are created when unknown
                     }
@@ -511,10 +513,10 @@
         }
 
         try {
-            String refProperty = node.getRefProperty().toJCRName(nsMappings);
+            String refProperty = NameFormat.format(node.getRefProperty(), nsMappings);
             String nameTest = null;
             if (node.getNameTest() != null) {
-                nameTest = node.getNameTest().toJCRName(nsMappings);
+                nameTest = NameFormat.format(node.getNameTest(), nsMappings);
             }
 
             if (node.getIncludeDescendants()) {
@@ -585,7 +587,7 @@
 
         String field = "";
         try {
-            field = node.getProperty().toJCRName(nsMappings);
+            field = NameFormat.format(node.getProperty(), nsMappings);
         } catch (NoPrefixDeclaredException e) {
             // should never happen
             exceptions.add(e);
@@ -774,8 +776,8 @@
                 case PropertyType.PATH:
                     // try to translate path
                     try {
-                        Path p = Path.create(literal, session.getNamespaceResolver(), false);
-                        values.add(p.toJCRPath(nsMappings));
+                        Path p = PathFormat.parse(literal, session.getNamespaceResolver());
+                        values.add(PathFormat.format(p, nsMappings));
                         log.debug("Coerced " + literal + " into PATH.");
                     } catch (MalformedPathException e) {
                         log.warn("Unable to coerce '" + literal + "' into a PATH: " + e.toString());
@@ -827,7 +829,9 @@
             if (literal.indexOf('/') > -1) {
                 // might be a path
                 try {
-                    values.add(Path.create(literal, session.getNamespaceResolver(), false).toJCRPath(nsMappings));
+                    values.add(PathFormat.format(
+                            PathFormat.parse(literal, session.getNamespaceResolver()),
+                            nsMappings));
                     log.debug("Coerced " + literal + " into PATH.");
                 } catch (Exception e) {
                     // not a path

Modified: jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/lucene/NamespaceMappings.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/lucene/NamespaceMappings.java?rev=421219&r1=421218&r2=421219&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/lucene/NamespaceMappings.java (original)
+++ jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/lucene/NamespaceMappings.java Wed Jul 12 03:15:17 2006
@@ -22,6 +22,7 @@
 import org.apache.jackrabbit.name.QName;
 import org.apache.jackrabbit.name.UnknownPrefixException;
 import org.apache.jackrabbit.name.AbstractNamespaceResolver;
+import org.apache.jackrabbit.name.NameFormat;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -143,9 +144,9 @@
      */
     public String translatePropertyName(String name, NamespaceResolver resolver)
             throws IllegalNameException, UnknownPrefixException {
-        QName qName = QName.fromJCRName(name, resolver);
+        QName qName = NameFormat.parse(name, resolver);
         try {
-            return qName.toJCRName(this);
+            return NameFormat.format(qName, this);
         } catch (NoPrefixDeclaredException e) {
             // should never happen actually, because we create yet unknown
             // uri mappings on the fly.

Modified: jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/lucene/NodeIndexer.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/lucene/NodeIndexer.java?rev=421219&r1=421218&r2=421219&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/lucene/NodeIndexer.java (original)
+++ jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/lucene/NodeIndexer.java Wed Jul 12 03:15:17 2006
@@ -27,6 +27,8 @@
 import org.apache.jackrabbit.name.NoPrefixDeclaredException;
 import org.apache.jackrabbit.name.Path;
 import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.name.NameFormat;
+import org.apache.jackrabbit.name.PathFormat;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.apache.lucene.document.Document;
@@ -136,7 +138,7 @@
                 doc.add(new Field(FieldNames.PARENT, node.getParentId().toString(), true, true, false));
                 NodeState parent = (NodeState) stateProvider.getItemState(node.getParentId());
                 NodeState.ChildNodeEntry child = parent.getChildNodeEntry(node.getNodeId());
-                String name = child.getName().toJCRName(mappings);
+                String name = NameFormat.format(child.getName(), mappings);
                 doc.add(new Field(FieldNames.LABEL, name, false, true, false));
             }
         } catch (NoSuchItemStateException e) {
@@ -193,7 +195,7 @@
      */
     private void addMVPName(Document doc, QName name) {
         try {
-            String propName = name.toJCRName(mappings);
+            String propName = NameFormat.format(name, mappings);
             doc.add(new Field(FieldNames.MVP, propName, false, true, false));
         } catch (NoPrefixDeclaredException e) {
             // will never happen, prefixes are created dynamically
@@ -210,7 +212,7 @@
     private void addValue(Document doc, InternalValue value, QName name) {
         String fieldName = name.getLocalName();
         try {
-            fieldName = name.toJCRName(mappings);
+            fieldName = NameFormat.format(name, mappings);
         } catch (NoPrefixDeclaredException e) {
             // will never happen
         }
@@ -410,7 +412,7 @@
         Path path = (Path) internalValue;
         String pathString = path.toString();
         try {
-            pathString = path.toJCRPath(mappings);
+            pathString = PathFormat.format(path, mappings);
         } catch (NoPrefixDeclaredException e) {
             // will never happen
         }

Modified: jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/lucene/QueryResultImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/lucene/QueryResultImpl.java?rev=421219&r1=421218&r2=421219&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/lucene/QueryResultImpl.java (original)
+++ jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/lucene/QueryResultImpl.java Wed Jul 12 03:15:17 2006
@@ -21,6 +21,7 @@
 import org.apache.jackrabbit.name.NamespaceResolver;
 import org.apache.jackrabbit.name.NoPrefixDeclaredException;
 import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.name.NameFormat;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -101,7 +102,7 @@
         try {
             String[] propNames = new String[selectProps.length];
             for (int i = 0; i < selectProps.length; i++) {
-                propNames[i] = selectProps[i].toJCRName(resolver);
+                propNames[i] = NameFormat.format(selectProps[i], resolver);
             }
             return propNames;
         } catch (NoPrefixDeclaredException npde) {

Modified: jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/lucene/RowIteratorImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/lucene/RowIteratorImpl.java?rev=421219&r1=421218&r2=421219&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/lucene/RowIteratorImpl.java (original)
+++ jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/lucene/RowIteratorImpl.java Wed Jul 12 03:15:17 2006
@@ -22,6 +22,7 @@
 import org.apache.jackrabbit.name.NamespaceResolver;
 import org.apache.jackrabbit.name.QName;
 import org.apache.jackrabbit.name.UnknownPrefixException;
+import org.apache.jackrabbit.name.NameFormat;
 import org.apache.jackrabbit.value.LongValue;
 import org.apache.jackrabbit.value.PathValue;
 import org.apache.jackrabbit.value.StringValue;
@@ -251,7 +252,7 @@
                 propertySet = tmp;
             }
             try {
-                QName prop = QName.fromJCRName(propertyName, resolver);
+                QName prop = NameFormat.parse(propertyName, resolver);
                 if (!propertySet.contains(prop)) {
                     throw new ItemNotFoundException(propertyName);
                 }

Modified: jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java?rev=421219&r1=421218&r2=421219&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java (original)
+++ jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java Wed Jul 12 03:15:17 2006
@@ -29,6 +29,7 @@
 import org.apache.jackrabbit.core.state.NodeStateIterator;
 import org.apache.jackrabbit.name.NoPrefixDeclaredException;
 import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.name.NameFormat;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.apache.lucene.analysis.Analyzer;
@@ -435,7 +436,7 @@
                 sortFields.add(new SortField(null, SortField.SCORE, orderSpecs[i]));
             } else {
                 try {
-                    prop = orderProps[i].toJCRName(getNamespaceMappings());
+                    prop = NameFormat.format(orderProps[i], getNamespaceMappings());
                 } catch (NoPrefixDeclaredException e) {
                     // will never happen
                 }

Modified: jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/lucene/WorkspaceTraversalResult.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/lucene/WorkspaceTraversalResult.java?rev=421219&r1=421218&r2=421219&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/lucene/WorkspaceTraversalResult.java (original)
+++ jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/lucene/WorkspaceTraversalResult.java Wed Jul 12 03:15:17 2006
@@ -21,6 +21,7 @@
 import org.apache.jackrabbit.name.QName;
 import org.apache.jackrabbit.name.NamespaceResolver;
 import org.apache.jackrabbit.name.NoPrefixDeclaredException;
+import org.apache.jackrabbit.name.NameFormat;
 
 import javax.jcr.query.QueryResult;
 import javax.jcr.query.RowIterator;
@@ -77,7 +78,7 @@
         try {
             String[] propNames = new String[properties.length];
             for (int i = 0; i < properties.length; i++) {
-                propNames[i] = properties[i].toJCRName(resolver);
+                propNames[i] = NameFormat.format(properties[i], resolver);
             }
             return propNames;
         } catch (NoPrefixDeclaredException npde) {

Modified: jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/sql/JCRSQLQueryBuilder.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/sql/JCRSQLQueryBuilder.java?rev=421219&r1=421218&r2=421219&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/sql/JCRSQLQueryBuilder.java (original)
+++ jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/sql/JCRSQLQueryBuilder.java Wed Jul 12 03:15:17 2006
@@ -33,6 +33,7 @@
 import org.apache.jackrabbit.name.NamespaceResolver;
 import org.apache.jackrabbit.name.QName;
 import org.apache.jackrabbit.name.UnknownPrefixException;
+import org.apache.jackrabbit.name.NameFormat;
 import org.apache.jackrabbit.util.ISO8601;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -584,7 +585,7 @@
                 QName qName = null;
                 if (name != null) {
                     try {
-                        qName = QName.fromJCRName(name, resolver);
+                        qName = NameFormat.parse(name, resolver);
                     } catch (IllegalNameException e) {
                         throw new IllegalArgumentException("Illegal name: " + name);
                     } catch (UnknownPrefixException e) {

Modified: jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/sql/QueryFormat.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/sql/QueryFormat.java?rev=421219&r1=421218&r2=421219&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/sql/QueryFormat.java (original)
+++ jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/sql/QueryFormat.java Wed Jul 12 03:15:17 2006
@@ -34,6 +34,7 @@
 import org.apache.jackrabbit.name.NamespaceResolver;
 import org.apache.jackrabbit.name.NoPrefixDeclaredException;
 import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.name.NameFormat;
 import org.apache.jackrabbit.util.ISO8601;
 
 import javax.jcr.query.InvalidQueryException;
@@ -151,7 +152,7 @@
 
             if (ntCount == 0) {
                 sb.append(" ");
-                sb.append(QName.NT_BASE.toJCRName(resolver));
+                sb.append(NameFormat.format(QName.NT_BASE, resolver));
             }
 
             // append WHERE clause
@@ -283,7 +284,7 @@
         try {
             if (containsDescendantOrSelf(node)) {
                 sb.append("(");
-                sb.append(QName.JCR_PATH.toJCRName(resolver));
+                sb.append(NameFormat.format(QName.JCR_PATH, resolver));
                 sb.append(" LIKE '");
                 LocationStepQueryNode[] steps = node.getPathSteps();
                 for (int i = 0; i < steps.length; i++) {
@@ -298,7 +299,7 @@
                 }
                 sb.append('\'');
                 sb.append(" OR ");
-                sb.append(QName.JCR_PATH.toJCRName(resolver));
+                sb.append(NameFormat.format(QName.JCR_PATH, resolver));
                 sb.append(" LIKE '");
                 for (int i = 0; i < steps.length; i++) {
                     if (steps[i].getNameTest() == null
@@ -311,7 +312,7 @@
                 }
                 sb.append("')");
             } else if (containsAllChildrenMatch(node)) {
-                sb.append(QName.JCR_PATH.toJCRName(resolver));
+                sb.append(NameFormat.format(QName.JCR_PATH, resolver));
                 sb.append(" LIKE '");
                 StringBuffer path = new StringBuffer();
                 LocationStepQueryNode[] steps = node.getPathSteps();
@@ -325,12 +326,12 @@
                 sb.append(path);
                 sb.append('\'');
                 sb.append(" AND NOT ");
-                sb.append(QName.JCR_PATH.toJCRName(resolver));
+                sb.append(NameFormat.format(QName.JCR_PATH, resolver));
                 sb.append(" LIKE '");
                 sb.append(path).append("/%").append('\'');
             } else {
                 // just do a best effort
-                sb.append(QName.JCR_PATH.toJCRName(resolver));
+                sb.append(NameFormat.format(QName.JCR_PATH, resolver));
                 sb.append(" LIKE '");
                 LocationStepQueryNode[] steps = node.getPathSteps();
                 for (int i = 0; i < steps.length; i++) {
@@ -355,7 +356,7 @@
         } else {
             if (node.getNameTest().getLocalName().length() > 0) {
                 try {
-                    sb.append(node.getNameTest().toJCRName(resolver));
+                    sb.append(NameFormat.format(node.getNameTest(), resolver));
                 } catch (NoPrefixDeclaredException e) {
                     exceptions.add(e);
                 }
@@ -474,7 +475,7 @@
         if (quote) {
             b.append('"');
         }
-        b.append(name.toJCRName(resolver));
+        b.append(NameFormat.format(name, resolver));
         if (quote) {
             b.append('"');
         }

Modified: jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/xpath/QueryFormat.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/xpath/QueryFormat.java?rev=421219&r1=421218&r2=421219&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/xpath/QueryFormat.java (original)
+++ jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/query/xpath/QueryFormat.java Wed Jul 12 03:15:17 2006
@@ -34,6 +34,7 @@
 import org.apache.jackrabbit.name.NamespaceResolver;
 import org.apache.jackrabbit.name.NoPrefixDeclaredException;
 import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.name.NameFormat;
 import org.apache.jackrabbit.util.ISO8601;
 import org.apache.jackrabbit.util.ISO9075;
 
@@ -117,7 +118,7 @@
                 try {
                     sb.append(pipe);
                     sb.append('@');
-                    sb.append(ISO9075.encode(selectProps[i]).toJCRName(resolver));
+                    sb.append(NameFormat.format(ISO9075.encode(selectProps[i]), resolver));
                     pipe = "|";
                 } catch (NoPrefixDeclaredException e) {
                     exceptions.add(e);
@@ -169,7 +170,7 @@
         QueryNode[] operands = node.getOperands();
         if (operands.length > 0) {
             try {
-                sb.append(XPathQueryBuilder.FN_NOT_10.toJCRName(resolver));
+                sb.append(NameFormat.format(XPathQueryBuilder.FN_NOT_10, resolver));
                 sb.append("(");
                 operands[0].accept(this, sb);
                 sb.append(")");
@@ -184,8 +185,8 @@
         StringBuffer sb = (StringBuffer) data;
         sb.append("@");
         try {
-            sb.append(ISO9075.encode(node.getPropertyName()).toJCRName(resolver));
-            sb.append("='").append(node.getValue().toJCRName(resolver));
+            sb.append(NameFormat.format(ISO9075.encode(node.getPropertyName()), resolver));
+            sb.append("='").append(NameFormat.format(node.getValue(), resolver));
         } catch (NoPrefixDeclaredException e) {
             exceptions.add(e);
         }
@@ -197,8 +198,8 @@
         StringBuffer sb = (StringBuffer) data;
         try {
             sb.append("@");
-            sb.append(QName.JCR_PRIMARYTYPE.toJCRName(resolver));
-            sb.append("='").append(node.getValue().toJCRName(resolver));
+            sb.append(NameFormat.format(QName.JCR_PRIMARYTYPE, resolver));
+            sb.append("='").append(NameFormat.format(node.getValue(), resolver));
             sb.append("'");
         } catch (NoPrefixDeclaredException e) {
             exceptions.add(e);
@@ -209,12 +210,12 @@
     public Object visit(TextsearchQueryNode node, Object data) {
         StringBuffer sb = (StringBuffer) data;
         try {
-            sb.append(XPathQueryBuilder.JCR_CONTAINS.toJCRName(resolver));
+            sb.append(NameFormat.format(XPathQueryBuilder.JCR_CONTAINS, resolver));
             sb.append("(");
             if (node.getPropertyName() == null) {
                 sb.append(".");
             } else {
-                sb.append(ISO9075.encode(node.getPropertyName()).toJCRName(resolver));
+                sb.append(NameFormat.format(ISO9075.encode(node.getPropertyName()), resolver));
             }
             sb.append(", '");
             sb.append(node.getQuery().replaceAll("'", "''"));
@@ -250,9 +251,9 @@
         } else {
             try {
                 if (node.getNameTest().getLocalName().length() == 0) {
-                    sb.append(XPathQueryBuilder.JCR_ROOT.toJCRName(resolver));
+                    sb.append(NameFormat.format(XPathQueryBuilder.JCR_ROOT, resolver));
                 } else {
-                    sb.append(ISO9075.encode(node.getNameTest()).toJCRName(resolver));
+                    sb.append(NameFormat.format(ISO9075.encode(node.getNameTest()), resolver));
                 }
             } catch (NoPrefixDeclaredException e) {
                 exceptions.add(e);
@@ -273,14 +274,14 @@
     public Object visit(DerefQueryNode node, Object data) {
         StringBuffer sb = (StringBuffer) data;
         try {
-            sb.append(XPathQueryBuilder.JCR_DEREF.toJCRName(resolver));
+            sb.append(NameFormat.format(XPathQueryBuilder.JCR_DEREF, resolver));
             sb.append("(@");
-            sb.append(ISO9075.encode(node.getRefProperty()).toJCRName(resolver));
+            sb.append(NameFormat.format(ISO9075.encode(node.getRefProperty()), resolver));
             sb.append(", '");
             if (node.getNameTest() == null) {
                 sb.append("*");
             } else {
-                sb.append(ISO9075.encode(node.getNameTest()).toJCRName(resolver));
+                sb.append(NameFormat.format(ISO9075.encode(node.getNameTest()), resolver));
             }
             sb.append("')");
         } catch (NoPrefixDeclaredException e) {
@@ -296,9 +297,9 @@
             String propName = "@";
             // only encode if not position function
             if (node.getProperty().equals(XPathQueryBuilder.FN_POSITION_FULL)) {
-                propName += node.getProperty().toJCRName(resolver);
+                propName += NameFormat.format(node.getProperty(), resolver);
             } else {
-                propName += ISO9075.encode(node.getProperty()).toJCRName(resolver);
+                propName += NameFormat.format(ISO9075.encode(node.getProperty()), resolver);
             }
 
             if (node.getOperation() == OPERATION_EQ_VALUE) {
@@ -317,7 +318,7 @@
                 sb.append(propName).append(" le ");
                 appendValue(node, sb);
             } else if (node.getOperation() == OPERATION_LIKE) {
-                sb.append(XPathQueryBuilder.JCR_LIKE.toJCRName(resolver));
+                sb.append(NameFormat.format(XPathQueryBuilder.JCR_LIKE, resolver));
                 sb.append("(").append(propName).append(", ");
                 appendValue(node, sb);
                 sb.append(")");
@@ -331,7 +332,7 @@
                 sb.append(propName).append(" != ");
                 appendValue(node, sb);
             } else if (node.getOperation() == OPERATION_NULL) {
-                sb.append(XPathQueryBuilder.FN_NOT.toJCRName(resolver));
+                sb.append(NameFormat.format(XPathQueryBuilder.FN_NOT, resolver));
                 sb.append("(").append(propName).append(")");
             } else if (node.getOperation() == OPERATION_NOT_NULL) {
                 sb.append(propName);
@@ -353,7 +354,7 @@
             for (int i = 0; i < specs.length; i++) {
                 sb.append(comma);
                 QName prop = ISO9075.encode(specs[i].getProperty());
-                sb.append(" @").append(prop.toJCRName(resolver));
+                sb.append(" @").append(NameFormat.format(prop, resolver));
                 if (!specs[i].isAscending()) {
                     sb.append(" descending");
                 }
@@ -387,7 +388,7 @@
         } else if (node.getValueType() == TYPE_DATE || node.getValueType() == TYPE_TIMESTAMP) {
             Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
             cal.setTime(node.getDateValue());
-            b.append(XPathQueryBuilder.XS_DATETIME.toJCRName(resolver));
+            b.append(NameFormat.format(XPathQueryBuilder.XS_DATETIME, resolver));
             b.append("('").append(ISO8601.format(cal)).append("')");
         } else if (node.getValueType() == TYPE_POSITION) {
             if (node.getPositionValue() == LocationStepQueryNode.LAST) {



Mime
View raw message