continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r708091 - in /continuum/branches/continuum-transient-state: continuum-api/src/main/java/org/apache/maven/continuum/ continuum-core/src/main/java/org/apache/maven/continuum/ continuum-core/src/main/java/org/apache/maven/continuum/buildcontro...
Date Mon, 27 Oct 2008 05:54:11 GMT
Author: ctan
Date: Sun Oct 26 22:54:11 2008
New Revision: 708091

URL: http://svn.apache.org/viewvc?rev=708091&view=rev
Log:
- removed scmRootAddress field from project
- created a new action class: "create-build-project-task"
- cleanup codes

Added:
    continuum/branches/continuum-transient-state/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CreateBuildProjectTaskAction.java
Modified:
    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/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/scm/queue/PrepareBuildProjectsTask.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-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/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=708091&r1=708090&r2=708091&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 Oct 26 22:54:11 2008
@@ -670,6 +670,9 @@
     ProjectScmRoot getProjectScmRoot( int projectScmRootId )
         throws ContinuumException;
 
+    ProjectScmRoot getProjectScmRootByProject( int projectId )
+        throws ContinuumException;
+
     // ----------------------------------------------------------------------
     //
     // ----------------------------------------------------------------------
@@ -682,7 +685,7 @@
                                                              int buildDefinitionId )
         throws ContinuumException;
 
-    void prepareBuildProjects( Collection<Map<Integer, Integer>> projectsAndBuildDefinitions )
+    void prepareBuildProjects( Collection<Map<Integer, Integer>> projectsAndBuildDefinitions, int trigger )
         throws ContinuumException;
     
     //void prepareBuildProjects( Map<Integer, Integer> projectsAndBuildDefinitionsMap )

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=708091&r1=708090&r2=708091&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 Oct 26 22:54:11 2008
@@ -52,13 +52,11 @@
 import org.apache.maven.continuum.build.settings.SchedulesActivator;
 import org.apache.maven.continuum.builddefinition.BuildDefinitionService;
 import org.apache.maven.continuum.builddefinition.BuildDefinitionServiceException;
-import org.apache.maven.continuum.buildqueue.BuildProjectTask;
 import org.apache.maven.continuum.configuration.ConfigurationException;
 import org.apache.maven.continuum.configuration.ConfigurationLoadingException;
 import org.apache.maven.continuum.configuration.ConfigurationService;
 import org.apache.maven.continuum.core.action.AbstractContinuumAction;
 import org.apache.maven.continuum.core.action.CreateProjectsFromMetadataAction;
-import org.apache.maven.continuum.execution.ContinuumBuildExecutor;
 import org.apache.maven.continuum.execution.ContinuumBuildExecutorConstants;
 import org.apache.maven.continuum.execution.manager.BuildExecutorManager;
 import org.apache.maven.continuum.initialization.ContinuumInitializationException;
@@ -197,21 +195,6 @@
     // ----------------------------------------------------------------------
     // Moved from core
     // ----------------------------------------------------------------------
