cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thors...@apache.org
Subject svn commit: r1304459 - in /cocoon/cocoon3/trunk: cocoon-sample/src/main/java/org/apache/cocoon/sample/action/ cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/ cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/action/ cocoon-sitemap/src/main...
Date Fri, 23 Mar 2012 16:09:16 GMT
Author: thorsten
Date: Fri Mar 23 16:09:15 2012
New Revision: 1304459

URL: http://svn.apache.org/viewvc?rev=1304459&view=rev
Log:
COCOON3-94
Bring back old school way of actions back to c3. Although it is not 100% like we had in c2.x
since the body of an action ATM is ignore.

Modified:
    cocoon/cocoon3/trunk/cocoon-sample/src/main/java/org/apache/cocoon/sample/action/ErrorThrowingAction.java
    cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/Invocation.java
    cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/InvocationImpl.java
    cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/action/Action.java
    cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/node/ActNode.java

Modified: cocoon/cocoon3/trunk/cocoon-sample/src/main/java/org/apache/cocoon/sample/action/ErrorThrowingAction.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-sample/src/main/java/org/apache/cocoon/sample/action/ErrorThrowingAction.java?rev=1304459&r1=1304458&r2=1304459&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-sample/src/main/java/org/apache/cocoon/sample/action/ErrorThrowingAction.java
(original)
+++ cocoon/cocoon3/trunk/cocoon-sample/src/main/java/org/apache/cocoon/sample/action/ErrorThrowingAction.java
Fri Mar 23 16:09:15 2012
@@ -51,4 +51,10 @@ public class ErrorThrowingAction impleme
     public String toString() {
         return "ErrorThrowingAction";
     }
+
+    @Override
+    public void setConfiguration(Map<String, ? extends Object> configuration) {
+        // nothing to do
+        
+    }
 }

Modified: cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/Invocation.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/Invocation.java?rev=1304459&r1=1304458&r2=1304459&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/Invocation.java
(original)
+++ cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/Invocation.java
Fri Mar 23 16:09:15 2012
@@ -38,7 +38,7 @@ public interface Invocation {
 
     boolean hasCompletePipeline();
 
-    void installAction(String type);
+    void installAction(String type, Map<String, ? extends Object> parameters);
 
     void installComponent(String type, Map<String, ? extends Object> parameters);
 

Modified: cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/InvocationImpl.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/InvocationImpl.java?rev=1304459&r1=1304458&r2=1304459&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/InvocationImpl.java
(original)
+++ cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/InvocationImpl.java
Fri Mar 23 16:09:15 2012
@@ -213,12 +213,14 @@ public class InvocationImpl implements I
      *
      * @see org.apache.cocoon.sitemap.Invocation#installAction(java.lang.String)
      */
-    public void installAction(String type) {
+    public void installAction(String type, Map<String, ? extends Object> parameters)
{
         if (this.pipeline == null) {
             throw new IllegalStateException("Action cannot be installed without having a
pipeline.");
         }
 
         Action action = this.componentProvider.createAction(type);
+        Map<String, ? extends Object> resolvedParameters = this.resolveParameters(parameters);
+        action.setConfiguration(resolvedParameters);
         this.actions.add(action);
     }
 

Modified: cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/action/Action.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/action/Action.java?rev=1304459&r1=1304458&r2=1304459&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/action/Action.java
(original)
+++ cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/action/Action.java
Fri Mar 23 16:09:15 2012
@@ -23,6 +23,8 @@ import java.util.Map;
 
 public interface Action {
 
+    void setConfiguration(Map<String, ? extends Object> configuration);
+    
     void setup(Map<String, Object> parameters) throws Exception;
 
     void execute() throws Exception;

Modified: cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/node/ActNode.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/node/ActNode.java?rev=1304459&r1=1304458&r2=1304459&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/node/ActNode.java
(original)
+++ cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/node/ActNode.java
Fri Mar 23 16:09:15 2012
@@ -18,10 +18,14 @@
  */
 package org.apache.cocoon.sitemap.node;
 
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
 import org.apache.cocoon.sitemap.Invocation;
 import org.apache.cocoon.sitemap.node.annotations.Parameter;
 
-@Node(name="act")
+@Node(name = "act")
 public class ActNode extends AbstractSitemapNode {
 
     private static final String ACTION_CATEGORY = "action:";
@@ -29,9 +33,24 @@ public class ActNode extends AbstractSit
     @Parameter
     private String type;
 
+    @Parameter
+    private String src;
+
     @Override
     public InvocationResult invoke(Invocation invocation) {
-        invocation.installAction(ACTION_CATEGORY + this.type);
+        final Map<String, Object> invocationParams = new HashMap<String, Object>(
+                this.getParameters());
+        
+        if (null != this.src) {
+            final String resolveParameter = (String) invocation
+                    .resolveParameter(this.src);
+            if (null != resolveParameter ) {
+                final URL resolve = invocation.resolve(resolveParameter);
+                invocationParams.put("source", resolve);
+            }
+        }
+
+        invocation.installAction(ACTION_CATEGORY + this.type, invocationParams);
 
         // signal that we did some processing
         return InvocationResult.CONTINUE;



Mime
View raw message