continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r344177 - in /maven/continuum/trunk: continuum-api/src/main/java/org/apache/maven/continuum/ continuum-core/src/main/java/org/apache/maven/continuum/ continuum-core/src/main/resources/META-INF/plexus/ continuum-web/src/main/resources/templa...
Date Mon, 14 Nov 2005 18:32:36 GMT
Author: evenisse
Date: Mon Nov 14 10:32:23 2005
New Revision: 344177

URL: http://svn.apache.org/viewcvs?rev=344177&view=rev
Log:
Don't add link 'Build Now' if project is in checkout queue.

Modified:
    maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
    maven/continuum/trunk/continuum-core/src/main/resources/META-INF/plexus/components.xml
    maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/Summary.vm

Modified: maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java?rev=344177&r1=344176&r2=344177&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
(original)
+++ maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
Mon Nov 14 10:32:23 2005
@@ -73,6 +73,8 @@
     boolean isInBuildingQueue( int projectId )
         throws ContinuumException;
 
+    boolean isInCheckoutQueue( int projectId )
+        throws ContinuumException;
     // ----------------------------------------------------------------------
     // Building
     // ----------------------------------------------------------------------

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java?rev=344177&r1=344176&r2=344177&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
Mon Nov 14 10:32:23 2005
@@ -41,6 +41,7 @@
 import org.apache.maven.continuum.project.builder.ContinuumProjectBuildingResult;
 import org.apache.maven.continuum.project.builder.maven.MavenOneContinuumProjectBuilder;
 import org.apache.maven.continuum.project.builder.maven.MavenTwoContinuumProjectBuilder;
+import org.apache.maven.continuum.scm.queue.CheckOutTask;
 import org.apache.maven.continuum.security.ContinuumSecurity;
 import org.apache.maven.continuum.store.ContinuumObjectNotFoundException;
 import org.apache.maven.continuum.store.ContinuumStore;
@@ -123,6 +124,11 @@
     private TaskQueue buildQueue;
 
     /**
+     * @plexus.requirement
+     */
+    private TaskQueue checkoutQueue;
+
+    /**
      * @plexus.configuration
      */
     private String workingDirectory;
@@ -203,12 +209,39 @@
         }
         catch ( TaskQueueException e )
         {
-            throw new ContinuumException( "Error while getting the queue snapshot.", e );
+            throw new ContinuumException( "Error while getting the building queue.", e );
         }
 
         for ( Iterator it = queue.iterator(); it.hasNext(); )
         {
             BuildProjectTask task = (BuildProjectTask) it.next();
+
+            if ( task.getProjectId() == projectId )
+            {
+                return true;
+            }
+        }
+
+        return false;
+    }
+
+    public boolean isInCheckoutQueue( int projectId )
+        throws ContinuumException
+    {
+        List queue;
+
+        try
+        {
+            queue = checkoutQueue.getQueueSnapshot();
+        }
+        catch ( TaskQueueException e )
+        {
+            throw new ContinuumException( "Error while getting the checkout queue.", e );
+        }
+
+        for ( Iterator it = queue.iterator(); it.hasNext(); )
+        {
+            CheckOutTask task = (CheckOutTask) it.next();
 
             if ( task.getProjectId() == projectId )
             {

Modified: maven/continuum/trunk/continuum-core/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/resources/META-INF/plexus/components.xml?rev=344177&r1=344176&r2=344177&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/resources/META-INF/plexus/components.xml
(original)
+++ maven/continuum/trunk/continuum-core/src/main/resources/META-INF/plexus/components.xml
Mon Nov 14 10:32:23 2005
@@ -29,6 +29,11 @@
           <field-name>buildQueue</field-name>
         </requirement>
         <requirement>
+          <role>org.codehaus.plexus.taskqueue.TaskQueue</role>
+          <role-hint>check-out-project</role-hint>
+          <field-name>checkoutQueue</field-name>
+        </requirement>
+        <requirement>
           <role>org.apache.maven.continuum.utils.WorkingDirectoryService</role>
         </requirement>
       </requirements>

Modified: maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/Summary.vm
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/Summary.vm?rev=344177&r1=344176&r2=344177&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/Summary.vm (original)
+++ maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/Summary.vm Mon
Nov 14 10:32:23 2005
@@ -62,7 +62,7 @@
         <td><a href="$link.setPage('View.vm').addPathInfo('fid', "$!{item.executorId}Project").addPathInfo('id',
$item.id)">$!item.name</a></td>
         <td>$!item.version</td>
         <td>
-          #if ( $continuum.isInBuildingQueue( $item.id ) )
+          #if ( $continuum.isInBuildingQueue( $item.id ) || $continuum.isInCheckoutQueue(
$item.id ) )
             <b>In&nbsp;queue</b>
           #elseif ( $item.state == 1 || $item.state == 2 || $item.state == 3 || $item.state
== 4 )
             #if ( $item.buildNumber != 0 )
@@ -80,7 +80,7 @@
         ## Operations
 
         #if ( $continuum.security.isAuthorized( $c1user, "buildProject" ) )
-          #if ( $continuum.isInBuildingQueue( $item.id ) )
+          #if ( $continuum.isInBuildingQueue( $item.id ) || $continuum.isInCheckoutQueue(
$item.id ) )
           <td>Build</td>
           #elseif ( $item.state == 1 || $item.state == 2 || $item.state == 3 || $item.state
== 4 )
           <td><a href="$link.addPathInfo('action', 'cam').addPathInfo('cid','buildProject').addPathInfo('id',
$item.id)">Build&nbsp;Now</a></td>



Mime
View raw message