continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r695224 - in /continuum/branches/continuum-transient-state: continuum-api/src/main/java/org/apache/continuum/dao/ continuum-api/src/main/java/org/apache/continuum/taskqueue/manager/ continuum-api/src/main/java/org/apache/maven/continuum/ co...
Date Sun, 14 Sep 2008 14:28:59 GMT
Author: ctan
Date: Sun Sep 14 07:28:58 2008
New Revision: 695224

URL: http://svn.apache.org/viewvc?rev=695224&view=rev
Log:
fixed prepare build of projects

Modified:
    continuum/branches/continuum-transient-state/continuum-api/src/main/java/org/apache/continuum/dao/ProjectDao.java
    continuum/branches/continuum-transient-state/continuum-api/src/main/java/org/apache/continuum/taskqueue/manager/TaskQueueManager.java
    continuum/branches/continuum-transient-state/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
    continuum/branches/continuum-transient-state/continuum-core/src/main/java/org/apache/continuum/taskqueue/manager/DefaultTaskQueueManager.java
    continuum/branches/continuum-transient-state/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
    continuum/branches/continuum-transient-state/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/BuildProjectTaskExecutor.java
    continuum/branches/continuum-transient-state/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java
    continuum/branches/continuum-transient-state/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutor.java
    continuum/branches/continuum-transient-state/continuum-model/src/main/mdo/continuum.xml
    continuum/branches/continuum-transient-state/continuum-store/src/main/java/org/apache/continuum/dao/AbstractDao.java
    continuum/branches/continuum-transient-state/continuum-store/src/main/java/org/apache/continuum/dao/ProjectDaoImpl.java
    continuum/branches/continuum-transient-state/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectsListAction.java

Modified: continuum/branches/continuum-transient-state/continuum-api/src/main/java/org/apache/continuum/dao/ProjectDao.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-transient-state/continuum-api/src/main/java/org/apache/continuum/dao/ProjectDao.java?rev=695224&r1=695223&r2=695224&view=diff
==============================================================================
--- continuum/branches/continuum-transient-state/continuum-api/src/main/java/org/apache/continuum/dao/ProjectDao.java
(original)
+++ continuum/branches/continuum-transient-state/continuum-api/src/main/java/org/apache/continuum/dao/ProjectDao.java
Sun Sep 14 07:28:58 2008
@@ -57,7 +57,7 @@
     Project getProjectWithCheckoutResult( int projectId )
         throws ContinuumStoreException;
 
-    Project getProjectWithScmResult( int projectId )
+    Project getProjectWithScmDetails( int projectId )
         throws ContinuumStoreException;
 
     List<Project> getProjectsInGroup( int projectGroupId )

Modified: continuum/branches/continuum-transient-state/continuum-api/src/main/java/org/apache/continuum/taskqueue/manager/TaskQueueManager.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-transient-state/continuum-api/src/main/java/org/apache/continuum/taskqueue/manager/TaskQueueManager.java?rev=695224&r1=695223&r2=695224&view=diff
==============================================================================
--- continuum/branches/continuum-transient-state/continuum-api/src/main/java/org/apache/continuum/taskqueue/manager/TaskQueueManager.java
(original)
+++ continuum/branches/continuum-transient-state/continuum-api/src/main/java/org/apache/continuum/taskqueue/manager/TaskQueueManager.java
Sun Sep 14 07:28:58 2008
@@ -51,6 +51,9 @@
     boolean isInCheckoutQueue( int projectId )
         throws TaskQueueManagerException;
 
+    boolean isInCurrentPrepareBuildTask( int projectId )
+        throws TaskQueueManagerException;
+
     boolean isInPrepareBuildQueue( int projectId )
         throws TaskQueueManagerException;
 

