jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r704165 - /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfigurationParser.java
Date Mon, 13 Oct 2008 17:06:29 GMT
Author: jukka
Date: Mon Oct 13 10:06:29 2008
New Revision: 704165

URL: http://svn.apache.org/viewvc?rev=704165&view=rev
Log:
JCR-1765: Config: make all elements in the security configuration optional

Added a simple workaround that just uses SimpleSecurityManager as the default if an explicit
security manager configuration is not present. This makes my backwards compatibility test
cases in sandbox work.

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfigurationParser.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfigurationParser.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfigurationParser.java?rev=704165&r1=704164&r2=704165&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfigurationParser.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfigurationParser.java
Mon Oct 13 10:06:29 2008
@@ -21,6 +21,7 @@
 import org.apache.jackrabbit.core.fs.FileSystem;
 import org.apache.jackrabbit.core.fs.FileSystemException;
 import org.apache.jackrabbit.core.fs.FileSystemFactory;
+import org.apache.jackrabbit.core.security.simple.SimpleSecurityManager;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
@@ -293,25 +294,33 @@
     }
 
     /**
-     * Parses the security manager configuration.
+     * Parses the security manager configuration. Returns default
+     * configuration based on the {@link SimpleSecurityManager} class if
+     * a security manager is not explicitly configured.
      *
+     * @see <a href="https://issues.apache.org/jira/browse/JCR-1765">JCR-1765</a>
      * @param security the &lt;security> element.
      * @return the security manager configuration.
      * @throws ConfigurationException if the configuration is broken
      */
     public SecurityManagerConfig parseSecurityManagerConfig(Element security)
             throws ConfigurationException {
+        BeanConfig bc = new BeanConfig(
+                SimpleSecurityManager.class.getName(), new Properties());
+        String wspAttr = "security";
+        BeanConfig wac = null;
 
-        BeanConfig bc = parseBeanConfig(security, SECURITY_MANAGER_ELEMENT);
+        Element element = getElement(security, SECURITY_MANAGER_ELEMENT, false);
+        if (element != null) {
+            bc = parseBeanConfig(security, SECURITY_MANAGER_ELEMENT);
 
-        Element smElement = getElement(security, SECURITY_MANAGER_ELEMENT);
-        String wspAttr = getAttribute(smElement, WSP_NAME_ATTRIBUTE, null);
+            wspAttr = getAttribute(element, WSP_NAME_ATTRIBUTE, null);
 
-        BeanConfig wac = null;
-        Element element = getElement(smElement, WORKSPACE_ACCESS_ELEMENT, false);
-        if (element != null) {
-            wac = parseBeanConfig(smElement, WORKSPACE_ACCESS_ELEMENT);
+            if (getElement(element, WORKSPACE_ACCESS_ELEMENT, false) != null) {
+                wac = parseBeanConfig(element, WORKSPACE_ACCESS_ELEMENT);
+            }
         }
+
         return new SecurityManagerConfig(bc, wspAttr, wac);
     }
 



Mime
View raw message