jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tri...@apache.org
Subject svn commit: r418779 - in /jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/config: ConfigurationParser.java RepositoryConfig.java SecurityConfig.java
Date Mon, 03 Jul 2006 14:40:48 GMT
Author: tripod
Date: Mon Jul  3 07:40:47 2006
New Revision: 418779

URL: http://svn.apache.org/viewvc?rev=418779&view=rev
Log:
JCR-474: Introduce 'SecurityConfig' for better extensability

Added:
    jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/config/SecurityConfig.java
  (with props)
Modified:
    jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/config/ConfigurationParser.java
    jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfig.java

Modified: jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/config/ConfigurationParser.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/config/ConfigurationParser.java?rev=418779&r1=418778&r2=418779&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/config/ConfigurationParser.java
(original)
+++ jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/config/ConfigurationParser.java
Mon Jul  3 07:40:47 2006
@@ -119,7 +119,7 @@
 
     /** Name of the default search index implementation class. */
     public static final String DEFAULT_QUERY_HANDLER =
-            "org.apache.jackrabbit.core.query.lucene.SearchIndex";
+            "com.day.crx.core.query.lucene.SearchIndex";
 
     /**
      * The configuration parser variables. These name-value pairs
@@ -209,17 +209,7 @@
 
         // Security configuration and access manager implementation
         Element security = getElement(root, SECURITY_ELEMENT);
-        String appName = getAttribute(security, APP_NAME_ATTRIBUTE);
-        AccessManagerConfig amc = new AccessManagerConfig(
-                parseBeanConfig(security, ACCESS_MANAGER_ELEMENT));
-
-        // Optional login module
-        Element loginModule = getElement(security, LOGIN_MODULE_ELEMENT, false);
-
-        LoginModuleConfig lmc = null;
-        if (loginModule != null) {
-            lmc = new LoginModuleConfig(parseBeanConfig(security, LOGIN_MODULE_ELEMENT));
-        }
+        SecurityConfig securityConfig = parseSecurityConfig(security);
 
         // General workspace configuration
         Element workspaces = getElement(root, WORKSPACES_ELEMENT);
@@ -244,9 +234,69 @@
         // Optional search configuration
         SearchConfig sc = parseSearchConfig(root);
 
-        return new RepositoryConfig(home, appName, amc, lmc, fsc,
+        return new RepositoryConfig(home, securityConfig, fsc,
                 workspaceDirectory, workspaceConfigDirectory, defaultWorkspace,
                 maxIdleTime, template, vc, sc, this);
+    }
+
+    /**
+     * Parses security configuration. Security configuration
+     * uses the following format:
+     * <pre>
+     *   &lt;Security appName="..."&gt;
+     *     &lt;AccessManager ...&gt;
+     *     &lt;LoginModule ... (optional)&gt;
+     *   &lt;/Security&gt;
+     * </pre>
+     * <p/>
+     * Both the <code>AccessManager</code> and <code>LoginModule</code>
+     * elements are {@link #parseBeanConfig(Element,String) bean configuration}
+     * elements.
+     * <p/>
+     * The login module is an optional feature of repository configuration.
+     *
+     * @param security the &lt;security> element.
+     * @return the security configuration.
+     * @throws ConfigurationException
+     */
+    public SecurityConfig parseSecurityConfig(Element security)
+            throws ConfigurationException {
+        String appName = getAttribute(security, APP_NAME_ATTRIBUTE);
+        AccessManagerConfig amc = parseAccessManagerConfig(security);
+        LoginModuleConfig lmc = parseLoginModuleConfig(security);
+        return new SecurityConfig(appName, amc, lmc);
+    }
+
+    /**
+     * Parses the access manager configuration.
+     *
+     * @param security the &lt;security> element.
+     * @return the access manager configuration.
+     * @throws ConfigurationException
+     */
+    public AccessManagerConfig parseAccessManagerConfig(Element security)
+            throws ConfigurationException {
+        return new AccessManagerConfig(
+                parseBeanConfig(security, ACCESS_MANAGER_ELEMENT));
+    }
+
+    /**
+     * Parses the login module configuration.
+     *
+     * @param security the &lt;security> element.
+     * @return the login module configuration.
+     * @throws ConfigurationException
+     */
+    public LoginModuleConfig parseLoginModuleConfig(Element security)
+            throws ConfigurationException {
+        // Optional login module
+        Element loginModule = getElement(security, LOGIN_MODULE_ELEMENT, false);
+
+        if (loginModule != null) {
+            return new LoginModuleConfig(parseBeanConfig(security, LOGIN_MODULE_ELEMENT));
+        } else {
+            return null;
+        }
     }
 
     /**

Modified: jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfig.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfig.java?rev=418779&r1=418778&r2=418779&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfig.java
(original)
+++ jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfig.java
Mon Jul  3 07:40:47 2006
@@ -154,19 +154,9 @@
     private final String home;
 
     /**
-     * Repository name for a JAAS app-entry configuration.
+     * The security config.
      */