Modified: continuum/branches/continuum-transient-state/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-transient-state/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java?rev=695224&r1=695223&r2=695224&view=diff
==============================================================================
--- continuum/branches/continuum-transient-state/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
(original)
+++ continuum/branches/continuum-transient-state/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
Sun Sep 14 07:28:58 2008
@@ -673,17 +673,20 @@
     // ----------------------------------------------------------------------
     //
     // ----------------------------------------------------------------------
-    Map<Integer, Integer> getProjectsAndBuildDefinitionsMap( Collection<Project>
projects, 
+    Collection<Map<Integer, Integer>> getProjectsAndBuildDefinitions( Collection<Project>
projects, 
                                                              List<BuildDefinition>
bds,
                                                              boolean checkDefaultBuildDefinitionForProject
)
         throws ContinuumException;
 
-    Map<Integer, Integer> getProjectsAndBuildDefinitionsMap( Collection<Project>
projects, 
+    Collection<Map<Integer, Integer>> getProjectsAndBuildDefinitions( Collection<Project>
projects, 
                                                              int buildDefinitionId )
         throws ContinuumException;
 
-    void prepareBuildProjects( Map<Integer, Integer> projectsAndBuildDefinitionsMap
)
+    void prepareBuildProjects( Collection<Map<Integer, Integer>> projectsAndBuildDefinitions
)
         throws ContinuumException;
+    
+    //void prepareBuildProjects( Map<Integer, Integer> projectsAndBuildDefinitionsMap
)
+    //    throws ContinuumException;
 
     // ----------------------------------------------------------------------
     // Task Queue Manager

Modified: continuum/branches/continuum-transient-state/continuum-core/src/main/java/org/apache/continuum/taskqueue/manager/DefaultTaskQueueManager.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-transient-state/continuum-core/src/main/java/org/apache/continuum/taskqueue/manager/DefaultTaskQueueManager.java?rev=695224&r1=695223&r2=695224&view=diff
==============================================================================
--- continuum/branches/continuum-transient-state/continuum-core/src/main/java/org/apache/continuum/taskqueue/manager/DefaultTaskQueueManager.java
(original)
+++ continuum/branches/continuum-transient-state/continuum-core/src/main/java/org/apache/continuum/taskqueue/manager/DefaultTaskQueueManager.java
Sun Sep 14 07:28:58 2008
@@ -254,12 +254,13 @@
     
         return false;
     }
-    
-    public boolean isInPrepareBuildQueue( int projectId )
+
+    public boolean isInCurrentPrepareBuildTask( int projectId )
         throws TaskQueueManagerException
     {
         Task task = getPrepareBuildTaskQueueExecutor().getCurrentTask();
-        if ( task != null && task instanceof PrepareBuildProjectsTask )
+
+        if ( task != null &&  task instanceof PrepareBuildProjectsTask )
         {
             Map<Integer, Integer> map = ( (PrepareBuildProjectsTask) task).getProjectsBuildDefinitionsMap();
             
@@ -273,9 +274,43 @@
                 }
             }
         }
+        
         return false;
     }
     
