jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r731981 - in /jackrabbit/branches/1.5: ./ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/
Date Tue, 06 Jan 2009 15:52:15 GMT
Author: jukka
Date: Tue Jan  6 07:52:15 2009
New Revision: 731981

URL: http://svn.apache.org/viewvc?rev=731981&view=rev
Log:
1.5: Merged revision 731934 (JCR-1920). Ignored other revisions.

Modified:
    jackrabbit/branches/1.5/   (props changed)
    jackrabbit/branches/1.5/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/BeanConfig.java
    jackrabbit/branches/1.5/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/LoginModuleConfig.java
    jackrabbit/branches/1.5/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfigurationParser.java
    jackrabbit/branches/1.5/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/SearchConfig.java

Propchange: jackrabbit/branches/1.5/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jan  6 07:52:15 2009
@@ -1,2 +1,2 @@
 /jackrabbit/branches/1.3:631261
-/jackrabbit/trunk:703899-704158,704165,704167,704324,704358,704361,704864,704933,704939,705010,705033,705243,705496,705522,705579,705925,705932,705934,705937-705938,705961,706242,706273,706285-706286,706562,706606,706649,706655,706660,706697,706918,707303-707304,707307,707310,707630,708206,708598,708609,708613,708619,708634,708840,708863,708909,708929,708943,709115,709142,709207,709211,710047,711238,711566-711567,711595,711841-711843,712984-712985,713037,713059,713065,713072,713076,713162,713214,713956,713958,713964,713971,713975,714034,718218,718249-718250,718371,718376,718566,718632,718981,719225,719282,719575-719577,719579,719585-719586,719588,719592,720455,720484,720492,720524,720533,720540,720673,720679,720687,720784,720940,720969,721186,721191,721194,721235,721387-721389,721470,721495,722068-722069,722463,722465,722467,722470,722825,723281,723346,723728,723784,724300,724387,725292,727376,727388,727390,727395,727397,727402,727492,727701
+/jackrabbit/trunk:703899-704158,704165,704167,704324,704358,704361,704864,704933,704939,705010,705033,705243,705496,705522,705579,705925,705932,705934,705937-705938,705961,706242,706273,706285-706286,706562,706606,706649,706655,706660,706697,706918,707303-707304,707307,707310,707630,708206,708598,708609,708613,708619,708634,708840,708863,708909,708929,708943,709115,709142,709207,709211,710047,711238,711566-711567,711595,711841-711843,712984-712985,713037,713059,713065,713072,713076,713162,713214,713956,713958,713964,713971,713975,714034,718218,718249-718250,718371,718376,718566,718632,718981,719225,719282,719575-719577,719579,719585-719586,719588,719592,720455,720484,720492,720524,720533,720540,720673,720679,720687,720784,720940,720969,721186,721191,721194,721235,721387-721389,721470,721495,722068-722069,722463,722465,722467,722470,722825,723281,723346,723728,723784,724300,724387,725292,727376,727388,727390,727395,727397,727402,727492,727701,728022,731896,731934,731941