-/*
-    /**
-     * @plexus.requirement role-hint="build-project"
-     */
-/*    private TaskQueue buildQueue;
-
-    /**
-     * @plexus.requirement role-hint="check-out-project"
-     */
-/*    private TaskQueue checkoutQueue;
-
-    /**
-     * @plexus.requirement role-hint="prepare-build-project"
-     */
-//    private TaskQueue prepareBuildQueue;
     
     /**
      * @plexus.requirement
@@ -570,296 +553,9 @@
     }
 
     // ----------------------------------------------------------------------
-    // Queues
-    // ----------------------------------------------------------------------
-/*
-    public List<BuildProjectTask> getProjectsInBuildQueue()
-        throws ContinuumException
-    {
-        try
-        {
-            return buildQueue.getQueueSnapshot();
-        }
-        catch ( TaskQueueException e )
-        {
-            throw new ContinuumException( "Error while getting the building queue.", e );
-        }
-    }
-
-    public boolean isInBuildingQueue( int projectId )
-        throws ContinuumException
-    {
-        return isInBuildingQueue( projectId, -1 );
-    }
-
-    public boolean isInBuildingQueue( int projectId, int buildDefinitionId )
-        throws ContinuumException
-    {
-        List<BuildProjectTask> queue = getProjectsInBuildQueue();
-
-        for ( BuildProjectTask task : queue )
-        {
-            if ( task != null )
-            {
-                if ( buildDefinitionId < 0 )
-                {
-                    if ( task.getProjectId() == projectId )
-                    {
-                        return true;
-                    }
-                }
-                else
-                {
-                    if ( task.getProjectId() == projectId && task.getBuildDefinitionId() == buildDefinitionId )
-                    {
-                        return true;
-                    }
-                }
-            }
-        }
-
-        return false;
-    }
-
-    public boolean isInCheckoutQueue( int projectId )
-        throws ContinuumException
-    {
-        List<CheckOutTask> queue = getCheckOutTasksInQueue();
-
-        for ( CheckOutTask task : queue )
-        {
-            if ( task != null && task.getProjectId() == projectId )
-            {
-                return true;
-            }
-        }
-
-        return false;
-    }
-
-    public List<CheckOutTask> getCheckOutTasksInQueue()
-        throws ContinuumException
-    {
-        try
-        {
-            return checkoutQueue.getQueueSnapshot();
-        }
-        catch ( TaskQueueException e )
-        {
-            throw new ContinuumException( "Error while getting the checkout queue.", e );
-        }
-    }
-
-    public TaskQueueExecutor getBuildTaskQueueExecutor()
-        throws ContinuumException
-    {
-        try
-        {
-            return (TaskQueueExecutor) container.lookup( TaskQueueExecutor.class, "build-project" );
-        }
-        catch ( ComponentLookupException e )
-        {
-            throw new ContinuumException( e.getMessage(), e );
-        }
-    }
-
-    public int getCurrentProjectIdBuilding()
-        throws ContinuumException
-    {
-        Task task = getBuildTaskQueueExecutor().getCurrentTask();
-        if ( task != null )
-        {
-            if ( task instanceof BuildProjectTask )
-            {
-                return ( (BuildProjectTask) task ).getProjectId();
-            }
-        }
-        return -1;
-    }
-    
-    public TaskQueueExecutor getPrepareBuildTaskQueueExecutor()
-        throws ContinuumException
-    {
-        try
-        {
-            return (TaskQueueExecutor) container.lookup( TaskQueueExecutor.class, "prepare-build-project" );
-        }
-        catch ( ComponentLookupException e )
-        {
-            throw new ContinuumException( e.getMessage(), e );
-        }
-    }
-    
-    public boolean isProjectInPrepareBuild( int projectId )
-        throws ContinuumException
-    {
-        Task task = getPrepareBuildTaskQueueExecutor().getCurrentTask();
-        if ( task != null && task instanceof PrepareBuildProjectsTask )
-        {
-            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;
-    }
-
-    public boolean removeFromBuildingQueue( int projectId, int buildDefinitionId, int trigger, String projectName )
-        throws ContinuumException
-    {
-        BuildDefinition buildDefinition = getBuildDefinition( buildDefinitionId );
-        String buildDefinitionLabel = buildDefinition.getDescription();
-        if ( StringUtils.isEmpty( buildDefinitionLabel ) )
-        {
-            buildDefinitionLabel = buildDefinition.getGoals();
-        }
-        BuildProjectTask buildProjectTask =
-            new BuildProjectTask( projectId, buildDefinitionId, trigger, projectName, buildDefinitionLabel );
-        return this.buildQueue.remove( buildProjectTask );
-    }
-
-    public boolean removeProjectsFromBuildingQueue( int[] projectsId )
-        throws ContinuumException
-    {
-        if ( projectsId == null )
-        {
-            return false;
-        }
-        if ( projectsId.length < 1 )
-        {
-            return false;
-        }
-        List<BuildProjectTask> queue = getProjectsInBuildQueue();
-
-        List<BuildProjectTask> tasks = new ArrayList<BuildProjectTask>();
-
-        for ( BuildProjectTask task : queue )
-        {
-            if ( task != null )
-            {
-                if ( ArrayUtils.contains( projectsId, task.getProjectId() ) )
-                {
-                    tasks.add( task );
-                }
-            }
-        }
-
-        for ( BuildProjectTask buildProjectTask : tasks )
-        {
-            getLogger().info( "cancel build for project " + buildProjectTask.getProjectId() );
-        }
-        if ( !tasks.isEmpty() )
-        {
-            return buildQueue.removeAll( tasks );
-        }
-
-        return false;
-    }
-
-    public boolean removeProjectsFromCheckoutQueue( int[] projectsId )
-        throws ContinuumException
-    {
-        if ( projectsId == null )
-        {
-            return false;
-        }
-        if ( projectsId.length < 1 )
-        {
-            return false;
-        }
-        List<CheckOutTask> queue = getCheckOutTasksInQueue();
-
-        List<CheckOutTask> tasks = new ArrayList<CheckOutTask>();
-
-        for ( CheckOutTask task : queue )
-        {
-            if ( task != null )
-            {
-                if ( ArrayUtils.contains( projectsId, task.getProjectId() ) )
-                {
-                    tasks.add( task );
-                }
-            }
-        }
-        if ( !tasks.isEmpty() )
-        {
-            return checkoutQueue.removeAll( tasks );
-        }
-        return false;
-    }
-
-    public boolean removeProjectFromBuildingQueue( int projectId )
-        throws ContinuumException
-    {
-        List<BuildProjectTask> queue = getProjectsInBuildQueue();
-
-        for ( BuildProjectTask task : queue )
-        {
-            if ( task != null && task.getProjectId() == projectId )
-            {
-                return buildQueue.remove( task );
-            }
-        }
-
-        return false;
-    }
-
-    public void removeProjectsFromBuildingQueueWithHashCodes( int[] hashCodes )
-        throws ContinuumException
-    {
-        List<BuildProjectTask> queue = getProjectsInBuildQueue();
-
-        for ( BuildProjectTask task : queue )
-        {
-            if ( ArrayUtils.contains( hashCodes, task.hashCode() ) )
-            {
-                buildQueue.remove( task );
-            }
-        }
-    }
-
-    public boolean removeProjectFromCheckoutQueue( int projectId )
-        throws ContinuumException
-    {
-        List<CheckOutTask> queue = getCheckOutTasksInQueue();
-
-        for ( CheckOutTask task : queue )
-        {
-            if ( task != null && task.getProjectId() == projectId )
-            {
-                return checkoutQueue.remove( task );
-            }
-        }
-
-        return false;
-    }
-
-    public void removeTasksFromCheckoutQueueWithHashCodes( int[] hashCodes )
-        throws ContinuumException
-    {
-        List<CheckOutTask> queue = getCheckOutTasksInQueue();
-
-        for ( CheckOutTask task : queue )
-        {
-            if ( ArrayUtils.contains( hashCodes, task.hashCode() ) )
-            {
-                checkoutQueue.remove( task );
-            }
-        }
-    }
-*/
-    // ----------------------------------------------------------------------
     //
     // ----------------------------------------------------------------------
 