+    public boolean isInPrepareBuildQueue( int projectId )
+        throws TaskQueueManagerException
+    {
+        try
+        {
+            List<PrepareBuildProjectsTask> queue = prepareBuildQueue.getQueueSnapshot();
+            
+            for ( PrepareBuildProjectsTask task : queue )
+            {
+                if ( task != null )
+                {
+                    Map<Integer, Integer> map = ( (PrepareBuildProjectsTask) task).getProjectsBuildDefinitionsMap();
+                    
+                    if ( map.size() > 0 )
+                    {
+                        Set<Integer> projectIds = map.keySet();
+                        
+                        if ( projectIds.contains( new Integer( projectId ) ) )
+                        {
+                            return true;
+                        }
+                    }
+                }
+            }
+            
+            return false;
+        }
+        catch ( TaskQueueException e )
+        {
+            throw new TaskQueueManagerException( "Error while getting the tasks in prepare
build queue", e );
+        }
+    }
+    
     public boolean isInPurgeQueue( int purgeConfigId )
         throws TaskQueueManagerException
     {

Modified: continuum/branches/continuum-transient-state/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-transient-state/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java?rev=695224&r1=695223&r2=695224&view=diff
==============================================================================
--- continuum/branches/continuum-transient-state/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
(original)
+++ continuum/branches/continuum-transient-state/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
Sun Sep 14 07:28:58 2008
@@ -1005,15 +1005,19 @@
             projectsList = getProjects();
         }
 
-        Map<Integer, Integer> projectsAndBuildDefinitionsMap = getProjectsAndBuildDefinitionsMap(
projectsList, null, true );
+        Collection<Map<Integer,Integer>> projectsAndBuildDefinitions = getProjectsAndBuildDefinitions(
projectsList, null, true );
 
-        prepareBuildProjects( projectsAndBuildDefinitionsMap );
+        prepareBuildProjects( projectsAndBuildDefinitions );
 
         for ( Project project : projectsList )
         {
-            if ( projectsAndBuildDefinitionsMap.get( project.getId() ) != null )
+            for ( Map<Integer, Integer> map : projectsAndBuildDefinitions )
             {
-                buildProject( project, projectsAndBuildDefinitionsMap.get( project.getId()
), trigger );
+                if ( map.get( project.getId() ) != null )
+                {
+                    buildProject( project, map.get( project.getId() ), trigger );
+                    break;
+                }
             }
         }
     }
@@ -1041,15 +1045,19 @@
             projectsList = getProjects();
         }
 
-        Map<Integer, Integer> projectsAndBuildDefinitionsMap = getProjectsAndBuildDefinitionsMap(
projectsList, buildDefinitionId );
+        Collection<Map<Integer, Integer>> projectsAndBuildDefinitions = getProjectsAndBuildDefinitions(
projectsList, buildDefinitionId );
 
-        prepareBuildProjects( projectsAndBuildDefinitionsMap );
+        prepareBuildProjects( projectsAndBuildDefinitions );
         
         for ( Project project : projectsList )
         {
-            if ( projectsAndBuildDefinitionsMap.get( project.getId() ) != null )
+            for ( Map<Integer, Integer> map : projectsAndBuildDefinitions )
             {
-                buildProject( project, buildDefinitionId, trigger );
+                if ( map.get( project.getId() ) != null )
+                {
+                    buildProject( project, buildDefinitionId, trigger );
+                    break;
+                }
             }
         }
     }
@@ -1101,8 +1109,6 @@
     {
         Collection<Project> projectsList;
 
-        Map<Integer, Integer> projectsAndBuildDefinitionsMap = new HashMap<Integer,
Integer>();
-        
         try
         {
             projectsList = getProjectsInBuildOrder( projectDao.getProjectsWithDependenciesByGroupId(
projectGroupId ) );
@@ -1114,17 +1120,21 @@
             projectsList = getProjects();
         }
 
-        projectsAndBuildDefinitionsMap = getProjectsAndBuildDefinitionsMap( projectsList,

-                                                                            bds, 
-                                                                            checkDefaultBuildDefinitionForProject
);
+        Collection<Map<Integer, Integer>> projectsAndBuildDefinitions = getProjectsAndBuildDefinitions(
projectsList, 
+                                                                                        
               bds,
+                                                                                        
               checkDefaultBuildDefinitionForProject );
 
-        prepareBuildProjects( projectsAndBuildDefinitionsMap );
+        prepareBuildProjects( projectsAndBuildDefinitions );
 
         for ( Project project : projectsList )
         {
-            if ( projectsAndBuildDefinitionsMap.get( project.getId() ) != null )
+            for ( Map<Integer, Integer> map : projectsAndBuildDefinitions )
             {
-                buildProject( project, projectsAndBuildDefinitionsMap.get( project.getId()
), ContinuumProjectState.TRIGGER_FORCED );
+                if ( map.get( project.getId() ) != null )
+                {
+                    buildProject( project, map.get( project.getId() ), ContinuumProjectState.TRIGGER_FORCED
);
+                    break;
+                }
             }
         }
     }
