continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r720121 - in /continuum/trunk: continuum-api/src/main/java/org/apache/maven/continuum/ continuum-core/src/main/java/org/apache/maven/continuum/ continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/
Date Mon, 24 Nov 2008 06:34:45 GMT
Author: ctan
Date: Sun Nov 23 22:34:45 2008
New Revision: 720121

URL: http://svn.apache.org/viewvc?rev=720121&view=rev
Log:
[CONTINUUM-1988] fixed error when building projects

Modified:
    continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
    continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
    continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectsListAction.java

Modified: continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java?rev=720121&r1=720120&r2=720121&view=diff
==============================================================================
--- continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
(original)
+++ continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
Sun Nov 23 22:34:45 2008
@@ -171,6 +171,12 @@
     void buildProjectsWithBuildDefinition( int buildDefinitionId )
         throws ContinuumException;
 
+    void buildProjectsWithBuildDefinition( List<Project> projects, List<BuildDefinition>
bds )
+        throws ContinuumException;
+
+    void buildProjectsWithBuildDefinition( List<Project> projects, int buildDefinitionId
)
+        throws ContinuumException;
+
     void buildProjects( int trigger )
         throws ContinuumException;
 
@@ -620,21 +626,6 @@
         throws ContinuumException;
 
     // ----------------------------------------------------------------------
-    //
-    // ----------------------------------------------------------------------
-    Collection<Map<Integer, Integer>> getProjectsAndBuildDefinitions( Collection<Project>
projects, 
-                                                             List<BuildDefinition>
bds,
-                                                             boolean checkDefaultBuildDefinitionForProject
)
-        throws ContinuumException;
-
-    Collection<Map<Integer, Integer>> getProjectsAndBuildDefinitions( Collection<Project>
projects, 
-                                                             int buildDefinitionId )
-        throws ContinuumException;
-
-    void prepareBuildProjects( Collection<Map<Integer, Integer>> projectsAndBuildDefinitions,
int trigger )
-        throws ContinuumException;
-
-    // ----------------------------------------------------------------------
     // Task Queue Manager
     // ----------------------------------------------------------------------
     TaskQueueManager getTaskQueueManager();

Modified: continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java?rev=720121&r1=720120&r2=720121&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
(original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
Sun Nov 23 22:34:45 2008
@@ -715,6 +715,18 @@
         buildProjects( ContinuumProjectState.TRIGGER_FORCED, buildDefinitionId );
     }
 