-
     public void removeProject( int projectId )
         throws ContinuumException
     {
@@ -1006,19 +702,7 @@
 
         Collection<Map<Integer,Integer>> projectsAndBuildDefinitions = getProjectsAndBuildDefinitions( projectsList, null, true );
 
-        prepareBuildProjects( projectsAndBuildDefinitions );
-
-        for ( Project project : projectsList )
-        {
-            for ( Map<Integer, Integer> map : projectsAndBuildDefinitions )
-            {
-                if ( map.get( project.getId() ) != null )
-                {
-                    buildProject( project, map.get( project.getId() ), trigger );
-                    break;
-                }
-            }
-        }
+        prepareBuildProjects( projectsAndBuildDefinitions, trigger );
     }
 
     /**
@@ -1046,19 +730,7 @@
 
         Collection<Map<Integer, Integer>> projectsAndBuildDefinitions = getProjectsAndBuildDefinitions( projectsList, buildDefinitionId );
 
-        prepareBuildProjects( projectsAndBuildDefinitions );
-        
-        for ( Project project : projectsList )
-        {
-            for ( Map<Integer, Integer> map : projectsAndBuildDefinitions )
-            {
-                if ( map.get( project.getId() ) != null )
-                {
-                    buildProject( project, buildDefinitionId, trigger );
-                    break;
-                }
-            }
-        }
+        prepareBuildProjects( projectsAndBuildDefinitions, trigger );
     }
 
     /**
@@ -1123,19 +795,7 @@
                                                                                                         bds,
                                                                                                         checkDefaultBuildDefinitionForProject );
 
-        prepareBuildProjects( projectsAndBuildDefinitions );
-
-        for ( Project project : projectsList )
-        {
-            for ( Map<Integer, Integer> map : projectsAndBuildDefinitions )
-            {
-                if ( map.get( project.getId() ) != null )
-                {
-                    buildProject( project, map.get( project.getId() ), ContinuumProjectState.TRIGGER_FORCED );
-                    break;
-                }
-            }
-        }
+        prepareBuildProjects( projectsAndBuildDefinitions, ContinuumProjectState.TRIGGER_FORCED );
     }
 
     /**
@@ -1192,9 +852,14 @@
                         if ( buildDefId != null && !taskQueueManager.isInBuildingQueue( project.getId(), buildDefId.intValue() ) &&
                             !taskQueueManager.isInCheckoutQueue( project.getId() ) && !taskQueueManager.isInPrepareBuildQueue( project.getId() ) )
                         {
-                            Project proj = projectDao.getProjectWithScmDetails( project.getId() );
+                            ProjectScmRoot scmRoot = getProjectScmRootByProject( project.getId() );
+                            
+                            String scmRootAddress = "";
 
-                            String scmRootAddress = proj.getScmRootAddress();
+                            if ( scmRoot != null )
+                            {
+                                scmRootAddress = scmRoot.getScmRootAddress();
+                            }
 
                             Map<Integer, Integer> projectsAndBuildDefinitionsMap = map.get( scmRootAddress );
                             
@@ -1212,28 +877,11 @@
                     {
                         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( map.values() );
-
-        for ( Project project : projectsList )
-        {
-            //buildProject( project, projectsAndBuildDefinitionsMap.get( project.getId() ), ContinuumProjectState.TRIGGER_SCHEDULED, false );
-            for ( Map<Integer, Integer> aMap : map.values() )
-            {
-                if ( aMap.get(  project.getId() ) != null )
-                {
-                    buildProject( project, aMap.get( project.getId() ), ContinuumProjectState.TRIGGER_SCHEDULED );
-                }
-            }
-        }
+        prepareBuildProjects( map.values(), ContinuumProjectState.TRIGGER_SCHEDULED );
     }
 
     public void buildProject( int projectId )
@@ -1264,9 +912,7 @@
 
         Map<Integer, Integer> projectsAndBuildDefinitionsMap = new HashMap<Integer, Integer>( projectId, buildDefinitionId );
 
-        prepareBuildProjects( projectsAndBuildDefinitionsMap );
-
-        buildProject( projectId, buildDefinitionId, ContinuumProjectState.TRIGGER_FORCED );
+        prepareBuildProjects( projectsAndBuildDefinitionsMap, ContinuumProjectState.TRIGGER_FORCED );
     }
 
     public void buildProject( int projectId, int trigger )
@@ -1295,17 +941,12 @@
 
         Map<Integer, Integer> projectsBuildDefinitionsMap = new HashMap<Integer, Integer>( projectId, buildDef.getId() );
 
-        prepareBuildProjects( projectsBuildDefinitionsMap );
-
-        //buildProject( projectId, buildDef.getId(), trigger, false );
-
-        buildProject( projectId, buildDef.getId(), trigger );
+        prepareBuildProjects( projectsBuildDefinitionsMap, trigger );
     }
 
     public void buildProject( int projectId, int buildDefinitionId, int trigger )
         throws ContinuumException
     {
-        //buildProject( projectId, buildDefinitionId, trigger, true );
         Project project;
 
         try
@@ -1317,188 +958,14 @@
             throw logAndCreateException( "Error while getting project " + projectId + ".", e );
         }
 
-        buildProject( project, buildDefinitionId, trigger );
-    }
-
-    /*
-    public void buildProject( Project project, int buildDefinitionId, int trigger )
-        throws ContinuumException
-    {
-        buildProject( project, buildDefinitionId, trigger, true );
-    }
-
-    private void buildProject( int projectId, int buildDefinitionId, int trigger, boolean checkQueues )
-        throws ContinuumException
-    {
-        Project project;
-
-        try
-        {
-            project = projectDao.getProject( projectId );
-        }
-        catch ( ContinuumStoreException e )
-        {
-            throw logAndCreateException( "Error while getting project " + projectId + ".", e );
-        }
-
-        buildProject( project, buildDefinitionId, trigger, checkQueues );
-    }*/
-    
-    private synchronized void buildProject( Project project, int buildDefinitionId, int trigger )
-        throws ContinuumException
-    {
-        try
-        {
-            if ( project.getState() != ContinuumProjectState.NEW &&
-                project.getState() != ContinuumProjectState.CHECKEDOUT &&
-                project.getState() != ContinuumProjectState.OK && project.getState() != ContinuumProjectState.FAILED &&
-                project.getState() != ContinuumProjectState.ERROR && project.getState() != ContinuumProjectState.CANCELLED )
-            {
-                ContinuumBuildExecutor executor = executorManager.getBuildExecutor( project.getExecutorId() );
-    
-                if ( executor.isBuilding( project ) || project.getState() == ContinuumProjectState.UPDATING )
-                {
-                    // project is building
-                    getLogger().info( "Project '" + project.getName() + "' already being built." );
-    
-                    return;
-                }
-                else
-                {
-                    project.setOldState( project.getState() );
-    
-                    project.setState( ContinuumProjectState.ERROR );
-    
-                    projectDao.updateProject( project );
-    
-                    project = projectDao.getProject( project.getId() );
-                }
-            }
-            else
-            {
-                project.setOldState( project.getState() );
-    
-                projectDao.updateProject( project );
-    
-                project = projectDao.getProject( project.getId() );
-            }
-    
-            BuildDefinition buildDefinition = getBuildDefinition( buildDefinitionId );
-            String buildDefinitionLabel = buildDefinition.getDescription();
-            if ( StringUtils.isEmpty( buildDefinitionLabel ) )
-            {
-                buildDefinitionLabel = buildDefinition.getGoals();
-            }
-    
-            getLogger().info( "Enqueuing '" + project.getName() + "' with build definition '" + buildDefinitionLabel +
-                "' - id=" + buildDefinitionId + ")." );
-    
-            BuildProjectTask task = new BuildProjectTask( project.getId(), buildDefinitionId, trigger, project
-                .getName(), buildDefinitionLabel );
-    
-            task.setMaxExecutionTime( buildDefinitionDao.getBuildDefinition( buildDefinitionId ).getSchedule()
-                .getMaxJobExecutionTime() * 1000 );
-    
-            taskQueueManager.getBuildQueue().put( task );
-        }
-        catch ( ContinuumStoreException e )
-        {
-            throw logAndCreateException( "Error while creating build object.", e );
-        }
-        catch ( TaskQueueException e )
-        {
-            throw logAndCreateException( "Error while creating enqueuing object.", 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 );
     }
 
-/*
-    private synchronized void buildProject( Project project, int buildDefinitionId, int trigger, boolean checkQueues )
-        throws ContinuumException
-    {
-        if ( checkQueues )
-        {
-            try
-            {
-                if ( taskQueueManager.isInBuildingQueue( project.getId(), buildDefinitionId ) )
-                {
-                    return;
-                }
-                
-                if ( taskQueueManager.isInCheckoutQueue( project.getId() ) )
-                {
-                    taskQueueManager.removeProjectFromCheckoutQueue( project.getId() );
-                }
-            }
-            catch ( TaskQueueManagerException e )
-            {
-                throw new ContinuumException( e.getMessage(), e );
-            }
-        }
-
-        try
-        {
-            if ( project.getState() != ContinuumProjectState.NEW &&
-                project.getState() != ContinuumProjectState.CHECKEDOUT &&
-                project.getState() != ContinuumProjectState.OK && project.getState() != ContinuumProjectState.FAILED &&
-                project.getState() != ContinuumProjectState.ERROR )
-            {
-                ContinuumBuildExecutor executor = executorManager.getBuildExecutor( project.getExecutorId() );
-
-                if ( executor.isBuilding( project ) || project.getState() == ContinuumProjectState.UPDATING )
-                {
-                    // project is building
-                    getLogger().info( "Project '" + project.getName() + "' already being built." );
-
-                    return;
-                }
-                else
-                {
-                    project.setOldState( project.getState() );
-
-                    project.setState( ContinuumProjectState.ERROR );
-
-                    projectDao.updateProject( project );
-
-                    project = projectDao.getProject( project.getId() );
-                }
-            }
-            else
-            {
-                project.setOldState( project.getState() );
-
-                projectDao.updateProject( project );
-
-                project = projectDao.getProject( project.getId() );
-            }
-
-            BuildDefinition buildDefinition = getBuildDefinition( buildDefinitionId );
-            String buildDefinitionLabel = buildDefinition.getDescription();
-            if ( StringUtils.isEmpty( buildDefinitionLabel ) )
-            {
-                buildDefinitionLabel = buildDefinition.getGoals();
-            }
-
-            getLogger().info( "Enqueuing '" + project.getName() + "' with build definition '" + buildDefinitionLabel +
-                "' - id=" + buildDefinitionId + ")." );
-
-            BuildProjectTask task = new BuildProjectTask( project.getId(), buildDefinitionId, trigger, project
-                .getName(), buildDefinitionLabel );
-
-            task.setMaxExecutionTime( buildDefinitionDao.getBuildDefinition( buildDefinitionId ).getSchedule()
-                .getMaxJobExecutionTime() * 1000 );
-
-            taskQueueManager.getBuildQueue().put( task );
-        }
-        catch ( ContinuumStoreException e )
-        {
-            throw logAndCreateException( "Error while creating build object.", e );
-        }
-        catch ( TaskQueueException e )
-        {
-            throw logAndCreateException( "Error while creating enqueuing object.", e );
-        }
-    }
-*/
     public BuildResult getBuildResult( int buildId )
         throws ContinuumException
     {
@@ -2127,7 +1594,6 @@
                 project.setScmPassword( null );
             }
 
-            project.setScmRootAddress( projectScmRoot.getScmRootAddress() );
             projectGroup.addProject( project );
         }
 
