cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r515052 - /cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/src/main/java/org/apache/cocoon/components/flow/apples/ApplesProcessor.java
Date Tue, 06 Mar 2007 10:18:30 GMT
Author: cziegeler
Date: Tue Mar  6 02:18:29 2007
New Revision: 515052

URL: http://svn.apache.org/viewvc?view=rev&rev=515052
Log:
Use Spring web application context

Modified:
    cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/src/main/java/org/apache/cocoon/components/flow/apples/ApplesProcessor.java

Modified: cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/src/main/java/org/apache/cocoon/components/flow/apples/ApplesProcessor.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/src/main/java/org/apache/cocoon/components/flow/apples/ApplesProcessor.java?view=diff&rev=515052&r1=515051&r2=515052
==============================================================================
--- cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/src/main/java/org/apache/cocoon/components/flow/apples/ApplesProcessor.java
(original)
+++ cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/src/main/java/org/apache/cocoon/components/flow/apples/ApplesProcessor.java
Tue Mar  6 02:18:29 2007
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You 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.
@@ -18,45 +18,41 @@
 
 import java.util.List;
 
-import org.apache.avalon.framework.CascadingRuntimeException;
 import org.apache.avalon.framework.activity.Disposable;
-import org.apache.avalon.framework.context.ContextException;
 import org.apache.avalon.framework.context.DefaultContext;
 import org.apache.avalon.framework.service.ServiceException;
 import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.cocoon.components.ContextHelper;
 import org.apache.cocoon.components.LifecycleHelper;
 import org.apache.cocoon.components.flow.AbstractInterpreter;
 import org.apache.cocoon.components.flow.ContinuationsDisposer;
 import org.apache.cocoon.components.flow.InvalidContinuationException;
 import org.apache.cocoon.components.flow.WebContinuation;
-import org.apache.cocoon.components.flow.apples.AppleController;
-import org.apache.cocoon.components.flow.apples.AppleRequest;
-import org.apache.cocoon.components.flow.apples.DefaultAppleRequest;
-import org.apache.cocoon.components.flow.apples.DefaultAppleResponse;
-import org.apache.cocoon.components.flow.apples.StatelessAppleController;
+import org.apache.cocoon.core.container.spring.avalon.AvalonUtils;
 import org.apache.cocoon.environment.ObjectModelHelper;
 import org.apache.cocoon.environment.Redirector;
 import org.apache.cocoon.environment.Request;
 import org.apache.cocoon.environment.Response;
+import org.apache.cocoon.spring.configurator.WebAppContextUtils;
+import org.springframework.web.context.WebApplicationContext;
 
 /**
  * ApplesProcessor is the core Cocoon component that provides the 'Apples' flow
  * implementation.
- * 
+ *
  * @version $Id$
  */
 public class ApplesProcessor extends AbstractInterpreter implements ContinuationsDisposer
{
 
+    /**
+     * @see org.apache.cocoon.components.flow.Interpreter#callFunction(java.lang.String,
java.util.List, org.apache.cocoon.environment.Redirector)
+     */
     public void callFunction(String className, List params, Redirector redirector) throws
Exception {
+        // Get the current web application context
+        final WebApplicationContext webAppContext = WebAppContextUtils.getCurrentWebApplicationContext();
+
         // Use the current sitemap's service manager for components
-        ServiceManager sitemapManager;
-        try {
-            sitemapManager = (ServiceManager) avalonContext.get(ContextHelper.CONTEXT_SITEMAP_SERVICE_MANAGER);
-        } catch (ContextException e) {
-            throw new CascadingRuntimeException("Cannot get sitemap service manager", e);
-        }    	
-    	
+        final ServiceManager sitemapManager = (ServiceManager) webAppContext.getBean(AvalonUtils.SERVICE_MANAGER_ROLE);
+
         AppleController app = instantiateController(className, sitemapManager);
 
         WebContinuation wk = null;
@@ -110,7 +106,7 @@
 		try {
 			Class clazz = Thread.currentThread().getContextClassLoader().loadClass(appleName);
 	        Object o = clazz.newInstance();
-	        appleController = (AppleController) o;			
+	        appleController = (AppleController) o;
 		} catch (ClassNotFoundException e) {
 			throw new AppleNotFoundException("Can't find a class of name '" + appleName + "'.", e);
 		} catch (InstantiationException e) {
@@ -148,7 +144,7 @@
         }
         else if (res.isSendStatus()) {
         	redirector.sendStatus(res.getStatus());
-        }     
+        }
         else {
             String uri = res.getURI();
             if (getLogger().isDebugEnabled()) {



Mime
View raw message