cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r418751 - in /cocoon/trunk/core/cocoon-core/src: main/java/org/apache/cocoon/core/CoreUtil.java main/java/org/apache/cocoon/servlet/CocoonServletListener.java test/java/org/apache/cocoon/SitemapTestCase.java
Date Mon, 03 Jul 2006 11:59:06 GMT
Author: cziegeler
Date: Mon Jul  3 04:59:05 2006
New Revision: 418751

URL: http://svn.apache.org/viewvc?rev=418751&view=rev
Log:
Remove *all* references to delete Cocoon object

Modified:
    cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/CoreUtil.java
    cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/servlet/CocoonServletListener.java
    cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/SitemapTestCase.java

Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/CoreUtil.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/CoreUtil.java?rev=418751&r1=418750&r2=418751&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/CoreUtil.java (original)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/CoreUtil.java Mon Jul
 3 04:59:05 2006
@@ -40,7 +40,6 @@
 import org.apache.avalon.framework.context.DefaultContext;
 import org.apache.avalon.framework.logger.Logger;
 import org.apache.cocoon.Constants;
-import org.apache.cocoon.Processor;
 import org.apache.cocoon.components.ContextHelper;
 import org.apache.cocoon.components.source.SourceUtil;
 import org.apache.cocoon.components.source.impl.DelayedRefreshSourceWrapper;
@@ -87,9 +86,6 @@
     /** The root logger. */
     protected Logger log;
 
-    /** The Root processor instance */
-    protected Processor processor;
-
     /** The environment context. */
     protected final Context environmentContext;
 
@@ -524,26 +520,9 @@
     }
 
     /**
-     * Creates the root processor object and handles exception handling.
-     */
-    public synchronized Processor createProcessor()
-    throws Exception {
-        try {
-            Processor p = (Processor)this.container.getBean("org.apache.cocoon.Cocoon");
-
-            this.processor = p;
-        } catch (Exception e) {
-            this.log.error("Exception reloading root processor.", e);
-            throw e;
-        }
-        return this.processor;
-    }
-
-    /**
      * Gets the current root processor object.
      * Reload the root processor if configuration changed or we are reloading.
      * @param reloadContainer Should the container be reloaded?
-     */
     public Processor getProcessor(boolean reloadContainer)
     throws Exception {
         if (this.settings.isReloadingEnabled("config")) {
@@ -578,6 +557,7 @@
         }
         return this.processor;
     }
+     */
 
     protected ConfigurableBeanFactory setupSpringContainer() throws Exception {
         if (this.log.isInfoEnabled()) {

Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/servlet/CocoonServletListener.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/servlet/CocoonServletListener.java?rev=418751&r1=418750&r2=418751&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/servlet/CocoonServletListener.java
(original)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/servlet/CocoonServletListener.java
Mon Jul  3 04:59:05 2006
@@ -65,7 +65,6 @@
 
         try {
             this.coreUtil = new CoreUtil(new HttpContext(servletContext), env);
-            this.coreUtil.createProcessor();          
         } catch (Exception e) {
             servletContext.log("Error during initializing Apache Cocoon " + Constants.VERSION
+ " - aborting.");
             servletContext.log(e.getMessage());

Modified: cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/SitemapTestCase.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/SitemapTestCase.java?rev=418751&r1=418750&r2=418751&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/SitemapTestCase.java (original)
+++ cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/SitemapTestCase.java Mon
Jul  3 04:59:05 2006
@@ -32,7 +32,9 @@
 import org.apache.cocoon.core.CoreUtil;
 import org.apache.cocoon.core.TestBootstrapEnvironment;
 import org.apache.cocoon.core.TestCoreUtil;
+import org.apache.cocoon.environment.Environment;
 import org.apache.cocoon.environment.ObjectModelHelper;
+import org.apache.cocoon.environment.internal.EnvironmentHelper;
 import org.apache.cocoon.environment.mock.MockContext;
 import org.apache.cocoon.environment.mock.MockEnvironment;
 import org.apache.cocoon.environment.mock.MockRequest;
@@ -48,10 +50,10 @@
 
     private Logger logger;
     private CoreUtil coreUtil;
-    private Processor processor;
     private String classDir;
     private ConfigurableBeanFactory container;
     private ServiceManager serviceManager;
+    private Processor rootProcessor;
 
     protected void setUp() throws Exception {
         super.setUp();
@@ -75,9 +77,9 @@
             new TestBootstrapEnvironment(this.getConfiguration());
 
         this.coreUtil = new TestCoreUtil(env);
-        this.processor = this.coreUtil.createProcessor();
         this.container = this.coreUtil.getContainer();
         this.serviceManager = (ServiceManager)this.container.getBean(ServiceManager.class.getName());
+        this.rootProcessor = (Processor)this.container.getBean(Processor.ROLE);
     }
 
     protected void tearDown() throws Exception {
@@ -194,10 +196,36 @@
 
     protected byte[] process(String uri) throws Exception {
         MockEnvironment env = getEnvironment(uri);
-        this.processor.process(env);
+        this.process(env);
         getLogger().info("Output: " + new String(env.getOutput(), "UTF-8"));
 
         return env.getOutput();
+    }
+
+    protected boolean process(Environment environment) throws Exception {
+        environment.startingProcessing();
+        final int environmentDepth = EnvironmentHelper.markEnvironment();
+        EnvironmentHelper.enterProcessor(this.rootProcessor, environment);
+        try {
+            boolean result;
+
+            result = this.rootProcessor.process(environment);
+
+            // commit response on success
+            environment.commitResponse();
+
+            return result;
+        } catch (Exception any) {
+            // reset response on error
+            environment.tryResetResponse();
+            throw any;
+        } finally {
+            EnvironmentHelper.leaveProcessor();
+            environment.finishingProcessing();
+            ProcessingUtil.cleanup();
+
+            EnvironmentHelper.checkEnvironment(environmentDepth, this.getLogger());
+        }
     }
 
     protected void pipeTest(String uri, String expectedSource) throws Exception {



Mime
View raw message