cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lgaw...@apache.org
Subject svn commit: r440449 - in /cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/src/main: java/org/apache/cocoon/components/flow/apples/ServiceApplesProcessor.java resources/META-INF/legacy/xconf/cocoon-apples.xconf
Date Tue, 05 Sep 2006 19:28:20 GMT
Author: lgawron
Date: Tue Sep  5 12:28:19 2006
New Revision: 440449

URL: http://svn.apache.org/viewvc?view=rev&rev=440449
Log:
Service apples:

in applicationContext.xml:
<bean id="orderCreateApple" class="com.mobilebox.gemini.web.apples.OrderCreateApple">
  <property name="orderRequestParser" ref="orderRequestParserService"/>
  <property name="orderService" ref="orderService"/>
</bean>

in sitemap.xmap
<map:flow language="service-apples"/>
<.../>
<map:match pattern="orderCreate">
  <map:call function="orderCreateApple"/>
</map:match>

Added:
    cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/src/main/java/org/apache/cocoon/components/flow/apples/ServiceApplesProcessor.java
  (with props)
Modified:
    cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/src/main/resources/META-INF/legacy/xconf/cocoon-apples.xconf

Added: 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/ServiceApplesProcessor.java?view=auto&rev=440449
==============================================================================
--- cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/src/main/java/org/apache/cocoon/components/flow/apples/ServiceApplesProcessor.java
(added)
+++ cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/src/main/java/org/apache/cocoon/components/flow/apples/ServiceApplesProcessor.java
Tue Sep  5 12:28:19 2006
@@ -0,0 +1,49 @@
+/*
+ * $Id$
+ *
+ * Created on 2006-09-05
+ *
+ * Copyright (c) 2006, MobileBox sp. z o.o.
+ * All rights reserved.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.apache.cocoon.components.flow.apples;
+
+import org.apache.cocoon.ProcessingException;
+
+/**
+ * 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>
+ * 
+ * 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;
+    }
+}

Propchange: cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/src/main/java/org/apache/cocoon/components/flow/apples/ServiceApplesProcessor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/src/main/java/org/apache/cocoon/components/flow/apples/ServiceApplesProcessor.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/src/main/resources/META-INF/legacy/xconf/cocoon-apples.xconf
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/src/main/resources/META-INF/legacy/xconf/cocoon-apples.xconf?view=diff&rev=440449&r1=440448&r2=440449
==============================================================================
--- cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/src/main/resources/META-INF/legacy/xconf/cocoon-apples.xconf
(original)
+++ cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/src/main/resources/META-INF/legacy/xconf/cocoon-apples.xconf
Tue Sep  5 12:28:19 2006
@@ -25,5 +25,9 @@
       class="org.apache.cocoon.components.flow.apples.ApplesProcessor" 
       name="apples" logger="apples">
     </component-instance>
+  	<component-instance 
+  		class="org.apache.cocoon.components.flow.apples.ServiceApplesProcessor" 
+  		name="service-apples" logger="service-apples">
+  	</component-instance>
   </flow-interpreters>
 </components>



Mime
View raw message