jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r504206 - in /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core: SearchManager.java query/xpath/XPathQueryBuilder.java
Date Tue, 06 Feb 2007 17:21:53 GMT
Author: mreutegg
Date: Tue Feb  6 09:21:52 2007
New Revision: 504206

URL: http://svn.apache.org/viewvc?view=rev&rev=504206
Log:
JCR-734: Update namespace uri for prefix fn

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SearchManager.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/xpath/XPathQueryBuilder.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SearchManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SearchManager.java?view=diff&rev=504206&r1=504205&r2=504206
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SearchManager.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SearchManager.java
Tue Feb  6 09:21:52 2007
@@ -37,6 +37,7 @@
 
 import javax.jcr.Node;
 import javax.jcr.RepositoryException;
+import javax.jcr.NamespaceException;
 import javax.jcr.observation.Event;
 import javax.jcr.observation.EventIterator;
 import javax.jcr.query.InvalidQueryException;
@@ -65,9 +66,14 @@
     /**
      * Namespace URI for xpath functions
      */
-    // @todo this is not final! What should we use?
     private static final String NS_FN_PREFIX = "fn";
-    public static final String NS_FN_URI = "http://www.w3.org/2004/10/xpath-functions";
+    public static final String NS_FN_URI = "http://www.w3.org/2005/xpath-functions";
+
+    /**
+     * Deprecated namespace URI for xpath functions
+     */
+    private static final String NS_FN_OLD_PREFIX = "fn_old";
+    public static final String NS_FN_OLD_URI = "http://www.w3.org/2004/10/xpath-functions";
 
     /**
      * Namespace URI for XML schema
@@ -185,6 +191,26 @@
 
         // register namespaces
         nsReg.safeRegisterNamespace(NS_XS_PREFIX, NS_XS_URI);
+        try {
+            if (nsReg.getPrefix(NS_FN_OLD_URI).equals(NS_FN_PREFIX)) {
+                // old uri is mapped to 'fn' prefix -> re-map
+                String prefix;
+                for (int i = 0; ; i++) {
+                    try {
+                        nsReg.getURI(NS_FN_OLD_PREFIX + i);
+                    } catch (NamespaceException e) {
+                        // not mapped to uri
+                        prefix = NS_FN_OLD_PREFIX + i;
+                        break;
+                    }
+                }
+                nsReg.registerNamespace(prefix, NS_FN_OLD_URI);
+            }
+        } catch (NamespaceException e) {
+            // does not yet exist
+            nsReg.safeRegisterNamespace(NS_FN_OLD_PREFIX, NS_FN_OLD_URI);
+        }
+        // at this point the 'fn' prefix shouldn't be assigned anymore
         nsReg.safeRegisterNamespace(NS_FN_PREFIX, NS_FN_URI);
 
         Properties params = config.getParameters();

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/xpath/XPathQueryBuilder.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/xpath/XPathQueryBuilder.java?view=diff&rev=504206&r1=504205&r2=504206
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/xpath/XPathQueryBuilder.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/xpath/XPathQueryBuilder.java
Tue Feb  6 09:21:52 2007
@@ -57,7 +57,7 @@
     /**
      * Namespace uri for xpath functions. See also class SearchManager
      */
-    static final String NS_FN_URI = "http://www.w3.org/2004/10/xpath-functions";
+    static final String NS_FN_URI = "http://www.w3.org/2005/xpath-functions";
 
     /**
      * QName for 'fn:not'



Mime
View raw message