@@ -2994,28 +2460,31 @@
             if ( !wdFile.mkdirs() )
             {
                 throw new InitializationException(
-                    "Could not making the working directory: " + "'" + wdFile.getAbsolutePath() + "'." );
+                    "Could not make the working directory: " + "'" + wdFile.getAbsolutePath() + "'." );
             }
         }
 
+        getLogger().info( "Showing all groups:" );
+        try
+        {
+            for ( ProjectGroup group : projectGroupDao.getAllProjectGroups() )
+            {
+                createProjectScmRootForProjectGroup( group );
+            }
+        }
+        catch ( ContinuumException e )
+        {
+            throw new InitializationException( "Error while creating project scm root for the project group", e );
+        }
+
         getLogger().info( "Showing all projects: " );
 
         for ( Project project : projectDao.getAllProjectsByNameWithBuildDetails() )
         {
-            if ( project.getScmRootAddress() == null || StringUtils.isEmpty( project.getScmRootAddress() ) )
-            {
-                try
-                {
-                    setScmRootAddressForProject( project );
-                }
-                catch ( ContinuumException e )
-                {
-                    throw new InitializationException( "Database is corrupted.", e );
-                }
-            }
-            
+            getLogger().info( "Project Notifiers: " );
             for ( ProjectNotifier notifier : (List<ProjectNotifier>) project.getNotifiers() )
             {
+                getLogger().info( "check if type isEmpty" );
                 if ( StringUtils.isEmpty( notifier.getType() ) )
                 {
                     try
@@ -3027,6 +2496,7 @@
                         throw new InitializationException( "Database is corrupted.", e );
                     }
                 }
+                getLogger().info( "notifier sendOnScmFailure: " + notifier.isSendOnScmFailure() );
             }
 
             if ( project.getState() != ContinuumProjectState.NEW &&
@@ -3582,6 +3052,24 @@
             throw new ContinuumException( "Error while retrieving projectScmRoot ", e );
         }
     }