+    public void buildProjectsWithBuildDefinition( List<Project> projects, List<BuildDefinition>
bds )
+        throws ContinuumException
+    {
+        prepareBuildProjects( projects, bds, true, ContinuumProjectState.TRIGGER_FORCED );
+    }
+
+    public void buildProjectsWithBuildDefinition( List<Project> projects, int buildDefinitionId
)
+        throws ContinuumException
+    {
+        prepareBuildProjects( projects, buildDefinitionId, ContinuumProjectState.TRIGGER_FORCED
);
+    }
+
     /**
      * fire of the builds of all projects across all project groups using their default build
definitions
      *
@@ -737,9 +749,7 @@
             projectsList = getProjects();
         }
 
-        Collection<Map<Integer,Integer>> projectsAndBuildDefinitions = getProjectsAndBuildDefinitions(
projectsList, null, true );
-
-        prepareBuildProjects( projectsAndBuildDefinitions, trigger );
+        prepareBuildProjects( projectsList, null, true, trigger );
     }
 
     /**
@@ -765,9 +775,7 @@
             projectsList = getProjects();
         }
 
-        Collection<Map<Integer, Integer>> projectsAndBuildDefinitions = getProjectsAndBuildDefinitions(
projectsList, buildDefinitionId );
-
-        prepareBuildProjects( projectsAndBuildDefinitions, trigger );
+        prepareBuildProjects( projectsList, buildDefinitionId, trigger );
     }
 
     /**
@@ -828,11 +836,7 @@
             projectsList = getProjects();
         }
 
-        Collection<Map<Integer, Integer>> projectsAndBuildDefinitions = getProjectsAndBuildDefinitions(
projectsList, 
-                                                                                        
               bds,
-                                                                                        
               checkDefaultBuildDefinitionForProject );
-
-        prepareBuildProjects( projectsAndBuildDefinitions, ContinuumProjectState.TRIGGER_FORCED
);
+        prepareBuildProjects( projectsList, bds, checkDefaultBuildDefinitionForProject, ContinuumProjectState.TRIGGER_FORCED
);
     }
 
     /**
@@ -930,26 +934,7 @@
     public void buildProjectWithBuildDefinition( int projectId, int buildDefinitionId )
         throws ContinuumException
     {
-        try
-        {
-            if ( taskQueueManager.isInBuildingQueue( projectId ) || taskQueueManager.isInPrepareBuildQueue(
projectId ) )
-            {
-                return;
-            }
-
-            if ( taskQueueManager.isInCheckoutQueue( projectId ) )
-            {
-                taskQueueManager.removeProjectFromCheckoutQueue( projectId );
-            }
-        }
-        catch ( TaskQueueManagerException e )
-        {
-            throw new ContinuumException( e.getMessage(), e );
-        }
-
-        Map<Integer, Integer> projectsAndBuildDefinitionsMap = new HashMap<Integer,
Integer>( projectId, buildDefinitionId );
-
-        prepareBuildProjects( projectsAndBuildDefinitionsMap, ContinuumProjectState.TRIGGER_FORCED
);
+        buildProject( projectId, buildDefinitionId, ContinuumProjectState.TRIGGER_FORCED
);
     }
 
     public void buildProject( int projectId, int trigger )
@@ -976,31 +961,33 @@
             throw new ContinuumException( e.getMessage(), e );
         }
 
-        Map<Integer, Integer> projectsBuildDefinitionsMap = new HashMap<Integer,
Integer>( projectId, buildDef.getId() );
-
+        Map<Integer, Integer> projectsBuildDefinitionsMap = new HashMap<Integer,
Integer>();
+        projectsBuildDefinitionsMap.put( projectId, buildDef.getId() );
+        
         prepareBuildProjects( projectsBuildDefinitionsMap, trigger );
     }
 
     public void buildProject( int projectId, int buildDefinitionId, int trigger )
         throws ContinuumException
     {
-        Project project;
-
         try
         {
-            project = projectDao.getProject( projectId );
+            if ( taskQueueManager.isInBuildingQueue( projectId, buildDefinitionId ) || 
+                 taskQueueManager.isInCheckoutQueue( projectId ) ||
+                 taskQueueManager.isInPrepareBuildQueue( projectId ))
+            {
+                return;
+            }
         }
-        catch ( ContinuumStoreException e )
+        catch ( TaskQueueManagerException e )
         {
-            throw logAndCreateException( "Error while getting project " + projectId + ".",
e );
+            throw new ContinuumException( e.getMessage(), e );
         }
 
-        Map context = new HashMap();
-        context.put( AbstractContinuumAction.KEY_PROJECT, project );
-        context.put( AbstractContinuumAction.KEY_BUILD_DEFINITION_ID, buildDefinitionId );
-        context.put( AbstractContinuumAction.KEY_TRIGGER, trigger );
-        
-        executeAction( "create-build-project-task", context );
+        Map<Integer, Integer> projectsBuildDefinitionsMap = new HashMap<Integer,
Integer>();
+        projectsBuildDefinitionsMap.put( projectId, buildDefinitionId );
+
+        prepareBuildProjects( projectsBuildDefinitionsMap, trigger );
     }
 
     public BuildResult getBuildResult( int buildId )
@@ -3208,9 +3195,8 @@
         return null;
     }
    
-    public Collection<Map<Integer, Integer>> getProjectsAndBuildDefinitions(
Collection<Project> projects, 
-                                                                             List<BuildDefinition>
bds,
-                                                                             boolean checkDefaultBuildDefinitionForProject
)
+    private void prepareBuildProjects( Collection<Project> projects, List<BuildDefinition>
bds,
+                                      boolean checkDefaultBuildDefinitionForProject, int
trigger )
         throws ContinuumException
     {
         Map<String, Map<Integer, Integer>> map = new HashMap<String, Map<Integer,
Integer>>();
@@ -3303,11 +3289,10 @@
             map.put( scmRootAddress, projectsAndBuildDefinitionsMap );
         }
 
-        return map.values();
+        prepareBuildProjects( map.values(), trigger );
     }
 
-    public Collection<Map<Integer, Integer>> getProjectsAndBuildDefinitions(
Collection<Project> projects, 
-                                                                             int buildDefinitionId
)
+    private void prepareBuildProjects( Collection<Project> projects, int buildDefinitionId,
int trigger )
         throws ContinuumException
     {
         Map<String, Map<Integer,Integer>> map = new HashMap<String, Map<Integer,
Integer>>();
@@ -3354,10 +3339,10 @@
             }
         }
 
-        return map.values();
+        prepareBuildProjects( map.values(), trigger );
     }
 
-    public void prepareBuildProjects( Collection<Map<Integer, Integer>> projectsBuildDefinitions,
int trigger )
+    private void prepareBuildProjects( Collection<Map<Integer, Integer>> projectsBuildDefinitions,
int trigger )
         throws ContinuumException
     {
         for ( Map<Integer, Integer> map : projectsBuildDefinitions )
@@ -3366,7 +3351,7 @@
         }
     }
 
-    public void prepareBuildProjects( Map<Integer, Integer> projectsBuildDefinitionsMap,
int trigger )
+    private void prepareBuildProjects( Map<Integer, Integer> projectsBuildDefinitionsMap,
int trigger )
         throws ContinuumException
     {
         try

Modified: continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectsListAction.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectsListAction.java?rev=720121&r1=720120&r2=720121&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectsListAction.java
(original)
+++ continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectsListAction.java
Sun Nov 23 22:34:45 2008
@@ -159,37 +159,18 @@
                 sortedProjects = projectsList;
             }
 
-            Collection<Map<Integer, Integer>> projectsBuildDefs = getProjectsBuildDefsMap(
sortedProjects );
-
-            getContinuum().prepareBuildProjects( projectsBuildDefs, ContinuumProjectState.TRIGGER_FORCED
);
-        }
-
-        return SUCCESS;
-    }
-
-    private Collection<Map<Integer, Integer>> getProjectsBuildDefsMap( List<Project>
projects )
-        throws ContinuumException
-    {
-        if ( this.getBuildDefinitionId() <= 0 )
-        {
-            boolean checkDefaultBuildDefinitionForProject = false;
-
-            if ( this.getBuildDefinitionId() == -1 )
+            if ( this.getBuildDefinitionId() <= 0 )
             {
-                checkDefaultBuildDefinitionForProject = true;
+                List<BuildDefinition> groupDefaultBDs = getContinuum().getDefaultBuildDefinitionsForProjectGroup(
projectGroupId );
+                getContinuum().buildProjectsWithBuildDefinition( sortedProjects, groupDefaultBDs
);
+            }
+            else
+            {
+                getContinuum().buildProjectsWithBuildDefinition( sortedProjects, buildDefinitionId
);
             }
-
-            List<BuildDefinition> groupDefaultBDs = getContinuum().getDefaultBuildDefinitionsForProjectGroup(
projectGroupId );
-
-            return getContinuum().getProjectsAndBuildDefinitions( projects, 
-                                                                  groupDefaultBDs, 
-                                                                  checkDefaultBuildDefinitionForProject
);
-        }
-        else
-        {
-            return getContinuum().getProjectsAndBuildDefinitions( projects,
-                                                                  this.getBuildDefinitionId()
);
         }
+
+        return SUCCESS;
     }
 
     public String getProjectGroupName()



Mime
View raw message