continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r724730 - in /continuum/branches/continuum-distributed-builds: continuum-api/src/main/java/org/apache/continuum/builder/distributed/manager/ continuum-builder/ continuum-builder/src/main/java/org/apache/continuum/builder/distributed/manager...
Date Tue, 09 Dec 2008 15:00:43 GMT
Author: ctan
Date: Tue Dec  9 07:00:42 2008
New Revision: 724730

URL: http://svn.apache.org/viewvc?rev=724730&view=rev
Log:
added cancel distributed build

Removed:
    continuum/branches/continuum-distributed-builds/continuum-webapp/src/main/java/org/apache/continuum/web/action/admin/DistributedBuildAction.java
Modified:
    continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/continuum/builder/distributed/manager/DistributedBuildManager.java
    continuum/branches/continuum-distributed-builds/continuum-builder/   (props changed)
    continuum/branches/continuum-distributed-builds/continuum-builder/src/main/java/org/apache/continuum/builder/distributed/manager/DefaultDistributedBuildManager.java
    continuum/branches/continuum-distributed-builds/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/admin/QueuesAction.java
    continuum/branches/continuum-distributed-builds/continuum-webapp/src/main/resources/struts.xml
    continuum/branches/continuum-distributed-builds/continuum-webapp/src/main/webapp/WEB-INF/jsp/admin/viewDistributedBuilds.jsp

Modified: continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/continuum/builder/distributed/manager/DistributedBuildManager.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/continuum/builder/distributed/manager/DistributedBuildManager.java?rev=724730&r1=724729&r2=724730&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/continuum/builder/distributed/manager/DistributedBuildManager.java
(original)
+++ continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/continuum/builder/distributed/manager/DistributedBuildManager.java
Tue Dec  9 07:00:42 2008
@@ -11,7 +11,10 @@
 {
     void buildProjectsInQueue()
         throws ContinuumException;
-    
+
+    void cancelDistributedBuild( String buildAgentUrl, int projectId )
+        throws ContinuumException;
+
     void updateProjectScmRoot( Map context )
         throws ContinuumException;
 

Propchange: continuum/branches/continuum-distributed-builds/continuum-builder/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Dec  9 07:00:42 2008
@@ -0,0 +1,5 @@
+.settings
+build
+target
+.classpath
+.project

Modified: continuum/branches/continuum-distributed-builds/continuum-builder/src/main/java/org/apache/continuum/builder/distributed/manager/DefaultDistributedBuildManager.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-builder/src/main/java/org/apache/continuum/builder/distributed/manager/DefaultDistributedBuildManager.java?rev=724730&r1=724729&r2=724730&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-builder/src/main/java/org/apache/continuum/builder/distributed/manager/DefaultDistributedBuildManager.java
(original)
+++ continuum/branches/continuum-distributed-builds/continuum-builder/src/main/java/org/apache/continuum/builder/distributed/manager/DefaultDistributedBuildManager.java
Tue Dec  9 07:00:42 2008
@@ -7,6 +7,8 @@
 import java.util.List;
 import java.util.Map;
 
+import javax.security.auth.login.Configuration;
+
 import org.apache.continuum.builder.distributed.BuildAgentListener;
 import org.apache.continuum.builder.distributed.DefaultBuildAgentListener;
 import org.apache.continuum.configuration.BuildAgentConfiguration;
@@ -213,6 +215,28 @@
         }
     }
 
+    public void cancelDistributedBuild( String buildAgentUrl, int projectId )
+    {
+        for ( BuildAgentListener listener : listeners )
+        {
+            if ( listener.getUrl().equals( buildAgentUrl ) )
+            {
+                // connect to client and cancel build or remove from queue
+                // if successful, remove to listener
+                for ( Project project : listener.getProjects() )
+                {
+                    if ( project.getId() == projectId )
+                    {
+                        log.info( "cancelled build of project " + projectId );
+                        return;
+                    }
+                }
+            }
+        }
+
+        log.info( "unable to cancel project build" );
+    }
+
     public void updateProjectScmRoot( Map context )
         throws ContinuumException
     {

Modified: continuum/branches/continuum-distributed-builds/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/admin/QueuesAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/admin/QueuesAction.java?rev=724730&r1=724729&r2=724730&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/admin/QueuesAction.java
(original)
+++ continuum/branches/continuum-distributed-builds/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/admin/QueuesAction.java
Tue Dec  9 07:00:42 2008
@@ -98,6 +98,8 @@
 
     private String buildAgentUrl;
 
+    private List<Integer> selectedProjects;
+
     // -----------------------------------------------------
     //  webwork
     // -----------------------------------------------------     
@@ -275,6 +277,29 @@
         return SUCCESS;
     }
 
+    public String cancelDistributedBuild()
+        throws Exception
+    {
+        try 
+        {
+            checkManageQueuesAuthorization();
+        }
+        catch( AuthorizationRequiredException authzE )
+        {
+            addActionError( authzE.getMessage() );
+            return REQUIRES_AUTHORIZATION;
+        }
+        catch ( AuthenticationRequiredException e )
+        {
+            addActionError( e.getMessage() );
+            return REQUIRES_AUTHENTICATION;
+        }
+
+        distributedBuildManager.cancelDistributedBuild( buildAgentUrl, projectId );
+
+        return SUCCESS;
+    }
+
     private int[] listToIntArray( List<String> strings )
     {
         if ( strings == null || strings.isEmpty() )
@@ -423,5 +448,35 @@
     public void setSelectedCheckOutTaskHashCodes( List<String> selectedCheckOutTaskHashCodes
)
     {
         this.selectedCheckOutTaskHashCodes = selectedCheckOutTaskHashCodes;
-    }    
+    }
+
+    public List<DistributedBuildSummary> getDistributedBuildSummary()
+    {
+        return distributedBuildSummary;
+    }
+
+    public void setDistributedBuildSummary( List<DistributedBuildSummary> distributedBuildSummary
)
+    {
+        this.distributedBuildSummary = distributedBuildSummary;
+    }
+
+    public String getBuildAgentUrl()
+    {
+        return buildAgentUrl;
+    }
+
+    public void setBuildAgentUrl( String buildAgentUrl )
+    {
+        this.buildAgentUrl = buildAgentUrl;
+    }
+
+    public List<Integer> getSelectedProjects()
+    {
+        return selectedProjects;
+    }
+
+    public void setSelectedProjects( List<Integer> selectedProjects )
+    {
+        this.selectedProjects = selectedProjects;
+    }
 }

