continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r1372260 [10/30] - in /continuum/trunk: ./ continuum-api/ continuum-api/src/main/java/org/apache/continuum/builder/distributed/ continuum-api/src/main/java/org/apache/continuum/builder/distributed/executor/ continuum-api/src/main/java/org/a...
Date Mon, 13 Aug 2012 04:29:28 GMT
Modified: continuum/trunk/continuum-core/src/main/java/org/apache/continuum/builder/distributed/work/DefaultContinuumWorker.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/continuum/builder/distributed/work/DefaultContinuumWorker.java?rev=1372260&r1=1372259&r2=1372260&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/continuum/builder/distributed/work/DefaultContinuumWorker.java (original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/continuum/builder/distributed/work/DefaultContinuumWorker.java Mon Aug 13 04:29:09 2012
@@ -1,9 +1,5 @@
 package org.apache.continuum.builder.distributed.work;
 
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-
 import org.apache.continuum.builder.distributed.manager.DistributedBuildManager;
 import org.apache.continuum.dao.BuildDefinitionDao;
 import org.apache.continuum.dao.BuildResultDao;
@@ -19,6 +15,10 @@ import org.apache.maven.continuum.projec
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
 /**
  * @plexus.component role="org.apache.continuum.builder.distributed.work.ContinuumWorker"
  */
@@ -66,7 +66,8 @@ public class DefaultContinuumWorker
 
         log.debug( "Start continuum worker..." );
 
-        List<ProjectRunSummary> currentRuns = new ArrayList<ProjectRunSummary>( distributedBuildManager.getCurrentRuns() );
+        List<ProjectRunSummary> currentRuns = new ArrayList<ProjectRunSummary>(
+            distributedBuildManager.getCurrentRuns() );
         List<ProjectRunSummary> runsToDelete = new ArrayList<ProjectRunSummary>();
 
         synchronized ( currentRuns )
@@ -77,39 +78,48 @@ public class DefaultContinuumWorker
                 {
                     // check for scm update
                     ProjectScmRoot scmRoot = projectScmRootDao.getProjectScmRoot( currentRun.getProjectScmRootId() );
-    
+
                     if ( scmRoot != null && scmRoot.getState() == ContinuumProjectState.UPDATING )
                     {
                         // check if it's still updating
-                        if ( !distributedBuildManager.isProjectCurrentlyPreparingBuild( currentRun.getProjectId(), currentRun.getBuildDefinitionId() ) )
+                        if ( !distributedBuildManager.isProjectCurrentlyPreparingBuild( currentRun.getProjectId(),
+                                                                                        currentRun.getBuildDefinitionId() ) )
                         {
                             // no longer updating, but state was not updated.
                             scmRoot.setState( ContinuumProjectState.ERROR );
-                            scmRoot.setError( "Problem encountered while returning scm update result to master by build agent '" + currentRun.getBuildAgentUrl() + "'. \n" +
-                                              "Make sure build agent is configured properly. Check the logs for more information." );
+                            scmRoot.setError(
+                                "Problem encountered while returning scm update result to master by build agent '" +
+                                    currentRun.getBuildAgentUrl() + "'. \n" +
+                                    "Make sure build agent is configured properly. Check the logs for more information." );
                             projectScmRootDao.updateProjectScmRoot( scmRoot );
-    
-                            log.debug( "projectId={}, buildDefinitionId={} is not updating anymore. Problem encountered while return scm update result by build agent {}. Stopping the build.",
-                                       new Object[] { currentRun.getProjectId(), currentRun.getBuildDefinitionId(), currentRun.getBuildAgentUrl() } );
+
+                            log.debug(
+                                "projectId={}, buildDefinitionId={} is not updating anymore. Problem encountered while return scm update result by build agent {}. Stopping the build.",
+                                new Object[]{currentRun.getProjectId(), currentRun.getBuildDefinitionId(),
+                                    currentRun.getBuildAgentUrl()} );
                             runsToDelete.add( currentRun );
                         }
                     }
                     else if ( scmRoot != null && scmRoot.getState() == ContinuumProjectState.ERROR )
                     {
-                        log.debug( "projectId={}, buildDefinitionId={} is not updating anymore. Problem encountered while return scm update result by build agent {}. Stopping the build.",
-                                   new Object[] { currentRun.getProjectId(), currentRun.getBuildDefinitionId(), currentRun.getBuildAgentUrl() } );
+                        log.debug(
+                            "projectId={}, buildDefinitionId={} is not updating anymore. Problem encountered while return scm update result by build agent {}. Stopping the build.",
+                            new Object[]{currentRun.getProjectId(), currentRun.getBuildDefinitionId(),
+                                currentRun.getBuildAgentUrl()} );
                         runsToDelete.add( currentRun );
                     }
                     else
                     {
                         Project project = projectDao.getProject( currentRun.getProjectId() );
-    
+
                         if ( project != null && project.getState() == ContinuumProjectState.BUILDING )
                         {
                             // check if it's still building
-                            if ( !distributedBuildManager.isProjectCurrentlyBuilding( currentRun.getProjectId(), currentRun.getBuildDefinitionId() ) )
+                            if ( !distributedBuildManager.isProjectCurrentlyBuilding( currentRun.getProjectId(),
+                                                                                      currentRun.getBuildDefinitionId() ) )
                             {
-                                BuildDefinition buildDefinition = buildDefinitionDao.getBuildDefinition( currentRun.getBuildDefinitionId() );
+                                BuildDefinition buildDefinition = buildDefinitionDao.getBuildDefinition(
+                                    currentRun.getBuildDefinitionId() );
 
                                 // no longer building, but state was not updated
                                 BuildResult buildResult = new BuildResult();
@@ -122,16 +132,20 @@ public class DefaultContinuumWorker
                                 buildResult.setStartTime( new Date().getTime() );
                                 buildResult.setEndTime( new Date().getTime() );
                                 buildResult.setExitCode( 1 );
-                                buildResult.setError( "Problem encountered while returning build result to master by build agent '" + currentRun.getBuildAgentUrl() + "'. \n" +
-                                                      "Make sure build agent is configured properly. Check the logs for more information." );
+                                buildResult.setError(
+                                    "Problem encountered while returning build result to master by build agent '" +
+                                        currentRun.getBuildAgentUrl() + "'. \n" +
+                                        "Make sure build agent is configured properly. Check the logs for more information." );
                                 buildResultDao.addBuildResult( project, buildResult );
-    
+
                                 project.setState( ContinuumProjectState.ERROR );
                                 project.setLatestBuildId( buildResult.getId() );
                                 projectDao.updateProject( project );
-    
-                                log.debug( "projectId={}, buildDefinitionId={} is not building anymore. Problem encountered while return build result by build agent {}. Stopping the build.",
-                                           new Object[] { currentRun.getProjectId(), currentRun.getBuildDefinitionId(), currentRun.getBuildAgentUrl() } );
+
+                                log.debug(
+                                    "projectId={}, buildDefinitionId={} is not building anymore. Problem encountered while return build result by build agent {}. Stopping the build.",
+                                    new Object[]{currentRun.getProjectId(), currentRun.getBuildDefinitionId(),
+                                        currentRun.getBuildAgentUrl()} );
 
                                 // create a build result
                                 runsToDelete.add( currentRun );
@@ -141,8 +155,9 @@ public class DefaultContinuumWorker
                 }
                 catch ( Exception e )
                 {
-                    log.error( "Unable to check if projectId={}, buildDefinitionId={} is still updating or building: {}",
-                               new Object[] { currentRun.getProjectId(), currentRun.getBuildDefinitionId(), e.getMessage() } );
+                    log.error(
+                        "Unable to check if projectId={}, buildDefinitionId={} is still updating or building: {}",
+                        new Object[]{currentRun.getProjectId(), currentRun.getBuildDefinitionId(), e.getMessage()} );
                 }
             }
 

Modified: continuum/trunk/continuum-core/src/main/java/org/apache/continuum/buildmanager/ParallelBuildsManager.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/continuum/buildmanager/ParallelBuildsManager.java?rev=1372260&r1=1372259&r2=1372260&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/continuum/buildmanager/ParallelBuildsManager.java (original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/continuum/buildmanager/ParallelBuildsManager.java Mon Aug 13 04:29:09 2012
@@ -19,16 +19,6 @@ package org.apache.continuum.buildmanage
  * under the License.
  */
 
-import java.io.File;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.annotation.Resource;
-
 import org.apache.continuum.buildqueue.BuildQueueService;
 import org.apache.continuum.buildqueue.BuildQueueServiceException;
 import org.apache.continuum.dao.BuildDefinitionDao;
@@ -60,6 +50,15 @@ import org.codehaus.plexus.util.StringUt
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.io.File;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import javax.annotation.Resource;
+
 /**
  * Parallel builds manager.
  *
@@ -72,8 +71,8 @@ public class ParallelBuildsManager
     private static final Logger log = LoggerFactory.getLogger( ParallelBuildsManager.class );
 
     // map must be synchronized!
-    private Map<Integer, OverallBuildQueue> overallBuildQueues =
-        Collections.synchronizedMap( new HashMap<Integer, OverallBuildQueue>() );
+    private Map<Integer, OverallBuildQueue> overallBuildQueues = Collections.synchronizedMap(
+        new HashMap<Integer, OverallBuildQueue>() );
 
     private static final int BUILD_QUEUE = 1;
 
@@ -98,8 +97,8 @@ public class ParallelBuildsManager
     /**
      * @see BuildsManager#buildProject(int, BuildDefinition, String, BuildTrigger, ScmResult, int)
      */
-    public void buildProject( int projectId, BuildDefinition buildDefinition, String projectName, BuildTrigger buildTrigger,
-                              ScmResult scmResult, int projectGroupId )
+    public void buildProject( int projectId, BuildDefinition buildDefinition, String projectName,
+                              BuildTrigger buildTrigger, ScmResult scmResult, int projectGroupId )
         throws BuildManagerException
     {
         try
@@ -136,19 +135,20 @@ public class ParallelBuildsManager
             {
                 buildDefinitionLabel = buildDefinition.getGoals();
             }
-    
-            BuildProjectTask buildTask =
-            	new BuildProjectTask( projectId, buildDefinition.getId(), buildTrigger, projectName, buildDefinitionLabel,
-                                      scmResult, projectGroupId );
+
+            BuildProjectTask buildTask = new BuildProjectTask( projectId, buildDefinition.getId(), buildTrigger,
+                                                               projectName, buildDefinitionLabel, scmResult,
+                                                               projectGroupId );
             try
             {
-                log.info(
-                    "Project '" + projectName + "' added to overall build queue '" + overallBuildQueue.getName() + "'." );
+                log.info( "Project '" + projectName + "' added to overall build queue '" + overallBuildQueue.getName() +
+                              "'." );
                 overallBuildQueue.addToBuildQueue( buildTask );
             }
             catch ( TaskQueueException e )
             {
-                throw new BuildManagerException( "Error occurred while adding project to build queue: " + e.getMessage() );
+                throw new BuildManagerException(
+                    "Error occurred while adding project to build queue: " + e.getMessage() );
             }
         }
         else
@@ -161,7 +161,7 @@ public class ParallelBuildsManager
      * @see BuildsManager#buildProjects(List, Map, BuildTrigger, Map, int)
      */
     public void buildProjects( List<Project> projects, Map<Integer, BuildDefinition> projectsBuildDefinitionsMap,
-    		                   BuildTrigger buildTrigger, Map<Integer, ScmResult> scmResultMap, int projectGroupId )
+                               BuildTrigger buildTrigger, Map<Integer, ScmResult> scmResultMap, int projectGroupId )
         throws BuildManagerException
     {
         int firstProjectId = 0;
@@ -185,13 +185,14 @@ public class ParallelBuildsManager
         if ( firstProjectId != 0 )
         {
             BuildDefinition buildDef = projectsBuildDefinitionsMap.get( firstProjectId );
-            
-            if ( buildDef.getArguments() == null || buildDef.getBuildFile() == null || buildDef.getGoals() == null || buildDef.getSchedule() == null )
+
+            if ( buildDef.getArguments() == null || buildDef.getBuildFile() == null || buildDef.getGoals() == null ||
+                buildDef.getSchedule() == null )
             {
                 log.error( "Null values set on build definition (id=" + buildDef.getId() + ")" );
                 throw new BuildManagerException( "Unable to build project due to null values set on " +
-                                                 "( GOALS , ARGUMENTS , BUILD_FILE, SCHEDULE_ID_OID ) of BUILDDEFINITION ID : " 
-                                                 + buildDef.getId() + " Please notify your system adminitrator");
+                                                     "( GOALS , ARGUMENTS , BUILD_FILE, SCHEDULE_ID_OID ) of BUILDDEFINITION ID : " +
+                                                     buildDef.getId() + " Please notify your system adminitrator" );
             }
             OverallBuildQueue overallBuildQueue = getOverallBuildQueueWhereProjectsInGroupAreQueued( projectGroupId );
 
@@ -206,17 +207,17 @@ public class ParallelBuildsManager
                 {
                     try
                     {
-                        if ( isInQueue( project.getId(), BUILD_QUEUE,
-                                        projectsBuildDefinitionsMap.get( project.getId() ).getId() ) )
+                        if ( isInQueue( project.getId(), BUILD_QUEUE, projectsBuildDefinitionsMap.get(
+                            project.getId() ).getId() ) )
                         {
                             log.warn( "Project '" + project.getId() + "' - '" + project.getName() +
-                                "' is already in build queue." );
+                                          "' is already in build queue." );
                             continue;
                         }
                         else if ( isProjectInAnyCurrentBuild( project.getId() ) )
                         {
                             log.warn( "Project '" + project.getId() + "' - '" + project.getName() +
-                                      "' is already building." );
+                                          "' is already building." );
                             continue;
                         }
                     }
@@ -234,15 +235,16 @@ public class ParallelBuildsManager
                     }
 
                     ScmResult scmResult = scmResultMap.get( project.getId() );
-                    BuildProjectTask buildTask =
-                    	new BuildProjectTask( project.getId(), buildDefinition.getId(), buildTrigger, project.getName(),
-                                              buildDefinitionLabel, scmResult, projectGroupId );
+                    BuildProjectTask buildTask = new BuildProjectTask( project.getId(), buildDefinition.getId(),
+                                                                       buildTrigger, project.getName(),
+                                                                       buildDefinitionLabel, scmResult,
+                                                                       projectGroupId );
                     buildTask.setMaxExecutionTime( buildDefinition.getSchedule().getMaxJobExecutionTime() * 1000 );
 
                     try
                     {
                         log.info( "Project '" + project.getId() + "' - '" + project.getName() +
-                            "' added to overall build queue '" + overallBuildQueue.getName() + "'." );
+                                      "' added to overall build queue '" + overallBuildQueue.getName() + "'." );
 
                         overallBuildQueue.addToBuildQueue( buildTask );
                     }
@@ -414,7 +416,8 @@ public class ParallelBuildsManager
     {
         try
         {
-            OverallBuildQueue overallBuildQueue = getOverallBuildQueueWhereProjectGroupIsQueued( projectGroupId, scmRootId );
+            OverallBuildQueue overallBuildQueue = getOverallBuildQueueWhereProjectGroupIsQueued( projectGroupId,
+                                                                                                 scmRootId );
 
             if ( overallBuildQueue != null )
             {
@@ -430,13 +433,15 @@ public class ParallelBuildsManager
                         overallBuildQueue = overallBuildQueues.get( key );
                         PrepareBuildProjectsTask task =
                             (PrepareBuildProjectsTask) overallBuildQueue.getPrepareBuildTaskQueueExecutor().getCurrentTask();
-                        if ( task != null && task.getProjectGroupId() == projectGroupId && task.getProjectScmRootId() == scmRootId )
+                        if ( task != null && task.getProjectGroupId() == projectGroupId &&
+                            task.getProjectScmRootId() == scmRootId )
                         {
                             overallBuildQueue.cancelPrepareBuildTask( projectGroupId, scmRootId );
                             return true;
                         }
                     }
-                    log.error( "Project group '{}' with scm root '{}' not found in any of the builds queues.", projectGroupId, scmRootId );
+                    log.error( "Project group '{}' with scm root '{}' not found in any of the builds queues.",
+                               projectGroupId, scmRootId );
                 }
             }
         }
