cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r434171 - in /cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring: SettingsBeanFactoryPostProcessor.java avalon/AvalonConfigurator.java avalon/ConfigReader.java
Date Wed, 23 Aug 2006 20:50:15 GMT
Author: cziegeler
Date: Wed Aug 23 13:50:14 2006
New Revision: 434171

URL: http://svn.apache.org/viewvc?rev=434171&view=rev
Log:
We don't need settings for reading the config anymore

Added:
    cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/avalon/AvalonConfigurator.java
  (with props)
Modified:
    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/avalon/ConfigReader.java

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?rev=434171&r1=434170&r2=434171&view=diff
==============================================================================
--- 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
Wed Aug 23 13:50:14 2006
@@ -22,7 +22,6 @@
 import java.io.InputStream;
 import java.net.URL;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.Iterator;

Added: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/avalon/AvalonConfigurator.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/avalon/AvalonConfigurator.java?rev=434171&view=auto
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/avalon/AvalonConfigurator.java
(added)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/avalon/AvalonConfigurator.java
Wed Aug 23 13:50:14 2006
@@ -0,0 +1,84 @@
+/*
+ * Copyright 2006 The Apache Software Foundation
+ * 
+ * Licensed 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.cocoon.core.container.spring.avalon;
+
+import javax.servlet.ServletContext;
+
+import org.apache.cocoon.core.container.spring.ConfigurationInfo;
+import org.springframework.beans.factory.FactoryBean;
+import org.springframework.web.context.ServletContextAware;
+import org.springframework.web.context.support.ServletContextResourceLoader;
+
+/**
+ *
+ * @since 2.2
+ * @version $Id$
+ */
+public class AvalonConfigurator
+    implements FactoryBean, ServletContextAware {
+
+    /** The servlet context. */
+    protected ServletContext servletContext;
+
+    /** The configuration. */
+    protected ConfigurationInfo ConfigurationInfo;
+
+    /** The avalon configuration location. */
+    protected String location = "/WEB-INF/cocoon/cocoon.xconf";
+
+    /**
+     * @see org.springframework.web.context.ServletContextAware#setServletContext(javax.servlet.ServletContext)
+     */
+    public void setServletContext(ServletContext sContext) {
+        this.servletContext = sContext;
+    }
+
+    protected void init()
+    throws Exception {
+        System.out.println("Reading config");
+        this.ConfigurationInfo = ConfigReader.readConfiguration(getLocation(), new ServletContextResourceLoader(this.servletContext));
+        System.out.println("Read config");
+    }
+
+    /**
+     * @see org.springframework.beans.factory.FactoryBean#getObject()
+     */
+    public Object getObject() throws Exception {
+        return this.ConfigurationInfo;
+    }
+
+    /**
+     * @see org.springframework.beans.factory.FactoryBean#getObjectType()
+     */
+    public Class getObjectType() {
+        return ConfigurationInfo.class;
+    }
+
+    /**
+     * @see org.springframework.beans.factory.FactoryBean#isSingleton()
+     */
+    public boolean isSingleton() {
+        return true;
+    }
+
+    public String getLocation() {
+        return location;
+    }
+
+    public void setLocation(String location) {
+        this.location = location;
+    }
+}

Propchange: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/avalon/AvalonConfigurator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/avalon/AvalonConfigurator.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/avalon/ConfigReader.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/avalon/ConfigReader.java?rev=434171&r1=434170&r2=434171&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/avalon/ConfigReader.java
(original)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/avalon/ConfigReader.java
Wed Aug 23 13:50:14 2006
@@ -28,7 +28,6 @@
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.configuration.ConfigurationException;
 import org.apache.cocoon.Constants;
-import org.apache.cocoon.configuration.Settings;
 import org.apache.cocoon.core.container.spring.ComponentInfo;
 import org.apache.cocoon.core.container.spring.ConfigurationInfo;
 import org.apache.cocoon.core.container.util.ConfigurationBuilder;
@@ -57,41 +56,35 @@
     /** The configuration info. */
     protected final ConfigurationInfo configInfo;
 
-    /** Settings. */
-    protected final Settings settings;
-
     /** All component configurations. */
     protected final List componentConfigs = new ArrayList();
 
-    public static ConfigurationInfo readConfiguration(String source, Settings settings)
+    public static ConfigurationInfo readConfiguration(String         source,
+                                                      ResourceLoader resourceLoader)
     throws Exception {
-        final ConfigReader converter = new ConfigReader(settings, null, null);
+        final ConfigReader converter = new ConfigReader(null, resourceLoader);
         converter.convert(source);
         return converter.configInfo;
     }
 
     public static ConfigurationInfo readConfiguration(Configuration     config,
                                                       ConfigurationInfo parentInfo,
-                                                      Settings          settings,
                                                       ResourceLoader    resourceLoader)
     throws Exception {
-        return readConfiguration(config, null, parentInfo, settings, resourceLoader);
+        return readConfiguration(config, null, parentInfo, resourceLoader);
     }
-//         PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(new
ServletContextResourceLoader(this.servletContext));
 
     public static ConfigurationInfo readConfiguration(Configuration     rolesConfig,
                                                       Configuration     componentConfig,
                                                       ConfigurationInfo parentInfo,
-                                                      Settings          settings,
                                                       ResourceLoader    resourceLoader)
     throws Exception {
-        final ConfigReader converter = new ConfigReader(settings, parentInfo, resourceLoader);
+        final ConfigReader converter = new ConfigReader(parentInfo, resourceLoader);
         converter.convert(rolesConfig, componentConfig, null);
         return converter.configInfo;        
     }
 
-    private ConfigReader(Settings          settings,
-                         ConfigurationInfo parentInfo,
+    private ConfigReader(ConfigurationInfo parentInfo,
                          ResourceLoader    resourceLoader)
     throws Exception {
         if ( resourceLoader != null ) {
@@ -99,7 +92,6 @@
         } else {
             this.resolver = new PathMatchingResourcePatternResolver();
         }
-        this.settings = settings;
 
         // now add selectors from parent
         if ( parentInfo != null ) {
@@ -157,7 +149,7 @@
             this.logger.info("Reading Avalon configuration from " + relativePath);
         }
         Resource root = this.resolver.getResource(this.convertUrl(relativePath));
-        final ConfigurationBuilder b = new ConfigurationBuilder(this.settings);
+        final ConfigurationBuilder b = new ConfigurationBuilder(null);
         
         final Configuration config = b.build(this.getInputSource(root));
         // validate cocoon.xconf
@@ -203,7 +195,7 @@
                     this.logger.info("Reading additional user roles: " + userRoles);
                 }
                 final Resource userRolesSource = this.resolver.getResource(this.getUrl(userRoles,
rootUri));
-                final ConfigurationBuilder b = new ConfigurationBuilder(this.settings);
+                final ConfigurationBuilder b = new ConfigurationBuilder(null);
                 final Configuration userRolesConfig = b.build(this.getInputSource(userRolesSource));
                 this.parseConfiguration(userRolesConfig, userRolesSource.getURL().toExternalForm(),
loadedConfigs);
             }
@@ -406,7 +398,7 @@
             // load it and store it in the read set
             Configuration includeConfig = null;
             try {
-                ConfigurationBuilder builder = new ConfigurationBuilder(this.settings);
+                ConfigurationBuilder builder = new ConfigurationBuilder(null);
                 includeConfig = builder.build(src.getInputStream(), uri);
             } catch (Exception e) {
                 throw new ConfigurationException("Cannot load '" + uri + "' at " + includeStatement.getLocation(),
e);



Mime
View raw message