Modified: continuum/branches/continuum-distributed-builds/continuum-webapp/src/main/resources/struts.xml
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-webapp/src/main/resources/struts.xml?rev=724730&r1=724729&r2=724730&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-webapp/src/main/resources/struts.xml
(original)
+++ continuum/branches/continuum-distributed-builds/continuum-webapp/src/main/resources/struts.xml
Tue Dec  9 07:00:42 2008
@@ -754,6 +754,7 @@
     
     <action name="displayQueues" class="queues" method="display">
       <result name="success">/WEB-INF/jsp/admin/buildQueueView.jsp</result>
+      <result name="distributed-build-success">/WEB-INF/jsp/admin/viewDistributedBuilds.jsp</result>
     </action>
     
     <action name="removeBuildQueueEntry" class="queues" method="remove">
@@ -792,6 +793,12 @@
       </result>      
     </action>    
     
+    <action name="cancelDistributedBuild" class="queues" method="cancelDistributedBuild">
+      <result name="success" type="redirect-action">
+        <param name="actionName">displayQueues</param>
+      </result>
+    </action>
+    
     <!--
     * Local Repository actions
     -->

Modified: continuum/branches/continuum-distributed-builds/continuum-webapp/src/main/webapp/WEB-INF/jsp/admin/viewDistributedBuilds.jsp
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-webapp/src/main/webapp/WEB-INF/jsp/admin/viewDistributedBuilds.jsp?rev=724730&r1=724729&r2=724730&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-webapp/src/main/webapp/WEB-INF/jsp/admin/viewDistributedBuilds.jsp
(original)
+++ continuum/branches/continuum-distributed-builds/continuum-webapp/src/main/webapp/WEB-INF/jsp/admin/viewDistributedBuilds.jsp
Tue Dec  9 07:00:42 2008
@@ -20,6 +20,7 @@
 <%@ taglib uri="/struts-tags" prefix="s" %>
 <%@ taglib uri="http://www.extremecomponents.org" prefix="ec" %>
 <%@ taglib uri='http://java.sun.com/jsp/jstl/core' prefix='c'%>
+<%@ taglib uri="http://plexus.codehaus.org/redback/taglib-1.0" prefix="redback" %>
 
 <html>
   <s:i18n name="localization.Continuum">
@@ -36,26 +37,34 @@
             </s:iterator>
           </div>
         </c:if>
-        <s:set name="distributedBuilds" value="distributedBuilds" scope="request"/>
-        <ec:table items="distributedBuilds"
-                  var="distributedBuild"
-                  showExports="false"
-                  showPagination="false"
-                  showStatusBar="false"
-                  sortable="false"
-                  filterable="false">
-          <ec:row>
-            <ec:column property="projectName" title="distributedBuild.table.project"/>
-            <ec:column property="url" title="distributedBuild.table.agentUrl"/>
-            <ec:column property="cancelEntry" title="&nbsp;" width="1%">
-              <s:url id="cancelUrl" action="cancelDistributedBuildProject" method="cancel"
namespace="/">
-                <s:param name="projectId">${pageScope.distributedBuild.projectId}</s:param>
-                <s:param name="buildAgentUrl">${pageScope.distributedBuild.url}</s:param>
-              </s:url>
-              <s:a href="%{cancelUrl}"><img src="<s:url value='/images/cancelbuild.gif'
includeParams="none"/>" alt="<s:text name='cancel'/>" title="<s:text name='cancel'/>"
border="0"></s:a>
-            </ec:column>
-          </ec:row>
-        </ec:table>
+        <c:if test="${not empty distributedBuilds}">
+          <s:set name="distributedBuilds" value="distributedBuilds" scope="request"/>
+          <ec:table items="distributedBuilds"
+                    var="distributedBuild"
+                    showExports="false"
+                    showPagination="false"
+                    showStatusBar="false"
+                    sortable="false"
+                    filterable="false">
+            <ec:row>
+              <ec:column property="projectName" title="distributedBuild.table.project"/>
+              <ec:column property="url" title="distributedBuild.table.agentUrl"/>
+              <ec:column property="cancelEntry" title="&nbsp;" width="1%">
+                <s:url id="cancelUrl" action="cancelDistributedBuild" method="cancelDistributedBuild"
namespace="/">
+                  <s:param name="projectId">${pageScope.distributedBuild.projectId}</s:param>
+                  <s:param name="buildAgentUrl">${pageScope.distributedBuild.url}</s:param>
+                </s:url>
+                <s:a href="%{cancelUrl}"><img src="<s:url value='/images/cancelbuild.gif'
includeParams="none"/>" alt="<s:text name='cancel'/>" title="<s:text name='cancel'/>"
border="0"></s:a>
+              </ec:column>
+            </ec:row>
+          </ec:table>
+        </c:if>
+        <c:if test="${empty distributedBuilds}">
+          <s:text name="distributedBuilds.empty"/>
+        </c:if>
+      </div>
+      <div id="h3">
+      
       </div>
     </body>
   </s:i18n>



Mime
View raw message