@@ -453,7 +458,8 @@ public class ParallelBuildsManager
     {
         try
         {
-            OverallBuildQueue overallBuildQueue = getOverallBuildQueueWhereProjectIsQueued( projectId, PREPARE_BUILD_QUEUE );
+            OverallBuildQueue overallBuildQueue = getOverallBuildQueueWhereProjectIsQueued( projectId,
+                                                                                            PREPARE_BUILD_QUEUE );
 
             if ( overallBuildQueue != null )
             {
@@ -501,8 +507,8 @@ public class ParallelBuildsManager
      * @see BuildsManager#checkoutProject(int, String, File, String, String, String, BuildDefinition, List)
      */
     public void checkoutProject( int projectId, String projectName, File workingDirectory, String scmRootUrl,
-    		                                 String scmUsername, String scmPassword, BuildDefinition defaultBuildDefinition,
-    		                                 List<Project> subProjects )
+                                 String scmUsername, String scmPassword, BuildDefinition defaultBuildDefinition,
+                                 List<Project> subProjects )
         throws BuildManagerException
     {
         try
@@ -519,16 +525,16 @@ public class ParallelBuildsManager
                 "Error occurred while checking if the project is already in queue: " + e.getMessage() );
         }
 
-        OverallBuildQueue overallBuildQueue =
-            getOverallBuildQueue( CHECKOUT_QUEUE, defaultBuildDefinition.getSchedule().getBuildQueues() );
-        CheckOutTask checkoutTask =
-        	new CheckOutTask( projectId, workingDirectory, projectName, scmUsername, scmPassword, scmRootUrl, subProjects );
+        OverallBuildQueue overallBuildQueue = getOverallBuildQueue( CHECKOUT_QUEUE,
+                                                                    defaultBuildDefinition.getSchedule().getBuildQueues() );
+        CheckOutTask checkoutTask = new CheckOutTask( projectId, workingDirectory, projectName, scmUsername,
+                                                      scmPassword, scmRootUrl, subProjects );
         try
         {
             if ( overallBuildQueue != null )
             {
                 log.info( "Project '" + projectName + "' added to overall build queue '" + overallBuildQueue.getName() +
-                    "'." );
+                              "'." );
                 overallBuildQueue.addToCheckoutQueue( checkoutTask );
             }
             else
@@ -629,27 +635,28 @@ public class ParallelBuildsManager
                 for ( Integer key : keySet )
                 {
                     OverallBuildQueue overallBuildQueue = overallBuildQueues.get( key );
-    
+
                     if ( overallBuildQueue.isInPrepareBuildQueue( projectId ) )
                     {
                         return true;
                     }
                 }
-    
+
                 return false;
             }
         }
         catch ( TaskQueueException e )
         {
-            throw new BuildManagerException( "Unable to check if projectId " + projectId + " is in prepare build queue", e );
+            throw new BuildManagerException( "Unable to check if projectId " + projectId + " is in prepare build queue",
+                                             e );
         }
     }
 
     /**
-     * @see BuildsManager#isInPrepareBuildQueue(int, int)
      * @param projectGroupId
      * @param scmRootId
      * @return
+     * @see BuildsManager#isInPrepareBuildQueue(int, int)
      */
     public boolean isInPrepareBuildQueue( int projectGroupId, int scmRootId )
         throws BuildManagerException
