cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r490741 - in /cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon: components/modules/input/ components/treeprocessor/ components/treeprocessor/sitemap/ core/container/spring/ core/container/spring/avalon/ environment/
Date Thu, 28 Dec 2006 15:42:51 GMT
Author: cziegeler
Date: Thu Dec 28 07:42:50 2006
New Revision: 490741

URL: http://svn.apache.org/viewvc?view=rev&rev=490741
Log:
Simplify container interface

Modified:
    cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/modules/input/SettingsInputModule.java
    cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/ConcreteTreeProcessor.java
    cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/PipelineNodeBuilder.java
    cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/SitemapLanguage.java
    cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/Container.java
    cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/avalon/SitemapHelper.java
    cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/environment/TemplateObjectModelHelper.java

Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/modules/input/SettingsInputModule.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/modules/input/SettingsInputModule.java?view=diff&rev=490741&r1=490740&r2=490741
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/modules/input/SettingsInputModule.java
(original)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/modules/input/SettingsInputModule.java
Thu Dec 28 07:42:50 2006
@@ -69,7 +69,7 @@
     public Object getAttribute(String name, Configuration modeConf, Map objectModel)
     throws ConfigurationException {
         final Container container = Container.getCurrentContainer();
-        final Settings settings = container.getSettings();
+        final Settings settings = (Settings)container.getBeanFactory().getBean(Settings.ROLE);
         return settings.getProperty(name);
     }
 

Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/ConcreteTreeProcessor.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/ConcreteTreeProcessor.java?view=diff&rev=490741&r1=490740&r2=490741
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/ConcreteTreeProcessor.java
(original)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/ConcreteTreeProcessor.java
Thu Dec 28 07:42:50 2006
@@ -115,7 +115,7 @@
         if (this.rootNode != null) {
             throw new IllegalStateException("setProcessorData() can only be called once");
         }
-        this.classLoader = container.getClassLoader();
+        this.classLoader = container.getBeanFactory().getClassLoader();
         this.container = container;
         this.manager = (ServiceManager)this.container.getBeanFactory().getBean(AvalonUtils.SERVICE_MANAGER_ROLE);
         this.rootNode = rootNode;

Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/PipelineNodeBuilder.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/PipelineNodeBuilder.java?view=diff&rev=490741&r1=490740&r2=490741
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/PipelineNodeBuilder.java
(original)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/PipelineNodeBuilder.java
Thu Dec 28 07:42:50 2006
@@ -49,7 +49,7 @@
         super.setBuilder(treeBuilder);
         // check ssettings for ignoring of internal only pipeline flags
         this.ignoreInternalOnly = false;
