cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r470963 - /cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/
Date Fri, 03 Nov 2006 19:35:06 GMT
Author: cziegeler
Date: Fri Nov  3 11:35:05 2006
New Revision: 470963

URL: http://svn.apache.org/viewvc?view=rev&rev=470963
Log:
Minor changes

Modified:
    cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/AbstractElementParser.java
    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/Constants.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
    cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/SitemapElementParser.java

Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/AbstractElementParser.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/AbstractElementParser.java?view=diff&rev=470963&r1=470962&r2=470963
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/AbstractElementParser.java
(original)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/AbstractElementParser.java
Fri Nov  3 11:35:05 2006
@@ -252,13 +252,16 @@
      * @param parserContext
      * @param springConfigLocation
      */
-    protected void registerPropertyOverrideConfigurer(final ParserContext parserContext,
final String location) {
+    protected void registerPropertyOverrideConfigurer(final ParserContext parserContext,
+                                                      final String        location,
+                                                      final boolean       scanClassPath)
{
         final RootBeanDefinition beanDef = this.createBeanDefinition(CocoonPropertyOverrideConfigurer.class.getName(),
                 null, true);
         beanDef.getPropertyValues().addPropertyValue("location", location);
         beanDef.getPropertyValues().addPropertyValue("resourceLoader",
                 parserContext.getReaderContext().getReader().getResourceLoader());
         beanDef.getPropertyValues().addPropertyValue("beanNameSeparator", "/");
+        beanDef.getPropertyValues().addPropertyValue("scanClassPath", Boolean.valueOf(scanClassPath));
         this.register(beanDef, CocoonPropertyOverrideConfigurer.class.getName(), parserContext.getRegistry());
     }
 

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=470963&r1=470962&r2=470963
==============================================================================
--- 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 11:35:05 2006
@@ -35,6 +35,7 @@
  * 
  * @version $Id: CocoonPropertyOverrideConfigurer.java 470754 2006-11-03
  *          10:47:52Z lgawron $
+ * @since 2.2
  */
 public class CocoonPropertyOverrideConfigurer extends PropertyOverrideConfigurer {
 
@@ -52,6 +53,11 @@
     protected ResourceLoader resourceLoader = new DefaultResourceLoader();
 
     /**
+     * Should we scan the classpath for properties?
+     */
+    protected boolean scanClassPath = true;
+
+    /**
      * The settings object.
      */
     protected Settings settings;
@@ -72,6 +78,13 @@
     }
 
     /**
+     * Set if we scan the class path.
+     */
+    public void setScanClassPath(boolean value) {
+        this.scanClassPath = value;
+    }
+
+    /**
      * Set the resource loader.
      * 
      * @param loader
@@ -93,12 +106,13 @@
         }
         final String mode = (this.settings != null ? this.settings.getRunningMode() : SettingsDefaults.DEFAULT_RUNNING_MODE);
         final Properties mergedProps = new Properties();
-        
-        //TODO change when location of files change
-        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);
+
+        if ( this.scanClassPath ) {
+            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

Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/Constants.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/Constants.java?view=diff&rev=470963&r1=470962&r2=470963
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/Constants.java
(original)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/Constants.java
Fri Nov  3 11:35:05 2006
@@ -29,4 +29,7 @@
 
     /** The default location of spring related per sitemap configuration files. */
     public static final String DEFAULT_SPRING_SITEMAP_CONFIGURATION_FILES = "config/spring";
+
+    /** The default location of spring related configuration files inside a block. */
+    public static final String DEFAULT_SPRING_BLOCK_CONFIGURATION_LOCATION = "classpath*:META-INF/cocoon/spring";
 }

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=470963&r1=470962&r2=470963
==============================================================================
--- 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 11:35:05 2006
@@ -185,7 +185,6 @@
         // create an empty properties object
         final Properties properties = new Properties();
 
-        // TODO change this when properties location changes
         // 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

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=470963&r1=470962&r2=470963
==============================================================================
--- 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 11:35:05 2006
@@ -68,19 +68,17 @@
         this.register(beanDef, Settings.ROLE, parserContext.getRegistry());
 
         // register a PropertyPlaceholderConfigurer
-        this.registerPropertyOverrideConfigurer(parserContext, springConfigLocation);
+        this.registerPropertyOverrideConfigurer(parserContext, springConfigLocation, true);
 
         // add the servlet context as a bean
         this.addComponent(ServletContextFactoryBean.class.getName(), ServletContext.class.getName(),
null, false,
                 parserContext.getRegistry());
 
         // handle includes
-        // TODO change when location of files change
-        String classPathLocation = "classpath*:META-INF/cocoon/spring";
         try {
-            this.handleBeanInclude(parserContext, null, classPathLocation, "*.xml", true);
+            this.handleBeanInclude(parserContext, null, Constants.DEFAULT_SPRING_BLOCK_CONFIGURATION_LOCATION,
"*.xml", true);
         } catch (Exception e) {
-            throw new BeanDefinitionStoreException("Unable to read spring configurations
from " + classPathLocation, e);
+            throw new BeanDefinitionStoreException("Unable to read spring configurations
from " + Constants.DEFAULT_SPRING_BLOCK_CONFIGURATION_LOCATION, e);
         }
 
         try {

Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/SitemapElementParser.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/SitemapElementParser.java?view=diff&rev=470963&r1=470962&r2=470963
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/SitemapElementParser.java
(original)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/SitemapElementParser.java
Fri Nov  3 11:35:05 2006
@@ -127,7 +127,7 @@
 
             // register a PropertyPlaceholderConfigurer
             if ( useDefaultIncludes ) {
-                this.registerPropertyOverrideConfigurer(parserContext, Constants.DEFAULT_SPRING_SITEMAP_CONFIGURATION_FILES);
+                this.registerPropertyOverrideConfigurer(parserContext, Constants.DEFAULT_SPRING_SITEMAP_CONFIGURATION_FILES,
false);
             }
             
             RootBeanDefinition def =  this.createBeanDefinition(SubSettingsBeanFactoryPostProcessor.class.getName(),



Mime
View raw message