@@ -662,20 +669,21 @@ public class ParallelBuildsManager
                 for ( Integer key : keySet )
                 {
                     OverallBuildQueue overallBuildQueue = overallBuildQueues.get( key );
-    
+
                     if ( overallBuildQueue.isInPrepareBuildQueue( projectGroupId, scmRootId ) )
                     {
                         return true;
                     }
                 }
-    
+
                 return false;
             }
         }
         catch ( TaskQueueException e )
         {
-            throw new BuildManagerException( "Unable to check if projectGroupId " + projectGroupId + " with scmRootId " + scmRootId 
-                                             + " is in prepare build queue", e );
+            throw new BuildManagerException(
+                "Unable to check if projectGroupId " + projectGroupId + " with scmRootId " + scmRootId +
+                    " is in prepare build queue", e );
         }
     }
 
@@ -713,7 +721,8 @@ public class ParallelBuildsManager
     {
         if ( isInPrepareBuildQueue( projectGroupId, scmRootId ) )
         {
-            log.warn( "Project group {} with scm root id {} is already in prepare build queue. Will not queue anymore." );
+            log.warn(
+                "Project group {} with scm root id {} is already in prepare build queue. Will not queue anymore." );
             return;
         }
 
@@ -730,31 +739,35 @@ public class ParallelBuildsManager
         }
         catch ( ContinuumStoreException e )
         {
-            throw new BuildManagerException( "Error occurred while retrieving build definition of project group " + projectGroupId, e );
+            throw new BuildManagerException(
+                "Error occurred while retrieving build definition of project group " + projectGroupId, e );
         }
 
-        OverallBuildQueue overallBuildQueue =
-            getOverallBuildQueue( PREPARE_BUILD_QUEUE, buildDef.getSchedule().getBuildQueues() );
+        OverallBuildQueue overallBuildQueue = getOverallBuildQueue( PREPARE_BUILD_QUEUE,
+                                                                    buildDef.getSchedule().getBuildQueues() );
 
-        PrepareBuildProjectsTask task =
-            new PrepareBuildProjectsTask( projectsBuildDefinitionsMap, buildTrigger, projectGroupId, projectGroupName,
-                                          scmRootAddress, scmRootId );
+        PrepareBuildProjectsTask task = new PrepareBuildProjectsTask( projectsBuildDefinitionsMap, buildTrigger,
+                                                                      projectGroupId, projectGroupName, scmRootAddress,
+                                                                      scmRootId );
 
         try
         {
             if ( overallBuildQueue != null )
             {
-                log.info( "Project group '{}' added to overall build queue '{}'", projectGroupId, overallBuildQueue.getName() );
+                log.info( "Project group '{}' added to overall build queue '{}'", projectGroupId,
+                          overallBuildQueue.getName() );
                 overallBuildQueue.addToPrepareBuildQueue( task );
             }
             else
             {
-                throw new BuildManagerException( "Unable to add project to prepare build queue. No overall build queue configured." );
+                throw new BuildManagerException(
+                    "Unable to add project to prepare build queue. No overall build queue configured." );
             }
         }
         catch ( TaskQueueException e )
         {
-            throw new BuildManagerException( "Error occurred while adding project to prepare build queue: " + e.getMessage() );
+            throw new BuildManagerException(
+                "Error occurred while adding project to prepare build queue: " + e.getMessage() );
         }
     }
 