Modified: jackrabbit/branches/1.5/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/BeanConfig.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.5/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/BeanConfig.java?rev=731981&r1=731980&r2=731981&view=diff
==============================================================================
--- jackrabbit/branches/1.5/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/BeanConfig.java
(original)
+++ jackrabbit/branches/1.5/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/BeanConfig.java
Tue Jan  6 07:52:15 2009
@@ -53,6 +53,18 @@
     private final Properties properties;
 
     /**
+     * Flag to validate the configured bean property names against
+     * the configured bean class. By default this is <code>true</code>
+     * to prevent incorrect property names. However, in some cases this
+     * validation should not be performed as client classes may access
+     * the configuration parameters directly through the
+     * {@link #getParameters()} method.
+     *
+     * @see <a href="https://issues.apache.org/jira/browse/JCR-1920">JCR-1920</a>
+     */
+    private boolean validate = true;
+
+    /**
      * Creates a bean configuration. Note that a copy of the given
      * bean properties is stored as a part of the created configuration
      * object. Thus the caller is free to modify the given properties
@@ -76,6 +88,16 @@
     }
 
     /**
+     * Allows subclasses to control whether the configured bean property
+     * names should be validated.
+     *
+     * @param validate flag to validate the configured property names
+     */
+    protected void setValidate(boolean validate) {
+        this.validate = validate;
+    }
+
+    /**
      * Returns the class name of the configured bean.
      *
      * @return class name of the bean
@@ -101,9 +123,12 @@
      */
     public Object newInstance() throws ConfigurationException {
         try {
+            // Instantiate the object using the default constructor
             Class objectClass =
                 Class.forName(getClassName(), true, getClassLoader());
             Object object = objectClass.newInstance();
+
+            // Set all configured bean properties
             BeanMap map = new BeanMap(object);
             Iterator iterator = map.keyIterator();
             while (iterator.hasNext()) {
@@ -113,15 +138,23 @@
                     map.put(name, properties.getProperty(name));
                 }
             }
-            Iterator it = properties.keySet().iterator();
-            while (it.hasNext()) {
-                String key = (String) it.next();
-                if (!map.containsKey(key) && properties.getProperty(key) != null)
{
-                    String msg = object.getClass().getName() + " does not support '" + key;
-                    log.error(msg);
-                    throw new ConfigurationException(msg);
+
+            if (validate) {
+                // Check that no invalid property names were configured
+                Iterator it = properties.keySet().iterator();
+                while (it.hasNext()) {
+                    String key = (String) it.next();
+                    if (!map.containsKey(key) && properties.getProperty(key) != null)
{
+                        String msg =
+                            "Configured class " + object.getClass().getName()
+                            + " does not contain the property " + key
+                            + ". Please fix the repository configuration.";
+                        log.error(msg);
+                        throw new ConfigurationException(msg);
+                    }
                 }
             }
+
             return object;
         } catch (ClassNotFoundException e) {
             throw new ConfigurationException(

Modified: jackrabbit/branches/1.5/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/LoginModuleConfig.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.5/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/LoginModuleConfig.java?rev=731981&r1=731980&r2=731981&view=diff
==============================================================================
--- jackrabbit/branches/1.5/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/LoginModuleConfig.java
(original)
+++ jackrabbit/branches/1.5/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/LoginModuleConfig.java
Tue Jan  6 07:52:15 2009
@@ -56,6 +56,7 @@
      */
     public LoginModuleConfig(BeanConfig config) {
         super(config);
+        setValidate(false); // JCR-1920
     }
 
     public LoginModule getLoginModule() throws ConfigurationException {

Modified: jackrabbit/branches/1.5/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfigurationParser.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.5/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfigurationParser.java?rev=731981&r1=731980&r2=731981&view=diff
==============================================================================
--- jackrabbit/branches/1.5/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfigurationParser.java
(original)
+++ jackrabbit/branches/1.5/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfigurationParser.java
Tue Jan  6 07:52:15 2009
@@ -522,6 +522,7 @@
             Element provFact = getElement(element, AC_PROVIDER_ELEMENT, false);
             if (provFact !=null ) {
                 factConf = parseBeanConfig(element, AC_PROVIDER_ELEMENT);
+                factConf.setValidate(false); // JCR-1920
             }
         }
         return new WorkspaceSecurityConfig(factConf);

Modified: jackrabbit/branches/1.5/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/SearchConfig.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.5/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/SearchConfig.java?rev=731981&r1=731980&r2=731981&view=diff
==============================================================================
--- jackrabbit/branches/1.5/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/SearchConfig.java
(original)
+++ jackrabbit/branches/1.5/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/SearchConfig.java
Tue Jan  6 07:52:15 2009
@@ -50,6 +50,7 @@
     public SearchConfig(
             String className, Properties properties, FileSystemFactory fsf) {
         super(className, properties);
+        setValidate(false); // JCR-1920: SearchManager uses getParameters()
         this.fsf = fsf;
     }
 



Mime
View raw message