cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r470732 - in /cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring: CocoonPropertyOverrideConfigurer.java SettingsBeanFactoryPostProcessor.java SettingsElementParser.java
Date Fri, 03 Nov 2006 09:10:14 GMT
Author: cziegeler
Date: Fri Nov  3 01:10:13 2006
New Revision: 470732

URL: http://svn.apache.org/viewvc?view=rev&rev=470732
Log:
Start support for reading configuration files directly from within the jars

Modified:
    cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/CocoonPropertyOverrideConfigurer.java
    cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/SettingsBeanFactoryPostProcessor.java
    cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/SettingsElementParser.java

Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/CocoonPropertyOverrideConfigurer.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/CocoonPropertyOverrideConfigurer.java?view=diff&rev=470732&r1=470731&r2=470732
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/CocoonPropertyOverrideConfigurer.java
(original)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/CocoonPropertyOverrideConfigurer.java
Fri Nov  3 01:10:13 2006
@@ -81,10 +81,13 @@
         if ( this.logger.isDebugEnabled() ) {
             this.logger.debug("Processing bean factory: " + beanFactory);
         }
+        final String mode = (this.settings != null ? this.settings.getRunningMode() : SettingsDefaults.DEFAULT_RUNNING_MODE);
         final Properties mergedProps = new Properties();
+        ResourceUtils.readProperties("classpath:*/META-INF/cocoon/spring", mergedProps, this.resourceLoader,
this.logger);
+        ResourceUtils.readProperties("classpath:*/META-INF/cocoon/spring/" + mode, mergedProps,
this.resourceLoader, this.logger);
+
         ResourceUtils.readProperties(this.location, mergedProps, this.resourceLoader, this.logger);
         // read properties from running-mode dependent directory
-        final String mode = (this.settings != null ? this.settings.getRunningMode() : SettingsDefaults.DEFAULT_RUNNING_MODE);
         ResourceUtils.readProperties(this.location + '/' + mode, mergedProps, this.resourceLoader,
this.logger);
         
         if ( mergedProps.size() > 0 ) {

Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/SettingsBeanFactoryPostProcessor.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/SettingsBeanFactoryPostProcessor.java?view=diff&rev=470732&r1=470731&r2=470732
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/SettingsBeanFactoryPostProcessor.java
(original)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/SettingsBeanFactoryPostProcessor.java
Fri Nov  3 01:10:13 2006
@@ -146,16 +146,21 @@
      * This method reads several property files and merges the result. If there
      * is more than one definition for a property, the last one wins.
      * The property files are read in the following order:
-     * 1) context://WEB-INF/cocoon/properties/*.properties
-     *    Default values for the core and each block - the order in which the files are read
is not guaranteed.
-     * 2) context://WEB-INF/cocoon/properties/[RUNNING_MODE]/*.properties
-     *    Default values for the running mode - the order in which the files are read is
not guaranteed.
-     * 3) Working directory from servlet context (if not already set)
-     * 4) Optional property file which is stored under ".cocoon/settings.properties" in the
user
+     * 1) classpath*:/META-INF/cocoon/properties/*.properties
+     *    Default values for the core and each block - the files are read in alphabetical
order.
+     * 2) classpath*:/META-INF/cocoon/properties/[RUNNING_MODE]/*.properties
+     *    Default values for the core and each block for a specific running mode - the files
are
+     *    read in alphabetical order.
+     * 3) context://WEB-INF/cocoon/properties/*.properties
+     *    User specific properties - the files are read in alphabetical order.
+     * 4) context://WEB-INF/cocoon/properties/[RUNNING_MODE]/*.properties
+     *    User specific properties for the running mode - the files are read in alphabetical
order.
+     * 5) Working directory from servlet context (if not already set)
+     * 6) Optional property file which is stored under ".cocoon/settings.properties" in the
user
      *    directory.
-     * 5) Additional property file specified by the "org.apache.cocoon.settings" property.
-     * 6) Property provider (if configured in the bean factory)
-     * 7) System properties
+     * 7) Additional property file specified by the "org.apache.cocoon.settings" property.
+     * 8) Property provider (if configured in the bean factory)
+     * 9) System properties
      *
      * This means that system properties (provided on startup of the web application) override
all
      * others etc.
@@ -179,6 +184,11 @@
         final MutableSettings s = new MutableSettings(mode);
         // create an empty properties object
         final Properties properties = new Properties();
+
+        // now read all properties from the properties directory
+        ResourceUtils.readProperties("classpath*:/META-INF/cocoon/properties", properties,
this.getResourceLoader(), this.logger);
+        // read all properties from the mode dependent directory
+        ResourceUtils.readProperties("classpath*:/META-INF/cocoon/properties/" + mode, properties,
this.getResourceLoader(), this.logger);
 
         // now read all properties from the properties directory
         ResourceUtils.readProperties("/WEB-INF/cocoon/properties", properties, this.getResourceLoader(),
this.logger);

Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/SettingsElementParser.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/SettingsElementParser.java?view=diff&rev=470732&r1=470731&r2=470732
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/SettingsElementParser.java
(original)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/SettingsElementParser.java
Fri Nov  3 01:10:13 2006
@@ -68,6 +68,7 @@
 
         // handle includes
         try {
+            this.handleBeanInclude(parserContext, null, "classpath*:/META-INF/cocoon/spring",
"*.xml", true);
             this.handleBeanInclude(parserContext, null, springConfigLocation, "*.xml", true);
         } catch (Exception e) {
             throw new BeanDefinitionStoreException("Unable to read spring configurations
from " + springConfigLocation, e);



Mime
View raw message