-        final Settings settings = treeBuilder.getContainer().getSettings();
+        final Settings settings = (Settings)treeBuilder.getContainer().getBeanFactory().getBean(Settings.ROLE);
         final String value = settings.getProperty(PipelineNodeBuilder.PROPERTY_SITEMAP_INTERNALONLY);
         if ( value != null ) {
             this.ignoreInternalOnly = Boolean.valueOf(value).booleanValue();

Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/SitemapLanguage.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/SitemapLanguage.java?view=diff&rev=490741&r1=490740&r2=490741
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/SitemapLanguage.java
(original)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/SitemapLanguage.java
Thu Dec 28 07:42:50 2006
@@ -60,6 +60,7 @@
 import org.apache.cocoon.components.treeprocessor.TreeBuilder;
 import org.apache.cocoon.components.treeprocessor.variables.VariableResolver;
 import org.apache.cocoon.components.treeprocessor.variables.VariableResolverFactory;
+import org.apache.cocoon.configuration.Settings;
 import org.apache.cocoon.core.container.spring.Container;
 import org.apache.cocoon.core.container.spring.avalon.AvalonUtils;
 import org.apache.cocoon.core.container.spring.avalon.SitemapHelper;
@@ -350,7 +351,7 @@
 
         // replace properties?
         if ( tree.getChild("components").getAttributeAsBoolean("replace-properties", true)
) {
-            tree = AvalonUtils.replaceProperties(tree, this.itsContainer.getSettings());
+            tree = AvalonUtils.replaceProperties(tree, (Settings)this.itsContainer.getBeanFactory().getBean(Settings.ROLE));
         }
 
         this.itsManager = (ServiceManager) this.itsContainer.getBeanFactory().getBean(AvalonUtils.SERVICE_MANAGER_ROLE);

Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/Container.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/Container.java?view=diff&rev=490741&r1=490740&r2=490741
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/Container.java
(original)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/Container.java
Thu Dec 28 07:42:50 2006
@@ -20,9 +20,7 @@
 
 import javax.servlet.ServletContext;
 
-import org.apache.cocoon.configuration.Settings;
 import org.apache.cocoon.spring.impl.ServletContextFactoryBean;
-import org.springframework.beans.factory.BeanFactory;
 import org.springframework.beans.factory.config.ConfigurableBeanFactory;
 import org.springframework.context.ConfigurableApplicationContext;
 import org.springframework.web.context.WebApplicationContext;
@@ -31,7 +29,6 @@
 import org.springframework.web.context.support.WebApplicationContextUtils;
 
 /**
- * FIXME - What about the ResourceLoader?
  * @version $Id$
  */
 public class Container {
@@ -41,12 +38,10 @@
 
     protected static final String CONTAINER_STACK_REQUEST_ATTRIBUTE = Container.class.getName()
+ "/Stack";
 
-    protected ClassLoader classLoader;
-    protected BeanFactory beanFactory;
+    protected WebApplicationContext beanFactory;
 
-    public Container(BeanFactory beanFactory, ClassLoader classLoader) {
-        this.beanFactory = beanFactory;
-        this.classLoader = classLoader;
+    public Container(WebApplicationContext webAppContext) {
+        this.beanFactory = webAppContext;
     }
 
     protected static Container ROOT_CONTAINER;
@@ -71,7 +66,7 @@
         if ( ROOT_CONTAINER == null ) {
             final ServletContext servletContext = ServletContextFactoryBean.getServletContext();
             final WebApplicationContext parentContext = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext);
-            ROOT_CONTAINER = new Container(parentContext, parentContext.getClassLoader());
+            ROOT_CONTAINER = new Container(parentContext);
         }
         return ROOT_CONTAINER;
     }
@@ -93,7 +88,7 @@
             stack.push(oldContext);
         }
         attributes.setAttribute(CONTAINER_REQUEST_ATTRIBUTE, this, RequestAttributes.SCOPE_REQUEST);
-        Thread.currentThread().setContextClassLoader(this.classLoader);
+        Thread.currentThread().setContextClassLoader(this.beanFactory.getClassLoader());
         return oldClassLoader;
     }
 
@@ -116,15 +111,7 @@
         }
     }
 
-    public ClassLoader getClassLoader() {
-        return this.classLoader;
-    }
-
-    public Settings getSettings() {
-        return (Settings)this.beanFactory.getBean(Settings.ROLE);
-    }
-
-    public BeanFactory getBeanFactory() {
+    public WebApplicationContext getBeanFactory() {
         return this.beanFactory;
     }
 

Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/avalon/SitemapHelper.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/avalon/SitemapHelper.java?view=diff&rev=490741&r1=490740&r2=490741
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/avalon/SitemapHelper.java
(original)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/avalon/SitemapHelper.java
Thu Dec 28 07:42:50 2006
@@ -176,7 +176,7 @@
                                                                                         parentContext,
                                                                                         contextUrl,
                                                                                         definition);
-            return new Container(context, context.getClassLoader());
+            return new Container(context);
         } finally {
             PARENT_CONTEXT.set(null);
         }

Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/environment/TemplateObjectModelHelper.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/environment/TemplateObjectModelHelper.java?view=diff&rev=490741&r1=490740&r2=490741
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/environment/TemplateObjectModelHelper.java
(original)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/environment/TemplateObjectModelHelper.java
Thu Dec 28 07:42:50 2006
@@ -27,6 +27,7 @@
 import org.apache.avalon.framework.parameters.ParameterException;
 import org.apache.avalon.framework.parameters.Parameters;
 import org.apache.cocoon.components.flow.FlowHelper;
+import org.apache.cocoon.configuration.Settings;
 import org.apache.cocoon.core.container.spring.Container;
 import org.apache.commons.jxpath.DynamicPropertyHandler;
 import org.apache.commons.jxpath.JXPathBeanInfo;
@@ -129,7 +130,7 @@
         }
 
         final Container container = Container.getCurrentContainer();
-        cocoon.put("settings", container.getSettings());
+        cocoon.put("settings", (Settings)container.getBeanFactory().getBean(Settings.ROLE));
 
         final Map map = new HashMap();
         map.put("cocoon", cocoon);



Mime
View raw message