cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r381317 - in /cocoon/trunk: cocoon-blocks-fw/cocoon-blocks-fw-ecm-impl/src/main/java/org/apache/cocoon/container/ cocoon-blocks-fw/cocoon-blocks-fw-ecm-impl/src/main/java/org/apache/cocoon/core/container/ cocoon-core/src/main/java/org/apach...
Date Mon, 27 Feb 2006 11:18:59 GMT
Author: cziegeler
Date: Mon Feb 27 03:18:51 2006
New Revision: 381317

URL: http://svn.apache.org/viewcvs?rev=381317&view=rev
Log:
Reduce the use of the Core object

Modified:
    cocoon/trunk/cocoon-blocks-fw/cocoon-blocks-fw-ecm-impl/src/main/java/org/apache/cocoon/container/ECMBlockServiceManager.java
    cocoon/trunk/cocoon-blocks-fw/cocoon-blocks-fw-ecm-impl/src/main/java/org/apache/cocoon/core/container/ComponentEnvironment.java
    cocoon/trunk/cocoon-blocks-fw/cocoon-blocks-fw-ecm-impl/src/main/java/org/apache/cocoon/core/container/CoreServiceManager.java
    cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/components/flow/AbstractInterpreter.java
    cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/TreeProcessor.java
    cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNodeBuilder.java
    cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/SitemapLanguage.java
    cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/Core.java
    cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/CoreUtil.java
    cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/Settings.java
    cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/BeanFactoryUtil.java
    cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/XmlConfigCreator.java
    cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/servlet/CoreUtil.java
    cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/generation/StatusGenerator.java
    cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/serialization/AbstractTextSerializer.java
    cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/servlet/CocoonServlet.java
    cocoon/trunk/cocoon-core/src/test/java/org/apache/cocoon/core/container/ContainerTestCase.java
    cocoon/trunk/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portlet/CocoonPortlet.java
    cocoon/trunk/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/sitemap/SitemapServlet.java

Modified: cocoon/trunk/cocoon-blocks-fw/cocoon-blocks-fw-ecm-impl/src/main/java/org/apache/cocoon/container/ECMBlockServiceManager.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-blocks-fw/cocoon-blocks-fw-ecm-impl/src/main/java/org/apache/cocoon/container/ECMBlockServiceManager.java?rev=381317&r1=381316&r2=381317&view=diff
==============================================================================
--- cocoon/trunk/cocoon-blocks-fw/cocoon-blocks-fw-ecm-impl/src/main/java/org/apache/cocoon/container/ECMBlockServiceManager.java
(original)
+++ cocoon/trunk/cocoon-blocks-fw/cocoon-blocks-fw-ecm-impl/src/main/java/org/apache/cocoon/container/ECMBlockServiceManager.java
Mon Feb 27 03:18:51 2006
@@ -101,7 +101,7 @@
                 false);
         
         // The Core object is needed for the Sitemap and various other Cocoon components
-        Core core = new Core(settings, newContext);
+        Core core = new Core(newContext);
         coreServicemanager.addInstance(Core.ROLE, core);
         
         // For the first block that is setup, source factories need to be setup before

Modified: cocoon/trunk/cocoon-blocks-fw/cocoon-blocks-fw-ecm-impl/src/main/java/org/apache/cocoon/core/container/ComponentEnvironment.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-blocks-fw/cocoon-blocks-fw-ecm-impl/src/main/java/org/apache/cocoon/core/container/ComponentEnvironment.java?rev=381317&r1=381316&r2=381317&view=diff
==============================================================================
--- cocoon/trunk/cocoon-blocks-fw/cocoon-blocks-fw-ecm-impl/src/main/java/org/apache/cocoon/core/container/ComponentEnvironment.java
(original)
+++ cocoon/trunk/cocoon-blocks-fw/cocoon-blocks-fw-ecm-impl/src/main/java/org/apache/cocoon/core/container/ComponentEnvironment.java
Mon Feb 27 03:18:51 2006
@@ -21,12 +21,9 @@
 import org.apache.avalon.excalibur.logger.LoggerManager;
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.context.Context;
-import org.apache.avalon.framework.context.ContextException;
 import org.apache.avalon.framework.logger.Logger;
 import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.cocoon.components.ComponentInfo;
