cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r383360 - in /cocoon/trunk: cocoon-core/src/main/java/org/apache/cocoon/ cocoon-core/src/main/java/org/apache/cocoon/bean/ cocoon-core/src/main/java/org/apache/cocoon/components/source/impl/ cocoon-core/src/main/java/org/apache/cocoon/compo...
Date Sun, 05 Mar 2006 17:34:26 GMT
Author: cziegeler
Date: Sun Mar  5 09:34:22 2006
New Revision: 383360

URL: http://svn.apache.org/viewcvs?rev=383360&view=rev
Log:
Start removing dependencies between processor and container

Modified:
    cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/Cocoon.java
    cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/ProcessingUtil.java
    cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/Processor.java
    cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/bean/CocoonWrapper.java
    cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/components/source/impl/SitemapSource.java
    cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/ConcreteTreeProcessor.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/SitemapLanguage.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/container/spring/BeanFactoryUtil.java
    cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/environment/internal/EnvironmentHelper.java
    cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/environment/internal/EnvironmentInfo.java
    cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/transformation/IncludeTransformer.java
    cocoon/trunk/cocoon-core/src/test/java/org/apache/cocoon/MockProcessor.java
    cocoon/trunk/cocoon-core/src/test/java/org/apache/cocoon/SitemapComponentTestCase.java
    cocoon/trunk/cocoon-core/src/test/java/org/apache/cocoon/core/container/ContainerTestCase.java
    cocoon/trunk/cocoon-cron/cocoon-cron-impl/src/main/java/org/apache/cocoon/components/cron/CocoonQuartzJobExecutor.java

Modified: cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/Cocoon.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/Cocoon.java?rev=383360&r1=383359&r2=383360&view=diff
==============================================================================
--- cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/Cocoon.java (original)
+++ cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/Cocoon.java Sun Mar  5 09:34:22
2006
@@ -34,6 +34,7 @@
 import org.springframework.beans.BeansException;
 import org.springframework.beans.factory.BeanFactory;
 import org.springframework.beans.factory.BeanFactoryAware;
+import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
 
 /**
  * The Cocoon Object is the main Kernel for the entire Cocoon system.
@@ -60,6 +61,9 @@
     /** The logger. */
     protected final Logger logger;
 
