continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From och...@apache.org
Subject svn commit: r727315 - in /continuum/branches/continuum-parallel-builds: continuum-core/src/main/java/org/apache/continuum/buildmanager/ continuum-core/src/main/java/org/apache/continuum/taskqueueexecutor/ continuum-core/src/main/java/org/apache/maven/c...
Date Wed, 17 Dec 2008 08:43:54 GMT
Author: oching
Date: Wed Dec 17 00:43:54 2008
New Revision: 727315

URL: http://svn.apache.org/viewvc?rev=727315&view=rev
Log:
additional fixes for parallel builds impl

Modified:
    continuum/branches/continuum-parallel-builds/continuum-core/src/main/java/org/apache/continuum/buildmanager/ParallelBuildsManager.java
    continuum/branches/continuum-parallel-builds/continuum-core/src/main/java/org/apache/continuum/taskqueueexecutor/ParallelBuildsThreadedTaskQueueExecutor.java
    continuum/branches/continuum-parallel-builds/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java
    continuum/branches/continuum-parallel-builds/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CreateBuildProjectTaskAction.java
    continuum/branches/continuum-parallel-builds/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/CheckOutTaskExecutor.java
    continuum/branches/continuum-parallel-builds/continuum-core/src/main/resources/META-INF/plexus/components.xml
    continuum/branches/continuum-parallel-builds/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ScheduleAction.java
    continuum/branches/continuum-parallel-builds/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/admin/QueuesAction.java

Modified: continuum/branches/continuum-parallel-builds/continuum-core/src/main/java/org/apache/continuum/buildmanager/ParallelBuildsManager.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-parallel-builds/continuum-core/src/main/java/org/apache/continuum/buildmanager/ParallelBuildsManager.java?rev=727315&r1=727314&r2=727315&view=diff
==============================================================================
--- continuum/branches/continuum-parallel-builds/continuum-core/src/main/java/org/apache/continuum/buildmanager/ParallelBuildsManager.java
(original)
+++ continuum/branches/continuum-parallel-builds/continuum-core/src/main/java/org/apache/continuum/buildmanager/ParallelBuildsManager.java
Wed Dec 17 00:43:54 2008
@@ -107,6 +107,11 @@
                 e.getMessage() );
         }
 
+        List<BuildQueue> buildQueues = buildDefinition.getSchedule().getBuildQueues();
+        for( BuildQueue buildQueue : buildQueues )
+        {
+            log.info( "[Build Project]++++++build queue : " + buildQueue.getId() + " - "
+ buildQueue.getName() );
+        }
         OverallBuildQueue overallBuildQueue =
             getOverallBuildQueue( projectId, BUILD_QUEUE, buildDefinition.getSchedule().getBuildQueues()
);
 
@@ -120,7 +125,8 @@
             new BuildProjectTask( projectId, buildDefinition.getId(), trigger, projectName,
buildDefinitionLabel );
         try
         {
-            log.info( "Queueing project '" + projectId + "' in build queue '" + overallBuildQueue.getName()
+ "'");
+            log.info( "++++++[Build] Project '" + projectName + "' added to overall build
queue '" + overallBuildQueue.getName() +
+                "'." );
             overallBuildQueue.addToBuildQueue( buildTask );
         }
         catch ( TaskQueueException e )
