continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r719982 - in /continuum/branches/continuum-distributed-builds: continuum-api/src/main/java/org/apache/continuum/configuration/ continuum-api/src/main/java/org/apache/maven/continuum/ continuum-base/continuum-configuration/src/main/java/org/...
Date Sun, 23 Nov 2008 12:26:06 GMT
Author: ctan
Date: Sun Nov 23 04:26:05 2008
New Revision: 719982

URL: http://svn.apache.org/viewvc?rev=719982&view=rev
Log:
more fix

Modified:
    continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/continuum/configuration/BuildAgentConfiguration.java
    continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
    continuum/branches/continuum-distributed-builds/continuum-base/continuum-configuration/src/main/java/org/apache/continuum/configuration/DefaultContinuumConfiguration.java
    continuum/branches/continuum-distributed-builds/continuum-base/continuum-configuration/src/main/mdo/continuum-configuration.xml
    continuum/branches/continuum-distributed-builds/continuum-base/continuum-configuration/src/test/java/org/apache/continuum/configuration/TestDefaultContinuumConfiguration.java
    continuum/branches/continuum-distributed-builds/continuum-base/continuum-configuration/src/test/resources/conf/continuum.xml
    continuum/branches/continuum-distributed-builds/continuum-commons/src/test/java/org/apache/maven/continuum/configuration/ConfigurationServiceTest.java
    continuum/branches/continuum-distributed-builds/continuum-commons/src/test/resources/conf/continuum.xml
    continuum/branches/continuum-distributed-builds/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
    continuum/branches/continuum-distributed-builds/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectsListAction.java

Modified: continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/continuum/configuration/BuildAgentConfiguration.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/continuum/configuration/BuildAgentConfiguration.java?rev=719982&r1=719981&r2=719982&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/continuum/configuration/BuildAgentConfiguration.java
(original)
+++ continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/continuum/configuration/BuildAgentConfiguration.java
Sun Nov 23 04:26:05 2008
@@ -4,8 +4,6 @@
 {
     private String url;
 
-    private String type;
-
     private String description;
 
     private boolean enabled;
@@ -15,15 +13,9 @@
         // do nothing
     }
 
-    public BuildAgentConfiguration( String url, String type, boolean enabled )
-    {
-        this( url, type, null, enabled );
-    }
-
-    public BuildAgentConfiguration( String url, String type, String description, boolean
enabled )
+    public BuildAgentConfiguration( String url, String description, boolean enabled )
     {
         this.url = url;
-        this.type = type;
         this.enabled = enabled;
         this.description = description;
     }
@@ -38,16 +30,6 @@
         this.url = url;
     }
 