+    /** The bean factory. */
+    protected ConfigurableListableBeanFactory beanFactory;
+
     /**
      * An optional component that is called before and after processing all
      * requests.
@@ -93,6 +97,7 @@
      * @see org.springframework.beans.factory.BeanFactoryAware#setBeanFactory(org.springframework.beans.factory.BeanFactory)
      */
     public void setBeanFactory(BeanFactory factory) throws BeansException {
+        this.beanFactory = (ConfigurableListableBeanFactory)factory;
         // get the optional request listener
         if (factory.containsBean(RequestListener.ROLE)) {
             this.requestListener = (RequestListener) factory.getBean(RequestListener.ROLE);
@@ -207,7 +212,7 @@
     public boolean process(Environment environment) throws Exception {
         environment.startingProcessing();
         final int environmentDepth = EnvironmentHelper.markEnvironment();
-        EnvironmentHelper.enterProcessor(this, this.serviceManager, environment);
+        EnvironmentHelper.enterProcessor(this, environment);
         try {
             boolean result;
             if (this.logger.isDebugEnabled()) {
@@ -339,5 +344,20 @@
      */
     public void setAttribute(String name, Object value) {
         this.processorAttributes.put(name, value);
+    }
+
+    /**
+     * @see org.apache.cocoon.Processor#getBeanFactory()
+     */
+    public ConfigurableListableBeanFactory getBeanFactory() {
+        return this.beanFactory;
+    }
+
+    /**
+     * @see org.apache.cocoon.Processor#getParent()
+     */
+    public Processor getParent() {
+        // we have no parent
+        return null;
     }
 }

Modified: cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/ProcessingUtil.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/ProcessingUtil.java?rev=383360&r1=383359&r2=383360&view=diff
==============================================================================
--- cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/ProcessingUtil.java (original)
+++ cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/ProcessingUtil.java Sun Mar 
5 09:34:22 2006
@@ -16,12 +16,16 @@
 package org.apache.cocoon;
 
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
 
 import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.cocoon.core.Settings;
 import org.apache.cocoon.environment.internal.EnvironmentHelper;
+import org.apache.excalibur.source.SourceResolver;
+import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
 
 /**
  * This is an utility class for processing Cocoon requests.
@@ -42,6 +46,9 @@
     /** Bean name for the service manager. */
     public static String SERVICE_MANAGER_ROLE = "org.apache.avalon.framework.service.ServiceManager";
 
+    /** Bean name for local source resolver. (TODO) */
+    public static String LOCAL_SOURCE_RESOLVER_ROLE = SourceResolver.ROLE + "/local";
+
     /**
      * Avoid construction.
      */
@@ -99,11 +106,45 @@
 
     /**
      * Get the current sitemap component manager.
-     * This method return the current sitemap component manager. This
+     * This method returns the current sitemap component manager. This
      * is the manager that holds all the components of the currently
      * processed (sub)sitemap.
      */
     static public ServiceManager getSitemapServiceManager() {
         return EnvironmentHelper.getSitemapServiceManager(); 
+    }
+
+    final static protected Map processors = new HashMap();
+
+    static public void register(Processor processor) {
+        ProcessorInfo pi = new ProcessorInfo();
+        if ( processor.getParent() != null ) {
+            pi.beanFactory = getBeanFactory(processor.getParent());
+        }
+        processors.put(processor, pi);
+    }
+
+    static public void unregister(Processor processor) {
+        processors.remove(processor);
+    }
+
+    static public void setBeanFactory(Processor processor, ConfigurableListableBeanFactory
beanFactory) {
+        ProcessorInfo pi = (ProcessorInfo)processors.get(processor);
+        if ( pi != null ) {
+            pi.beanFactory = beanFactory;
+        }
+        throw new IllegalStateException("Processor has not been registered. " + processor);
       
+    }
+
+    static public ConfigurableListableBeanFactory getBeanFactory(Processor processor) {
+        ProcessorInfo pi = (ProcessorInfo)processors.get(processor);
+        if ( pi != null ) {
+            return pi.beanFactory;
+        }
+        throw new IllegalStateException("Processor has not been registered. " + processor);
+    }
+
+    protected static final class ProcessorInfo {
+        public ConfigurableListableBeanFactory beanFactory;
     }
 }

Modified: cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/Processor.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/Processor.java?rev=383360&r1=383359&r2=383360&view=diff
==============================================================================
--- cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/Processor.java (original)
+++ cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/Processor.java Sun Mar  5 09:34:22
2006
@@ -22,6 +22,7 @@
 import org.apache.cocoon.components.pipeline.ProcessingPipeline;
 import org.apache.cocoon.environment.Environment;
 import org.apache.cocoon.environment.SourceResolver;
+import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
 
 /**
  *
@@ -124,4 +125,9 @@
      * @since 2.2
      */
     Object removeAttribute(String name);
+
+    /** FIXME - Remove this and use ProcessingUtil. */
+    ConfigurableListableBeanFactory getBeanFactory();
+
+    Processor getParent();
 }

Modified: cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/bean/CocoonWrapper.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/bean/CocoonWrapper.java?rev=383360&r1=383359&r2=383360&view=diff
==============================================================================
--- cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/bean/CocoonWrapper.java (original)
+++ cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/bean/CocoonWrapper.java Sun Mar
 5 09:34:22 2006
@@ -446,7 +446,7 @@
 
         XMLConsumer consumer = new ContentHandlerWrapper(handler);
         Processor.InternalPipelineDescription pipeline = cocoon.buildPipeline(env);
-        EnvironmentHelper.enterProcessor(pipeline.lastProcessor, pipeline.pipelineManager,
env);
+        EnvironmentHelper.enterProcessor(pipeline.lastProcessor, env);
         try {
             pipeline.processingPipeline.prepareInternal(env);
             pipeline.processingPipeline.process(env, consumer);

Modified: cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/components/source/impl/SitemapSource.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/components/source/impl/SitemapSource.java?rev=383360&r1=383359&r2=383360&view=diff
==============================================================================
--- cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/components/source/impl/SitemapSource.java
(original)
+++ cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/components/source/impl/SitemapSource.java
Sun Mar  5 09:34:22 2006
@@ -191,8 +191,7 @@
             ByteArrayOutputStream os = new ByteArrayOutputStream();
             this.environment.setOutputStream(os);
             EnvironmentHelper.enterProcessor(this.pipelineDescription.lastProcessor,
-                                            this.manager,
-                                            this.environment);
+                                             this.environment);
             try {
 
                 this.pipelineDescription.processingPipeline.process(this.environment);
@@ -269,7 +268,6 @@
             if (redirectURL == null) {
 
                 EnvironmentHelper.enterProcessor(this.pipelineDescription.lastProcessor,
-                                                 this.manager,
                                                  this.environment);
                 try {
                     this.pipelineDescription.processingPipeline.prepareInternal(this.environment);
@@ -340,7 +338,6 @@
                 // We have to add an environment changer
                 // for clean environment stack handling.
                 EnvironmentHelper.enterProcessor(this.pipelineDescription.lastProcessor,
-                                                 this.manager,
                                                  this.environment);
                 try {
                     this.pipelineDescription.processingPipeline.process(this.environment,

Modified: cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/ConcreteTreeProcessor.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/ConcreteTreeProcessor.java?rev=383360&r1=383359&r2=383360&view=diff
==============================================================================
--- cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/ConcreteTreeProcessor.java
(original)
+++ cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/ConcreteTreeProcessor.java
Sun Mar  5 09:34:22 2006
@@ -50,7 +50,7 @@
 import org.apache.cocoon.sitemap.SitemapExecutor;
 import org.apache.cocoon.util.location.Location;
 import org.apache.cocoon.util.location.LocationImpl;
-import org.springframework.beans.factory.config.ConfigurableBeanFactory;
+import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
 
 /**
  * The concrete implementation of {@link Processor}, containing the evaluation tree and associated
@@ -96,7 +96,7 @@
     protected Map processorAttributes = new HashMap();
 
     /** Bean Factory for this sitemap. */
-    protected ConfigurableBeanFactory beanFactory;
+    protected ConfigurableListableBeanFactory beanFactory;
 
     /**
      * Builds a concrete processig, given the wrapping processor
@@ -111,7 +111,7 @@
     }
 
     /** Set the processor data, result of the treebuilder job */
-    public void setProcessorData(ConfigurableBeanFactory beanFactory,
+    public void setProcessorData(ConfigurableListableBeanFactory beanFactory,
                                  ServiceManager manager,
                                  ProcessingNode rootNode,
                                  List disposableNodes,
@@ -315,7 +315,7 @@
 
             this.sitemapExecutor.enterSitemap(this, environment.getObjectModel(), this.wrappingProcessor.source.getURI());
             // and now process
-            EnvironmentHelper.enterProcessor(this, this.manager, environment);
+            EnvironmentHelper.enterProcessor(this, environment);
             final Redirector oldRedirector = context.getRedirector();
 
             // Build a redirector
@@ -512,4 +512,17 @@
         return "sitemap";
     }
 
+    /**
+     * @see org.apache.cocoon.Processor#getBeanFactory()
+     */
+    public ConfigurableListableBeanFactory getBeanFactory() {
+        return this.beanFactory;
+    }
+
+    /**
+     * @see org.apache.cocoon.Processor#getParent()
+     */
+    public Processor getParent() {
+        return this.wrappingProcessor.getParent();
+    }
 }

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=383360&r1=383359&r2=383360&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
Sun Mar  5 09:34:22 2006
@@ -49,6 +49,7 @@
 import org.apache.excalibur.source.Source;
 import org.apache.excalibur.source.SourceResolver;
 import org.apache.regexp.RE;
+import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
 import org.xml.sax.SAXException;
 
 /**
@@ -343,7 +344,7 @@
     private Configuration createSitemapProgram(Source source) throws ProcessingException,
SAXException, IOException {
         NamespacedSAXConfigurationHandler handler = new NamespacedSAXConfigurationHandler();
         AnnotationsFilter annotationsFilter = new AnnotationsFilter(handler);
-        SourceUtil.toSAX(source, annotationsFilter);
+        SourceUtil.toSAX(this.manager, source, null, annotationsFilter);
         return handler.getConfiguration();        
     }
     
@@ -387,7 +388,7 @@
         // If these components try to access the current processor or the
         // current service manager they must get this one - which is currently
         // in the process of initialization.
-        EnvironmentHelper.enterProcessor(this, this.manager, env);
+        EnvironmentHelper.enterProcessor(this, env);
 
         try {
 
@@ -490,5 +491,25 @@
      */
     public void setAttribute(String name, Object value) {
         this.concreteProcessor.setAttribute(name, value);
+    }
+
+    /**
+     * @see org.apache.cocoon.Processor#getBeanFactory()
+     */
+    public ConfigurableListableBeanFactory getBeanFactory() {
+        if ( this.concreteProcessor != null ) {
+            return this.concreteProcessor.getBeanFactory();
+        }
+        if ( parent != null ) {
+            return this.parent.getBeanFactory();
+        }
+        return null;
+    }
+
+    /**
+     * @see org.apache.cocoon.Processor#getParent()
+     */
+    public Processor getParent() {
+        return this.parent;
     }
 }

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=383360&r1=383359&r2=383360&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
Sun Mar  5 09:34:22 2006
@@ -654,7 +654,7 @@
      * element of the tree.
      */
     protected ConfigurableListableBeanFactory createBeanFactory(Context       context,
-                                                        Configuration config)
+                                                                Configuration config)
     throws Exception {
         // setup spring container
         // first, get the correct parent

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=383360&r1=383359&r2=383360&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 Sun Mar  5
09:34:22 2006
@@ -611,7 +611,7 @@
         env.logger = this.log;
         env.servletContext = this.environmentContext;
         env.settings = this.settings;
-        ConfigurableBeanFactory rootContext = BeanFactoryUtil.createRootApplicationContext(env);
+        ConfigurableBeanFactory rootContext = BeanFactoryUtil.createRootBeanFactory(env);
         ConfigurationInfo result = ConfigReader.readConfiguration(settings.getConfiguration(),
env);
         ConfigurableBeanFactory mainContext = BeanFactoryUtil.createBeanFactory(env, result,
rootContext, true);
 

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=383360&r1=383359&r2=383360&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
Sun Mar  5 09:34:22 2006
@@ -109,7 +109,7 @@
      * @return A new root application factory.
      * @throws Exception
      */
-    public static ConfigurableListableBeanFactory createRootApplicationContext(AvalonEnvironment
 env)
+    public static ConfigurableListableBeanFactory createRootBeanFactory(AvalonEnvironment
 env)
     throws Exception {
         final ApplicationContext parent = (ApplicationContext)env.servletContext.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
         CocoonBeanFactory factory = new CocoonBeanFactory(parent);

Modified: cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/environment/internal/EnvironmentHelper.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/environment/internal/EnvironmentHelper.java?rev=383360&r1=383359&r2=383360&view=diff
==============================================================================
--- cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/environment/internal/EnvironmentHelper.java
(original)
+++ cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/environment/internal/EnvironmentHelper.java
Sun Mar  5 09:34:22 2006
@@ -27,6 +27,7 @@
 import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.avalon.framework.service.Serviceable;
 import org.apache.cocoon.ProcessingException;
+import org.apache.cocoon.ProcessingUtil;
 import org.apache.cocoon.Processor;
 import org.apache.cocoon.components.source.SourceUtil;
 import org.apache.cocoon.environment.Environment;
@@ -265,20 +266,18 @@
      *
      * @throws ProcessingException if processor is null
      */
-    public static void enterProcessor(Processor processor,
-                                      ServiceManager manager,
+    public static void enterProcessor(Processor   processor,
                                       Environment env)
     throws ProcessingException {
         if (null == processor) {
             throw new ProcessingException("Processor is not set.");
         }
-
         EnvironmentStack stack = (EnvironmentStack)environmentStack.get();
         if (stack == null) {
             stack = new EnvironmentStack();
             environmentStack.set(stack);
         }
-        stack.pushInfo(new EnvironmentInfo(processor, stack.getOffset(), manager, env));
+        stack.pushInfo(new EnvironmentInfo(processor, stack.getOffset(), env));
         stack.setOffset(stack.size() - 1);
     }
 
@@ -309,7 +308,7 @@
             throw new ProcessingException("There must be a current processing environment.");
         }
 
-        stack.pushInfo(new EnvironmentInfo(info.processor, stack.getOffset(), info.manager,
env));
+        stack.pushInfo(new EnvironmentInfo(info.processor, stack.getOffset(), env));
         stack.setOffset(stack.size() - 1);
     }
 
@@ -391,8 +390,12 @@
     static public ServiceManager getSitemapServiceManager() {
         final EnvironmentStack stack = (EnvironmentStack)environmentStack.get();
         if ( stack != null && !stack.isEmpty()) {
-            final EnvironmentInfo info = stack.getCurrentInfo();
-            return info.manager;
+            EnvironmentInfo info = stack.getCurrentInfo();
+            // FIXME - Workaround!
+            if ( info.processor.getBeanFactory() == null ) {
+                info = (EnvironmentInfo)stack.get(stack.getOffset() - 1);
+            }
+            return (ServiceManager) info.processor.getBeanFactory().getBean(ProcessingUtil.SERVICE_MANAGER_ROLE);
         }
         return null;
     }

Modified: cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/environment/internal/EnvironmentInfo.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/environment/internal/EnvironmentInfo.java?rev=383360&r1=383359&r2=383360&view=diff
==============================================================================
--- cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/environment/internal/EnvironmentInfo.java
(original)
+++ cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/environment/internal/EnvironmentInfo.java
Sun Mar  5 09:34:22 2006
@@ -15,7 +15,6 @@
  */
 package org.apache.cocoon.environment.internal;
 
-import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.cocoon.Processor;
 import org.apache.cocoon.environment.Environment;
 
@@ -33,16 +32,13 @@
 
     public final Processor      processor;
     public final int            oldStackCount;
-    public final ServiceManager manager;
     public final Environment    environment;
 
-    public EnvironmentInfo(Processor processor, 
-                           int oldStackCount,
-                           ServiceManager manager,
-                           Environment    environment) {
+    public EnvironmentInfo(Processor   processor, 
+                           int         oldStackCount,
+                           Environment environment) {
         this.processor = processor;
         this.oldStackCount = oldStackCount;
-        this.manager = manager;
         this.environment = environment;
     }
 }

Modified: cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/transformation/IncludeTransformer.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/transformation/IncludeTransformer.java?rev=383360&r1=383359&r2=383360&view=diff
==============================================================================
--- cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/transformation/IncludeTransformer.java
(original)
+++ cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/transformation/IncludeTransformer.java
Sun Mar  5 09:34:22 2006
@@ -1062,7 +1062,7 @@
                     }
 
                     // Setup this thread's environment
-                    EnvironmentHelper.enterProcessor(processor, manager, environment);
+                    EnvironmentHelper.enterProcessor(processor, environment);
                     try {
                         element.process(this);
 

Modified: cocoon/trunk/cocoon-core/src/test/java/org/apache/cocoon/MockProcessor.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-core/src/test/java/org/apache/cocoon/MockProcessor.java?rev=383360&r1=383359&r2=383360&view=diff
==============================================================================
--- cocoon/trunk/cocoon-core/src/test/java/org/apache/cocoon/MockProcessor.java (original)
+++ cocoon/trunk/cocoon-core/src/test/java/org/apache/cocoon/MockProcessor.java Sun Mar  5
09:34:22 2006
@@ -19,6 +19,7 @@
 
 import org.apache.cocoon.environment.Environment;
 import org.apache.cocoon.environment.SourceResolver;
+import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
 
 /**
  * Mock processor
@@ -26,8 +27,14 @@
  * @version $Id$
  */
 public class MockProcessor implements Processor {
-    
-    /* (non-Javadoc)
+
+    private final ConfigurableListableBeanFactory beanFactory;
+
+    public MockProcessor(ConfigurableListableBeanFactory factory) {
+        this.beanFactory = factory;
+    }
+
+    /**
      * @see org.apache.cocoon.Processor#buildPipeline(org.apache.cocoon.environment.Environment)
      */
     public InternalPipelineDescription buildPipeline(Environment environment)
@@ -35,34 +42,34 @@
         return null;
     }
     
-    /* (non-Javadoc)
+    /**
      * @see org.apache.cocoon.Processor#getComponentConfigurations()
      */
     public Map getComponentConfigurations() {
         return null;
     }
     
-    /* (non-Javadoc)
+    /**
      * @see org.apache.cocoon.Processor#getContext()
      */
     public String getContext() {
         return null;
     }
-    /* (non-Javadoc)
+    /**
      * @see org.apache.cocoon.Processor#getRootProcessor()
      */
     public Processor getRootProcessor() {
         return this;
     }
     
-    /* (non-Javadoc)
+    /**
      * @see org.apache.cocoon.Processor#getSourceResolver()
      */
     public SourceResolver getSourceResolver() {
         return null;
     }
 
-    /* (non-Javadoc)
+    /**
      * @see org.apache.cocoon.Processor#process(org.apache.cocoon.environment.Environment)
      */
     public boolean process(Environment environment) throws Exception {
@@ -90,4 +97,17 @@
         // nothing to do
     }
 
+    /**
+     * @see org.apache.cocoon.Processor#getParent()
+     */
+    public Processor getParent() {
+        return null;
+    }
+
+    /**
+     * @see org.apache.cocoon.Processor#getBeanFactory()
+     */
+    public ConfigurableListableBeanFactory getBeanFactory() {
+        return this.beanFactory;
+    }
 }

Modified: cocoon/trunk/cocoon-core/src/test/java/org/apache/cocoon/SitemapComponentTestCase.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-core/src/test/java/org/apache/cocoon/SitemapComponentTestCase.java?rev=383360&r1=383359&r2=383360&view=diff
==============================================================================
--- cocoon/trunk/cocoon-core/src/test/java/org/apache/cocoon/SitemapComponentTestCase.java
(original)
+++ cocoon/trunk/cocoon-core/src/test/java/org/apache/cocoon/SitemapComponentTestCase.java
Sun Mar  5 09:34:22 2006
@@ -359,9 +359,9 @@
         // enter & leave environment, as a manager is looked up using
         // the processing context stack
         MockEnvironment env = new MockEnvironment();
-        Processor processor = new MockProcessor();
+        Processor processor = new MockProcessor(this.getBeanFactory());
         
-        EnvironmentHelper.enterProcessor(processor, this.getManager(), env);
+        EnvironmentHelper.enterProcessor(processor, env);
 
         try {
             ServiceSelector selector = null;

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=383360&r1=383359&r2=383360&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
Sun Mar  5 09:34:22 2006
@@ -40,7 +40,7 @@
 import org.apache.cocoon.core.container.spring.ConfigReader;
 import org.apache.cocoon.core.container.spring.ConfigurationInfo;
 import org.apache.cocoon.environment.mock.MockContext;
-import org.springframework.beans.factory.config.ConfigurableBeanFactory;
+import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
 
 /**
  * JUnit TestCase for Cocoon Components.
@@ -133,8 +133,8 @@
     /** The context */
     private Context context;
 
-    /** The root application context. */
-    private ConfigurableBeanFactory rootContext;
+    /** The root bean factory. */
+    private ConfigurableListableBeanFactory rootBeanFactory;
 
     /** Return the logger */
     protected Logger getLogger() {
@@ -146,6 +146,11 @@
         return this.manager;
     }
 
+    /** Return the bean factory. */
+    protected ConfigurableListableBeanFactory getBeanFactory() {
+        return this.rootBeanFactory;
+    }
+
     /**
      * @see junit.framework.TestCase#setUp()
      */
@@ -220,9 +225,9 @@
      * Disposes the <code>ComponentLocator</code>
      */
     final private void done() {
-        if( this.rootContext != null ) {
-            this.rootContext.destroySingletons();
-            this.rootContext = null;
+        if( this.rootBeanFactory != null ) {
+            this.rootBeanFactory.destroySingletons();
+            this.rootBeanFactory = null;
         }
         this.manager = null;
         this.context = null;
@@ -288,15 +293,15 @@
         avalonEnv.settings = new MutableSettings();
         avalonEnv.servletContext = new MockContext();
 
-        this.rootContext = BeanFactoryUtil.createRootApplicationContext(avalonEnv);
+        this.rootBeanFactory = BeanFactoryUtil.createRootBeanFactory(avalonEnv);
         // read roles
         ConfigurationInfo rolesInfo = ConfigReader.readConfiguration(confRM, null, avalonEnv);
-        ConfigurableBeanFactory rolesContext = BeanFactoryUtil.createBeanFactory(avalonEnv,
rolesInfo, rootContext, true);
+        ConfigurableListableBeanFactory rolesContext = BeanFactoryUtil.createBeanFactory(avalonEnv,
rolesInfo, this.rootBeanFactory, true);
 
         // read components
         ConfigurationInfo componentsInfo = ConfigReader.readConfiguration(confCM, rolesInfo,
avalonEnv);
         this.addComponents( componentsInfo );
-        ConfigurableBeanFactory componentsContext = BeanFactoryUtil.createBeanFactory(avalonEnv,
componentsInfo, rolesContext, false);
+        ConfigurableListableBeanFactory componentsContext = BeanFactoryUtil.createBeanFactory(avalonEnv,
componentsInfo, rolesContext, false);
 
         this.manager = (ServiceManager)componentsContext.getBean(ServiceManager.class.getName());
     }

Modified: cocoon/trunk/cocoon-cron/cocoon-cron-impl/src/main/java/org/apache/cocoon/components/cron/CocoonQuartzJobExecutor.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-cron/cocoon-cron-impl/src/main/java/org/apache/cocoon/components/cron/CocoonQuartzJobExecutor.java?rev=383360&r1=383359&r2=383360&view=diff
==============================================================================
--- cocoon/trunk/cocoon-cron/cocoon-cron-impl/src/main/java/org/apache/cocoon/components/cron/CocoonQuartzJobExecutor.java
(original)
+++ cocoon/trunk/cocoon-cron/cocoon-cron-impl/src/main/java/org/apache/cocoon/components/cron/CocoonQuartzJobExecutor.java
Sun Mar  5 09:34:22 2006
@@ -83,7 +83,7 @@
         m_env.startingProcessing();
         
         try {
-            EnvironmentHelper.enterProcessor(m_processor, m_manager, m_env);
+            EnvironmentHelper.enterProcessor(m_processor, m_env);
         }
         catch (ProcessingException e) {
             throw new JobExecutionException(e);



Mime
View raw message