-    private final String name;
-
-    /**
-     * Repository access manager configuration;
-     */
-    private final AccessManagerConfig amc;
-
-    /**
-     * Repository login module configuration. Optional, can be null
-     */
-    private final LoginModuleConfig lmc;
+    private final SecurityConfig sec;
 
     /**
      * Repository file system configuration.
@@ -226,9 +216,7 @@
      *
      * @param template workspace configuration template
      * @param home repository home directory
-     * @param name repository name for a JAAS app-entry configuration
-     * @param amc access manager configuration
-     * @param lmc login module configuration (can be <code>null</code>)
+     * @param sec the security configuration
      * @param fsc file system configuration
      * @param workspaceDirectory workspace root directory
      * @param workspaceConfigDirectory optional workspace configuration directory
@@ -238,17 +226,14 @@
      * @param sc search configuration for system search manager.
      * @param parser the ConfigurationParser that servers as config factory
      */
-    public RepositoryConfig(String home, String name,
-            AccessManagerConfig amc, LoginModuleConfig lmc, FileSystemConfig fsc,
+    public RepositoryConfig(String home, SecurityConfig sec, FileSystemConfig fsc,
             String workspaceDirectory, String workspaceConfigDirectory,
             String defaultWorkspace, int workspaceMaxIdleTime,
             Element template, VersioningConfig vc, SearchConfig sc,
             ConfigurationParser parser) {
         workspaces = new HashMap();
         this.home = home;
-        this.name = name;
-        this.amc = amc;
-        this.lmc = lmc;
+        this.sec = sec;
         this.fsc = fsc;
         this.workspaceDirectory = workspaceDirectory;
         this.workspaceConfigDirectory = workspaceConfigDirectory;
@@ -641,7 +626,7 @@
      * @return repository name
      */
     public String getAppName() {
-        return name;
+        return sec.getAppName();
     }
 
     /**
@@ -650,7 +635,7 @@
      * @return access manager configuration
      */
     public AccessManagerConfig getAccessManagerConfig() {
-        return amc;
+        return sec.getAccessManagerConfig();
     }
 
     /**
@@ -660,7 +645,16 @@
      *         JAAS mechanism should be used.
      */
     public LoginModuleConfig getLoginModuleConfig() {
-        return lmc;
+        return sec.getLoginModuleConfig();
+    }
+
+    /**
+     * Returns the repository security configuration.
+     *
+     * @return security configutation
+     */
+    public SecurityConfig getSecurityConfig() {
+        return sec;
     }
 
     /**
@@ -730,4 +724,4 @@
     public SearchConfig getSearchConfig() {
         return sc;
     }
-}
+}
\ No newline at end of file

Added: jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/config/SecurityConfig.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/config/SecurityConfig.java?rev=418779&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/config/SecurityConfig.java
(added)
+++ jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/config/SecurityConfig.java
Mon Jul  3 07:40:47 2006
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.core.config;
+
+/**
+ * Search index configuration. This bean configuration class
+ * is used to create configured search index objects.
+ * <p>
+ * In addition to generic bean configuration information, this
+ * class also contains an optional file system configuration
+ * used by the search index.
+ *
+ * @see WorkspaceConfig#getSearchConfig()
+ */
+public class SecurityConfig {
+
+    /**
+     * Repository name for a JAAS app-entry configuration.
+     */
+    private final String name;
+
+    /**
+     * Repository access manager configuration;
+     */
+    private final AccessManagerConfig amc;
+
+    /**
+     * Repository login module configuration. Optional, can be null
+     */
+    private final LoginModuleConfig lmc;
+
+    /**
+     * Creates a new security configuration.
+     *
+     * @param name repository name for a JAAS app-entry configuration
+     * @param amc access manager configuration
+     * @param lmc login module configuration (can be <code>null</code>)
+     */
+    public SecurityConfig(
+            String name, AccessManagerConfig amc, LoginModuleConfig lmc) {
+        this.name = name;
+        this.amc = amc;
+        this.lmc = lmc;
+    }
+
+    /**
+     * Returns the repository name. The repository name can be used for
+     * JAAS app-entry configuration.
+     *
+     * @return repository name
+     */
+    public String getAppName() {
+        return name;
+    }
+
+    /**
+     * Returns the repository access manager configuration.
+     *
+     * @return access manager configuration
+     */
+    public AccessManagerConfig getAccessManagerConfig() {
+        return amc;
+    }
+
+    /**
+     * Returns the repository login module configuration.
+     *
+     * @return login module configuration, or <code>null</code> if standard
+     *         JAAS mechanism should be used.
+     */
+    public LoginModuleConfig getLoginModuleConfig() {
+        return lmc;
+    }
+
+}
\ No newline at end of file

Propchange: jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/config/SecurityConfig.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/config/SecurityConfig.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision url rev



Mime
View raw message