@@ -155,18 +161,26 @@
         if ( firstProjectId != 0 )
         {
             BuildDefinition buildDef = projectsBuildDefinitionsMap.get( firstProjectId );
+            List<BuildQueue> buildQueues = buildDef.getSchedule().getBuildQueues();
+            for( BuildQueue buildQueue : buildQueues )
+            {
+                log.info( "[Build Projects]++++++BUILD QUEUE from projectsBuildDefinitionsMap
: " + 
+                          buildQueue.getId() + " - " + buildQueue.getName() );
+            }
+            
             OverallBuildQueue overallBuildQueue =
                 getOverallBuildQueue( firstProjectId, BUILD_QUEUE, buildDef.getSchedule().getBuildQueues()
);
-            ;
 
             if ( overallBuildQueue != null )
-            {
+            {                
                 for ( Project project : projects )
                 {
                     try
                     {
-                        if ( isInQueue( project.getId(), BUILD_QUEUE, -1 ) )
+                        if ( isInQueue( project.getId(), BUILD_QUEUE, projectsBuildDefinitionsMap.get(
project.getId() ).getId() ) )
                         {
+                            log.warn( "Project '" + project.getId() + "' - '" + project.getName()
+
+                                "' is already in build queue." );
                             continue;
                         }
                     }
@@ -190,6 +204,9 @@
 
                     try
                     {
+                        log.info( "++++++[Build Projects] Project '" + project.getId() +
"' - '" + project.getName() +
+                            "' added to overall build queue '" + overallBuildQueue.getName()
+ "'." );
+                        
                         overallBuildQueue.addToBuildQueue( buildTask );
                     }
                     catch ( TaskQueueException e )
@@ -320,11 +337,19 @@
 
         OverallBuildQueue overallBuildQueue =
             getOverallBuildQueue( projectId, CHECKOUT_QUEUE, defaultBuildDefinition.getSchedule().getBuildQueues()
);
-
+        
+        List<BuildQueue> buildQueues = defaultBuildDefinition.getSchedule().getBuildQueues();
+        for( BuildQueue buildQueue : buildQueues )
+        {
+            log.info( "++++++build queue : " + buildQueue.getId() + " - " + buildQueue.getName()
);
+        }
+        
         CheckOutTask checkoutTask =
             new CheckOutTask( projectId, workingDirectory, projectName, scmUsername, scmPassword
);
         try
         {
+            log.info( "++++++[Checkout] Project '" + projectName + "' added to overall build
queue '" + overallBuildQueue.getName() +
+                "'." );
             overallBuildQueue.addToCheckoutQueue( checkoutTask );
         }
         catch ( TaskQueueException e )
@@ -911,8 +936,7 @@
             try
             {   
                 for ( BuildQueue buildQueue : buildQueues )
-                {
-                    log.info( "BUILD QUEUE : " + buildQueue.getId() + " : " + buildQueue.getName()
);                    
+                {                                        
                     OverallBuildQueue overallBuildQueue = overallBuildQueues.get( buildQueue.getId()
);
                     if ( overallBuildQueue != null )
                     {
@@ -926,8 +950,6 @@
                             taskQueue = overallBuildQueue.getCheckoutQueue();
                         }
                         
-                        log.info( "SIZE OF TASK QUEUE :: " + taskQueue.getQueueSnapshot().size()
);
-
                         if ( idx == 0 )
                         {
                             size = taskQueue.getQueueSnapshot().size();
@@ -960,8 +982,6 @@
             for( Integer key : keySet )
             {
                 OverallBuildQueue overallBuildQueue = overallBuildQueues.get( key );
-                log.info( "OVERALLBUILD QUEUE :: " + overallBuildQueue.getId() + " : "
-                          + overallBuildQueue.getName() );
                 if( overallBuildQueue.getName().equals( ConfigurationService.DEFAULT_BUILD_QUEUE_NAME
) )
                 {
                     return overallBuildQueue;
@@ -993,7 +1013,6 @@
                     (OverallBuildQueue) container.lookup( OverallBuildQueue.class );
                 defaultOverallBuildQueue.setId( defaultBuildQueue.getId() );
                 defaultOverallBuildQueue.setName( defaultBuildQueue.getName() );
-                //defaultOverallBuildQueue.setContainer( container );
 
                 overallBuildQueues.put( defaultOverallBuildQueue.getId(), defaultOverallBuildQueue
);
             }

Modified: continuum/branches/continuum-parallel-builds/continuum-core/src/main/java/org/apache/continuum/taskqueueexecutor/ParallelBuildsThreadedTaskQueueExecutor.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-parallel-builds/continuum-core/src/main/java/org/apache/continuum/taskqueueexecutor/ParallelBuildsThreadedTaskQueueExecutor.java?rev=727315&r1=727314&r2=727315&view=diff
==============================================================================
--- continuum/branches/continuum-parallel-builds/continuum-core/src/main/java/org/apache/continuum/taskqueueexecutor/ParallelBuildsThreadedTaskQueueExecutor.java
(original)
+++ continuum/branches/continuum-parallel-builds/continuum-core/src/main/java/org/apache/continuum/taskqueueexecutor/ParallelBuildsThreadedTaskQueueExecutor.java
Wed Dec 17 00:43:54 2008
@@ -282,7 +282,8 @@
     {
         log.info( "Starting task executor, thread name '" + name + "'." );
 
-        this.executorService = Executors.newSingleThreadExecutor();
+        //this.executorService = Executors.newSingleThreadExecutor();
+        this.executorService = Executors.newCachedThreadPool();
 
         executorRunnable = new ExecutorRunnable();
 

Modified: continuum/branches/continuum-parallel-builds/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-parallel-builds/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java?rev=727315&r1=727314&r2=727315&view=diff
==============================================================================
--- continuum/branches/continuum-parallel-builds/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java
(original)
+++ continuum/branches/continuum-parallel-builds/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java
Wed Dec 17 00:43:54 2008
@@ -57,6 +57,7 @@
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
  * @version $Id$
  * @plexus.component role="org.apache.maven.continuum.buildcontroller.BuildController" role-hint="default"
+ *      instantiation-strategy="per-lookup"
  */
 public class DefaultBuildController
     extends AbstractLogEnabled

Modified: continuum/branches/continuum-parallel-builds/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CreateBuildProjectTaskAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-parallel-builds/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CreateBuildProjectTaskAction.java?rev=727315&r1=727314&r2=727315&view=diff
==============================================================================
--- continuum/branches/continuum-parallel-builds/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CreateBuildProjectTaskAction.java
(original)
+++ continuum/branches/continuum-parallel-builds/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CreateBuildProjectTaskAction.java
Wed Dec 17 00:43:54 2008
@@ -28,6 +28,7 @@
 import org.apache.maven.continuum.execution.ContinuumBuildExecutor;
 import org.apache.maven.continuum.execution.manager.BuildExecutorManager;
 import org.apache.maven.continuum.model.project.BuildDefinition;
+import org.apache.maven.continuum.model.project.BuildQueue;
 import org.apache.maven.continuum.model.project.Project;
 import org.apache.maven.continuum.project.ContinuumProjectState;
 import org.apache.maven.continuum.store.ContinuumStoreException;
@@ -64,10 +65,19 @@
         List<Project> projectsToBeBuilt = new ArrayList<Project>();
         int trigger = AbstractContinuumAction.getTrigger( context );
         
+        getLogger().info( "\n--------- create build project tasks action ---------" );
+        
         // update state of each project first
         for( Project project : projects )
         {
+            getLogger().info( "##### project : " + project.getId() + " - " + project.getName()
);
             BuildDefinition buildDefinition = projectsBuildDefinitionsMap.get( project.getId()
);
+            List<BuildQueue> buildQueues = buildDefinition.getSchedule().getBuildQueues();
+            for( BuildQueue buildQueue : buildQueues )
+            {
+                getLogger().info( "##### build queue : " + buildQueue.getId() + " - " + buildQueue.getName()
);
+            }
+
             if ( parallelBuildsManager.isInAnyBuildQueue( project.getId(), buildDefinition.getId()
) )
             {
                 return;

Modified: continuum/branches/continuum-parallel-builds/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/CheckOutTaskExecutor.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-parallel-builds/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/CheckOutTaskExecutor.java?rev=727315&r1=727314&r2=727315&view=diff
==============================================================================
--- continuum/branches/continuum-parallel-builds/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/CheckOutTaskExecutor.java
(original)
+++ continuum/branches/continuum-parallel-builds/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/CheckOutTaskExecutor.java
Wed Dec 17 00:43:54 2008
@@ -36,7 +36,7 @@
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
  * @version $Id$
  * @plexus.component role="org.codehaus.plexus.taskqueue.execution.TaskExecutor"
- * role-hint="check-out-project"
+ * role-hint="check-out-project" instantiation-strategy="per-lookup"
  */
 public class CheckOutTaskExecutor
     extends AbstractLogEnabled
@@ -59,6 +59,8 @@
     public void executeTask( Task t )
         throws TaskExecutionException
     {
+        getLogger().info( "Checkout task executor.." );
+        
         CheckOutTask task = (CheckOutTask) t;
 
         int projectId = task.getProjectId();

Modified: continuum/branches/continuum-parallel-builds/continuum-core/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-parallel-builds/continuum-core/src/main/resources/META-INF/plexus/components.xml?rev=727315&r1=727314&r2=727315&view=diff
==============================================================================
--- continuum/branches/continuum-parallel-builds/continuum-core/src/main/resources/META-INF/plexus/components.xml
(original)
+++ continuum/branches/continuum-parallel-builds/continuum-core/src/main/resources/META-INF/plexus/components.xml
Wed Dec 17 00:43:54 2008
@@ -63,9 +63,11 @@
         <requirement>
           <role>org.apache.maven.continuum.buildcontroller.BuildController</role>
         </requirement>
+        <!-- 
         <requirement>
           <role>org.apache.continuum.taskqueue.manager.TaskQueueManager</role>
         </requirement>
+         -->
       </requirements>
     </component>
 

Modified: continuum/branches/continuum-parallel-builds/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ScheduleAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-parallel-builds/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ScheduleAction.java?rev=727315&r1=727314&r2=727315&view=diff
==============================================================================
--- continuum/branches/continuum-parallel-builds/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ScheduleAction.java
(original)
+++ continuum/branches/continuum-parallel-builds/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ScheduleAction.java
Wed Dec 17 00:43:54 2008
@@ -22,19 +22,16 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
-import java.util.Iterator;
 import java.util.List;
 
 import org.apache.continuum.dao.BuildQueueDao;
 
 import org.apache.maven.continuum.ContinuumException;
-import org.apache.maven.continuum.model.project.BuildDefinition;
 import org.apache.maven.continuum.model.project.BuildQueue;
 import org.apache.maven.continuum.model.project.Schedule;
 import org.apache.maven.continuum.store.ContinuumStoreException;
 import org.apache.maven.continuum.web.exception.AuthenticationRequiredException;
 import org.apache.maven.continuum.web.exception.AuthorizationRequiredException;
-import org.apache.maven.model.Build;
 
 import com.opensymphony.xwork2.Preparable;
 
@@ -162,8 +159,7 @@
             description = schedule.getDescription();
             name = schedule.getName();
             delay = schedule.getDelay();
-            maxJobExecutionTime = schedule.getMaxJobExecutionTime();
-
+            maxJobExecutionTime = schedule.getMaxJobExecutionTime();            
         }
         else
         {
@@ -222,8 +218,28 @@
         schedule.setDescription( description );
         schedule.setName( name );
         schedule.setMaxJobExecutionTime( maxJobExecutionTime );
-
-        schedule.setBuildQueues( getBuildQueuesFromSelectedBuildQueues() );
+                
+        // remove old build queues
+        /*List<BuildQueue> existingBuildQueues = schedule.getBuildQueues();
+        for( BuildQueue buildQueue : existingBuildQueues )
+        {
+            schedule.removeBuildQueue( buildQueue );
+        }
+        */
+        for ( String buildQueueId : buildQueueIds )
+        {   
+            try
+            {
+                BuildQueue buildQueue = buildQueueDao.getBuildQueueByName( buildQueueId )
;
+                schedule.addBuildQueue( buildQueue );
+            }
+            catch ( ContinuumStoreException e)
+            {
+                addActionError( e.getMessage() );
+            }
+        }
+        
+        //schedule.setBuildQueues( getBuildQueuesFromSelectedBuildQueues() );
 
         return schedule;
     }
@@ -295,17 +311,18 @@
     }
     
     private List<BuildQueue> getBuildQueuesFromSelectedBuildQueues()
-    {
+    {   
         if ( this.buildQueueIds == null )
         {
             return Collections.EMPTY_LIST;
         }
-        List<BuildQueue> selectedBuildQueue = new ArrayList<BuildQueue>();
+     
+        List<BuildQueue> selectedBuildQueue = new ArrayList<BuildQueue>();  
     
         for ( String buildQueueId : buildQueueIds )
-        {
+        {  
         	try
         	{
-        	    BuildQueue buildQueue = buildQueueDao.getBuildQueueByName( buildQueueId ) ;

+        	    BuildQueue buildQueue = buildQueueDao.getBuildQueueByName( buildQueueId ) ;
         	}
         	catch ( ContinuumStoreException e)
         	{

Modified: continuum/branches/continuum-parallel-builds/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/admin/QueuesAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-parallel-builds/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/admin/QueuesAction.java?rev=727315&r1=727314&r2=727315&view=diff
==============================================================================
--- continuum/branches/continuum-parallel-builds/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/admin/QueuesAction.java
(original)
+++ continuum/branches/continuum-parallel-builds/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/admin/QueuesAction.java
Wed Dec 17 00:43:54 2008
@@ -26,8 +26,7 @@
 import java.util.Set;
 
 import org.apache.commons.lang.ArrayUtils;
-import org.apache.continuum.buildmanager.BuildsManager;
-import org.apache.continuum.taskqueue.manager.TaskQueueManager;
+import org.apache.continuum.buildmanager.BuildManagerException;
 import org.apache.maven.continuum.buildqueue.BuildProjectTask;
 import org.apache.maven.continuum.model.project.Project;
 import org.apache.maven.continuum.scm.queue.CheckOutTask;
@@ -37,7 +36,6 @@
 import org.codehaus.plexus.logging.LogEnabled;
 import org.codehaus.plexus.redback.rbac.Resource;
 import org.codehaus.plexus.taskqueue.Task;
-import org.codehaus.plexus.taskqueue.execution.TaskQueueExecutor;
 import org.codehaus.redback.integration.interceptor.SecureAction;
 import org.codehaus.redback.integration.interceptor.SecureActionBundle;
 import org.codehaus.redback.integration.interceptor.SecureActionException;
@@ -52,24 +50,15 @@
     extends AbstractBuildQueueAction
     implements SecureAction, LogEnabled
 {    
-    /**
-     * @plexus.requirement role-hint='build-project'
-     */
-    private TaskQueueExecutor taskQueueExecutor;    
-    
     private BuildProjectTask currentBuildProjectTask;
     
     private List<BuildProjectTask> buildProjectTasks;
     
     private List<String> selectedBuildTaskHashCodes;
-    
-    /**
-     * @plexus.requirement role-hint='check-out-project'
-     */    
-    private TaskQueueExecutor checkoutTaskQueueExecutor; 
-    
+        
     private CheckOutTask currentCheckOutTask;
     
+    // retain! can be used for parallel builds
     private List<CheckOutTask> currentCheckOutTasks;
     
     private List<String> selectedCheckOutTaskHashCodes;
@@ -85,15 +74,8 @@
     /**
      * @plexus.requirement
      */
-    private TaskQueueManager taskQueueManager;
-    
- // TODO: deng parallel builds
-    
-    /**
-     * @plexus.requirement role-hint="parallel"
-     */
-    private BuildsManager parallelBuildsManager;
-    
+    //private TaskQueueManager taskQueueManager;
+        
     private List<BuildProjectTask> currentBuildProjectTasks = new ArrayList<BuildProjectTask>();
     
     private Map<String, List<BuildProjectTask>> buildsInQueue = new HashMap<String,
List<BuildProjectTask>>();
@@ -106,7 +88,7 @@
 
     public String cancelCurrent()
         throws Exception
-    {
+    {        
         try 
         {
             checkManageQueuesAuthorization();
@@ -144,7 +126,7 @@
             return REQUIRES_AUTHENTICATION;
         }
          
-        parallelBuildsManager.removeProjectFromCheckoutQueue( projectId );
+        getContinuum().getBuildsManager().removeProjectFromCheckoutQueue( projectId );
         //taskQueueManager.removeProjectFromCheckoutQueue( projectId );
         return SUCCESS;
     }
@@ -166,7 +148,16 @@
             return REQUIRES_AUTHENTICATION;
         }
         
-        cancelCheckout( projectId );
+        try
+        {
+            cancelCheckout( projectId );
+        }
+        catch ( BuildManagerException e )
+        {
+            addActionError( e.getMessage() );
+            return ERROR;
+        }
+        
         return SUCCESS;
     }
     
@@ -174,14 +165,14 @@
         throws Exception
     {
         // current builds
-        for( Task task : parallelBuildsManager.getCurrentBuilds() )
+        for( Task task : getContinuum().getBuildsManager().getCurrentBuilds() )
         {
             BuildProjectTask buildTask = (BuildProjectTask) task;
             this.currentBuildProjectTasks.add( buildTask );
         }
         
         // queued builds
-        Map<String, List<Task>> builds = parallelBuildsManager.getProjectsInBuildQueues();
+        Map<String, List<Task>> builds = getContinuum().getBuildsManager().getProjectsInBuildQueues();
         Set<String> keySet = builds.keySet(); 
         List<BuildProjectTask> buildTasks = new ArrayList<BuildProjectTask>();
         for( String key : keySet )
@@ -195,14 +186,14 @@
         }
         
         // current checkouts
-        for( Task task : parallelBuildsManager.getCurrentCheckouts() )
+        for( Task task : getContinuum().getBuildsManager().getCurrentCheckouts() )
         {
             CheckOutTask checkoutTask = (CheckOutTask) task;
             this.currentCheckOutTasks.add( checkoutTask );
         }
         
         // queued checkouts
-        Map<String, List<Task>> checkouts = parallelBuildsManager.getProjectsInCheckoutQueues();
+        Map<String, List<Task>> checkouts = getContinuum().getBuildsManager().getProjectsInCheckoutQueues();
         keySet = builds.keySet(); 
         List<CheckOutTask> checkoutTasks = new ArrayList<CheckOutTask>();
         for( String key : keySet )
@@ -215,14 +206,6 @@
             checkoutsInQueue.put( key, checkoutTasks );
         }
         
-        //this.setCurrentBuildProjectTask( (BuildProjectTask) taskQueueExecutor.getCurrentTask()
);        
-        //this.setBuildProjectTasks( taskQueueManager.getProjectsInBuildQueue() );
-        
-        /*this.setCurrentBuildProjectTask( (BuildProjectTask) taskQueueExecutor.getCurrentTask()
);        
-        this.setBuildProjectTasks( taskQueueManager.getProjectsInBuildQueue() );
-        
-        this.setCurrentCheckOutTask( (CheckOutTask) checkoutTaskQueueExecutor.getCurrentTask()
);
-        this.setCurrentCheckOutTasks( taskQueueManager.getCheckOutTasksInQueue() );*/
         return SUCCESS;
     }
 
@@ -244,7 +227,7 @@
             return REQUIRES_AUTHENTICATION;
         }
                 
-        parallelBuildsManager.removeProjectFromBuildQueue( projectId, buildDefinitionId,
trigger, projectName );
+        getContinuum().getBuildsManager().removeProjectFromBuildQueue( projectId, buildDefinitionId,
trigger, projectName );
         Project project = getContinuum().getProject( projectId );
         project.setState( project.getOldState() );
         getContinuum().updateProject( project );
@@ -270,9 +253,9 @@
             return REQUIRES_AUTHENTICATION;
         }
         
-        // TODO: deng parallel builds
-        // - implement delete with hashcodes in parallel builds manager! how to do this???
-        taskQueueManager.removeProjectsFromBuildingQueueWithHashCodes( listToIntArray(this.getSelectedBuildTaskHashCodes())
);
+        getContinuum().getBuildsManager().removeProjectsFromBuildQueueWithHashcodes(
+                                                                                     listToIntArray(
this.getSelectedBuildTaskHashCodes() ) );
+        //taskQueueManager.removeProjectsFromBuildingQueueWithHashCodes( listToIntArray(this.getSelectedBuildTaskHashCodes())
);
         return SUCCESS;
     }
 
@@ -293,11 +276,12 @@
             addActionError( e.getMessage() );
             return REQUIRES_AUTHENTICATION;
         }
+     
+        //taskQueueManager
+          //  .removeTasksFromCheckoutQueueWithHashCodes( listToIntArray( this.getSelectedCheckOutTaskHashCodes()
) );
         
-     // TODO: deng parallel builds
-        // - implement delete with hashcodes in parallel builds manager! how to do this???
-        taskQueueManager
-            .removeTasksFromCheckoutQueueWithHashCodes( listToIntArray( this.getSelectedCheckOutTaskHashCodes()
) );
+        getContinuum().getBuildsManager().removeProjectsFromCheckoutQueueWithHashcodes(
+                                                                                        listToIntArray(
this.getSelectedCheckOutTaskHashCodes() ) );
         return SUCCESS;
     }
 
@@ -331,10 +315,35 @@
     }
     
     private boolean cancelCheckout(int projectId)
+        throws BuildManagerException
     {
-        Task task = getCheckoutTaskQueueExecutor().getCurrentTask();
-
-        if ( task != null )
+        List<Task> tasks = getContinuum().getBuildsManager().getCurrentCheckouts();
+        if( tasks != null )
+        {        
+            for( Task task : tasks )
+            {
+                if( task != null && task instanceof CheckOutTask )              
     
+                {
+                    if ( ( (CheckOutTask) task ).getProjectId() == projectId )
+                    {
+                        getLogger().info( "Cancelling checkout for project " + projectId
);
+                        return getContinuum().getBuildsManager().cancelCheckout( projectId
);
+                    }
+                    else
+                    {
+                        getLogger().warn(
+                                          "Current task is not for the given projectId ("
+ projectId + "): "
+                                              + ( (CheckOutTask) task ).getProjectId() +
"; not cancelling checkout" );
+                    }
+                }
+            }
+        }
+        else
+        {
+            getLogger().warn( "No task running - not cancelling checkout" );
+        }
+        
+        /*if ( task != null )
         {
             if ( task instanceof CheckOutTask )
             {
@@ -354,11 +363,8 @@
             {
                 getLogger().warn( "Current task not a CheckOutTask - not cancelling checkout"
);
             }
-        }
-        else
-        {
-            getLogger().warn( "No task running - not cancelling checkout" );
-        }
+        }*/
+        
         return false;
     }
     
@@ -423,7 +429,7 @@
         this.currentBuildProjectTask = currentBuildProjectTask;
     }
 
-    public TaskQueueExecutor getTaskQueueExecutor()
+    /*public TaskQueueExecutor getTaskQueueExecutor()
     {
         return taskQueueExecutor;
     }
@@ -438,7 +444,7 @@
     public void setCheckoutTaskQueueExecutor( TaskQueueExecutor checkoutTaskQueueExecutor
)
     {
         this.checkoutTaskQueueExecutor = checkoutTaskQueueExecutor;
-    }
+    }*/
 
 
     public CheckOutTask getCurrentCheckOutTask()



Mime
View raw message