cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From reinh...@apache.org
Subject svn commit: r517434 - in /cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/src: changes/ main/java/org/apache/cocoon/components/flow/apples/ main/resources/META-INF/cocoon/avalon/
Date Mon, 12 Mar 2007 22:36:32 GMT
Author: reinhard
Date: Mon Mar 12 15:36:30 2007
New Revision: 517434

URL: http://svn.apache.org/viewvc?view=rev&rev=517434
Log:
- rename the Apples interpreter 'service-apples' to 'spring-apples'
- remove the possibility to mix normales apples with spring-apples

Added:
    cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/src/main/java/org/apache/cocoon/components/flow/apples/SpringApplesProcessor.java
      - copied, changed from r516667, cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/src/main/java/org/apache/cocoon/components/flow/apples/ServiceApplesProcessor.java
Removed:
    cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/src/main/java/org/apache/cocoon/components/flow/apples/ServiceApplesProcessor.java
Modified:
    cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/src/changes/changes.xml
    cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/src/main/java/org/apache/cocoon/components/flow/apples/ApplesProcessor.java
    cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/src/main/resources/META-INF/cocoon/avalon/cocoon-apples.xconf

Modified: cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/src/changes/changes.xml?view=diff&rev=517434&r1=517433&r2=517434
==============================================================================
--- cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/src/changes/changes.xml (original)
+++ cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/src/changes/changes.xml Mon Mar 12
15:36:30 2007
@@ -26,8 +26,8 @@
   <body>
     <release version="1.0.0-RC1" date="2007-??-??" description="unreleased"> 
       <action dev="reinhard" type="add">
-        Apples can also be Spring beans. In order to lookup a bean, prepand #, e.g. to lookup
a bean of name 'myBean',
-        use &lt;map:call function="#myBean"/&gt;.
+        Apples can also be Spring beans. In order to lookup a bean, use the "spring-apples"
interpreter. The former
+        "service-apples" interpreter has been deprecated.
       </action>         
       <action dev="reinhard" type="add">
         Add an AppleNotFoundException which informs why an Apple can't be initialized.

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=517434&r1=517433&r2=517434
==============================================================================
--- 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
Mon Mar 12 15:36:30 2007
@@ -67,13 +67,11 @@
             appleContext.put("continuation-id", wk.getId());
         }
 
-
         LifecycleHelper.setupComponent(app, getLogger(), appleContext, sitemapManager, null,
true);
         processApple(params, redirector, app, wk);
     }
 
     public void handleContinuation(String continuationId, List params, Redirector redirector)
throws Exception {
-
         WebContinuation wk = this.continuationsMgr.lookupWebContinuation(continuationId,
getInterpreterID());
         if (wk == null) {
             // Throw an InvalidContinuationException to be handled inside the
@@ -88,7 +86,6 @@
         // TODO access control checks? exception to be thrown for illegal
         // access?
         processApple(params, redirector, app, wk);
-
     }
 
     protected AppleController instantiateController(String appleName, ServiceManager sitemapManager)
throws AppleNotFoundException {

Copied: cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/src/main/java/org/apache/cocoon/components/flow/apples/SpringApplesProcessor.java
(from r516667, cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/src/main/java/org/apache/cocoon/components/flow/apples/ServiceApplesProcessor.java)
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/src/main/java/org/apache/cocoon/components/flow/apples/SpringApplesProcessor.java?view=diff&rev=517434&p1=cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/src/main/java/org/apache/cocoon/components/flow/apples/ServiceApplesProcessor.java&r1=516667&p2=cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/src/main/java/org/apache/cocoon/components/flow/apples/SpringApplesProcessor.java&r2=517434
==============================================================================
--- cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/src/main/java/org/apache/cocoon/components/flow/apples/ServiceApplesProcessor.java
(original)
+++ cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/src/main/java/org/apache/cocoon/components/flow/apples/SpringApplesProcessor.java
Mon Mar 12 15:36:30 2007
@@ -16,30 +16,39 @@
  */
 package org.apache.cocoon.components.flow.apples;
 
-import org.apache.cocoon.ProcessingException;
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.avalon.framework.service.ServiceManager;
 
 /**
  * A special version of ApplesProcessor that interprets the parameter passed to
  * instantiateController as service/bean name instead of classname. The class is
  * probably most useful with spring container integration.
- *
- * Declare your flow in sitemap as &lt;map:flow language=&quot;service-apples&quot/&gt>
- * Define your AppleController beans in block/config/spring/ and call them from
- * sitemap by &lt;map:call function=&quot;beanName&quot/&gt>
- *
+ * 
+ * Declare your flow in sitemap as &lt;map:flow
+ * language=&quot;service-apples&quot/&gt> Define your AppleController beans
in
+ * block/config/spring/ and call them from sitemap by &lt;map:call
+ * function=&quot;beanName&quot/&gt>
+ * 
  * Please remember to declare your StatelessAppleControllers as singletons. If
  * you wish to use continuations beans have to be declared as non-singletons.
- *
+ * 
  * You are of course free to use any container features in your beans like
  * dependency injection.
- *
+ * 
  * @version $Id$
  */
-public class ServiceApplesProcessor extends ApplesProcessor {
-    protected AppleController instantiateController(String beanName) throws Exception {
-        Object bean = this.manager.lookup(beanName);
-        if (!(bean instanceof AppleController))
-            throw new ProcessingException("The bean called is not a AppleController");
-        return (AppleController) bean;
+public class SpringApplesProcessor extends ApplesProcessor {
+
+    protected AppleController instantiateController(String beanName, ServiceManager sitemapManager)
+            throws AppleNotFoundException {
+        try {
+            return (AppleController) sitemapManager.lookup(beanName);
+        } catch (ClassCastException e) {
+            throw new AppleNotFoundException("The bean '" + beanName
+                    + "' doesn't implement the AppleController interface.", e);
+        } catch (ServiceException e) {
+            throw new AppleNotFoundException("Can't find any bean of name '" + beanName +
"'.", e);
+        }
     }
+
 }

Modified: cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/src/main/resources/META-INF/cocoon/avalon/cocoon-apples.xconf
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/src/main/resources/META-INF/cocoon/avalon/cocoon-apples.xconf?view=diff&rev=517434&r1=517433&r2=517434
==============================================================================
--- cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/src/main/resources/META-INF/cocoon/avalon/cocoon-apples.xconf
(original)
+++ cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/src/main/resources/META-INF/cocoon/avalon/cocoon-apples.xconf
Mon Mar 12 15:36:30 2007
@@ -15,9 +15,7 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
-
 <!--+
-    |
     | SVN $Id$
     +-->
 <components>
@@ -27,8 +25,13 @@
       name="apples" logger="apples">
     </component-instance>
   	<component-instance 
-  		class="org.apache.cocoon.components.flow.apples.ServiceApplesProcessor" 
+  		class="org.apache.cocoon.components.flow.apples.SpringApplesProcessor" 
+  		name="spring-apples" logger="spring-apples">
+  	</component-instance>  	    
+    <!-- The name 'service-apples' has been deprecated -->
+  	<component-instance 
+  		class="org.apache.cocoon.components.flow.apples.SpringApplesProcessor" 
   		name="service-apples" logger="service-apples">
   	</component-instance>
   </flow-interpreters>
-</components>
+</components>
\ No newline at end of file



Mime
View raw message