@@ -1167,9 +1177,9 @@
 
             projectsList = getProjects();
         }
-
-        Map<Integer, Integer> projectsAndBuildDefinitionsMap = new HashMap<Integer,
Integer>();
         
+        Map<String, Map<Integer, Integer>> map = new HashMap<String, Map<Integer,
Integer>>();
+
         for ( Project project : projectsList )
         {
             List<Integer> buildDefIds = (List<Integer>) projectsMap.get( new
Integer( project.getId() ) );
@@ -1183,25 +1193,46 @@
                         if ( buildDefId != null && !taskQueueManager.isInBuildingQueue(
project.getId(), buildDefId.intValue() ) &&
                             !taskQueueManager.isInCheckoutQueue( project.getId() ) &&
!taskQueueManager.isInPrepareBuildQueue( project.getId() ) )
                         {
+                            Project proj = projectDao.getProjectWithScmDetails( project.getId()
);
+
+                            String scmRootAddress = proj.getScmRootAddress();
+
+                            Map<Integer, Integer> projectsAndBuildDefinitionsMap =
map.get( scmRootAddress );
+                            
+                            if ( projectsAndBuildDefinitionsMap == null )
+                            {
+                                projectsAndBuildDefinitionsMap = new HashMap<Integer,
Integer>();
+                            }
+                            
                             projectsAndBuildDefinitionsMap.put( project.getId(), buildDefId
);
+                            
+                            map.put( scmRootAddress, projectsAndBuildDefinitionsMap );
                         }
                     } 
                     catch ( TaskQueueManagerException e )
                     {
                         throw new ContinuumException( e.getMessage(), e );
                     }
+                    catch ( ContinuumStoreException e )
+                    {
+                        // do we throw this or skip it?
+                        throw new ContinuumException( "Error while retrieving project", e
);
+                    }
                 }
             }
         }
-        
-        prepareBuildProjects( projectsAndBuildDefinitionsMap );
-        
+
+        prepareBuildProjects( map.values() );
+
         for ( Project project : projectsList )
         {
             //buildProject( project, projectsAndBuildDefinitionsMap.get( project.getId()
), ContinuumProjectState.TRIGGER_SCHEDULED, false );
-            if ( projectsAndBuildDefinitionsMap.get(  project.getId() ) != null )
+            for ( Map<Integer, Integer> aMap : map.values() )
             {
-                buildProject( project, projectsAndBuildDefinitionsMap.get( project.getId()
), ContinuumProjectState.TRIGGER_SCHEDULED );
+                if ( aMap.get(  project.getId() ) != null )
+                {
+                    buildProject( project, aMap.get( project.getId() ), ContinuumProjectState.TRIGGER_SCHEDULED
);
+                }
             }
         }
     }
@@ -1231,11 +1262,11 @@
         {
             throw new ContinuumException( e.getMessage(), e );
         }
-     
+
         Map<Integer, Integer> projectsAndBuildDefinitionsMap = new HashMap<Integer,
Integer>( projectId, buildDefinitionId );
-        
+
         prepareBuildProjects( projectsAndBuildDefinitionsMap );
-        
+
         buildProject( projectId, buildDefinitionId, ContinuumProjectState.TRIGGER_FORCED
);
     }
 
@@ -1264,9 +1295,9 @@
         }
 
         Map<Integer, Integer> projectsBuildDefinitionsMap = new HashMap<Integer,
Integer>( projectId, buildDef.getId() );
-        
+
         prepareBuildProjects( projectsBuildDefinitionsMap );
-        
+
         //buildProject( projectId, buildDef.getId(), trigger, false );
 
         buildProject( projectId, buildDef.getId(), trigger );
