jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1372788 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name: NamespaceConstants.java NamespaceRegistryImpl.java Namespaces.java
Date Tue, 14 Aug 2012 09:08:50 GMT
Author: angela
Date: Tue Aug 14 09:08:49 2012
New Revision: 1372788

URL: http://svn.apache.org/viewvc?rev=1372788&view=rev
Log:
OAK-125 : Improved namespace registry 

- add backwards compatible set of reservered namespaces

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NamespaceConstants.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NamespaceRegistryImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/Namespaces.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NamespaceConstants.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NamespaceConstants.java?rev=1372788&r1=1372787&r2=1372788&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NamespaceConstants.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NamespaceConstants.java
Tue Aug 14 09:08:49 2012
@@ -16,6 +16,11 @@
  */
 package org.apache.jackrabbit.oak.plugins.name;
 
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import javax.jcr.NamespaceRegistry;
+
 import org.apache.jackrabbit.JcrConstants;
 
 /**
@@ -26,4 +31,41 @@ public interface NamespaceConstants {
     String REP_NAMESPACES = "rep:namespaces";
 
     String NAMESPACES_PATH = '/' + JcrConstants.JCR_SYSTEM + '/' + REP_NAMESPACES;
+
+    // TODO: see http://java.net/jira/browse/JSR_333-50)
+    String PREFIX_SV = "sv";
+    String NAMESPACE_SV = "http://www.jcp.org/jcr/sv/1.0";
+
+    String PREFIX_REP = "rep";
+    String NAMESPACE_REP = "internal"; // TODO: see OAK-74
+
+    // additional XML namespace
+    String PREFIX_XMLNS = "xmlns";
+    String NAMESPACE_XMLNS = "http://www.w3.org/2000/xmlns/";
+
+    /**
+     * Reserved namespace prefixes as defined in jackrabbit 2
+     */
+    Collection<String> RESERVED_PREFIXES = Collections.unmodifiableList(Arrays.asList(
+            NamespaceRegistry.PREFIX_XML,
+            NamespaceRegistry.PREFIX_JCR,
+            NamespaceRegistry.PREFIX_NT,
+            NamespaceRegistry.PREFIX_MIX,
+            PREFIX_XMLNS,
+            PREFIX_REP,
+            PREFIX_SV
+    ));
+
+    /**
+     * Reserved namespace URIs as defined in jackrabbit 2
+     */
+    Collection<String> RESERVED_URIS = Collections.unmodifiableList(Arrays.asList(
+            NamespaceRegistry.NAMESPACE_XML,
+            NamespaceRegistry.NAMESPACE_JCR,
+            NamespaceRegistry.NAMESPACE_NT,
+            NamespaceRegistry.NAMESPACE_MIX,
+            NAMESPACE_XMLNS,
+            NAMESPACE_REP,
+            NAMESPACE_SV
+    ));
 }
\ No newline at end of file

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NamespaceRegistryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NamespaceRegistryImpl.java?rev=1372788&r1=1372787&r2=1372788&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NamespaceRegistryImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NamespaceRegistryImpl.java
Tue Aug 14 09:08:49 2012
@@ -17,6 +17,7 @@
 package org.apache.jackrabbit.oak.plugins.name;
 
 import java.util.Arrays;
+import java.util.HashSet;
 import java.util.Map;
 
 import javax.annotation.Nonnull;

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/Namespaces.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/Namespaces.java?rev=1372788&r1=1372787&r2=1372788&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/Namespaces.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/Namespaces.java
Tue Aug 14 09:08:49 2012
@@ -32,29 +32,26 @@ import org.apache.jackrabbit.oak.api.Tre
  */
 class Namespaces implements NamespaceConstants {
 
-    private static final Map<String, String> defaults = new HashMap<String, String>();
-
     private Namespaces() {
     }
 
+    private static final Map<String, String> DEFAULTS = new HashMap<String, String>();
     static {
         // Standard namespace specified by JCR (default one not included)
-        defaults.put(NamespaceRegistry.PREFIX_EMPTY, NamespaceRegistry.NAMESPACE_EMPTY);
-        defaults.put(NamespaceRegistry.PREFIX_JCR, NamespaceRegistry.NAMESPACE_JCR);
-        defaults.put(NamespaceRegistry.PREFIX_NT,  NamespaceRegistry.NAMESPACE_NT);
-        defaults.put(NamespaceRegistry.PREFIX_MIX, NamespaceRegistry.NAMESPACE_MIX);
-        defaults.put(NamespaceRegistry.PREFIX_XML, NamespaceRegistry.NAMESPACE_XML);
+        DEFAULTS.put(NamespaceRegistry.PREFIX_EMPTY, NamespaceRegistry.NAMESPACE_EMPTY);
+        DEFAULTS.put(NamespaceRegistry.PREFIX_JCR, NamespaceRegistry.NAMESPACE_JCR);
+        DEFAULTS.put(NamespaceRegistry.PREFIX_NT,  NamespaceRegistry.NAMESPACE_NT);
+        DEFAULTS.put(NamespaceRegistry.PREFIX_MIX, NamespaceRegistry.NAMESPACE_MIX);
+        DEFAULTS.put(NamespaceRegistry.PREFIX_XML, NamespaceRegistry.NAMESPACE_XML);
 
         // Namespace included in Jackrabbit 2.x
-        // TODO: use constants (see also http://java.net/jira/browse/JSR_333-50)
-        defaults.put("sv", "http://www.jcp.org/jcr/sv/1.0");
-
-        // TODO: see OAK-74
-        defaults.put("rep", "internal");
+        DEFAULTS.put(PREFIX_XMLNS, NAMESPACE_XMLNS);
+        DEFAULTS.put(PREFIX_SV, NAMESPACE_SV);
+        DEFAULTS.put(PREFIX_REP, NAMESPACE_REP);
     }
 
     public static Map<String, String> getNamespaceMap(Tree root) {
-        Map<String, String> map = new HashMap<String, String>(defaults);
+        Map<String, String> map = new HashMap<String, String>(DEFAULTS);
 
         Tree system = root.getChild(JcrConstants.JCR_SYSTEM);
         if (system != null) {



Mime
View raw message