@@ -787,7 +800,7 @@ public class ParallelBuildsManager
      * @see BuildsManager#removeProjectFromBuildQueue(int, int, BuildTrigger, String, int)
      */
     public void removeProjectFromBuildQueue( int projectId, int buildDefinitionId, BuildTrigger buildTrigger,
-    		                                 String projectName, int projectGroupId )
+                                             String projectName, int projectGroupId )
         throws BuildManagerException
     {
         try
@@ -795,7 +808,7 @@ public class ParallelBuildsManager
             OverallBuildQueue overallBuildQueue = getOverallBuildQueueWhereProjectIsQueued( projectId, BUILD_QUEUE );
             if ( overallBuildQueue != null )
             {
-            	overallBuildQueue.removeProjectFromBuildQueue( projectId, buildDefinitionId, buildTrigger, projectName,
+                overallBuildQueue.removeProjectFromBuildQueue( projectId, buildDefinitionId, buildTrigger, projectName,
                                                                projectGroupId );
             }
             else
@@ -844,8 +857,8 @@ public class ParallelBuildsManager
         {
             try
             {
-                OverallBuildQueue overallBuildQueue = getOverallBuildQueueWhereProjectIsQueued( projectId, BUILD_QUEUE )
-                    ;
+                OverallBuildQueue overallBuildQueue = getOverallBuildQueueWhereProjectIsQueued( projectId,
+                                                                                                BUILD_QUEUE );
                 if ( overallBuildQueue != null )
                 {
                     overallBuildQueue.removeProjectFromBuildQueue( projectId );
@@ -871,8 +884,8 @@ public class ParallelBuildsManager
         {
             try
             {
-                OverallBuildQueue overallBuildQueue =
-                    getOverallBuildQueueWhereProjectIsQueued( projectId, CHECKOUT_QUEUE );
+                OverallBuildQueue overallBuildQueue = getOverallBuildQueueWhereProjectIsQueued( projectId,
+                                                                                                CHECKOUT_QUEUE );
                 if ( overallBuildQueue != null )
                 {
                     overallBuildQueue.removeProjectFromCheckoutQueue( projectId );
@@ -942,14 +955,16 @@ public class ParallelBuildsManager
     {
         try
         {
-            OverallBuildQueue overallBuildQueue = getOverallBuildQueueWhereProjectGroupIsQueued( projectGroupId, scmRootAddress );
+            OverallBuildQueue overallBuildQueue = getOverallBuildQueueWhereProjectGroupIsQueued( projectGroupId,
+                                                                                                 scmRootAddress );
             if ( overallBuildQueue != null )
             {
                 overallBuildQueue.removeProjectFromPrepareBuildQueue( projectGroupId, scmRootAddress );
             }
             else
             {
-                log.info( "Project group '{}' with scm '{}' not found in any of the build queues.", projectGroupId, scmRootAddress );
+                log.info( "Project group '{}' with scm '{}' not found in any of the build queues.", projectGroupId,
+                          scmRootAddress );
             }
         }
         catch ( TaskQueueException e )
@@ -1057,11 +1072,11 @@ public class ParallelBuildsManager
         {
             try
             {
-                BuildDefinition buildDefinition =
-                    buildDefinitionDao.getBuildDefinition( buildTask.getBuildDefinitionId() );
+                BuildDefinition buildDefinition = buildDefinitionDao.getBuildDefinition(
+                    buildTask.getBuildDefinitionId() );
 
                 buildProject( buildTask.getProjectId(), buildDefinition, buildTask.getProjectName(),
-                		      buildTask.getBuildTrigger(), buildTask.getScmResult(), buildTask.getProjectGroupId() );
+                              buildTask.getBuildTrigger(), buildTask.getScmResult(), buildTask.getProjectGroupId() );
             }
             catch ( ContinuumStoreException e )
             {
@@ -1075,8 +1090,8 @@ public class ParallelBuildsManager
             {
                 BuildDefinition buildDefinition = buildDefinitionDao.getDefaultBuildDefinition( task.getProjectId() );
                 checkoutProject( task.getProjectId(), task.getProjectName(), task.getWorkingDirectory(),
-                		task.getScmRootUrl(), task.getScmUserName(), task.getScmPassword(), buildDefinition,
-                		task.getProjectsWithCommonScmRoot() );
+                                 task.getScmRootUrl(), task.getScmUserName(), task.getScmPassword(), buildDefinition,
+                                 task.getProjectsWithCommonScmRoot() );
             }
             catch ( ContinuumStoreException e )
             {
@@ -1086,8 +1101,9 @@ public class ParallelBuildsManager
 
         for ( PrepareBuildProjectsTask prepareTask : prepareBuildTasks )
         {
-            prepareBuildProjects( prepareTask.getProjectsBuildDefinitionsMap(), prepareTask.getBuildTrigger(), prepareTask.getProjectGroupId(),
-                                  prepareTask.getProjectGroupName(), prepareTask.getScmRootAddress(), prepareTask.getProjectScmRootId() );
+            prepareBuildProjects( prepareTask.getProjectsBuildDefinitionsMap(), prepareTask.getBuildTrigger(),
+                                  prepareTask.getProjectGroupId(), prepareTask.getProjectGroupName(),
+                                  prepareTask.getScmRootAddress(), prepareTask.getProjectScmRootId() );
         }
     }
 
@@ -1249,11 +1265,11 @@ public class ParallelBuildsManager
             for ( PrepareBuildProjectsTask task : tasks.values() )
             {
                 Map<Integer, Integer> map = task.getProjectsBuildDefinitionsMap();
-    
+
                 if ( map.size() > 0 )
                 {
                     Set<Integer> projectIds = map.keySet();
-    
+
                     if ( projectIds.contains( new Integer( projectId ) ) )
                     {
                         log.info( "Project '{}' is currently preparing build", projectId );
@@ -1275,9 +1291,11 @@ public class ParallelBuildsManager
         {
             for ( PrepareBuildProjectsTask task : tasks.values() )
             {
-                if ( task != null && task.getProjectGroupId() == projectGroupId && task.getProjectScmRootId() == scmRootId )
+                if ( task != null && task.getProjectGroupId() == projectGroupId &&
+                    task.getProjectScmRootId() == scmRootId )
                 {
-                    log.info( "Project group '{}' with scm root '{}' is currently preparing build", projectGroupId, scmRootId );
+                    log.info( "Project group '{}' with scm root '{}' is currently preparing build", projectGroupId,
+                              scmRootId );
                     return true;
                 }
             }
@@ -1286,7 +1304,7 @@ public class ParallelBuildsManager
         return false;
     }
 
-    public Map<String,PrepareBuildProjectsTask> getCurrentProjectInPrepareBuild()
+    public Map<String, PrepareBuildProjectsTask> getCurrentProjectInPrepareBuild()
         throws BuildManagerException
     {
         synchronized ( overallBuildQueues )
@@ -1312,20 +1330,22 @@ public class ParallelBuildsManager
     {
         synchronized ( overallBuildQueues )
         {
-            Map<String, List<PrepareBuildProjectsTask>> queuedPrepareBuilds = new HashMap<String, List<PrepareBuildProjectsTask>>();
+            Map<String, List<PrepareBuildProjectsTask>> queuedPrepareBuilds =
+                new HashMap<String, List<PrepareBuildProjectsTask>>();
             Set<Integer> keySet = overallBuildQueues.keySet();
             for ( Integer key : keySet )
             {
                 OverallBuildQueue overallBuildQueue = overallBuildQueues.get( key );
                 try
                 {
-                    queuedPrepareBuilds.put( overallBuildQueue.getName(), overallBuildQueue.getProjectsInPrepareBuildQueue() );
+                    queuedPrepareBuilds.put( overallBuildQueue.getName(),
+                                             overallBuildQueue.getProjectsInPrepareBuildQueue() );
                 }
                 catch ( TaskQueueException e )
                 {
                     throw new BuildManagerException(
-                        "Error occurred while getting projects in prepare build queue '" + overallBuildQueue.getName() + "'.",
-                        e );
+                        "Error occurred while getting projects in prepare build queue '" + overallBuildQueue.getName() +
+                            "'.", e );
                 }
             }
             return queuedPrepareBuilds;
@@ -1337,14 +1357,16 @@ public class ParallelBuildsManager
     {
         try
         {
-            OverallBuildQueue overallBuildQueue = getOverallBuildQueueWhereProjectGroupIsQueued( projectGroupId, scmRootId );
+            OverallBuildQueue overallBuildQueue = getOverallBuildQueueWhereProjectGroupIsQueued( projectGroupId,
+                                                                                                 scmRootId );
             if ( overallBuildQueue != null )
             {
                 overallBuildQueue.removeProjectFromPrepareBuildQueue( projectGroupId, scmRootId );
             }
             else
             {
-                log.info( "Project group '{}' with scm '{}' not found in any of the build queues.", projectGroupId, scmRootId );
+                log.info( "Project group '{}' with scm '{}' not found in any of the build queues.", projectGroupId,
+                          scmRootId );
             }
         }
         catch ( TaskQueueException e )
@@ -1590,11 +1612,13 @@ public class ParallelBuildsManager
         }
         catch ( ContinuumStoreException e )
         {
-            throw new BuildManagerException( "Error while retrieving overall build queue for project: " + e.getMessage() );
+            throw new BuildManagerException(
+                "Error while retrieving overall build queue for project: " + e.getMessage() );
         }
         catch ( TaskQueueException e )
         {
-            throw new BuildManagerException( "Error while retrieving overall build queue for project: " + e.getMessage() );
+            throw new BuildManagerException(
+                "Error while retrieving overall build queue for project: " + e.getMessage() );
         }
 
         return whereToBeQueued;
@@ -1629,17 +1653,17 @@ public class ParallelBuildsManager
         {
             OverallBuildQueue whereQueued = null;
             Set<Integer> keySet = overallBuildQueues.keySet();
-    
+
             for ( Integer key : keySet )
             {
                 OverallBuildQueue overallBuildQueue = overallBuildQueues.get( key );
-    
+
                 if ( overallBuildQueue.isInPrepareBuildQueue( projectGroupId, scmRootAddress ) )
                 {
                     whereQueued = overallBuildQueue;
                 }
             }
-    
+
             return whereQueued;
         }
     }
@@ -1666,10 +1690,10 @@ public class ParallelBuildsManager
         throws BuildManagerException
     {
         Map<String, CheckOutTask> checkouts = getCurrentCheckouts();
-        for( String key : checkouts.keySet() )
+        for ( String key : checkouts.keySet() )
         {
             CheckOutTask task = checkouts.get( key );
-            if( task.getProjectId() == projectId )
+            if ( task.getProjectId() == projectId )
             {
                 return true;
             }
@@ -1683,7 +1707,7 @@ public class ParallelBuildsManager
     {
         for ( int i = 0; i < projectIds.length; i++ )
         {
-            if ( isProjectInAnyCurrentBuild( projectIds[i] ) ) 
+            if ( isProjectInAnyCurrentBuild( projectIds[i] ) )
             {
                 return true;
             }

Modified: continuum/trunk/continuum-core/src/main/java/org/apache/continuum/purge/DefaultContinuumPurgeManager.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/continuum/purge/DefaultContinuumPurgeManager.java?rev=1372260&r1=1372259&r2=1372260&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/continuum/purge/DefaultContinuumPurgeManager.java (original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/continuum/purge/DefaultContinuumPurgeManager.java Mon Aug 13 04:29:09 2012
@@ -19,8 +19,6 @@ package org.apache.continuum.purge;
  * under the License.
  */
 
-import java.util.List;
-
 import org.apache.continuum.buildmanager.BuildsManager;
 import org.apache.continuum.model.repository.DirectoryPurgeConfiguration;
 import org.apache.continuum.model.repository.DistributedDirectoryPurgeConfiguration;
@@ -36,6 +34,8 @@ import org.codehaus.plexus.taskqueue.Tas
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.util.List;
+
 /**
  * DefaultContinuumPurgeManager
  *
@@ -48,7 +48,7 @@ public class DefaultContinuumPurgeManage
     implements ContinuumPurgeManager
 {
     private static final Logger log = LoggerFactory.getLogger( DefaultContinuumPurgeManager.class );
-    
+
     /**
      * @plexus.requirement
      */
@@ -63,12 +63,12 @@ public class DefaultContinuumPurgeManage
      * @plexus.requirement
      */
     private TaskQueueManager taskQueueManager;
-    
+
     /**
      * @plexus.requirement role-hint="parallel"
      */
     private BuildsManager parallelBuildsManager;
-    
+
     public void purge( Schedule schedule )
         throws ContinuumPurgeManagerException
     {
@@ -78,12 +78,13 @@ public class DefaultContinuumPurgeManage
 
         repoPurgeList = purgeConfigurationService.getEnableRepositoryPurgeConfigurationsBySchedule( schedule.getId() );
         dirPurgeList = purgeConfigurationService.getEnableDirectoryPurgeConfigurationsBySchedule( schedule.getId() );
-        distributedDirPurgeList = purgeConfigurationService.getEnableDistributedDirectoryPurgeConfigurationsBySchedule( schedule.getId() );
+        distributedDirPurgeList = purgeConfigurationService.getEnableDistributedDirectoryPurgeConfigurationsBySchedule(
+            schedule.getId() );
 
         boolean hasRepoPurge = repoPurgeList != null && repoPurgeList.size() > 0;
         boolean hasDirPurge = dirPurgeList != null && dirPurgeList.size() > 0;
         boolean hasDitributedDirPurge = distributedDirPurgeList != null && distributedDirPurgeList.size() > 0;
-        
+
         if ( hasRepoPurge )
         {
             for ( RepositoryPurgeConfiguration repoPurge : repoPurgeList )
@@ -99,7 +100,7 @@ public class DefaultContinuumPurgeManage
                 purgeDirectory( dirPurge );
             }
         }
-        
+
         if ( hasDitributedDirPurge )
         {
             for ( DistributedDirectoryPurgeConfiguration dirPurge : distributedDirPurgeList )
@@ -107,7 +108,7 @@ public class DefaultContinuumPurgeManage
                 purgeDistributedDirectory( dirPurge );
             }
         }
-        
+
         if ( !hasRepoPurge && !hasDirPurge && !hasDitributedDirPurge )
         {
             // This purge is not enable for a purge process.
@@ -131,8 +132,8 @@ public class DefaultContinuumPurgeManage
             LocalRepository repository = repoPurge.getRepository();
 
             // do not purge if repository is in use and if repository is already in purge queue
-            if ( !taskQueueManager.isRepositoryInUse( repository.getId() ) && 
-                 !taskQueueManager.isInPurgeQueue( repoPurge.getId() ) )
+            if ( !taskQueueManager.isRepositoryInUse( repository.getId() ) && !taskQueueManager.isInPurgeQueue(
+                repoPurge.getId() ) )
             {
                 taskQueueManager.getPurgeQueue().put( new PurgeTask( repoPurge.getId() ) );
             }
@@ -155,8 +156,7 @@ public class DefaultContinuumPurgeManage
             if ( "releases".equals( dirPurge.getDirectoryType() ) )
             {
                 // do not purge if release in progress
-                if ( !taskQueueManager.releaseInProgress() && 
-                     !taskQueueManager.isInPurgeQueue( dirPurge.getId() ) )
+                if ( !taskQueueManager.releaseInProgress() && !taskQueueManager.isInPurgeQueue( dirPurge.getId() ) )
                 {
                     taskQueueManager.getPurgeQueue().put( new PurgeTask( dirPurge.getId() ) );
                 }
@@ -164,8 +164,8 @@ public class DefaultContinuumPurgeManage
             else if ( "buildOutput".equals( dirPurge.getDirectoryType() ) )
             {
                 // do not purge if build in progress
-                if ( !parallelBuildsManager.isBuildInProgress() && 
-                     !taskQueueManager.isInPurgeQueue( dirPurge.getId() ) )
+                if ( !parallelBuildsManager.isBuildInProgress() && !taskQueueManager.isInPurgeQueue(
+                    dirPurge.getId() ) )
                 {
                     taskQueueManager.getPurgeQueue().put( new PurgeTask( dirPurge.getId() ) );
                 }

Modified: continuum/trunk/continuum-core/src/main/java/org/apache/continuum/release/distributed/DistributedReleaseUtil.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/continuum/release/distributed/DistributedReleaseUtil.java?rev=1372260&r1=1372259&r2=1372260&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/continuum/release/distributed/DistributedReleaseUtil.java (original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/continuum/release/distributed/DistributedReleaseUtil.java Mon Aug 13 04:29:09 2012
@@ -101,7 +101,7 @@ public class DistributedReleaseUtil
     public static final String KEY_RELEASE_GOAL = "release-goal";
 
     public static final String KEY_BUILD_AGENT_URL = "build-agent-url";
-    
+
     public static final String KEY_USERNAME = "username";
 
     public static String getScmTag( Map<String, Object> context, String defaultValue )
@@ -218,7 +218,7 @@ public class DistributedReleaseUtil
     {
         return getInteger( context, KEY_PROJECT_ID );
     }
-    
+
     public static String getUsername( Map<String, Object> context )
     {
         return getString( context, KEY_USERNAME, "" );

Modified: continuum/trunk/continuum-core/src/main/java/org/apache/continuum/release/distributed/manager/DefaultDistributedReleaseManager.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/continuum/release/distributed/manager/DefaultDistributedReleaseManager.java?rev=1372260&r1=1372259&r2=1372260&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/continuum/release/distributed/manager/DefaultDistributedReleaseManager.java (original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/continuum/release/distributed/manager/DefaultDistributedReleaseManager.java Mon Aug 13 04:29:09 2012
@@ -19,21 +19,6 @@ package org.apache.continuum.release.dis
  * under the License.
  */
 
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
-import javax.xml.stream.XMLStreamException;
-
 import org.apache.continuum.builder.distributed.manager.DistributedBuildManager;
 import org.apache.continuum.configuration.BuildAgentConfiguration;
 import org.apache.continuum.configuration.BuildAgentConfigurationException;
@@ -57,6 +42,20 @@ import org.codehaus.plexus.util.StringUt
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import javax.xml.stream.XMLStreamException;
+
 /**
  * @plexus.component role="org.apache.continuum.release.distributed.manager.DistributedReleaseManager"
  */
@@ -103,14 +102,17 @@ public class DefaultDistributedReleaseMa
         {
             if ( distributedBuildManager.isAgentAvailable( buildAgentUrl ) )
             {
-                SlaveBuildAgentTransportService client = createSlaveBuildAgentTransportClientConnection( buildAgentUrl );
+                SlaveBuildAgentTransportService client = createSlaveBuildAgentTransportClientConnection(
+                    buildAgentUrl );
                 return client.getReleasePluginParameters( projectId, pomFilename );
             }
 
             // call reload in case we disable the build agent
             distributedBuildManager.reload();
 
-            throw new ContinuumReleaseException( "Failed to retrieve release plugin parameters because build agent " + buildAgentUrl + " is not available" );
+            throw new ContinuumReleaseException(
+                "Failed to retrieve release plugin parameters because build agent " + buildAgentUrl +
+                    " is not available" );
         }
         catch ( MalformedURLException e )
         {
@@ -140,14 +142,16 @@ public class DefaultDistributedReleaseMa
         {
             if ( distributedBuildManager.isAgentAvailable( buildAgentUrl ) )
             {
-                SlaveBuildAgentTransportService client = createSlaveBuildAgentTransportClientConnection( buildAgentUrl );
+                SlaveBuildAgentTransportService client = createSlaveBuildAgentTransportClientConnection(
+                    buildAgentUrl );
                 return client.processProject( projectId, pomFilename, autoVersionSubmodules );
             }
 
             // call reload in case we disable the build agent
             distributedBuildManager.reload();
 
-            throw new ContinuumReleaseException( "Failed to process project for releasing because build agent " + buildAgentUrl + " is unavailable" );
+            throw new ContinuumReleaseException(
+                "Failed to process project for releasing because build agent " + buildAgentUrl + " is unavailable" );
         }
         catch ( MalformedURLException e )
         {
@@ -162,7 +166,8 @@ public class DefaultDistributedReleaseMa
     }
 
     public String releasePrepare( Project project, Properties releaseProperties, Map<String, String> releaseVersion,
-                                  Map<String, String> developmentVersion, Map<String, String> environments, String username )
+                                  Map<String, String> developmentVersion, Map<String, String> environments,
+                                  String username )
         throws ContinuumReleaseException, BuildAgentConfigurationException
     {
         String buildAgentUrl = environments.get( DistributedReleaseUtil.KEY_BUILD_AGENT_URL );
@@ -176,23 +181,25 @@ public class DefaultDistributedReleaseMa
         {
             if ( distributedBuildManager.isAgentAvailable( buildAgentUrl ) )
             {
-                SlaveBuildAgentTransportService client = createSlaveBuildAgentTransportClientConnection( buildAgentUrl );
-    
-                String releaseId =
-                    client.releasePrepare( createProjectMap( project ), releaseProperties,
-                                           releaseVersion, developmentVersion, environments, username );
-    
-                addReleasePrepare( releaseId, buildAgentUrl, releaseVersion.get( releaseId ), "prepare", releaseProperties.getProperty( "preparation-goals" ), username );
-    
+                SlaveBuildAgentTransportService client = createSlaveBuildAgentTransportClientConnection(
+                    buildAgentUrl );
+
+                String releaseId = client.releasePrepare( createProjectMap( project ), releaseProperties,
+                                                          releaseVersion, developmentVersion, environments, username );
+
+                addReleasePrepare( releaseId, buildAgentUrl, releaseVersion.get( releaseId ), "prepare",
+                                   releaseProperties.getProperty( "preparation-goals" ), username );
+
                 addReleaseInProgress( releaseId, "prepare", project.getId(), username );
-    
+
                 return releaseId;
             }
 
             // call reload in case we disable the build agent
             distributedBuildManager.reload();
 
-            throw new ContinuumReleaseException( "Failed to prepare release project because the build agent " + buildAgentUrl + " is not available" );
+            throw new ContinuumReleaseException(
+                "Failed to prepare release project because the build agent " + buildAgentUrl + " is not available" );
         }
         catch ( MalformedURLException e )
         {
@@ -220,23 +227,25 @@ public class DefaultDistributedReleaseMa
         {
             if ( distributedBuildManager.isAgentAvailable( buildAgentUrl ) )
             {
-                SlaveBuildAgentTransportService client = createSlaveBuildAgentTransportClientConnection( buildAgentUrl );
+                SlaveBuildAgentTransportService client = createSlaveBuildAgentTransportClientConnection(
+                    buildAgentUrl );
                 Map<String, Object> result = client.getReleaseResult( releaseId );
-    
+
                 ReleaseResult releaseResult = new ReleaseResult();
                 releaseResult.setStartTime( DistributedReleaseUtil.getStartTime( result ) );
                 releaseResult.setEndTime( DistributedReleaseUtil.getEndTime( result ) );
                 releaseResult.setResultCode( DistributedReleaseUtil.getReleaseResultCode( result ) );
                 releaseResult.getOutputBuffer().append( DistributedReleaseUtil.getReleaseOutput( result ) );
-    
+
                 return releaseResult;
             }
 
             // call reload in case we disable a build agent
             distributedBuildManager.reload();
 
-            throw new ContinuumReleaseException( "Failed to get release result of " + releaseId + 
-                                                 " because the build agent " + buildAgentUrl + " is not available" );
+            throw new ContinuumReleaseException( "Failed to get release result of " + releaseId +
+                                                     " because the build agent " + buildAgentUrl +
+                                                     " is not available" );
         }
         catch ( MalformedURLException e )
         {
@@ -264,15 +273,17 @@ public class DefaultDistributedReleaseMa
         {
             if ( distributedBuildManager.isAgentAvailable( buildAgentUrl ) )
             {
-                SlaveBuildAgentTransportService client = createSlaveBuildAgentTransportClientConnection( buildAgentUrl );
+                SlaveBuildAgentTransportService client = createSlaveBuildAgentTransportClientConnection(
+                    buildAgentUrl );
                 return client.getListener( releaseId );
             }
 
             // call reload in case we disable the build agent
             distributedBuildManager.reload();
 
-            throw new ContinuumReleaseException( "Failed to get listener for " + releaseId + 
-                                                 " because the build agent " + buildAgentUrl + " is not available" );
+            throw new ContinuumReleaseException( "Failed to get listener for " + releaseId +
+                                                     " because the build agent " + buildAgentUrl +
+                                                     " is not available" );
         }
         catch ( MalformedURLException e )
         {
@@ -300,15 +311,17 @@ public class DefaultDistributedReleaseMa
         {
             if ( distributedBuildManager.isAgentAvailable( buildAgentUrl ) )
             {
-                SlaveBuildAgentTransportService client = createSlaveBuildAgentTransportClientConnection( buildAgentUrl );
+                SlaveBuildAgentTransportService client = createSlaveBuildAgentTransportClientConnection(
+                    buildAgentUrl );
                 client.removeListener( releaseId );
             }
 
             // call reload in case we disable the build agent
             distributedBuildManager.reload();
 
-            throw new ContinuumReleaseException( "Failed to remove listener of " + releaseId + 
-                                                 " because the build agent " + buildAgentUrl + " is not available" );
+            throw new ContinuumReleaseException( "Failed to remove listener of " + releaseId +
+                                                     " because the build agent " + buildAgentUrl +
+                                                     " is not available" );
         }
         catch ( MalformedURLException e )
         {
@@ -337,15 +350,17 @@ public class DefaultDistributedReleaseMa
         {
             if ( distributedBuildManager.isAgentAvailable( buildAgentUrl ) )
             {
-                SlaveBuildAgentTransportService client = createSlaveBuildAgentTransportClientConnection( buildAgentUrl );
+                SlaveBuildAgentTransportService client = createSlaveBuildAgentTransportClientConnection(
+                    buildAgentUrl );
                 return client.getPreparedReleaseName( releaseId );
             }
 
             // call reload in case we disable the build agent
             distributedBuildManager.reload();
 
-            throw new ContinuumReleaseException( "Failed to get prepared release name of " + releaseId + 
-                                                 " because the build agent " + buildAgentUrl + " is not available" );
+            throw new ContinuumReleaseException( "Failed to get prepared release name of " + releaseId +
+                                                     " because the build agent " + buildAgentUrl +
+                                                     " is not available" );
         }
         catch ( MalformedURLException e )
         {
@@ -365,7 +380,7 @@ public class DefaultDistributedReleaseMa
     {
         List<PreparedRelease> releases = getPreparedReleases();
 
-        for ( PreparedRelease release: releases )
+        for ( PreparedRelease release : releases )
         {
             if ( release.getReleaseId().equals( releaseId ) )
             {
@@ -396,17 +411,18 @@ public class DefaultDistributedReleaseMa
         map.put( DistributedReleaseUtil.KEY_USERNAME, username );
 
         if ( repository != null )
-        {   
-            map.put( DistributedReleaseUtil.KEY_LOCAL_REPOSITORY_NAME, repository.getName() );         
+        {
+            map.put( DistributedReleaseUtil.KEY_LOCAL_REPOSITORY_NAME, repository.getName() );
         }
 
         try
         {
             if ( distributedBuildManager.isAgentAvailable( buildAgentUrl ) )
             {
-                SlaveBuildAgentTransportService client = createSlaveBuildAgentTransportClientConnection( buildAgentUrl );
+                SlaveBuildAgentTransportService client = createSlaveBuildAgentTransportClientConnection(
+                    buildAgentUrl );
                 client.releasePerform( releaseId, goals, arguments, useReleaseProfile, map, username );
-    
+
                 addReleaseInProgress( releaseId, "perform", projectId, username );
             }
             else
@@ -414,8 +430,9 @@ public class DefaultDistributedReleaseMa
                 // call reload in case we disable the build agent
                 distributedBuildManager.reload();
 
-                throw new ContinuumReleaseException( "Failed to perform release of " + releaseId + 
-                                                     " because the build agent " + buildAgentUrl + " is not available" );
+                throw new ContinuumReleaseException( "Failed to perform release of " + releaseId +
+                                                         " because the build agent " + buildAgentUrl +
+                                                         " is not available" );
             }
         }
         catch ( MalformedURLException e )
@@ -432,7 +449,8 @@ public class DefaultDistributedReleaseMa
 
     public String releasePerformFromScm( int projectId, String goals, String arguments, boolean useReleaseProfile,
                                          LocalRepository repository, String scmUrl, String scmUsername,
-                                         String scmPassword, String scmTag, String scmTagBase, Map environments, String username )
+                                         String scmPassword, String scmTag, String scmTagBase, Map environments,
+                                         String username )
         throws ContinuumReleaseException, BuildAgentConfigurationException
     {
         String buildAgentUrl = (String) environments.get( DistributedReleaseUtil.KEY_BUILD_AGENT_URL );
@@ -456,29 +474,31 @@ public class DefaultDistributedReleaseMa
         map.put( DistributedReleaseUtil.KEY_USERNAME, username );
 
         if ( repository != null )
-        {            
-            map.put( DistributedReleaseUtil.KEY_LOCAL_REPOSITORY_NAME, repository.getName() );         
+        {
+            map.put( DistributedReleaseUtil.KEY_LOCAL_REPOSITORY_NAME, repository.getName() );
         }
 
         try
         {
             if ( distributedBuildManager.isAgentAvailable( buildAgentUrl ) )
             {
-                SlaveBuildAgentTransportService client = createSlaveBuildAgentTransportClientConnection( buildAgentUrl );
-                String releaseId =
-                    client.releasePerformFromScm( goals, arguments, useReleaseProfile, map, scmUrl, scmUsername,
-                                                  scmPassword, scmTag, scmTagBase, environments, username );
-    
+                SlaveBuildAgentTransportService client = createSlaveBuildAgentTransportClientConnection(
+                    buildAgentUrl );
+                String releaseId = client.releasePerformFromScm( goals, arguments, useReleaseProfile, map, scmUrl,
+                                                                 scmUsername, scmPassword, scmTag, scmTagBase,
+                                                                 environments, username );
+
                 addReleasePrepare( releaseId, buildAgentUrl, scmTag, "perform", goals, username );
                 addReleaseInProgress( releaseId, "perform", projectId, username );
-    
+
                 return releaseId;
             }
 
             // call reload in case we disable the build agent
             distributedBuildManager.reload();
 
-            throw new ContinuumReleaseException( "Failed to perform release because the build agent " + buildAgentUrl + " is not available" );
+            throw new ContinuumReleaseException(
+                "Failed to perform release because the build agent " + buildAgentUrl + " is not available" );
         }
         catch ( MalformedURLException e )
         {
@@ -506,16 +526,18 @@ public class DefaultDistributedReleaseMa
         {
             if ( distributedBuildManager.isAgentAvailable( buildAgentUrl ) )
             {
-                SlaveBuildAgentTransportService client = createSlaveBuildAgentTransportClientConnection( buildAgentUrl );
+                SlaveBuildAgentTransportService client = createSlaveBuildAgentTransportClientConnection(
+                    buildAgentUrl );
                 client.releaseRollback( releaseId, projectId );
                 return;
             }
-            
+
             // call reload in case we disable the build agent
             distributedBuildManager.reload();
 
-            throw new ContinuumReleaseException( "Unable to rollback release " + releaseId + 
-                                                 " because the build agent " + buildAgentUrl + " is not available" );
+            throw new ContinuumReleaseException( "Unable to rollback release " + releaseId +
+                                                     " because the build agent " + buildAgentUrl +
+                                                     " is not available" );
         }
         catch ( MalformedURLException e )
         {
@@ -546,17 +568,19 @@ public class DefaultDistributedReleaseMa
                 removeFromReleaseInProgress( releaseId );
                 removeFromPreparedReleases( releaseId );
 
-                SlaveBuildAgentTransportService client = createSlaveBuildAgentTransportClientConnection( buildAgentUrl );
+                SlaveBuildAgentTransportService client = createSlaveBuildAgentTransportClientConnection(
+                    buildAgentUrl );
                 String result = client.releaseCleanup( releaseId );
-    
+
                 return result;
             }
 
             // call reload in case we disable the build agent
             distributedBuildManager.reload();
 
-            throw new ContinuumReleaseException( "Failed to cleanup release of " + releaseId + 
-                                                 " because the build agent " + buildAgentUrl + " is not available" );
+            throw new ContinuumReleaseException( "Failed to cleanup release of " + releaseId +
+                                                     " because the build agent " + buildAgentUrl +
+                                                     " is not available" );
         }
         catch ( MalformedURLException e )
         {
@@ -593,17 +617,18 @@ public class DefaultDistributedReleaseMa
                     {
                         if ( distributedBuildManager.isAgentAvailable( buildAgentUrl ) )
                         {
-                            SlaveBuildAgentTransportService client = createSlaveBuildAgentTransportClientConnection( buildAgentUrl );
+                            SlaveBuildAgentTransportService client = createSlaveBuildAgentTransportClientConnection(
+                                buildAgentUrl );
                             Map map = client.getListener( releaseId );
-    
+
                             if ( map != null && !map.isEmpty() )
                             {
                                 Map<String, Object> release = releasesInProgress.get( releaseId );
                                 release.put( DistributedReleaseUtil.KEY_RELEASE_ID, releaseId );
                                 release.put( DistributedReleaseUtil.KEY_BUILD_AGENT_URL, buildAgentUrl );
-    
+
                                 releases.add( release );
-    
+
                                 releasesMap.put( releaseId, releasesInProgress.get( releaseId ) );
                             }
                         }
@@ -636,11 +661,11 @@ public class DefaultDistributedReleaseMa
 
         return releases;
     }
-    
+
     public String getDefaultBuildagent( int projectId )
     {
         BuildResult buildResult = buildResultDao.getLatestBuildResultForProject( projectId );
-        
+
         return buildResult != null ? buildResult.getBuildUrl() : null;
     }
 
@@ -651,8 +676,7 @@ public class DefaultDistributedReleaseMa
 
         for ( PreparedRelease release : releases )
         {
-            if ( release.getReleaseId().equals( releaseId ) &&
-                            release.getReleaseType().equals( releaseType ) )
+            if ( release.getReleaseId().equals( releaseId ) && release.getReleaseType().equals( releaseType ) )
             {
                 return release;
             }
@@ -661,10 +685,11 @@ public class DefaultDistributedReleaseMa
         return null;
     }
 
-    public SlaveBuildAgentTransportService createSlaveBuildAgentTransportClientConnection( String buildAgentUrl ) 
+    public SlaveBuildAgentTransportService createSlaveBuildAgentTransportClientConnection( String buildAgentUrl )
         throws MalformedURLException, Exception
     {
-        return new SlaveBuildAgentTransportClient( new URL( buildAgentUrl ), "", configurationService.getSharedSecretPassword() );
+        return new SlaveBuildAgentTransportClient( new URL( buildAgentUrl ), "",
+                                                   configurationService.getSharedSecretPassword() );
     }
 
     private Map createProjectMap( Project project )
@@ -722,7 +747,7 @@ public class DefaultDistributedReleaseMa
         return null;
     }
 
-    private void addReleasePrepare( String releaseId, String buildAgentUrl, String releaseName, String releaseType, 
+    private void addReleasePrepare( String releaseId, String buildAgentUrl, String releaseName, String releaseType,
                                     String releaseGoals, String username )
         throws ContinuumReleaseException
     {
@@ -800,7 +825,7 @@ public class DefaultDistributedReleaseMa
     private File getPreparedReleasesFile()
     {
         return new File( System.getProperty( "appserver.base" ) + File.separator + "conf" + File.separator +
-            PREPARED_RELEASES_FILENAME );
+                             PREPARED_RELEASES_FILENAME );
     }
 
     private boolean checkBuildAgent( String buildAgentUrl )
@@ -835,7 +860,7 @@ public class DefaultDistributedReleaseMa
         }
     }
 
-    private void savePreparedReleases( List<PreparedRelease> preparedReleases)
+    private void savePreparedReleases( List<PreparedRelease> preparedReleases )
         throws ContinuumReleaseException
     {
         File file = getPreparedReleasesFile();
@@ -865,9 +890,9 @@ public class DefaultDistributedReleaseMa
             throw new ContinuumReleaseException( "Failed to write prepared releases in file", e );
         }
     }
-    
+
     // for unit test
-    
+
     public void setBuildResultDao( BuildResultDao buildResultDao )
     {
         this.buildResultDao = buildResultDao;

Modified: continuum/trunk/continuum-core/src/main/java/org/apache/continuum/repository/DefaultRepositoryService.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/continuum/repository/DefaultRepositoryService.java?rev=1372260&r1=1372259&r2=1372260&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/continuum/repository/DefaultRepositoryService.java (original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/continuum/repository/DefaultRepositoryService.java Mon Aug 13 04:29:09 2012
@@ -19,8 +19,6 @@ package org.apache.continuum.repository;
  * under the License.
  */
 
-import java.util.List;
-
 import org.apache.continuum.dao.LocalRepositoryDao;
 import org.apache.continuum.dao.ProjectGroupDao;
 import org.apache.continuum.dao.RepositoryPurgeConfigurationDao;
@@ -34,6 +32,8 @@ import org.apache.maven.continuum.store.
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.util.List;
+
 /**
  * DefaultRepositoryService
  *

Modified: continuum/trunk/continuum-core/src/main/java/org/apache/continuum/taskqueue/DefaultOverallBuildQueue.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/continuum/taskqueue/DefaultOverallBuildQueue.java?rev=1372260&r1=1372259&r2=1372260&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/continuum/taskqueue/DefaultOverallBuildQueue.java (original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/continuum/taskqueue/DefaultOverallBuildQueue.java Mon Aug 13 04:29:09 2012
@@ -19,13 +19,6 @@ package org.apache.continuum.taskqueue;
  * under the License.
  */
 
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.annotation.Resource;
-
 import org.apache.commons.lang.ArrayUtils;
 import org.apache.continuum.dao.BuildDefinitionDao;
 import org.apache.continuum.taskqueueexecutor.ParallelBuildsThreadedTaskQueueExecutor;
@@ -40,6 +33,12 @@ import org.codehaus.plexus.util.StringUt
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import javax.annotation.Resource;
+
 /**
  * "Overall" build queue which has a checkout queue and a build queue.
  *
@@ -292,7 +291,7 @@ public class DefaultOverallBuildQueue
         if ( task != null && task.getProjectId() == projectId )
         {
             log.info( "Cancelling checkout task for project '" + projectId + "' in task executor '" +
-                checkoutTaskQueueExecutor );
+                          checkoutTaskQueueExecutor );
             checkoutTaskQueueExecutor.cancelTask( task );
         }
     }
@@ -331,7 +330,7 @@ public class DefaultOverallBuildQueue
      * @see OverallBuildQueue#removeProjectFromBuildQueue(int, int, BuildTrigger, String, int)
      */
     public boolean removeProjectFromBuildQueue( int projectId, int buildDefinitionId, BuildTrigger buildTrigger,
-    		                                    String projectName, int projectGroupId )
+                                                String projectName, int projectGroupId )
         throws TaskQueueException
     {
         BuildDefinition buildDefinition;
@@ -352,9 +351,9 @@ public class DefaultOverallBuildQueue
             buildDefinitionLabel = buildDefinition.getGoals();
         }
 
-        BuildProjectTask buildProjectTask =
-        	                      new BuildProjectTask( projectId, buildDefinitionId, buildTrigger, projectName, 
-                                  buildDefinitionLabel, null, projectGroupId );
+        BuildProjectTask buildProjectTask = new BuildProjectTask( projectId, buildDefinitionId, buildTrigger,
+                                                                  projectName, buildDefinitionLabel, null,
+                                                                  projectGroupId );
 
         return getBuildQueue().remove( buildProjectTask );
     }
@@ -502,7 +501,8 @@ public class DefaultOverallBuildQueue
         {
             if ( task != null && task.getProjectGroupId() == projectGroupId && task.getProjectScmRootId() == scmRootId )
             {
-                log.info( "Project group {} with scm root {} is in prepare build queue {}", new Object[] { projectGroupId, scmRootId, task } );
+                log.info( "Project group {} with scm root {} is in prepare build queue {}",
+                          new Object[]{projectGroupId, scmRootId, task} );
                 return true;
             }
         }
@@ -519,9 +519,11 @@ public class DefaultOverallBuildQueue
         List<PrepareBuildProjectsTask> queue = getProjectsInPrepareBuildQueue();
         for ( PrepareBuildProjectsTask task : queue )
         {
-            if ( task != null && task.getProjectGroupId() == projectGroupId && task.getScmRootAddress().equals( scmRootAddress ) )
+            if ( task != null && task.getProjectGroupId() == projectGroupId && task.getScmRootAddress().equals(
+                scmRootAddress ) )
             {
-                log.info( "Project group {} with scm root {} is in prepare build queue {}", new Object[] { projectGroupId, scmRootAddress, task } );
+                log.info( "Project group {} with scm root {} is in prepare build queue {}",
+                          new Object[]{projectGroupId, scmRootAddress, task} );
                 return true;
             }
         }
@@ -537,9 +539,8 @@ public class DefaultOverallBuildQueue
         PrepareBuildProjectsTask task = (PrepareBuildProjectsTask) prepareBuildTaskQueueExecutor.getCurrentTask();
         if ( task != null && task.getProjectGroupId() == projectGroupId && task.getProjectScmRootId() == scmRootId )
         {
-            log.info(
-                "Cancelling prepare build task for project group '{}' with scmRootId '{}' in task executor '{}'", 
-                new Object[] { projectGroupId, scmRootId, prepareBuildTaskQueueExecutor } );
+            log.info( "Cancelling prepare build task for project group '{}' with scmRootId '{}' in task executor '{}'",
+                      new Object[]{projectGroupId, scmRootId, prepareBuildTaskQueueExecutor} );
             prepareBuildTaskQueueExecutor.cancelTask( task );
         }
     }
@@ -560,8 +561,8 @@ public class DefaultOverallBuildQueue
 
                 if ( projectIds.contains( new Integer( projectId ) ) )
                 {
-                    log.info(
-                             "Cancelling prepare build task for project '{}' in task executor '{}'", projectId, prepareBuildTaskQueueExecutor );
+                    log.info( "Cancelling prepare build task for project '{}' in task executor '{}'", projectId,
+                              prepareBuildTaskQueueExecutor );
                     prepareBuildTaskQueueExecutor.cancelTask( task );
                 }
             }

Modified: continuum/trunk/continuum-core/src/main/java/org/apache/continuum/taskqueue/manager/DefaultTaskQueueManager.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/continuum/taskqueue/manager/DefaultTaskQueueManager.java?rev=1372260&r1=1372259&r2=1372260&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/continuum/taskqueue/manager/DefaultTaskQueueManager.java (original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/continuum/taskqueue/manager/DefaultTaskQueueManager.java Mon Aug 13 04:29:09 2012
@@ -19,11 +19,6 @@ package org.apache.continuum.taskqueue.m
  * under the License.
  */
 
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
 import org.apache.commons.lang.ArrayUtils;
 import org.apache.continuum.buildmanager.BuildManagerException;
 import org.apache.continuum.buildmanager.BuildsManager;
@@ -51,6 +46,11 @@ import org.codehaus.plexus.taskqueue.exe
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
 /**
  * @author <a href="mailto:ctan@apache.org">Maria Catherine Tan</a>
  * @plexus.component role="org.apache.continuum.taskqueue.manager.TaskQueueManager" role-hint="default"
@@ -131,8 +131,8 @@ public class DefaultTaskQueueManager
             {
                 if ( task != null )
                 {
-                    if ( task.getProjectGroupId() == projectGroupId &&
-                        task.getScmRootAddress().equals( scmRootAddress ) )
+                    if ( task.getProjectGroupId() == projectGroupId && task.getScmRootAddress().equals(
+                        scmRootAddress ) )
                     {
                         return true;
                     }

Modified: continuum/trunk/continuum-core/src/main/java/org/apache/continuum/taskqueueexecutor/ParallelBuildsThreadedTaskQueueExecutor.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/continuum/taskqueueexecutor/ParallelBuildsThreadedTaskQueueExecutor.java?rev=1372260&r1=1372259&r2=1372260&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/continuum/taskqueueexecutor/ParallelBuildsThreadedTaskQueueExecutor.java (original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/continuum/taskqueueexecutor/ParallelBuildsThreadedTaskQueueExecutor.java Mon Aug 13 04:29:09 2012
@@ -19,6 +19,13 @@ package org.apache.continuum.taskqueueex
  * under the License.
  */
 
+import edu.emory.mathcs.backport.java.util.concurrent.CancellationException;
+import edu.emory.mathcs.backport.java.util.concurrent.ExecutionException;
+import edu.emory.mathcs.backport.java.util.concurrent.ExecutorService;
+import edu.emory.mathcs.backport.java.util.concurrent.Executors;
+import edu.emory.mathcs.backport.java.util.concurrent.Future;
+import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit;
+import edu.emory.mathcs.backport.java.util.concurrent.TimeoutException;
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.Startable;
@@ -33,14 +40,6 @@ import org.codehaus.plexus.util.StringUt
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import edu.emory.mathcs.backport.java.util.concurrent.CancellationException;
-import edu.emory.mathcs.backport.java.util.concurrent.ExecutionException;
-import edu.emory.mathcs.backport.java.util.concurrent.ExecutorService;
-import edu.emory.mathcs.backport.java.util.concurrent.Executors;
-import edu.emory.mathcs.backport.java.util.concurrent.Future;
-import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit;
-import edu.emory.mathcs.backport.java.util.concurrent.TimeoutException;
-
 /**
  * Modified plexus ThreadedTaskQueueExecutor
  */
@@ -99,8 +98,9 @@ public class ParallelBuildsThreadedTaskQ
                 }
                 catch ( InterruptedException e )
                 {
-                    log.info( "Executor thread interrupted, command: " +
-                        ( command == SHUTDOWN ? "Shutdown" : command == CANCEL_TASK ? "Cancel task" : "Unknown" ) );
+                    log.info( "Executor thread interrupted, command: " + ( command == SHUTDOWN
+                        ? "Shutdown"
+                        : command == CANCEL_TASK ? "Cancel task" : "Unknown" ) );
                     continue;
                 }
 



Mime
View raw message