+
+    public ProjectScmRoot getProjectScmRootByProject( int projectId )
+        throws ContinuumException
+    {
+        Project project = getProject( projectId );
+        ProjectGroup group = getProjectGroupByProjectId( projectId );
+        
+        List<ProjectScmRoot> scmRoots = getProjectScmRootByProjectGroup( group.getId() );
+        
+        for ( ProjectScmRoot scmRoot : scmRoots )
+        {
+            if( project.getScmUrl() != null && project.getScmUrl().startsWith( scmRoot.getScmRootAddress() ) )
+            {
+                return scmRoot;
+            }
+        }
+        return null;
+    }
    
     public Collection<Map<Integer, Integer>> getProjectsAndBuildDefinitions( Collection<Project> projects, 
                                                                     List<BuildDefinition> bds,
@@ -3658,27 +3146,24 @@
                 continue;
             }
 
-            try
-            {
-                Project proj = projectDao.getProjectWithScmDetails( projectId );
+            ProjectScmRoot scmRoot = getProjectScmRootByProject( projectId );
 
-                String scmRootAddress = proj.getScmRootAddress();
-
-                Map<Integer, Integer> projectsAndBuildDefinitionsMap = map.get( scmRootAddress );
-
-                if ( projectsAndBuildDefinitionsMap == null )
-                {
-                    projectsAndBuildDefinitionsMap = new HashMap<Integer, Integer>();
-                }
+            String scmRootAddress = "";
+            if ( scmRoot != null )
+            {
+                scmRootAddress = scmRoot.getScmRootAddress();
+            }
 
-                projectsAndBuildDefinitionsMap.put( projectId, buildDefId );
+            Map<Integer, Integer> projectsAndBuildDefinitionsMap = map.get( scmRootAddress );
 
-                map.put( scmRootAddress, projectsAndBuildDefinitionsMap );
-            }
-            catch ( ContinuumStoreException e )
+            if ( projectsAndBuildDefinitionsMap == null )
             {
-                throw new ContinuumException( "Erro while retrieving project", e );
+                projectsAndBuildDefinitionsMap = new HashMap<Integer, Integer>();
             }
+
+            projectsAndBuildDefinitionsMap.put( projectId, buildDefId );
+
+            map.put( scmRootAddress, projectsAndBuildDefinitionsMap );
         }
 
         return map.values();
@@ -3707,9 +3192,13 @@
                     taskQueueManager.removeProjectFromCheckoutQueue( projectId );
                 }
                 
-                Project proj = projectDao.getProjectWithScmDetails( projectId );
-                
-                String scmRootAddress = proj.getScmRootAddress();
+                ProjectScmRoot scmRoot = getProjectScmRootByProject( projectId );
+
+                String scmRootAddress = "";
+                if ( scmRoot != null )
+                {
+                    scmRootAddress = scmRoot.getScmRootAddress();
+                }
                 
                 Map<Integer, Integer> projectsAndBuildDefinitionsMap = map.get( scmRootAddress );
                 
@@ -3726,30 +3215,26 @@
             {
                 throw new ContinuumException( e.getMessage(), e );
             }
-            catch ( ContinuumStoreException e )
-            {
-                throw new ContinuumException( "Error while retrieving project", e );
-            }
         }
 
         return map.values();
     }
 
-    public void prepareBuildProjects( Collection<Map<Integer, Integer>> projectsBuildDefinitions )
+    public void prepareBuildProjects( Collection<Map<Integer, Integer>> projectsBuildDefinitions, int trigger )
         throws ContinuumException
     {
         for ( Map<Integer, Integer> map : projectsBuildDefinitions )
         {
-            prepareBuildProjects( map );
+            prepareBuildProjects( map, trigger );
         }
     }
 
-    public void prepareBuildProjects( Map<Integer, Integer> projectsBuildDefinitionsMap )
+    public void prepareBuildProjects( Map<Integer, Integer> projectsBuildDefinitionsMap, int trigger )
         throws ContinuumException
     {
         try
         {
-            PrepareBuildProjectsTask task = new PrepareBuildProjectsTask( projectsBuildDefinitionsMap );
+            PrepareBuildProjectsTask task = new PrepareBuildProjectsTask( projectsBuildDefinitionsMap, trigger );
             taskQueueManager.getPrepareBuildQueue().put( task );
         }
         catch ( TaskQueueException e )
@@ -3758,32 +3243,6 @@
         }
     }
 