-    public String getType()
-    {
-        return type;
-    }
-
-    public void setType( String type )
-    {
-        this.type = type;
-    }
-
     public String getDescription()
     {
         return description;

Modified: continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java?rev=719982&r1=719981&r2=719982&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
(original)
+++ continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
Sun Nov 23 04:26:05 2008
@@ -31,7 +31,6 @@
 import org.apache.continuum.repository.RepositoryService;
 import org.apache.continuum.taskqueue.manager.TaskQueueManager;
 import org.apache.maven.continuum.builddefinition.BuildDefinitionService;
-import org.apache.maven.continuum.buildqueue.BuildProjectTask;
 import org.apache.maven.continuum.configuration.ConfigurationService;
 import org.apache.maven.continuum.installation.InstallationService;
 import org.apache.maven.continuum.model.project.BuildDefinition;
@@ -44,7 +43,6 @@
 import org.apache.maven.continuum.profile.ProfileService;
 import org.apache.maven.continuum.project.builder.ContinuumProjectBuildingResult;
 import org.apache.maven.continuum.release.ContinuumReleaseManager;
-import org.codehaus.plexus.taskqueue.execution.TaskQueueExecutor;
 import org.codehaus.plexus.util.dag.CycleDetectedException;
 
 /**
@@ -171,6 +169,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 +624,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/branches/continuum-distributed-builds/continuum-base/continuum-configuration/src/main/java/org/apache/continuum/configuration/DefaultContinuumConfiguration.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-base/continuum-configuration/src/main/java/org/apache/continuum/configuration/DefaultContinuumConfiguration.java?rev=719982&r1=719981&r2=719982&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-base/continuum-configuration/src/main/java/org/apache/continuum/configuration/DefaultContinuumConfiguration.java
(original)
+++ continuum/branches/continuum-distributed-builds/continuum-base/continuum-configuration/src/main/java/org/apache/continuum/configuration/DefaultContinuumConfiguration.java
Sun Nov 23 04:26:05 2008
@@ -158,9 +158,8 @@
                 List<org.apache.continuum.configuration.model.BuildAgentConfiguration>
agents = configuration.getBuildAgents();
                 for ( org.apache.continuum.configuration.model.BuildAgentConfiguration agent
: agents )
                 {
-                    BuildAgentConfiguration buildAgent = new BuildAgentConfiguration( agent.getUrl(),

-                                                                                      agent.getType(),
-                                                                                      agent.Description(),
+                    BuildAgentConfiguration buildAgent = new BuildAgentConfiguration( agent.getUrl(),
+                                                                                      agent.getDescription(),
                                                                                       agent.isEnabled()
);
                     buildAgents.add( buildAgent );
                 }
@@ -237,7 +236,6 @@
                     buildAgent.setUrl( agent.getUrl() );
                     buildAgent.setDescription( agent.getDescription() );
                     buildAgent.setEnabled( agent.isEnabled() );
-                    buildAgent.setType( agent.getType() );
                     
                     buildAgents.add( buildAgent );
                 }

Modified: continuum/branches/continuum-distributed-builds/continuum-base/continuum-configuration/src/main/mdo/continuum-configuration.xml
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-base/continuum-configuration/src/main/mdo/continuum-configuration.xml?rev=719982&r1=719981&r2=719982&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-base/continuum-configuration/src/main/mdo/continuum-configuration.xml
(original)
+++ continuum/branches/continuum-distributed-builds/continuum-base/continuum-configuration/src/main/mdo/continuum-configuration.xml
Sun Nov 23 04:26:05 2008
@@ -121,11 +121,6 @@
           <version>1.0.1+</version>
           <type>boolean</type>
         </field>
-        <field jpox.column="buildagent_type">
-          <name>type</name>
-          <version>1.0.1+</version>
-          <type>String</type>
-        </field>
       </fields>
     </class>    
   </classes>

Modified: continuum/branches/continuum-distributed-builds/continuum-base/continuum-configuration/src/test/java/org/apache/continuum/configuration/TestDefaultContinuumConfiguration.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-base/continuum-configuration/src/test/java/org/apache/continuum/configuration/TestDefaultContinuumConfiguration.java?rev=719982&r1=719981&r2=719982&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-base/continuum-configuration/src/test/java/org/apache/continuum/configuration/TestDefaultContinuumConfiguration.java
(original)
+++ continuum/branches/continuum-distributed-builds/continuum-base/continuum-configuration/src/test/java/org/apache/continuum/configuration/TestDefaultContinuumConfiguration.java
Sun Nov 23 04:26:05 2008
@@ -73,7 +73,6 @@
         org.apache.continuum.configuration.BuildAgentConfiguration buildAgentConfig = generalConfiguration.getBuildAgents().get(
0 );
         assertEquals( "http://buildagent/xmlrpc", buildAgentConfig.getUrl() );
         assertEquals( "linux", buildAgentConfig.getDescription() );
-        assertEquals( "remote", buildAgentConfig.getType() );
         assertTrue( buildAgentConfig.isEnabled() );
     }
 
@@ -99,7 +98,6 @@
         buildAgentConfiguration.setUrl( "http://buildagent/test" );
         buildAgentConfiguration.setDescription( "windows xp" );
         buildAgentConfiguration.setEnabled( false );
-        buildAgentConfiguration.setType( "local" );
         List<BuildAgentConfiguration> buildAgents = new ArrayList<BuildAgentConfiguration>();
         buildAgents.add( buildAgentConfiguration );
         generalConfiguration.setBuildAgents( buildAgents );
@@ -119,7 +117,6 @@
         assertEquals( 8080, configuration.getGeneralConfiguration().getProxyConfiguration().getProxyPort()
);
         assertEquals(targetDir.getPath(), configuration.getGeneralConfiguration().getBuildOutputDirectory().getPath());
         assertEquals( "http://buildagent/test", configuration.getGeneralConfiguration().getBuildAgents().get(
0 ).getUrl() );
-        assertEquals( "local", configuration.getGeneralConfiguration().getBuildAgents().get(
0 ).getType() );
         assertFalse( configuration.getGeneralConfiguration().getBuildAgents().get( 0 ).isEnabled()
);
         log.info( "generalConfiguration " + configuration.getGeneralConfiguration().toString()
);
     }

Modified: continuum/branches/continuum-distributed-builds/continuum-base/continuum-configuration/src/test/resources/conf/continuum.xml
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-base/continuum-configuration/src/test/resources/conf/continuum.xml?rev=719982&r1=719981&r2=719982&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-base/continuum-configuration/src/test/resources/conf/continuum.xml
(original)
+++ continuum/branches/continuum-distributed-builds/continuum-base/continuum-configuration/src/test/resources/conf/continuum.xml
Sun Nov 23 04:26:05 2008
@@ -7,7 +7,6 @@
       <url>http://buildagent/xmlrpc</url>
       <description>linux</description>
       <enabled>true</enabled>
-      <type>remote</type>
     </buildAgent>
   </buildAgents>
 </continuum-configuration>
\ No newline at end of file

Modified: continuum/branches/continuum-distributed-builds/continuum-commons/src/test/java/org/apache/maven/continuum/configuration/ConfigurationServiceTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-commons/src/test/java/org/apache/maven/continuum/configuration/ConfigurationServiceTest.java?rev=719982&r1=719981&r2=719982&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-commons/src/test/java/org/apache/maven/continuum/configuration/ConfigurationServiceTest.java
(original)
+++ continuum/branches/continuum-distributed-builds/continuum-commons/src/test/java/org/apache/maven/continuum/configuration/ConfigurationServiceTest.java
Sun Nov 23 04:26:05 2008
@@ -94,7 +94,7 @@
         service.setUrl( "http://test/zloug" );
         service.setBuildOutputDirectory( new File( "testBuildOutputDir" ) );
 
-        BuildAgentConfiguration buildAgent = new BuildAgentConfiguration( "http://test/xmlrpc",
"local", "windows", false );
+        BuildAgentConfiguration buildAgent = new BuildAgentConfiguration( "http://test/xmlrpc",
"windows", false );
         service.addBuildAgent( buildAgent );
 
         service.store();
@@ -107,7 +107,6 @@
         assertEquals( "http://test/zloug", service.getUrl() );
         assertEquals( "check # build agents", 2, service.getBuildAgents().size() );     
  
         assertEquals( "http://test/xmlrpc", service.getBuildAgents().get( 1 ).getUrl() );
-        assertEquals( "local", service.getBuildAgents().get( 1 ).getType() );
         assertEquals( "windows", service.getBuildAgents().get( 1 ).getDescription() );
         assertFalse( service.getBuildAgents().get( 1 ).isEnabled() );
 
@@ -119,7 +118,6 @@
         assertEquals( "check # build agents", 1, service.getBuildAgents().size() );
         assertEquals( "http://buildagent/xmlrpc", service.getBuildAgents().get( 0 ).getUrl()
);
         assertEquals( "linux", service.getBuildAgents().get( 0 ).getDescription() );
-        assertEquals( "remote", service.getBuildAgents().get( 0 ).getType() );
         assertTrue( service.getBuildAgents().get( 0 ).isEnabled() );
     }
 }

Modified: continuum/branches/continuum-distributed-builds/continuum-commons/src/test/resources/conf/continuum.xml
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-commons/src/test/resources/conf/continuum.xml?rev=719982&r1=719981&r2=719982&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-commons/src/test/resources/conf/continuum.xml
(original)
+++ continuum/branches/continuum-distributed-builds/continuum-commons/src/test/resources/conf/continuum.xml
Sun Nov 23 04:26:05 2008
@@ -7,7 +7,6 @@
       <url>http://buildagent/xmlrpc</url>
       <description>linux</description>
       <enabled>true</enabled>
-      <type>remote</type>
     </buildAgent>
   </buildAgents>
   <distributedBuildEnabled>true</distributedBuildEnabled>

Modified: continuum/branches/continuum-distributed-builds/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java?rev=719982&r1=719981&r2=719982&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
(original)
+++ continuum/branches/continuum-distributed-builds/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
Sun Nov 23 04:26:05 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
);
     }
 
     /**
@@ -874,7 +878,7 @@
             projectsList = getProjects();
         }
 
-        Map<String, Map<Integer, Integer>> map = new HashMap<String, Map<Integer,
Integer>>();
+        Map<ProjectScmRoot, Map<Integer, Integer>> map = new HashMap<ProjectScmRoot,
Map<Integer, Integer>>();
 
         for ( Project project : projectsList )
         {
@@ -890,15 +894,8 @@
                             !taskQueueManager.isInCheckoutQueue( project.getId() ) &&
!taskQueueManager.isInPrepareBuildQueue( project.getId() ) )
                         {
                             ProjectScmRoot scmRoot = getProjectScmRootByProject( project.getId()
);
-                            
-                            String scmRootAddress = "";
-
-                            if ( scmRoot != null )
-                            {
-                                scmRootAddress = scmRoot.getScmRootAddress();
-                            }
 
-                            Map<Integer, Integer> projectsAndBuildDefinitionsMap =
map.get( scmRootAddress );
+                            Map<Integer, Integer> projectsAndBuildDefinitionsMap =
map.get( scmRoot );
                             
                             if ( projectsAndBuildDefinitionsMap == null )
                             {
@@ -907,7 +904,7 @@
                             
                             projectsAndBuildDefinitionsMap.put( project.getId(), buildDefId
);
                             
-                            map.put( scmRootAddress, projectsAndBuildDefinitionsMap );
+                            map.put( scmRoot, projectsAndBuildDefinitionsMap );
                         }
                     } 
                     catch ( TaskQueueManagerException e )
@@ -984,23 +981,23 @@
     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>( projectId, buildDefinitionId );
+
+        prepareBuildProjects( projectsBuildDefinitionsMap, trigger );
     }
 
     public BuildResult getBuildResult( int buildId )
@@ -3208,12 +3205,11 @@
         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>>();
+        Map<ProjectScmRoot, Map<Integer, Integer>> map = new HashMap<ProjectScmRoot,
Map<Integer, Integer>>();
 
         for ( Project project : projects )
         {
@@ -3285,13 +3281,7 @@
 
             ProjectScmRoot scmRoot = getProjectScmRootByProject( projectId );
 
-            String scmRootAddress = "";
-            if ( scmRoot != null )
-            {
-                scmRootAddress = scmRoot.getScmRootAddress();
-            }
-
-            Map<Integer, Integer> projectsAndBuildDefinitionsMap = map.get( scmRootAddress
);
+            Map<Integer, Integer> projectsAndBuildDefinitionsMap = map.get( scmRoot
);
 
             if ( projectsAndBuildDefinitionsMap == null )
             {
@@ -3300,17 +3290,16 @@
 
             projectsAndBuildDefinitionsMap.put( projectId, buildDefId );
 
-            map.put( scmRootAddress, projectsAndBuildDefinitionsMap );
+            map.put( scmRoot, 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>>();
+        Map<ProjectScmRoot, Map<Integer,Integer>> map = new HashMap<ProjectScmRoot,
Map<Integer, Integer>>();
 
         for ( Project project : projects )
         {
@@ -3331,13 +3320,7 @@
                 
                 ProjectScmRoot scmRoot = getProjectScmRootByProject( projectId );
 
-                String scmRootAddress = "";
-                if ( scmRoot != null )
-                {
-                    scmRootAddress = scmRoot.getScmRootAddress();
-                }
-                
-                Map<Integer, Integer> projectsAndBuildDefinitionsMap = map.get( scmRootAddress
);
+                Map<Integer, Integer> projectsAndBuildDefinitionsMap = map.get( scmRoot
);
                 
                 if ( projectsAndBuildDefinitionsMap == null )
                 {
@@ -3346,7 +3329,7 @@
                 
                 projectsAndBuildDefinitionsMap.put( projectId, buildDefinitionId );
                 
-                map.put( scmRootAddress, projectsAndBuildDefinitionsMap );
+                map.put( scmRoot, projectsAndBuildDefinitionsMap );
             }
             catch ( TaskQueueManagerException e )
             {
@@ -3354,10 +3337,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,17 +3349,24 @@
         }
     }
 
-    public void prepareBuildProjects( Map<Integer, Integer> projectsBuildDefinitionsMap,
int trigger )
+    private void prepareBuildProjects( Map<Integer, Integer> projectsBuildDefinitionsMap,
int trigger )
         throws ContinuumException
     {
-        try
+        if ( configurationService.isDistributedBuildEnabled() )
         {
-            PrepareBuildProjectsTask task = new PrepareBuildProjectsTask( projectsBuildDefinitionsMap,
trigger );
-            taskQueueManager.getPrepareBuildQueue().put( task );
+            
         }
-        catch ( TaskQueueException e )
+        else
         {
-            throw logAndCreateException( "Error while creating enqueuing object.", e );
+            try
+            {
+                PrepareBuildProjectsTask task = new PrepareBuildProjectsTask( projectsBuildDefinitionsMap,
trigger );
+                taskQueueManager.getPrepareBuildQueue().put( task );
+            }
+            catch ( TaskQueueException e )
+            {
+                throw logAndCreateException( "Error while creating enqueuing object.", e
);
+            }
         }
     }
 

Modified: continuum/branches/continuum-distributed-builds/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectsListAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectsListAction.java?rev=719982&r1=719981&r2=719982&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectsListAction.java
(original)
+++ continuum/branches/continuum-distributed-builds/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectsListAction.java
Sun Nov 23 04:26:05 2008
@@ -20,15 +20,12 @@
  */
 
 import java.util.ArrayList;
-import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
-import java.util.Map;
 
 import org.apache.maven.continuum.ContinuumException;
 import org.apache.maven.continuum.model.project.BuildDefinition;
 import org.apache.maven.continuum.model.project.Project;
-import org.apache.maven.continuum.project.ContinuumProjectState;
 import org.apache.maven.continuum.web.exception.AuthorizationRequiredException;
 import org.codehaus.plexus.util.StringUtils;
 import org.codehaus.plexus.util.dag.CycleDetectedException;
@@ -159,37 +156,19 @@
                 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() <= 0 )
+            {
+                List<BuildDefinition> groupDefaultBDs = getContinuum().getDefaultBuildDefinitionsForProjectGroup(
projectGroupId );
 
-            if ( this.getBuildDefinitionId() == -1 )
+                getContinuum().buildProjectsWithBuildDefinition( sortedProjects, groupDefaultBDs
);
+            }
+            else
             {
-                checkDefaultBuildDefinitionForProject = true;
+                getContinuum().buildProjectsWithBuildDefinition( sortedProjects, this.getBuildDefinitionId()
);
             }
-
-            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