@@ -1613,7 +1644,7 @@
         
         try
         {
-            project = projectDao.getProjectWithScmResult( projectId );
+            project = projectDao.getProjectWithScmDetails( projectId );
         }
         catch ( ContinuumStoreException e )
         {
@@ -2019,6 +2050,8 @@
 
         ProjectGroup projectGroup = (ProjectGroup) result.getProjectGroups().iterator().next();
 
+        ProjectScmRoot projectScmRoot;
+
         try
         {
             if ( projectGroupId == -1 )
@@ -2055,17 +2088,17 @@
 
             String url = (String) context.get( CreateProjectsFromMetadataAction.KEY_URL );
             
-            ProjectScmRoot scmRoot = projectScmRootDao.getProjectScmRootByProjectGroupAndScmRootAddress(
projectGroup.getId(), url );
+            projectScmRoot = projectScmRootDao.getProjectScmRootByProjectGroupAndScmRootAddress(
projectGroup.getId(), url );
             
-            if ( scmRoot == null )
+            if ( projectScmRoot == null )
             {
-                scmRoot = new ProjectScmRoot();
+                projectScmRoot = new ProjectScmRoot();
                 
-                scmRoot.setProjectGroup( projectGroup );
+                projectScmRoot.setProjectGroup( projectGroup );
                 
-                scmRoot.setScmRootAddress( url );
+                projectScmRoot.setScmRootAddress( url );
                 
-                projectScmRootDao.addProjectScmRoot( scmRoot );
+                projectScmRoot = projectScmRootDao.addProjectScmRoot( projectScmRoot );
 
             }
 
@@ -2102,6 +2135,7 @@
                 project.setScmPassword( null );
             }
 
+            project.setScmRootAddress( projectScmRoot.getScmRootAddress() );
             projectGroup.addProject( project );
         }
 
@@ -3545,12 +3579,12 @@
         }
     }
    
-    public Map<Integer, Integer> getProjectsAndBuildDefinitionsMap( Collection<Project>
projects, 
+    public Collection<Map<Integer, Integer>> getProjectsAndBuildDefinitions(
Collection<Project> projects, 
                                                                     List<BuildDefinition>
bds,
                                                                     boolean checkDefaultBuildDefinitionForProject
)
         throws ContinuumException
     {
-        Map<Integer, Integer> projectsAndBuildDefinitionsMap = new HashMap<Integer,
Integer>();
+        Map<String, Map<Integer, Integer>> map = new HashMap<String, Map<Integer,
Integer>>();
 
         for ( Project project : projects )
         {
@@ -3620,26 +3654,41 @@
                 continue;
             }
 
-            projectsAndBuildDefinitionsMap.put( projectId, buildDefId );
+            try
+            {
+                Project proj = projectDao.getProjectWithScmDetails( projectId );
+
+                String scmRootAddress = proj.getScmRootAddress();
+
+                Map<Integer, Integer> projectsAndBuildDefinitionsMap = map.get( scmRootAddress
);
+
+                if ( projectsAndBuildDefinitionsMap == null )
+                {
+                    projectsAndBuildDefinitionsMap = new HashMap<Integer, Integer>();
+                }
+
+                projectsAndBuildDefinitionsMap.put( projectId, buildDefId );
+
+                map.put( scmRootAddress, projectsAndBuildDefinitionsMap );
+            }
+            catch ( ContinuumStoreException e )
+            {
+                throw new ContinuumException( "Erro while retrieving project", e );
+            }
         }
 
-        return projectsAndBuildDefinitionsMap;
+        return map.values();
     }
 
