continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jvan...@apache.org
Subject svn commit: r161820 - in maven/continuum/trunk/continuum-web/src/main: java/org/codehaus/continuum/web/action/Call.java java/org/codehaus/continuum/web/action/CallApplicationModel.java resources/META-INF/plexus/components.xml resources/forms/continuumProject.xml
Date Tue, 19 Apr 2005 01:07:56 GMT
Author: jvanzyl
Date: Mon Apr 18 18:07:53 2005
New Revision: 161820

URL: http://svn.apache.org/viewcvs?view=rev&rev=161820
Log:
o create an action that can make arbitrary calls into the application model.
  the action is configured with the role of the application model and a series
  of calls. each call has an id (cid) and an expression to use when calling
  the application model. so you just need to specify the cid in the webapp
  and the expression will be looked up and executed using the request
  parameters.
  
  So i can do something like 
  
  http://...?action=cam&cid=buildProject
  
  and 
  
  continuum.buildProject(#id)
  
  will be executed.
  
  No java code required!
  

Added:
    maven/continuum/trunk/continuum-web/src/main/java/org/codehaus/continuum/web/action/Call.java
    maven/continuum/trunk/continuum-web/src/main/java/org/codehaus/continuum/web/action/CallApplicationModel.java
Modified:
    maven/continuum/trunk/continuum-web/src/main/resources/META-INF/plexus/components.xml
    maven/continuum/trunk/continuum-web/src/main/resources/forms/continuumProject.xml

Added: maven/continuum/trunk/continuum-web/src/main/java/org/codehaus/continuum/web/action/Call.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-web/src/main/java/org/codehaus/continuum/web/action/Call.java?view=auto&rev=161820
==============================================================================
--- maven/continuum/trunk/continuum-web/src/main/java/org/codehaus/continuum/web/action/Call.java
(added)
+++ maven/continuum/trunk/continuum-web/src/main/java/org/codehaus/continuum/web/action/Call.java
Mon Apr 18 18:07:53 2005
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2005 Your Corporation. All Rights Reserved.
+ */
+package org.codehaus.continuum.web.action;
+
+/**
+ * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
+ * @version $Id:$
+ */
+public class Call
+{
+    private String cid;
+
+    private String expression;
+
+    public String getCid()
+    {
+        return cid;
+    }
+
+    public String getExpression()
+    {
+        return expression;
+    }
+}

Added: maven/continuum/trunk/continuum-web/src/main/java/org/codehaus/continuum/web/action/CallApplicationModel.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-web/src/main/java/org/codehaus/continuum/web/action/CallApplicationModel.java?view=auto&rev=161820
==============================================================================
--- maven/continuum/trunk/continuum-web/src/main/java/org/codehaus/continuum/web/action/CallApplicationModel.java
(added)
+++ maven/continuum/trunk/continuum-web/src/main/java/org/codehaus/continuum/web/action/CallApplicationModel.java
Mon Apr 18 18:07:53 2005
@@ -0,0 +1,65 @@
+package org.codehaus.continuum.web.action;
+
+import org.codehaus.plexus.summit.rundata.RunData;
+import org.codehaus.plexus.action.AbstractAction;
+import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable;
+import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
+
+import java.util.Map;
+import java.util.List;
+import java.util.Iterator;
+import java.util.HashMap;
+
+import ognl.Ognl;
+
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
+ * @version $Id: Login.java,v 1.1 2005/04/01 00:11:34 jvanzyl Exp $
+ */
+public class CallApplicationModel
+    extends AbstractAction
+    implements Initializable
+{
+    private static String CID = "cid";
+
+    private String applicationRole;
+
+    private List calls;
+
+    private Map callMap;
+
+    public void execute( Map parameters )
+        throws Exception
+    {
+        Object application = lookup( applicationRole );
+
+        System.out.println( "application = " + application );
+
+        String cid = (String) parameters.get( CID );
+
+        Call call = (Call) callMap.get( cid );
+
+        String expression = call.getExpression();
+
+        System.out.println( "expression = " + expression );
+
+        Ognl.getValue( expression, parameters, application );
+    }
+
+    // ----------------------------------------------------------------------
+    // Lifecylce Management
+    // ----------------------------------------------------------------------
+
+    public void initialize()
+        throws Exception
+    {
+        callMap = new HashMap();
+
+        for ( Iterator i = calls.iterator(); i.hasNext(); )
+        {
+            Call call = (Call) i.next();
+
+            callMap.put( call.getCid(), call );
+        }
+    }
+}

Modified: maven/continuum/trunk/continuum-web/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-web/src/main/resources/META-INF/plexus/components.xml?view=diff&r1=161819&r2=161820
==============================================================================
--- maven/continuum/trunk/continuum-web/src/main/resources/META-INF/plexus/components.xml
(original)
+++ maven/continuum/trunk/continuum-web/src/main/resources/META-INF/plexus/components.xml
Mon Apr 18 18:07:53 2005
@@ -168,6 +168,21 @@
       <implementation>org.apache.maven.continuum.web.action.Login</implementation>
     </component>
 
+    <component>
+      <role>org.codehaus.plexus.action.Action</role>
+      <role-hint>cam</role-hint>
+      <implementation>org.codehaus.continuum.web.action.CallApplicationModel</implementation>
+      <configuration>
+        <application-role>org.apache.maven.continuum.Continuum</application-role>
+        <calls>
+          <call>
+            <cid>buildProject</cid>
+            <expression>buildProject(#id)</expression>
+          </call>
+        </calls>
+      </configuration>
+    </component>
+
     <!--
      |
      | Validators

Modified: maven/continuum/trunk/continuum-web/src/main/resources/forms/continuumProject.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-web/src/main/resources/forms/continuumProject.xml?view=diff&r1=161819&r2=161820
==============================================================================
--- maven/continuum/trunk/continuum-web/src/main/resources/forms/continuumProject.xml (original)
+++ maven/continuum/trunk/continuum-web/src/main/resources/forms/continuumProject.xml Mon
Apr 18 18:07:53 2005
@@ -60,6 +60,9 @@
   </delete>
 
   <!-- Summary -->
+
+  <!-- TODO: the headings here need to be i18n -->
+
   <summary>
     <title-key>title.key</title-key>
     <summary-elements>
@@ -69,14 +72,13 @@
       <summary-element>
         <id>project.name</id>
       </summary-element>
-      <!--
-      <summary-element>
-        <id>project.type</id>
-      </summary-element>
-      -->
     </summary-elements>
     <operations>
       <operation>
+        <name>Build</name>
+        <action>target/continuumProject.form?mode=summary&amp;action=cam&amp;cid=buildProject&amp;id=$id$</action>
+      </operation>
+      <operation>
         <name>Builds</name>
         <action>target/ProjectBuilds.vm?view=ProjectBuilds&amp;id=$id$</action>
       </operation>
@@ -85,7 +87,7 @@
         <action>target/$type$Project.form?mode=view&amp;id=$id$</action>
       </operation>
       <operation>
-        <name>Details</name>
+        <name>Edit</name>
         <action>target/$type$Project.form?mode=update&amp;id=$id$</action>
       </operation>
       <operation>



Mime
View raw message