-    private void setScmRootAddressForProject( Project project )
-        throws ContinuumException
-    {
-        boolean found = false;
-
-        ProjectGroup projectGroup = project.getProjectGroup();
-
-        List<ProjectScmRoot> scmRoots = projectScmRootDao.getProjectScmRootByProjectGroup( projectGroup.getId() );
-        
-        for ( ProjectScmRoot scmRoot : scmRoots )
-        {
-            if ( project.getScmUrl().startsWith( scmRoot.getScmRootAddress() ) )
-            {
-                project.setScmRootAddress( scmRoot.getScmRootAddress() );
-                found = true;
-                break;
-            }
-        }
-        
-        if ( !found )
-        {
-            createProjectScmRootForProjectGroup( projectGroup );
-            setScmRootAddressForProject( project );
-        }
-    }
-
     private void createProjectScmRootForProjectGroup( ProjectGroup projectGroup )
         throws ContinuumException
     {
@@ -3816,14 +3275,21 @@
     private ProjectScmRoot createProjectScmRoot( ProjectGroup projectGroup, String url )
         throws ContinuumException
     {
-        ProjectScmRoot projectScmRoot = new ProjectScmRoot();
-        
-        projectScmRoot.setProjectGroup( projectGroup );
-        
-        projectScmRoot.setScmRootAddress( url );
-        
         try
         {
+            ProjectScmRoot scmRoot = projectScmRootDao.getProjectScmRootByProjectGroupAndScmRootAddress( projectGroup.getId(), url );
+
+            if ( scmRoot != null )
+            {
+                return null;
+            }
+
+            ProjectScmRoot projectScmRoot = new ProjectScmRoot();
+
+            projectScmRoot.setProjectGroup( projectGroup );
+
+            projectScmRoot.setScmRootAddress( url );
+
             return projectScmRootDao.addProjectScmRoot( projectScmRoot );
         }
         catch ( ContinuumStoreException e )

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=708091&r1=708090&r2=708091&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 Oct 26 22:54:11 2008
@@ -19,8 +19,6 @@
  * under the License.
  */
 
-import org.apache.continuum.taskqueue.manager.TaskQueueManager;
-import org.apache.continuum.taskqueue.manager.TaskQueueManagerException;
 import org.apache.maven.continuum.buildqueue.BuildProjectTask;
 import org.codehaus.plexus.logging.AbstractLogEnabled;
 import org.codehaus.plexus.taskqueue.Task;
@@ -39,11 +37,6 @@
      * @plexus.requirement
      */
     private BuildController controller;
-    
-    /**
-     * @plexus.requirement
-     */
-    private TaskQueueManager taskQueueManager;
 
     // ----------------------------------------------------------------------
     // TaskExecutor Implementation
@@ -53,23 +46,6 @@
         throws TaskExecutionException
     {
         BuildProjectTask buildProjectTask = (BuildProjectTask) task;
-
-        try
-        {
-            while ( taskQueueManager.isInPrepareBuildQueue( buildProjectTask.getProjectId() ) ||
-                    taskQueueManager.isInCurrentPrepareBuildTask( buildProjectTask.getProjectId() ) )
-            {
-                Thread.sleep( 1000 );
-            }
-        }
-        catch ( TaskQueueManagerException e )
-        {
-            throw new TaskExecutionException( e.getMessage(), e );
-        }
-        catch ( InterruptedException e )
-        {
-            throw new TaskExecutionException( e.getMessage(), e );
-        }
         
         controller.build( buildProjectTask.getProjectId(), buildProjectTask.getBuildDefinitionId(), buildProjectTask
             .getTrigger() );

Added: continuum/branches/continuum-transient-state/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CreateBuildProjectTaskAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-transient-state/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CreateBuildProjectTaskAction.java?rev=708091&view=auto
==============================================================================
--- continuum/branches/continuum-transient-state/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CreateBuildProjectTaskAction.java (added)
+++ continuum/branches/continuum-transient-state/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CreateBuildProjectTaskAction.java Sun Oct 26 22:54:11 2008
@@ -0,0 +1,147 @@
+package org.apache.maven.continuum.core.action;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.Map;
+
+import org.apache.continuum.dao.BuildDefinitionDao;
+import org.apache.continuum.dao.ProjectDao;
+import org.apache.continuum.taskqueue.manager.TaskQueueManager;
+import org.apache.maven.continuum.ContinuumException;
+import org.apache.maven.continuum.buildqueue.BuildProjectTask;
+import org.apache.maven.continuum.execution.ContinuumBuildExecutor;
+import org.apache.maven.continuum.execution.manager.BuildExecutorManager;
+import org.apache.maven.continuum.model.project.BuildDefinition;
+import org.apache.maven.continuum.model.project.Project;
+import org.apache.maven.continuum.project.ContinuumProjectState;
+import org.apache.maven.continuum.store.ContinuumStoreException;
+import org.codehaus.plexus.taskqueue.TaskQueueException;
+import org.codehaus.plexus.util.StringUtils;
+
+/**
+ * @author <a href="mailto:ctan@apache.org">Maria Catherine Tan</a>
+ * @plexus.component role="org.codehaus.plexus.action.Action" role-hint="create-build-project-task"
+ */
+public class CreateBuildProjectTaskAction
+    extends AbstractContinuumAction
+{
+    /**
+     * @plexus.requirement
+     */
+    private TaskQueueManager taskQueueManager;
+
+    /**
+     * @plexus.requirement
+     */
+    private BuildExecutorManager executorManager;
+
+    /**
+     * @plexus.requirement
+     */
+    private ProjectDao projectDao;
+
+    /**
+     * @plexus.requirement
+     */
+    private BuildDefinitionDao buildDefinitionDao;
+    
+    public synchronized void execute( Map context )
+        throws Exception
+    {
+        Project project = AbstractContinuumAction.getProject( context );
+        int buildDefinitionId = AbstractContinuumAction.getBuildDefinitionId( context );
+        int trigger = AbstractContinuumAction.getTrigger( context );
+        
+        if ( taskQueueManager.isInBuildingQueue( project.getId(), buildDefinitionId ) )
+        {
+            return;
+        }
+
+        if ( taskQueueManager.isInCheckoutQueue( project.getId() ) )
+        {
+            taskQueueManager.removeProjectFromCheckoutQueue( project.getId() );
+        }
+        
+        try
+        {
+            if ( project.getState() != ContinuumProjectState.NEW &&
+                project.getState() != ContinuumProjectState.CHECKEDOUT &&
+                project.getState() != ContinuumProjectState.OK && project.getState() != ContinuumProjectState.FAILED &&
+                project.getState() != ContinuumProjectState.ERROR )
+            {
+                ContinuumBuildExecutor executor = executorManager.getBuildExecutor( project.getExecutorId() );
+
+                if ( executor.isBuilding( project ) || project.getState() == ContinuumProjectState.UPDATING )
+                {
+                    // project is building
+                    getLogger().info( "Project '" + project.getName() + "' already being built." );
+
+                    return;
+                }
+                else
+                {
+                    project.setOldState( project.getState() );
+
+                    project.setState( ContinuumProjectState.ERROR );
+
+                    projectDao.updateProject( project );
+
+                    project = projectDao.getProject( project.getId() );
+                }
+            }
+            else
+            {
+                project.setOldState( project.getState() );
+
+                projectDao.updateProject( project );
+
+                project = projectDao.getProject( project.getId() );
+            }
+
+            BuildDefinition buildDefinition = buildDefinitionDao.getBuildDefinition( buildDefinitionId );
+            String buildDefinitionLabel = buildDefinition.getDescription();
+            if ( StringUtils.isEmpty( buildDefinitionLabel ) )
+            {
+                buildDefinitionLabel = buildDefinition.getGoals();
+            }
+
+            getLogger().info( "Enqueuing '" + project.getName() + "' with build definition '" + buildDefinitionLabel +
+                "' - id=" + buildDefinitionId + ")." );
+
+            BuildProjectTask task = new BuildProjectTask( project.getId(), buildDefinitionId, trigger, project
+                .getName(), buildDefinitionLabel );
+
+            task.setMaxExecutionTime( buildDefinition.getSchedule()
+                .getMaxJobExecutionTime() * 1000 );
+
+            taskQueueManager.getBuildQueue().put( task );
+        }
+        catch ( ContinuumStoreException e )
+        {
+            getLogger().error( "Error while creating build object", e );
+            throw new ContinuumException( "Error while creating build object.", e );
+        }
+        catch ( TaskQueueException e )
+        {
+            getLogger().error( "Error while enqueuing object", e );
+            throw new ContinuumException( "Error while enqueuing object.", e );
+        }
+    }
+}

Modified: continuum/branches/continuum-transient-state/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTask.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-transient-state/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTask.java?rev=708091&r1=708090&r2=708091&view=diff
==============================================================================
--- continuum/branches/continuum-transient-state/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTask.java (original)
+++ continuum/branches/continuum-transient-state/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTask.java Sun Oct 26 22:54:11 2008
@@ -9,9 +9,12 @@
 {
     private Map<Integer, Integer> projectsBuildDefinitionsMap;
 
-    public PrepareBuildProjectsTask( Map<Integer, Integer> projectsBuildDefinitionsMap )
+    private int trigger;
+
+    public PrepareBuildProjectsTask( Map<Integer, Integer> projectsBuildDefinitionsMap, int trigger )
     {
         this.projectsBuildDefinitionsMap = projectsBuildDefinitionsMap;
+        this.trigger = trigger;
     }
     
     public long getMaxExecutionTime()
@@ -29,6 +32,16 @@
     {
         this.projectsBuildDefinitionsMap = projectsBuildDefinitionsMap;
     }
+
+    public int getTrigger()
+    {
+        return trigger;
+    }
+
+    public void setTrigger( int trigger )
+    {
+        this.trigger = trigger;
+    }
     
     public int getHashCode()
     {

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=708091&r1=708090&r2=708091&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 Oct 26 22:54:11 2008
@@ -18,6 +18,7 @@
 import org.apache.maven.continuum.project.ContinuumProjectState;
 import org.apache.maven.continuum.store.ContinuumStoreException;
 import org.apache.maven.continuum.utils.ContinuumUtils;
+import org.apache.maven.continuum.utils.ProjectSorter;
 import org.apache.maven.continuum.utils.WorkingDirectoryService;
 import org.codehaus.plexus.action.ActionManager;
 import org.codehaus.plexus.action.ActionNotFoundException;
@@ -26,6 +27,7 @@
 import org.codehaus.plexus.taskqueue.execution.TaskExecutionException;
 import org.codehaus.plexus.taskqueue.execution.TaskExecutor;
 import org.codehaus.plexus.util.StringUtils;
+import org.codehaus.plexus.util.dag.CycleDetectedException;
 
 /**
  * @author <a href="mailto:ctan@apache.org">Maria Catherine Tan</a>
@@ -72,6 +74,7 @@
         PrepareBuildProjectsTask prepareTask = (PrepareBuildProjectsTask) task;
         
         Map<Integer, Integer> projectsBuildDefinitionsMap = prepareTask.getProjectsBuildDefinitionsMap();
+        int trigger = prepareTask.getTrigger();
         Set<Integer> projectsId = projectsBuildDefinitionsMap.keySet();
         Map context = new HashMap();
 
@@ -127,6 +130,9 @@
             getLogger().info( "Ending prepare build" );
             endPrepareBuild( context );
         }
+
+        int projectGroupId = AbstractContinuumAction.getProjectGroupId( context );
+        buildProjects( projectGroupId, projectsBuildDefinitionsMap, trigger );
     }
     
     private Map initializeContext( int projectId, int buildDefinitionId )
@@ -150,7 +156,8 @@
                     break;
                 }
             }
-            
+
+            context.put( AbstractContinuumAction.KEY_PROJECT_GROUP_ID, projectGroup.getId() );
             context.put( AbstractContinuumAction.KEY_PROJECT_ID, projectId );
             context.put( AbstractContinuumAction.KEY_PROJECT, project );
     
@@ -416,4 +423,70 @@
             throw new TaskExecutionException( "Error storing project scm root", e );
         }
     }
+
+    private void buildProjects( int projectGroupId, Map<Integer, Integer> projectsAndBuildDefinitionsMap, int trigger )
+        throws TaskExecutionException
+    {
+        List<Project> projects = projectDao.getProjectsWithDependenciesByGroupId( projectGroupId );
+        List<Project> projectList;
+        
+        try
+        {
+            projectList = ProjectSorter.getSortedProjects( projects, getLogger() );
+        }
+        catch ( CycleDetectedException e )
+        {
+            projectList = projectDao.getAllProjectsByName();
+        }
+
+        for ( Project project : projectList )
+        {
+            boolean shouldBuild = false;
+            int buildDefinitionId = 0;
+            
+            if ( projectsAndBuildDefinitionsMap.get( project.getId() ) != null )
+            {
+                buildDefinitionId = projectsAndBuildDefinitionsMap.get( project.getId() );
+                shouldBuild = true;
+            }
+            else if ( project.getState() == ContinuumProjectState.CHECKEDOUT || project.getState() == ContinuumProjectState.NEW ) //check if no build result yet for project
+            {
+                try
+                {
+                    //get default build definition for project
+                    buildDefinitionId = buildDefinitionDao.getDefaultBuildDefinition( project.getId() ).getId();
+                }
+                catch ( ContinuumStoreException e )
+                {
+                    getLogger().error( "Error while creating build object", e );
+                    throw new TaskExecutionException( "Error while creating build object", e );
+                }
+                shouldBuild = true;
+            }
+
+            if ( shouldBuild )
+            {
+                try
+                {
+                    Map context = new HashMap();
+                    context.put( AbstractContinuumAction.KEY_PROJECT, project );
+                    context.put( AbstractContinuumAction.KEY_BUILD_DEFINITION_ID, buildDefinitionId );
+                    context.put( AbstractContinuumAction.KEY_TRIGGER, trigger );
+                    
+                    getLogger().info( "Performing action create-build-project-task" );
+                    actionManager.lookup( "create-build-project-task" ).execute( context );
+                }
+                catch ( ActionNotFoundException e )
+                {
+                   getLogger().error( "Error looking up action 'build-project'" );
+                   throw new TaskExecutionException( "Error looking up action 'build-project'", e );
+                }
+                catch ( Exception e )
+                {
+                    getLogger().error( e.getMessage(), e );
+                    throw new TaskExecutionException( "Error executing action 'build-project'", e );
+                }
+            }
+        }
+    }
 }

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=708091&r1=708090&r2=708091&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 Oct 26 22:54:11 2008
@@ -351,11 +351,6 @@
             <type>ScmResult</type>
           </association>
         </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-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=708091&r1=708090&r2=708091&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 Oct 26 22:54:11 2008
@@ -162,88 +162,7 @@
 
             Collection<Map<Integer, Integer>> projectsBuildDefs = getProjectsBuildDefsMap( sortedProjects );
             
-            getContinuum().prepareBuildProjects( projectsBuildDefs );
-            
-            for ( Project project : sortedProjects )
-            {
-                if ( this.getBuildDefinitionId() <= 0 )
-                {
-                    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
-                {
-                    getContinuum().buildProject( project.getId(), this.getBuildDefinitionId(),
-                                                 ContinuumProjectState.TRIGGER_FORCED );
-                }
-            }
-            
-            /*
-            //TODO : Change this part because it's a duplicate of DefaultContinuum.buildProjectGroup*
-            List<BuildDefinition> groupDefaultBDs = null;
-
-            if ( getBuildDefinitionId() <= 0 )
-            {
-                groupDefaultBDs = getContinuum().getDefaultBuildDefinitionsForProjectGroup( projectGroupId );
-            }
-          
-            
-            for ( Iterator i = sortedProjects.iterator(); i.hasNext(); )
-            {
-                Project project = (Project) i.next();
-                if ( this.getBuildDefinitionId() <= 0 )
-                {
-                    int buildDefId = -1;
-
-                    if ( groupDefaultBDs != null )
-                    {
-                        for ( BuildDefinition bd : groupDefaultBDs )
-                        {
-                            if ( project.getExecutorId().equals( bd.getType() ) )
-                            {
-                                buildDefId = bd.getId();
-                                break;
-                            }
-                        }
-                    }
-
-                    BuildDefinition projectDefaultBD = null;
-                    if ( this.getBuildDefinitionId() == -1 )
-                    {
-                        try
-                        {
-                            projectDefaultBD = getContinuum().getDefaultBuildDefinition( project.getId() );
-                        }
-                        catch ( ContinuumException e )
-                        {
-                            // here skip ObjectNotException
-                            getLogger().debug( e.getMessage() );
-                        }
-
-                        if ( projectDefaultBD != null )
-                        {
-                            buildDefId = projectDefaultBD.getId();
-                            getLogger().debug( "Project " + project.getId() +
-                                " has own default build definition, will use it instead of group's." );
-                        }
-                    }
-
-                    getContinuum().buildProject( project.getId(), buildDefId, ContinuumProjectState.TRIGGER_FORCED );
-                }
-                else
-                {
-                    getContinuum().buildProject( project.getId(), this.getBuildDefinitionId(),
-                                                 ContinuumProjectState.TRIGGER_FORCED );
-                }
-            }
-            */
+            getContinuum().prepareBuildProjects( projectsBuildDefs, ContinuumProjectState.TRIGGER_FORCED );
         }
 
         return SUCCESS;



Mime
View raw message