-import org.apache.cocoon.core.Core;
-import org.apache.cocoon.core.Settings;
 import org.apache.cocoon.core.container.util.ConfigurationBuilder;
 import org.apache.cocoon.util.JMXUtils;
 
@@ -45,7 +42,6 @@
     public final RoleManager roleManager;
     public final LoggerManager loggerManager;
     private final ClassLoader classLoader;
-    private Core core;
 
     public ComponentEnvironment(ClassLoader classLoader, Logger logger, RoleManager roleManager,
LoggerManager loggerManager,
             Context context, ServiceManager serviceManager) {
@@ -64,14 +60,6 @@
         this.loggerManager = loggerManager;
         this.context = context;
         this.serviceManager = serviceManager;
-        // FIXME - we should ensure that the context is never null!
-        if ( this.context != null ) {
-            try {
-                this.core = (Core)this.context.get(Core.ROLE);
-            } catch (ContextException ignore) {
-                // this can never happen
-            }
-        }
     }
 
     public Class loadClass(String name) throws ClassNotFoundException {
@@ -85,8 +73,7 @@
         ComponentInfo ci = null;
         final InputStream is = this.classLoader.getResourceAsStream(bu.toString());
         if ( is != null ) {
-            final Settings settings = (this.core == null ? null : this.core.getSettings());
-            final ConfigurationBuilder cb = new ConfigurationBuilder(settings);
+            final ConfigurationBuilder cb = new ConfigurationBuilder(null);
             final Configuration conf = cb.build(is);
             ci = new ComponentInfo();
             ci.fill(conf);

Modified: cocoon/trunk/cocoon-blocks-fw/cocoon-blocks-fw-ecm-impl/src/main/java/org/apache/cocoon/core/container/CoreServiceManager.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-blocks-fw/cocoon-blocks-fw-ecm-impl/src/main/java/org/apache/cocoon/core/container/CoreServiceManager.java?rev=381317&r1=381316&r2=381317&view=diff
==============================================================================
--- cocoon/trunk/cocoon-blocks-fw/cocoon-blocks-fw-ecm-impl/src/main/java/org/apache/cocoon/core/container/CoreServiceManager.java
(original)
+++ cocoon/trunk/cocoon-blocks-fw/cocoon-blocks-fw-ecm-impl/src/main/java/org/apache/cocoon/core/container/CoreServiceManager.java
Mon Feb 27 03:18:51 2006
@@ -42,9 +42,7 @@
 import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.avalon.framework.thread.ThreadSafe;
 import org.apache.cocoon.components.ComponentInfo;
-import org.apache.cocoon.core.Core;
 import org.apache.cocoon.core.CoreResourceNotFoundException;
-import org.apache.cocoon.core.Settings;
 import org.apache.cocoon.core.container.handler.AbstractComponentHandler;
 import org.apache.cocoon.core.container.handler.AliasComponentHandler;
 import org.apache.cocoon.core.container.handler.ComponentHandler;
@@ -109,9 +107,6 @@
 
     protected ComponentEnvironment componentEnv;
 
-    /** The settings */
-    private Settings settings;
-
     /** The location where this manager is defined */
     protected String location;
 
@@ -171,7 +166,6 @@
     public void contextualize( final Context context ) 
     throws ContextException {
         this.context = context;
-        this.settings = ((Core)context.get(Core.ROLE)).getSettings();
     }
 
     /**
@@ -825,7 +819,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);

Modified: cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/components/flow/AbstractInterpreter.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/components/flow/AbstractInterpreter.java?rev=381317&r1=381316&r2=381317&view=diff
==============================================================================
--- cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/components/flow/AbstractInterpreter.java
(original)
+++ cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/components/flow/AbstractInterpreter.java
Mon Feb 27 03:18:51 2006
@@ -33,7 +33,6 @@
 import org.apache.cocoon.Constants;
 import org.apache.cocoon.components.ContextHelper;
 import org.apache.cocoon.components.flow.util.PipelineUtil;
-import org.apache.cocoon.core.Core;
 import org.apache.cocoon.core.Settings;
 import org.apache.cocoon.environment.Context;
 import org.apache.cocoon.environment.Redirector;
@@ -121,9 +120,7 @@
     public void service(ServiceManager sm) throws ServiceException {
         this.manager = sm;
         this.continuationsMgr = (ContinuationsManager)sm.lookup(ContinuationsManager.ROLE);
-        final Core core = (Core)this.manager.lookup(Core.ROLE);
-        this.settings = core.getSettings();
-        this.manager.release(core);
+        this.settings = (Settings)this.manager.lookup(Settings.ROLE);
     }
 
     /**

Modified: cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/TreeProcessor.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/TreeProcessor.java?rev=381317&r1=381316&r2=381317&view=diff
==============================================================================
--- cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/TreeProcessor.java
(original)
+++ cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/TreeProcessor.java
Mon Feb 27 03:18:51 2006
@@ -47,7 +47,7 @@
 import org.apache.cocoon.components.source.SourceUtil;
 import org.apache.cocoon.components.source.impl.DelayedRefreshSourceWrapper;
 import org.apache.cocoon.components.treeprocessor.sitemap.FlowNode;
-import org.apache.cocoon.core.Core;
+import org.apache.cocoon.core.Settings;
 import org.apache.cocoon.environment.Environment;
 import org.apache.cocoon.environment.internal.EnvironmentHelper;
 import org.apache.cocoon.sitemap.SitemapExecutor;
@@ -89,8 +89,8 @@
      */
     protected ServiceManager manager;
 
-    /** The core object. */
-    protected Core core;
+    /** The settings. */
+    protected Settings settings;
 
     /** Last modification time */
     protected long lastModified = 0;
@@ -150,7 +150,7 @@
 
         this.resolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
         this.fam = (SitemapMonitor) this.manager.lookup(SitemapMonitor.ROLE);
-        this.core = (Core) this.manager.lookup(Core.ROLE);
+        this.settings = (Settings) this.manager.lookup(Settings.ROLE);
         this.environmentHelper = new EnvironmentHelper(parent.environmentHelper);
         // Setup environment helper
         ContainerUtil.enableLogging(this.environmentHelper, this.getLogger());
@@ -187,7 +187,7 @@
         this.manager = manager;
         this.resolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
         this.fam = (SitemapMonitor) this.manager.lookup(SitemapMonitor.ROLE);
-        this.core = (Core) this.manager.lookup(Core.ROLE);
+        this.settings = (Settings) this.manager.lookup(Settings.ROLE);
     }
 
     /**
@@ -231,10 +231,10 @@
     throws ConfigurationException {
 
         this.checkReload = config.getAttributeAsBoolean("check-reload",
-                             this.core.getSettings().isReloadingEnabled("sitemap"));
+                             this.settings.isReloadingEnabled("sitemap"));
 
         // Reload check delay. Default is 1 second.
-        this.lastModifiedDelay = config.getChild("reload").getAttributeAsLong("delay", this.core.getSettings().getReloadDelay("sitemap"));
+        this.lastModifiedDelay = config.getChild("reload").getAttributeAsLong("delay", this.settings.getReloadDelay("sitemap"));
 
         String fileName = config.getAttribute("file", "sitemap.xmap");
         
@@ -750,10 +750,10 @@
             }
             this.manager.release(this.fam);
             this.manager.release(this.resolver);
-            this.manager.release(this.core);
+            this.manager.release(this.settings);
             this.resolver = null;
             this.manager = null;
-            this.core = null;
+            this.settings = null;
         }
     }
 

Modified: cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNodeBuilder.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNodeBuilder.java?rev=381317&r1=381316&r2=381317&view=diff
==============================================================================
--- cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNodeBuilder.java
(original)
+++ cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNodeBuilder.java
Mon Feb 27 03:18:51 2006
@@ -20,7 +20,7 @@
 import org.apache.cocoon.components.treeprocessor.AbstractProcessingNodeBuilder;
 import org.apache.cocoon.components.treeprocessor.ProcessingNode;
 import org.apache.cocoon.components.treeprocessor.variables.VariableResolverFactory;
-import org.apache.cocoon.core.Core;
+import org.apache.cocoon.core.Settings;
 
 /**
  *
@@ -36,12 +36,12 @@
     }
 
     public ProcessingNode buildNode(Configuration config) throws Exception {
-        final Core core = (Core)manager.lookup(Core.ROLE);
+        final Settings settings = (Settings)manager.lookup(Settings.ROLE);
         MountNode node = new MountNode(
             VariableResolverFactory.getResolver(config.getAttribute("uri-prefix"), manager),
             VariableResolverFactory.getResolver(config.getAttribute("src"), manager),
             this.treeBuilder.getProcessor().getWrappingProcessor(),
-            config.getAttributeAsBoolean("check-reload", core.getSettings().isReloadingEnabled("sitemap")),
+            config.getAttributeAsBoolean("check-reload", settings.isReloadingEnabled("sitemap")),
             config.getAttributeAsBoolean("pass-through", false)
         );
   

Modified: cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/SitemapLanguage.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/SitemapLanguage.java?rev=381317&r1=381316&r2=381317&view=diff
==============================================================================
--- cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/SitemapLanguage.java
(original)
+++ cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/SitemapLanguage.java
Mon Feb 27 03:18:51 2006
@@ -41,6 +41,7 @@
 import org.apache.cocoon.components.treeprocessor.DefaultTreeBuilder;
 import org.apache.cocoon.components.treeprocessor.TreeBuilder;
 import org.apache.cocoon.core.Core;
+import org.apache.cocoon.core.Settings;
 import org.apache.cocoon.core.container.spring.BeanFactoryUtil;
 import org.apache.cocoon.core.container.spring.AvalonEnvironment;
 import org.apache.cocoon.core.container.spring.CocoonBeanFactory;
@@ -137,7 +138,7 @@
         ae.core = (Core)this.beanFactory.getBean(Core.ROLE);
         ae.logger = this.getLogger();
         ae.servletContext = ((ServletConfig)context.get(CocoonServlet.CONTEXT_SERVLET_CONFIG)).getServletContext();
-        ae.settings = ae.core.getSettings();
+        ae.settings = (Settings)this.beanFactory.getBean(Settings.ROLE);
         final ConfigurationInfo parentConfigInfo = (ConfigurationInfo)parentContext.getBean(ConfigurationInfo.class.getName());
         final ConfigurationInfo ci = ConfigReader.readConfiguration(c, parentConfigInfo,
ae);
 

Modified: cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/Core.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/Core.java?rev=381317&r1=381316&r2=381317&view=diff
==============================================================================
--- cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/Core.java (original)
+++ cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/Core.java Mon Feb 27 03:18:51
2006
@@ -16,7 +16,6 @@
  */
 package org.apache.cocoon.core;
 
-import java.io.File;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
@@ -57,17 +56,13 @@
     /** The component context. */
     private final Context context;
 
-    private final Settings settings;
-
     /**
      * Constructor
      * The core object is created by the {@link CoreUtil} class. Never construct
      * a core object yourself (apart from testing of course)!
-     * @param s The settings
      * @param c The context
      */
-    public Core(Settings s, Context c) {
-        this.settings = s;
+    public Core(Context c) {
         this.context = c;
     }
 
@@ -116,13 +111,6 @@
     }
 
     /**
-     * Return the settings.
-     */
-    public Settings getSettings() {
-        return this.settings;
-    }
-
-    /**
      * Update the dynamic settings at runtime.
      * @param dynSettings
      */
@@ -148,39 +136,6 @@
      */
     public Map getCurrentObjectModel() {
         return ContextHelper.getObjectModel(this.context);
-    }
-
-    /**
-     * Return the work directory.
-     */
-    public File getWorkDirectory() {
-        try {
-            return (File)this.context.get(Constants.CONTEXT_WORK_DIR);
-        } catch (ContextException ce) {
-            throw new CoreResourceNotFoundException("Unable to get the working directory
from the context.", ce);
-        }        
-    }
-
-    /**
-     * Return the upload directory.
-     */
-    public File getUploadDirectory() {
-        try {
-            return (File)this.context.get(Constants.CONTEXT_UPLOAD_DIR);
-        } catch (ContextException ce) {
-            throw new CoreResourceNotFoundException("Unable to get the upload directory from
the context.", ce);
-        }        
-    }
-
-    /**
-     * Return the cache directory.
-     */
-    public File getCacheDirectory() {
-        try {
-            return (File)this.context.get(Constants.CONTEXT_CACHE_DIR);
-        } catch (ContextException ce) {
-            throw new CoreResourceNotFoundException("Unable to get the cache directory from
the context.", ce);
-        }        
     }
 
     /**

Modified: cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/CoreUtil.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/CoreUtil.java?rev=381317&r1=381316&r2=381317&view=diff
==============================================================================
--- cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/CoreUtil.java (original)
+++ cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/CoreUtil.java Mon Feb 27
03:18:51 2006
@@ -309,7 +309,7 @@
      * @return A new core object.
      */
     protected Core createCore() {
-        final Core c = new Core(this.settings, this.appContext);
+        final Core c = new Core(this.appContext);
         return c;
     }
 
@@ -635,7 +635,7 @@
         env.core = this.core;
         env.logger = this.log;
         env.servletContext = this.environmentContext;
-        env.settings = this.core.getSettings();
+        env.settings = this.settings;
         ConfigurableBeanFactory rootContext = BeanFactoryUtil.createRootApplicationContext(env);
         ConfigurationInfo result = ConfigReader.readConfiguration(settings.getConfiguration(),
env);
         ConfigurableBeanFactory mainContext = BeanFactoryUtil.createApplicationContext(env,
result, rootContext, true);

Modified: cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/Settings.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/Settings.java?rev=381317&r1=381316&r2=381317&view=diff
==============================================================================
--- cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/Settings.java (original)
+++ cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/Settings.java Mon Feb 27
03:18:51 2006
@@ -25,6 +25,9 @@
  */
 public interface Settings extends BaseSettings, DynamicSettings {
 
+    /** The role to lookup this bean. */
+    String ROLE = Settings.class.getName();
+
     /**
      * Get the value of a property.
      * @param key The name of the property.

Modified: cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/BeanFactoryUtil.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/BeanFactoryUtil.java?rev=381317&r1=381316&r2=381317&view=diff
==============================================================================
--- cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/BeanFactoryUtil.java
(original)
+++ cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/BeanFactoryUtil.java
Mon Feb 27 03:18:51 2006
@@ -73,7 +73,7 @@
                                                                    BeanFactory        parent,
                                                                    boolean            addCocoon)
     throws Exception {
-        final String xmlConfig = (new XmlConfigCreator()).createConfig(info, addCocoon);
+        final String xmlConfig = (new XmlConfigCreator(env.logger)).createConfig(info, addCocoon);
         Resource rsc = new ByteArrayResource(xmlConfig.getBytes("utf-8"));
         Logger logger = env.logger;
         if ( info.rootLogger != null ) {

Modified: cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/XmlConfigCreator.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/XmlConfigCreator.java?rev=381317&r1=381316&r2=381317&view=diff
==============================================================================
--- cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/XmlConfigCreator.java
(original)
+++ cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/XmlConfigCreator.java
Mon Feb 27 03:18:51 2006
@@ -42,6 +42,16 @@
     protected static final String DOCTYPE =
         "<!DOCTYPE beans PUBLIC \"-//SPRING//DTD BEAN//EN\" \"http://www.springframework.org/dtd/spring-beans.dtd\">\n";
 
+    private final Logger logger;
+
+    public XmlConfigCreator() {
+        this(null);
+    }
+
+    public XmlConfigCreator(Logger log) {
+        this.logger = log;
+    }
+
     public String createConfig(ConfigurationInfo info, boolean addCocoon) 
     throws Exception {
         final Map components = info.getComponents();
@@ -197,6 +207,10 @@
             final String role = (String)prI.next();
             final Object pooledInfo = components.remove(role);
             components.put(role + "Pooled", pooledInfo);
+        }
+        if ( this.logger != null && this.logger.isDebugEnabled() ) {
+            this.logger.debug("Created Spring xml configuration");
+            this.logger.debug(buffer.toString());
         }
         return buffer.toString();
     }

Modified: cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/servlet/CoreUtil.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/servlet/CoreUtil.java?rev=381317&r1=381316&r2=381317&view=diff
==============================================================================
--- cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/servlet/CoreUtil.java (original)
+++ cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/servlet/CoreUtil.java Mon
Feb 27 03:18:51 2006
@@ -232,7 +232,7 @@
         DefaultContext appContext = new ComponentContext();
         CoreUtil.addSourceResolverContext(appContext, servletConfig, knownFile);
         CoreUtil.addSettingsContext(appContext, settings);
-        CoreUtil.addCoreContext(appContext, new Core(settings, appContext));
+        CoreUtil.addCoreContext(appContext, new Core(appContext));
         return appContext;
     }
 

Modified: cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/generation/StatusGenerator.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/generation/StatusGenerator.java?rev=381317&r1=381316&r2=381317&view=diff
==============================================================================
--- cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/generation/StatusGenerator.java
(original)
+++ cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/generation/StatusGenerator.java
Mon Feb 27 03:18:51 2006
@@ -31,7 +31,6 @@
 import org.apache.cocoon.components.flow.ContinuationsManager;
 import org.apache.cocoon.components.flow.WebContinuationDataBean;
 import org.apache.cocoon.components.source.SourceUtil;
-import org.apache.cocoon.core.Core;
 import org.apache.cocoon.core.Settings;
 import org.apache.cocoon.environment.SourceResolver;
 import org.apache.cocoon.xml.AttributesImpl;
@@ -123,9 +122,9 @@
     protected Context context;
 
     /**
-     * The Cocoon core.
+     * The settings.
      */
-    protected Core core;
+    protected Settings settings;
 
     /**
      * The StoreJanitor used to get cache statistics
@@ -174,7 +173,7 @@
      */
     public void service(ServiceManager manager) throws ServiceException {
         super.service(manager);
-        this.core = (Core) this.manager.lookup(Core.ROLE);
+        this.settings = (Settings) this.manager.lookup(Settings.ROLE);
 
         if (this.manager.hasService(StoreJanitor.ROLE)) {
             this.storeJanitor = (StoreJanitor) manager.lookup(StoreJanitor.ROLE);
@@ -213,11 +212,11 @@
      */
     public void dispose() {
         if (this.manager != null) {
-            this.manager.release(this.core);
+            this.manager.release(this.settings);
             this.manager.release(this.storePersistent);
             this.manager.release(this.storeJanitor);
             this.manager.release(this.continuationsManager);
-            this.core = null;
+            this.settings = null;
             this.storePersistent = null;
             this.storeJanitor = null;
             this.continuationsManager = null;
@@ -276,7 +275,7 @@
         atts.addCDATAAttribute(NAMESPACE, "date", dateTime);
         atts.addCDATAAttribute(NAMESPACE, "host", localHost);
         atts.addCDATAAttribute(NAMESPACE, "cocoon-version", Constants.VERSION);
-        dateTime = DateFormat.getDateTimeInstance().format(new Date(this.core.getSettings().getCreationTime()));
+        dateTime = DateFormat.getDateTimeInstance().format(new Date(this.settings.getCreationTime()));
         atts.addCDATAAttribute(NAMESPACE, "creation-time", dateTime);
         atts.addCDATAAttribute(NAMESPACE, "build-info", Constants.BUILD_INFO);
         super.contentHandler.startElement(NAMESPACE, "statusinfo", "statusinfo", atts);
@@ -468,7 +467,7 @@
     }
 
     private void genSettings() throws SAXException {
-        final Settings s = core.getSettings();
+        final Settings s = this.settings;
         this.startGroup("Base Settings");
 
         this.addValue("Running mode", s.getProperty(Settings.PROPERTY_RUNNING_MODE,

Modified: cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/serialization/AbstractTextSerializer.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/serialization/AbstractTextSerializer.java?rev=381317&r1=381316&r2=381317&view=diff
==============================================================================
--- cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/serialization/AbstractTextSerializer.java
(original)
+++ cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/serialization/AbstractTextSerializer.java
Mon Feb 27 03:18:51 2006
@@ -23,7 +23,7 @@
 import org.apache.avalon.framework.service.Serviceable;
 import org.apache.cocoon.Constants;
 import org.apache.cocoon.caching.CacheableProcessingComponent;
-import org.apache.cocoon.core.Core;
+import org.apache.cocoon.core.Settings;
 import org.apache.cocoon.util.ClassUtils;
 import org.apache.cocoon.util.TraxErrorHandler;
 import org.apache.cocoon.xml.AbstractXMLPipe;
@@ -157,12 +157,12 @@
      * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
      */
     public void service(ServiceManager manager) throws ServiceException {
-        final Core core = (Core)manager.lookup(Core.ROLE);
-        String defaultEncoding  = core.getSettings().getFormEncoding();
+        final Settings settings = (Settings)manager.lookup(Settings.ROLE);
+        String defaultEncoding  = settings.getFormEncoding();
         if (defaultEncoding != null) {
             this.format.setProperty(OutputKeys.ENCODING, defaultEncoding);
         }
-        manager.release(core);
+        manager.release(settings);
     }
 
     /**

Modified: cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/servlet/CocoonServlet.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/servlet/CocoonServlet.java?rev=381317&r1=381316&r2=381317&view=diff
==============================================================================
--- cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/servlet/CocoonServlet.java (original)
+++ cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/servlet/CocoonServlet.java Mon
Feb 27 03:18:51 2006
@@ -132,7 +132,7 @@
 
         this.containerEncoding = this.getInitParameter("container-encoding", "ISO-8859-1");
         this.requestFactory = new RequestFactory(coreUtil.getSettings().isAutosaveUploads(),
-                                                 new File(coreUtil.getCore().getSettings().getUploadDirectory()),
+                                                 new File(coreUtil.getSettings().getUploadDirectory()),
                                                  coreUtil.getSettings().isAllowOverwrite(),
                                                  coreUtil.getSettings().isSilentlyRename(),
                                                  coreUtil.getSettings().getMaxUploadSize(),

Modified: cocoon/trunk/cocoon-core/src/test/java/org/apache/cocoon/core/container/ContainerTestCase.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-core/src/test/java/org/apache/cocoon/core/container/ContainerTestCase.java?rev=381317&r1=381316&r2=381317&view=diff
==============================================================================
--- cocoon/trunk/cocoon-core/src/test/java/org/apache/cocoon/core/container/ContainerTestCase.java
(original)
+++ cocoon/trunk/cocoon-core/src/test/java/org/apache/cocoon/core/container/ContainerTestCase.java
Mon Feb 27 03:18:51 2006
@@ -287,7 +287,7 @@
         avalonEnv.logger = this.logger;
         avalonEnv.context = this.context;
         avalonEnv.settings = new MutableSettings();
-        avalonEnv.core = new Core(avalonEnv.settings, avalonEnv.context);
+        avalonEnv.core = new Core(avalonEnv.context);
         avalonEnv.servletContext = new MockContext();
 
         this.rootContext = BeanFactoryUtil.createRootApplicationContext(avalonEnv);

Modified: cocoon/trunk/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portlet/CocoonPortlet.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portlet/CocoonPortlet.java?rev=381317&r1=381316&r2=381317&view=diff
==============================================================================
--- cocoon/trunk/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portlet/CocoonPortlet.java
(original)
+++ cocoon/trunk/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portlet/CocoonPortlet.java
Mon Feb 27 03:18:51 2006
@@ -163,7 +163,7 @@
         }
 
         this.containerEncoding = getInitParameter("container-encoding", "ISO-8859-1");
-        this.settings = this.coreUtil.getCore().getSettings();
+        this.settings = this.coreUtil.getSettings();
         this.requestFactory = new RequestFactory(this.settings.isAutosaveUploads(),
                 new File(this.settings.getUploadDirectory()),
                 this.settings.isAllowOverwrite(),

Modified: cocoon/trunk/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/sitemap/SitemapServlet.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/sitemap/SitemapServlet.java?rev=381317&r1=381316&r2=381317&view=diff
==============================================================================
--- cocoon/trunk/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/sitemap/SitemapServlet.java
(original)
+++ cocoon/trunk/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/sitemap/SitemapServlet.java
Mon Feb 27 03:18:51 2006
@@ -35,7 +35,7 @@
 import org.apache.cocoon.Processor;
 import org.apache.cocoon.components.LifecycleHelper;
 import org.apache.cocoon.components.treeprocessor.TreeProcessor;
-import org.apache.cocoon.core.Core;
+import org.apache.cocoon.core.Settings;
 import org.apache.cocoon.core.servlet.CoreUtil;
 import org.apache.cocoon.environment.http.HttpContext;
 import org.apache.cocoon.environment.http.HttpEnvironment;
@@ -85,9 +85,9 @@
             this.containerEncoding = "ISO-8859-1";
         }
         
-        Core core = null;
+        Settings settings = null;
         try {
-            core = (Core) this.serviceManager.lookup(Core.ROLE);
+            settings = (Settings) this.serviceManager.lookup(Settings.ROLE);
         } catch (ServiceException e) {
             throw new ServletException("Could not find a Core object from the parent service
manager", e);
         }
@@ -105,7 +105,7 @@
         if (sitemapPath != null && sitemapPath.charAt(0) != '/')
             sitemapPath = "/" + sitemapPath;
 
-        Context context = CoreUtil.createContext(config, core.getSettings(), sitemapPath);
+        Context context = CoreUtil.createContext(config, settings, sitemapPath);
         
         try {
             this.processor = (Processor) ClassUtils.newInstance(TreeProcessor.class.getName());



Mime
View raw message