-    public Map<Integer, Integer> getProjectsAndBuildDefinitionsMap( Collection<Project>
projects, 
+    public Collection<Map<Integer, Integer>> getProjectsAndBuildDefinitions(
Collection<Project> projects, 
                                                                     int buildDefinitionId
)
         throws ContinuumException
     {
-        Map<Integer, Integer> projectsAndBuildDefinitionsMap = new HashMap<Integer,
Integer>();
+        Map<String, Map<Integer,Integer>> map = new HashMap<String, Map<Integer,
Integer>>();
 
         for ( Project project : projects )
         {
             int projectId = project.getId();
-            
-            if ( projectsAndBuildDefinitionsMap.containsKey( projectId ) )
-            {
-                continue;
-            }
 
             try
             {
@@ -3653,16 +3702,42 @@
                 {
                     taskQueueManager.removeProjectFromCheckoutQueue( projectId );
                 }
+                
+                Project proj = projectDao.getProjectWithScmDetails( projectId );
+                
+                String scmRootAddress = proj.getScmRootAddress();
+                
+                Map<Integer, Integer> projectsAndBuildDefinitionsMap = map.get( scmRootAddress
);
+                
+                if ( projectsAndBuildDefinitionsMap == null )
+                {
+                    projectsAndBuildDefinitionsMap = new HashMap<Integer, Integer>();
+                }
+                
+                projectsAndBuildDefinitionsMap.put( projectId, buildDefinitionId );
+                
+                map.put( scmRootAddress, projectsAndBuildDefinitionsMap );
             }
             catch ( TaskQueueManagerException e )
             {
                 throw new ContinuumException( e.getMessage(), e );
             }
-
-            projectsAndBuildDefinitionsMap.put( projectId, buildDefinitionId );
+            catch ( ContinuumStoreException e )
+            {
+                throw new ContinuumException( "Error while retrieving project", e );
+            }
         }
 
-        return projectsAndBuildDefinitionsMap;
+        return map.values();
+    }
+
+    public void prepareBuildProjects( Collection<Map<Integer, Integer>> projectsBuildDefinitions
)
+        throws ContinuumException
+    {
+        for ( Map<Integer, Integer> map : projectsBuildDefinitions )
+        {
+            prepareBuildProjects( map );
+        }
     }
 
     public void prepareBuildProjects( Map<Integer, Integer> projectsBuildDefinitionsMap
)

Modified: continuum/branches/continuum-transient-state/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/BuildProjectTaskExecutor.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-transient-state/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/BuildProjectTaskExecutor.java?rev=695224&r1=695223&r2=695224&view=diff
==============================================================================
--- continuum/branches/continuum-transient-state/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/BuildProjectTaskExecutor.java
(original)
+++ continuum/branches/continuum-transient-state/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/BuildProjectTaskExecutor.java
Sun Sep 14 07:28:58 2008
@@ -21,7 +21,6 @@
 
 import org.apache.continuum.taskqueue.manager.TaskQueueManager;
 import org.apache.continuum.taskqueue.manager.TaskQueueManagerException;
-import org.apache.maven.continuum.Continuum;
 import org.apache.maven.continuum.buildqueue.BuildProjectTask;
 import org.codehaus.plexus.logging.AbstractLogEnabled;
 import org.codehaus.plexus.taskqueue.Task;
@@ -57,7 +56,8 @@
 
         try
         {
-            while ( taskQueueManager.isInPrepareBuildQueue( buildProjectTask.getProjectId()
) )
+            while ( taskQueueManager.isInPrepareBuildQueue( buildProjectTask.getProjectId()
) ||
+                    taskQueueManager.isInCurrentPrepareBuildTask( buildProjectTask.getProjectId()
) )
             {
                 Thread.sleep( 1000 );
             }

Modified: continuum/branches/continuum-transient-state/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-transient-state/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java?rev=695224&r1=695223&r2=695224&view=diff
==============================================================================
--- continuum/branches/continuum-transient-state/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java
(original)
+++ continuum/branches/continuum-transient-state/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java
Sun Sep 14 07:28:58 2008
@@ -357,7 +357,7 @@
 
         try
         {
-            Project project = projectDao.getProjectWithScmResult( projectId );
+            Project project = projectDao.getProjectWithScmDetails( projectId );
             
             context.setProject( project );
 

Modified: continuum/branches/continuum-transient-state/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutor.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-transient-state/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutor.java?rev=695224&r1=695223&r2=695224&view=diff
==============================================================================
--- continuum/branches/continuum-transient-state/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutor.java
(original)
+++ continuum/branches/continuum-transient-state/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutor.java
Sun Sep 14 07:28:58 2008
@@ -28,7 +28,7 @@
 import org.codehaus.plexus.util.StringUtils;
 
 /**
- * @author Maria Catherine Tan
+ * @author <a href="mailto:ctan@apache.org">Maria Catherine Tan</a>
  * @plexus.component role="org.codehaus.plexus.taskqueue.execution.TaskExecutor"
  * role-hint="prepare-build-project"
  */
@@ -136,7 +136,7 @@
 
         try
         {
-            Project project = projectDao.getProjectWithScmResult( projectId );
+            Project project = projectDao.getProjectWithScmDetails( projectId );
             ProjectGroup projectGroup = project.getProjectGroup();
             
             List<ProjectScmRoot> scmRoots = projectScmRootDao.getProjectScmRootByProjectGroup(
projectGroup.getId() );

Modified: continuum/branches/continuum-transient-state/continuum-model/src/main/mdo/continuum.xml
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-transient-state/continuum-model/src/main/mdo/continuum.xml?rev=695224&r1=695223&r2=695224&view=diff
==============================================================================
--- continuum/branches/continuum-transient-state/continuum-model/src/main/mdo/continuum.xml
(original)
+++ continuum/branches/continuum-transient-state/continuum-model/src/main/mdo/continuum.xml
Sun Sep 14 07:28:58 2008
@@ -344,13 +344,18 @@
             <multiplicity>*</multiplicity>
           </association>
         </field>     
-        <field jpox.fetch-groups="project-all-details project-with-scm-result">
+        <field jpox.fetch-groups="project-all-details project-with-scm-details">
           <name>scmResult</name>
           <version>1.1.2+</version>
           <association>
             <type>ScmResult</type>
           </association>
-        </field>   
+        </field>
+        <field jpox.fetch-groups="project-all-details project-with-scm-details">
+          <name>scmRootAddress</name>
+          <version>1.1.2+</version>
+          <type>String</type>
+        </field>
       </fields>
     </class>
 

Modified: continuum/branches/continuum-transient-state/continuum-store/src/main/java/org/apache/continuum/dao/AbstractDao.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-transient-state/continuum-store/src/main/java/org/apache/continuum/dao/AbstractDao.java?rev=695224&r1=695223&r2=695224&view=diff
==============================================================================
--- continuum/branches/continuum-transient-state/continuum-store/src/main/java/org/apache/continuum/dao/AbstractDao.java
(original)
+++ continuum/branches/continuum-transient-state/continuum-store/src/main/java/org/apache/continuum/dao/AbstractDao.java
Sun Sep 14 07:28:58 2008
@@ -57,7 +57,7 @@
 
     protected static final String BUILD_TEMPLATE_BUILD_DEFINITIONS = "build-template-build-definitions";
     
-    protected static final String PROJECT_WITH_SCM_RESULT_FETCH_GROUP = "project-with-scm-result";
+    protected static final String PROJECT_WITH_SCM_DETAILS_FETCH_GROUP = "project-with-scm-details";
 
     /**
      * @plexus.requirement

Modified: continuum/branches/continuum-transient-state/continuum-store/src/main/java/org/apache/continuum/dao/ProjectDaoImpl.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-transient-state/continuum-store/src/main/java/org/apache/continuum/dao/ProjectDaoImpl.java?rev=695224&r1=695223&r2=695224&view=diff
==============================================================================
--- continuum/branches/continuum-transient-state/continuum-store/src/main/java/org/apache/continuum/dao/ProjectDaoImpl.java
(original)
+++ continuum/branches/continuum-transient-state/continuum-store/src/main/java/org/apache/continuum/dao/ProjectDaoImpl.java
Sun Sep 14 07:28:58 2008
@@ -183,10 +183,10 @@
         return (Project) getObjectById( Project.class, projectId, PROJECT_WITH_CHECKOUT_RESULT_FETCH_GROUP
);
     }
     
-    public Project getProjectWithScmResult( int projectId )
+    public Project getProjectWithScmDetails( int projectId )
         throws ContinuumStoreException
     {
-        return (Project) getObjectById( Project.class, projectId, PROJECT_WITH_SCM_RESULT_FETCH_GROUP
);
+        return (Project) getObjectById( Project.class, projectId, PROJECT_WITH_SCM_DETAILS_FETCH_GROUP
);
     }
 
     public List<Project> getProjectsInGroup( int projectGroupId )

Modified: continuum/branches/continuum-transient-state/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectsListAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-transient-state/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectsListAction.java?rev=695224&r1=695223&r2=695224&view=diff
==============================================================================
--- continuum/branches/continuum-transient-state/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectsListAction.java
(original)
+++ continuum/branches/continuum-transient-state/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectsListAction.java
Sun Sep 14 07:28:58 2008
@@ -20,6 +20,7 @@
  */
 
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
@@ -159,16 +160,23 @@
                 sortedProjects = projectsList;
             }
 
-            Map<Integer, Integer> projectsBuildDefsMap = getProjectsBuildDefsMap( sortedProjects
);
+            Collection<Map<Integer, Integer>> projectsBuildDefs = getProjectsBuildDefsMap(
sortedProjects );
             
-            getContinuum().prepareBuildProjects( projectsBuildDefsMap );
+            getContinuum().prepareBuildProjects( projectsBuildDefs );
             
             for ( Project project : sortedProjects )
             {
                 if ( this.getBuildDefinitionId() <= 0 )
                 {
-                    getContinuum().buildProject( project.getId(), projectsBuildDefsMap.get(
project.getId() ),
-                                                 ContinuumProjectState.TRIGGER_FORCED );
+                    for ( Map<Integer, Integer> map : projectsBuildDefs )
+                    {
+                        if ( map.get( project.getId() ) != null )
+                        {
+                            getContinuum().buildProject( project.getId(), map.get( project.getId()
),
+                                                         ContinuumProjectState.TRIGGER_FORCED
);
+                            break;
+                        }
+                    }
                 }
                 else
                 {
@@ -241,11 +249,9 @@
         return SUCCESS;
     }
     
-    private Map<Integer, Integer> getProjectsBuildDefsMap( List<Project> projects
)
+    private Collection<Map<Integer, Integer>> getProjectsBuildDefsMap( List<Project>
projects )
         throws ContinuumException
     {
-        Map<Integer, Integer> projectsBuildDefsMap = new HashMap<Integer, Integer>();
-        
         if ( this.getBuildDefinitionId() <= 0 )
         {
             boolean checkDefaultBuildDefinitionForProject = false;
@@ -257,14 +263,14 @@
             
             List<BuildDefinition> groupDefaultBDs = getContinuum().getDefaultBuildDefinitionsForProjectGroup(
projectGroupId );
             
-            return getContinuum().getProjectsAndBuildDefinitionsMap( projects, 
-                                                                     groupDefaultBDs, 
-                                                                     checkDefaultBuildDefinitionForProject
);
+            return getContinuum().getProjectsAndBuildDefinitions( projects, 
+                                                                  groupDefaultBDs, 
+                                                                  checkDefaultBuildDefinitionForProject
);
         }
         else
         {
-            return getContinuum().getProjectsAndBuildDefinitionsMap( projects,
-                                                                     this.getBuildDefinitionId()
);
+            return getContinuum().getProjectsAndBuildDefinitions( projects,
+                                                                  this.getBuildDefinitionId()
);
         }
     }
 



Mime
View raw message