continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From och...@apache.org
Subject svn commit: r941625 [10/24] - in /continuum/branches/continuum-flat-multi-module: ./ continuum-api/ continuum-api/src/main/java/org/apache/continuum/builder/distributed/ continuum-api/src/main/java/org/apache/continuum/builder/distributed/manager/ cont...
Date Thu, 06 May 2010 09:23:34 GMT
Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java Thu May  6 09:23:13 2010
@@ -27,6 +27,7 @@ import java.util.Map;
 import org.apache.continuum.dao.BuildResultDao;
 import org.apache.continuum.dao.ProjectDao;
 import org.apache.continuum.utils.ContinuumUtils;
+import org.apache.continuum.utils.build.BuildTrigger;
 import org.apache.maven.continuum.configuration.ConfigurationService;
 import org.apache.maven.continuum.execution.ContinuumBuildCancelledException;
 import org.apache.maven.continuum.execution.ContinuumBuildExecutionResult;
@@ -49,6 +50,8 @@ import org.apache.maven.continuum.projec
 public class ExecuteBuilderContinuumAction
     extends AbstractContinuumAction
 {
+    private static final String KEY_CANCELLED = "cancelled";
+
     /**
      * @plexus.requirement
      */
@@ -85,7 +88,7 @@ public class ExecuteBuilderContinuumActi
 
         BuildDefinition buildDefinition = getBuildDefinition( context );
 
-        int trigger = getTrigger( context );
+        BuildTrigger buildTrigger = getBuildTrigger( context );
 
         ScmResult scmResult = getScmResult( context );
 
@@ -103,7 +106,9 @@ public class ExecuteBuilderContinuumActi
 
         buildResult.setState( ContinuumProjectState.BUILDING );
 
-        buildResult.setTrigger( trigger );
+        buildResult.setTrigger( buildTrigger.getTrigger() );
+        
+        buildResult.setUsername( buildTrigger.getUsername() );
 
         buildResult.setScmResult( scmResult );
 
@@ -113,9 +118,9 @@ public class ExecuteBuilderContinuumActi
 
         buildResultDao.addBuildResult( project, buildResult );
 
-        context.put( KEY_BUILD_ID, Integer.toString( buildResult.getId() ) );
+        AbstractContinuumAction.setBuildId( context, Integer.toString( buildResult.getId() ) );
 
-        context.put( KEY_CANCELLED, false );
+        setCancelled( context, false );
 
         buildResult = buildResultDao.getBuildResult( buildResult.getId() );
 
@@ -137,7 +142,7 @@ public class ExecuteBuilderContinuumActi
 
             buildResult.setState( ContinuumProjectState.CANCELLED );
 
-            context.put( KEY_CANCELLED, true );
+            setCancelled( context, true );
         }
         catch ( Throwable e )
         {
@@ -196,18 +201,25 @@ public class ExecuteBuilderContinuumActi
                 notifier.goalsCompleted( project, buildDefinition, buildResult );
             }
 
-            context.put( KEY_PROJECT, project );
+            AbstractContinuumAction.setProject( context, project );
 
             projectDao.updateProject( project );
 
-            String projectScmRootUrl = getString( context, KEY_PROJECT_SCM_ROOT_URL, project.getScmUrl() );
-            List<Project> projectsWithCommonScmRoot = getListOfProjectsInGroupWithCommonScmRoot( context );
-            
             // ----------------------------------------------------------------------
             // Backup test result files
             // ----------------------------------------------------------------------
             //TODO: Move as a plugin
-            buildExecutor.backupTestFiles( project, buildResult.getId(), projectScmRootUrl, projectsWithCommonScmRoot );
+            buildExecutor.backupTestFiles( project, buildResult.getId() );
         }
     }
+
+    public static boolean isCancelled( Map<String, Object> context )
+    {
+        return getBoolean( context, KEY_CANCELLED );
+    }
+
+    private static void setCancelled( Map<String, Object> context, boolean cancelled )
+    {
+        context.put( KEY_CANCELLED, cancelled );
+    }
 }

Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/RemoveAssignableRolesAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/RemoveAssignableRolesAction.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/RemoveAssignableRolesAction.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/RemoveAssignableRolesAction.java Thu May  6 09:23:13 2010
@@ -19,6 +19,8 @@ package org.apache.maven.continuum.core.
  * under the License.
  */
 
+import java.util.Map;
+
 import org.apache.continuum.dao.ProjectGroupDao;
 import org.apache.maven.continuum.ContinuumException;
 import org.apache.maven.continuum.model.project.ProjectGroup;
@@ -26,8 +28,6 @@ import org.apache.maven.continuum.store.
 import org.codehaus.plexus.redback.role.RoleManager;
 import org.codehaus.plexus.redback.role.RoleManagerException;
 
-import java.util.Map;
-
 /**
  * AddAssignableRolesAction:
  *

Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/RemoveBuildDefinitionFromProjectAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/RemoveBuildDefinitionFromProjectAction.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/RemoveBuildDefinitionFromProjectAction.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/RemoveBuildDefinitionFromProjectAction.java Thu May  6 09:23:13 2010
@@ -19,12 +19,12 @@ package org.apache.maven.continuum.core.
  * under the License.
  */
 
+import java.util.Map;
+
 import org.apache.continuum.dao.ProjectDao;
 import org.apache.maven.continuum.model.project.BuildDefinition;
 import org.apache.maven.continuum.model.project.Project;
 
-import java.util.Map;
-
 /**
  * AddBuildDefinitionToProjectAction:
  *
@@ -41,11 +41,11 @@ public class RemoveBuildDefinitionFromPr
      */
     private ProjectDao projectDao;
 
-    public void execute( Map map )
+    public void execute( Map context )
         throws Exception
     {
-        BuildDefinition buildDefinition = getBuildDefinition( map );
-        int projectId = getProjectId( map );
+        BuildDefinition buildDefinition = getBuildDefinition( context );
+        int projectId = getProjectId( context );
 
         Project project = projectDao.getProjectWithAllDetails( projectId );
 

Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/RemoveBuildDefinitionFromProjectGroupAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/RemoveBuildDefinitionFromProjectGroupAction.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/RemoveBuildDefinitionFromProjectGroupAction.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/RemoveBuildDefinitionFromProjectGroupAction.java Thu May  6 09:23:13 2010
@@ -19,13 +19,13 @@ package org.apache.maven.continuum.core.
  * under the License.
  */
 
+import java.util.Map;
+
 import org.apache.continuum.dao.ProjectGroupDao;
 import org.apache.maven.continuum.ContinuumException;
 import org.apache.maven.continuum.model.project.BuildDefinition;
 import org.apache.maven.continuum.model.project.ProjectGroup;
 
-import java.util.Map;
-
 /**
  * AddBuildDefinitionToProjectAction:
  *
@@ -43,11 +43,11 @@ public class RemoveBuildDefinitionFromPr
     private ProjectGroupDao projectGroupDao;
 
 
-    public void execute( Map map )
+    public void execute( Map context )
         throws Exception
     {
-        BuildDefinition buildDefinition = getBuildDefinition( map );
-        int projectGroupId = getProjectGroupId( map );
+        BuildDefinition buildDefinition = getBuildDefinition( context );
+        int projectGroupId = getProjectGroupId( context );
 
         ProjectGroup projectGroup = projectGroupDao.getProjectGroupWithBuildDetailsByProjectGroupId( projectGroupId );
 

Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/StoreCheckOutScmResultAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/StoreCheckOutScmResultAction.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/StoreCheckOutScmResultAction.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/StoreCheckOutScmResultAction.java Thu May  6 09:23:13 2010
@@ -19,14 +19,14 @@ package org.apache.maven.continuum.core.
  * under the License.
  */
 
+import java.util.Map;
+
 import org.apache.continuum.dao.ProjectDao;
 import org.apache.maven.continuum.model.project.Project;
 import org.apache.maven.continuum.model.scm.ScmResult;
 import org.apache.maven.continuum.store.ContinuumStoreException;
 import org.codehaus.plexus.taskqueue.execution.TaskExecutionException;
 
-import java.util.Map;
-
 /**
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
  * @version $Id$
@@ -50,7 +50,7 @@ public class StoreCheckOutScmResultActio
             //
             // ----------------------------------------------------------------------
 
-            ScmResult scmResult = AbstractContinuumAction.getCheckoutResult( context, null );
+            ScmResult scmResult = CheckoutProjectContinuumAction.getCheckoutResult( context, null );
 
             Project project = projectDao.getProject( getProjectId( context ) );
 

Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/StoreProjectAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/StoreProjectAction.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/StoreProjectAction.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/StoreProjectAction.java Thu May  6 09:23:13 2010
@@ -36,6 +36,8 @@ import org.apache.maven.continuum.store.
 public class StoreProjectAction
     extends AbstractContinuumAction
 {
+    private static final String KEY_SCM_USE_CREDENTIALS_CACHE = "useCredentialsCache";
+
     /**
      * @plexus.requirement
      */
@@ -52,20 +54,20 @@ public class StoreProjectAction
         //
         // ----------------------------------------------------------------------
 
-        boolean useCredentialsCache = getBoolean( context, KEY_SCM_USE_CREDENTIALS_CACHE, false );
+        boolean useCredentialsCache = isUseScmCredentialsCache( context, false );
         // CONTINUUM-1605 don't store username/password
-        if ( !useCredentialsCache )
+        if ( useCredentialsCache )
         {
             project.setScmUsername( null );
             project.setScmPassword( null );
-            project.setScmUseCache( false );
+            project.setScmUseCache( true );
         }
 
         projectGroup.addProject( project );
 
         projectGroupDao.updateProjectGroup( projectGroup );
 
-        context.put( KEY_PROJECT_ID, project.getId() );
+        setProjectId( context, project.getId() );
 
         // ----------------------------------------------------------------------
         // Set the working directory
@@ -86,4 +88,14 @@ public class StoreProjectAction
 */
 //        store.updateProject( project );
     }
+
+    public static boolean isUseScmCredentialsCache( Map<String, Object> context, boolean defaultValue )
+    {
+        return getBoolean( context, KEY_SCM_USE_CREDENTIALS_CACHE, defaultValue );
+    }
+
+    public static void setUseScmCredentialsCache( Map<String, Object> context, boolean useScmCredentialsCache )
+    {
+        context.put( KEY_SCM_USE_CREDENTIALS_CACHE, useScmCredentialsCache );
+    }
 }

Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/StoreProjectGroupAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/StoreProjectGroupAction.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/StoreProjectGroupAction.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/StoreProjectGroupAction.java Thu May  6 09:23:13 2010
@@ -51,6 +51,6 @@ public class StoreProjectGroupAction
 
         projectGroup = projectGroupDao.addProjectGroup( projectGroup );
 
-        context.put( KEY_PROJECT_GROUP_ID, projectGroup.getId() );
+        AbstractContinuumAction.setProjectGroupId( context, projectGroup.getId() );
     }
 }

Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateBuildDefinitionFromProjectAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateBuildDefinitionFromProjectAction.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateBuildDefinitionFromProjectAction.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateBuildDefinitionFromProjectAction.java Thu May  6 09:23:13 2010
@@ -19,12 +19,12 @@ package org.apache.maven.continuum.core.
  * under the License.
  */
 
+import java.util.Map;
+
 import org.apache.continuum.dao.ProjectDao;
 import org.apache.maven.continuum.model.project.BuildDefinition;
 import org.apache.maven.continuum.model.project.Project;
 
-import java.util.Map;
-
 /**
  * AddBuildDefinitionToProjectAction:
  *
@@ -41,11 +41,11 @@ public class UpdateBuildDefinitionFromPr
      */
     private ProjectDao projectDao;
 
-    public void execute( Map map )
+    public void execute( Map context )
         throws Exception
     {
-        BuildDefinition buildDefinition = getBuildDefinition( map );
-        int projectId = getProjectId( map );
+        BuildDefinition buildDefinition = getBuildDefinition( context );
+        int projectId = getProjectId( context );
 
         Project project = projectDao.getProjectWithAllDetails( projectId );
 
@@ -53,7 +53,7 @@ public class UpdateBuildDefinitionFromPr
 
         updateBuildDefinitionInList( project.getBuildDefinitions(), buildDefinition );
 
-        map.put( AbstractContinuumAction.KEY_BUILD_DEFINITION, buildDefinition );
+        AbstractContinuumAction.setBuildDefinition( context, buildDefinition );
     }
 
 }

Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateBuildDefinitionFromProjectGroupAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateBuildDefinitionFromProjectGroupAction.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateBuildDefinitionFromProjectGroupAction.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateBuildDefinitionFromProjectGroupAction.java Thu May  6 09:23:13 2010
@@ -19,12 +19,12 @@ package org.apache.maven.continuum.core.
  * under the License.
  */
 
+import java.util.Map;
+
 import org.apache.continuum.dao.ProjectGroupDao;
 import org.apache.maven.continuum.model.project.BuildDefinition;
 import org.apache.maven.continuum.model.project.ProjectGroup;
 
-import java.util.Map;
-
 /**
  * AddBuildDefinitionToProjectAction:
  *
@@ -41,11 +41,11 @@ public class UpdateBuildDefinitionFromPr
      */
     private ProjectGroupDao projectGroupDao;
 
-    public void execute( Map map )
+    public void execute( Map context )
         throws Exception
     {
-        BuildDefinition buildDefinition = getBuildDefinition( map );
-        int projectGroupId = getProjectGroupId( map );
+        BuildDefinition buildDefinition = getBuildDefinition( context );
+        int projectGroupId = getProjectGroupId( context );
 
         ProjectGroup projectGroup = projectGroupDao.getProjectGroupWithBuildDetailsByProjectGroupId( projectGroupId );
 
@@ -53,6 +53,6 @@ public class UpdateBuildDefinitionFromPr
 
         updateBuildDefinitionInList( projectGroup.getBuildDefinitions(), buildDefinition );
 
-        map.put( AbstractContinuumAction.KEY_BUILD_DEFINITION, buildDefinition );
+        AbstractContinuumAction.setBuildDefinition( context, buildDefinition );
     }
 }

Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateProjectFromWorkingDirectoryContinuumAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateProjectFromWorkingDirectoryContinuumAction.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateProjectFromWorkingDirectoryContinuumAction.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateProjectFromWorkingDirectoryContinuumAction.java Thu May  6 09:23:13 2010
@@ -19,6 +19,8 @@ package org.apache.maven.continuum.core.
  * under the License.
  */
 
+import java.util.Map;
+
 import org.apache.continuum.dao.BuildDefinitionDao;
 import org.apache.continuum.dao.ProjectDao;
 import org.apache.maven.continuum.ContinuumException;
@@ -27,12 +29,10 @@ import org.apache.maven.continuum.execut
 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.model.scm.ScmResult;
 import org.apache.maven.continuum.store.ContinuumStoreException;
 import org.apache.maven.continuum.utils.WorkingDirectoryService;
 
-import java.util.List;
-import java.util.Map;
-
 /**
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
  * @version $Id$
@@ -79,11 +79,9 @@ public class UpdateProjectFromWorkingDir
 
         ContinuumBuildExecutor builder = buildExecutorManager.getBuildExecutor( project.getExecutorId() );
 
-        List<Project> projectsWithCommonScmRoot = getListOfProjectsInGroupWithCommonScmRoot( context );
-        String projectScmRootUrl = getString( context, KEY_PROJECT_SCM_ROOT_URL, project.getScmUrl() );
-        
-        builder.updateProjectFromCheckOut( workingDirectoryService.getWorkingDirectory( project, 
-                        projectScmRootUrl, projectsWithCommonScmRoot ), project, buildDefinition );
+        ScmResult scmResult = (ScmResult) context.get( "scmResult" );
+        builder.updateProjectFromCheckOut( workingDirectoryService.getWorkingDirectory( project ), project,
+                                           buildDefinition, scmResult );
 
         // ----------------------------------------------------------------------
         // Store the new descriptor

Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateWorkingDirectoryFromScmContinuumAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateWorkingDirectoryFromScmContinuumAction.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateWorkingDirectoryFromScmContinuumAction.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateWorkingDirectoryFromScmContinuumAction.java Thu May  6 09:23:13 2010
@@ -19,6 +19,12 @@ package org.apache.maven.continuum.core.
  * under the License.
  */
 
+import java.io.File;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
 import org.apache.continuum.dao.BuildResultDao;
 import org.apache.continuum.dao.ProjectDao;
 import org.apache.continuum.scm.ContinuumScm;
@@ -31,6 +37,7 @@ import org.apache.maven.continuum.model.
 import org.apache.maven.continuum.model.scm.ChangeSet;
 import org.apache.maven.continuum.model.scm.ScmResult;
 import org.apache.maven.continuum.notification.ContinuumNotificationDispatcher;
+import org.apache.maven.continuum.project.ContinuumProjectState;
 import org.apache.maven.continuum.store.ContinuumObjectNotFoundException;
 import org.apache.maven.continuum.store.ContinuumStoreException;
 import org.apache.maven.continuum.utils.WorkingDirectoryService;
@@ -40,12 +47,6 @@ import org.apache.maven.scm.command.upda
 import org.apache.maven.scm.manager.NoSuchScmProviderException;
 import org.apache.maven.scm.repository.ScmRepositoryException;
 
-import java.io.File;
-import java.util.Date;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
 /**
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
  * @version $Id$
@@ -53,7 +54,9 @@ import java.util.Map;
  */
 public class UpdateWorkingDirectoryFromScmContinuumAction
     extends AbstractContinuumAction
-{                                                                  
+{
+    private static final String KEY_UPDATE_SCM_RESULT = "update-result";
+
     /**
      * @plexus.requirement
      */
@@ -93,6 +96,12 @@ public class UpdateWorkingDirectoryFromS
 
         Date latestUpdateDate = null;
 
+        int originalState = project.getState();
+
+        project.setState( ContinuumProjectState.UPDATING );
+
+        projectDao.updateProject( project );
+
         try
         {
             BuildResult buildResult = buildResultDao.getLatestBuildResultForProject( project.getId() );
@@ -102,24 +111,19 @@ public class UpdateWorkingDirectoryFromS
         catch ( Exception e )
         {
         }
-        
+
         try
         {
             notifier.checkoutStarted( project, buildDefinition );
 
-            List<Project> projectsWithCommonScmRoot = getListOfProjectsInGroupWithCommonScmRoot( context );           
-            String projectScmRootUrl = getString( context, KEY_PROJECT_SCM_ROOT_URL, project.getScmUrl() );
-
-            // TODO: not sure why this is different to the context, but it all needs to change            
-            File workingDirectory =
-                workingDirectoryService.getWorkingDirectory( project, projectScmRootUrl,
-                                                             projectsWithCommonScmRoot );
-            
-            ContinuumScmConfiguration config = createScmConfiguration( project, workingDirectory, projectScmRootUrl );
+            // TODO: not sure why this is different to the context, but it all needs to change
+            File workingDirectory = workingDirectoryService.getWorkingDirectory( project );
+            ContinuumScmConfiguration config = createScmConfiguration( project, workingDirectory );
             config.setLatestUpdateDate( latestUpdateDate );
             String tag = config.getTag();
-            String msg = project.getName() + "', id: '" + project.getId() + "' to '" +
-                workingDirectory.getAbsolutePath() + "'" + ( tag != null ? " with branch/tag " + tag + "." : "." );
+            String msg =
+                project.getName() + "', id: '" + project.getId() + "' to '" + workingDirectory.getAbsolutePath() + "'" +
+                    ( tag != null ? " with branch/tag " + tag + "." : "." );
             getLogger().info( "Updating project: " + msg );
             scmResult = scm.update( config );
 
@@ -146,8 +150,8 @@ public class UpdateWorkingDirectoryFromS
             result.setSuccess( false );
 
             result.setProviderMessage( e.getMessage() + ": " + getValidationMessages( e ) );
-            
-            getLogger().error( e.getMessage(), e);
+
+            getLogger().error( e.getMessage(), e );
         }
         catch ( NoSuchScmProviderException e )
         {
@@ -157,8 +161,8 @@ public class UpdateWorkingDirectoryFromS
             result.setSuccess( false );
 
             result.setProviderMessage( e.getMessage() );
-            
-            getLogger().error( e.getMessage(), e);
+
+            getLogger().error( e.getMessage(), e );
         }
         catch ( ScmException e )
         {
@@ -167,47 +171,37 @@ public class UpdateWorkingDirectoryFromS
             result.setSuccess( false );
 
             result.setException( ContinuumUtils.throwableMessagesToString( e ) );
-            
-            getLogger().error( e.getMessage(), e);
+
+            getLogger().error( e.getMessage(), e );
         }
         finally
         {
             // set back to the original state
-            // TODO: transient states!
-            //try
-            //{
-            //    project = projectDao.getProject( project.getId() );
-
-            //    project.setState( state );
-
-            //    projectDao.updateProject( project );
-            //}
-            //catch ( Exception e )
-            //{
-                // nasty nasty, but we're in finally, so just sacrifice the state to keep the original exception
-            //    getLogger().error( e.getMessage(), e );
-            //}
+            try
+            {
+                project = projectDao.getProject( project.getId() );
+
+                project.setState( originalState );
+
+                projectDao.updateProject( project );
+            }
+            catch ( Exception e )
+            {
+            // nasty nasty, but we're in finally, so just sacrifice the state to keep the original exception
+                getLogger().error( e.getMessage(), e );
+            }
 
             notifier.checkoutComplete( project, buildDefinition );
         }
-        
+
         context.put( KEY_UPDATE_SCM_RESULT, result );
-        context.put( KEY_PROJECT, project );
+        AbstractContinuumAction.setProject( context, project );
     }
 
-    private ContinuumScmConfiguration createScmConfiguration( Project project, File workingDirectory, String scmRootUrl )
+    private ContinuumScmConfiguration createScmConfiguration( Project project, File workingDirectory )
     {
         ContinuumScmConfiguration config = new ContinuumScmConfiguration();
-        
-        if( project.isCheckedOutInSingleDirectory() && scmRootUrl!= null && !"".equals( scmRootUrl ) )
-        {
-            config.setUrl( scmRootUrl );
-        }
-        else
-        {
-            config.setUrl( project.getScmUrl() );
-        }
-        
+        config.setUrl( project.getScmUrl() );
         config.setUsername( project.getScmUsername() );
         config.setPassword( project.getScmPassword() );
         config.setUseCredentialsCache( project.isScmUseCache() );
@@ -322,7 +316,7 @@ public class UpdateWorkingDirectoryFromS
 
         return cmd;
     }
-    
+
     private String getValidationMessages( ScmRepositoryException ex )
     {
         List<String> messages = ex.getValidationMessages();
@@ -343,4 +337,14 @@ public class UpdateWorkingDirectoryFromS
         }
         return message.toString();
     }
+
+    public static ScmResult getUpdateScmResult( Map<String, Object> context )
+    {
+        return getUpdateScmResult( context, null );
+    }
+
+    public static ScmResult getUpdateScmResult( Map<String, Object> context, ScmResult defaultValue )
+    {
+        return (ScmResult) getObject( context, KEY_UPDATE_SCM_RESULT, defaultValue );
+    }
 }

Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ValidateProject.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ValidateProject.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ValidateProject.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ValidateProject.java Thu May  6 09:23:13 2010
@@ -19,15 +19,15 @@ package org.apache.maven.continuum.core.
  * under the License.
  */
 
+import java.util.List;
+import java.util.Map;
+
 import org.apache.continuum.dao.ProjectDao;
 import org.apache.maven.continuum.ContinuumException;
 import org.apache.maven.continuum.execution.manager.BuildExecutorManager;
 import org.apache.maven.continuum.model.project.Project;
 import org.codehaus.plexus.util.StringUtils;
 
-import java.util.List;
-import java.util.Map;
-
 /**
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
  * @version $Id$

Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ValidateProjectGroup.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ValidateProjectGroup.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ValidateProjectGroup.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ValidateProjectGroup.java Thu May  6 09:23:13 2010
@@ -19,10 +19,10 @@ package org.apache.maven.continuum.core.
  * under the License.
  */
 
-import org.apache.maven.continuum.model.project.ProjectGroup;
-
 import java.util.Map;
 
+import org.apache.maven.continuum.model.project.ProjectGroup;
+
 /**
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
  * @version $Id$

Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/execution/AbstractBuildExecutor.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/execution/AbstractBuildExecutor.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/execution/AbstractBuildExecutor.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/execution/AbstractBuildExecutor.java Thu May  6 09:23:13 2010
@@ -22,6 +22,7 @@ package org.apache.maven.continuum.execu
 import java.io.File;
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
@@ -29,10 +30,13 @@ import java.util.Properties;
 import org.apache.continuum.utils.shell.ExecutionResult;
 import org.apache.continuum.utils.shell.ShellCommandHelper;
 import org.apache.maven.artifact.Artifact;
+import org.apache.maven.continuum.builddefinition.BuildDefinitionUpdatePolicyConstants;
 import org.apache.maven.continuum.installation.InstallationService;
 import org.apache.maven.continuum.model.project.BuildDefinition;
 import org.apache.maven.continuum.model.project.Project;
+import org.apache.maven.continuum.model.scm.ChangeFile;
 import org.apache.maven.continuum.model.scm.ChangeSet;
+import org.apache.maven.continuum.model.scm.ScmResult;
 import org.apache.maven.continuum.model.system.Installation;
 import org.apache.maven.continuum.model.system.Profile;
 import org.apache.maven.continuum.project.ContinuumProjectState;
@@ -244,7 +248,7 @@ public abstract class AbstractBuildExecu
         throws ContinuumBuildExecutorException
     {
 
-        File workingDirectory = getWorkingDirectory( project, null, null );
+        File workingDirectory = getWorkingDirectory( project );
 
         String actualExecutable = findExecutable( executable, defaultExecutable, resolveExecutable, workingDirectory );
 
@@ -336,7 +340,7 @@ public abstract class AbstractBuildExecu
         return jdk.getVarValue();
     }
 
-    public void backupTestFiles( Project project, int buildId, String projectScmRootUrl, List<Project> projectsWithCommonScmRoot )
+    public void backupTestFiles( Project project, int buildId )
     {
         //Nothing to do, by default
     }
@@ -396,6 +400,42 @@ public abstract class AbstractBuildExecu
 
         return relPath + File.separator + buildFile;
     }
+    
+    protected boolean isDescriptionUpdated( BuildDefinition buildDefinition, ScmResult scmResult, Project project )
+    {
+        boolean update = true;
+        if ( buildDefinition != null && scmResult != null )
+        {
+            int policy = buildDefinition.getUpdatePolicy();
+            if ( BuildDefinitionUpdatePolicyConstants.UPDATE_DESCRIPTION_NEVER == policy )
+            {
+                update = false;
+            }
+            else if ( BuildDefinitionUpdatePolicyConstants.UPDATE_DESCRIPTION_ONLY_FOR_NEW_POM == policy )
+            {
+                update = pomUpdated( buildDefinition.getBuildFile(), scmResult, project );
+            }
+        }
+        return update;
+    }
+
+    private boolean pomUpdated( String buildFile, ScmResult scmResult, Project project )
+    {
+        String filename = project.getScmUrl() + "/" + buildFile;
+        for ( Iterator changeIt = scmResult.getChanges().listIterator(); changeIt.hasNext(); )
+        {
+            ChangeSet change = (ChangeSet) changeIt.next();
+            for ( Iterator fileIt = change.getFiles().listIterator(); fileIt.hasNext(); )
+            {
+                ChangeFile changeFile = (ChangeFile) fileIt.next();
+                if ( filename.endsWith( changeFile.getName() ) )
+                {
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
 
     public boolean isBuilding( Project project )
     {
@@ -416,9 +456,9 @@ public abstract class AbstractBuildExecu
         return Collections.EMPTY_LIST;
     }
 
-    public File getWorkingDirectory( Project project, String projectScmRootUrl, List<Project> projectsWithCommonScmRoot )
+    public File getWorkingDirectory( Project project )
     {
-        return getWorkingDirectoryService().getWorkingDirectory( project, projectScmRootUrl, projectsWithCommonScmRoot );
+        return getWorkingDirectoryService().getWorkingDirectory( project );
     }
 
     public InstallationService getInstallationService()

Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/execution/ant/AntBuildExecutor.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/execution/ant/AntBuildExecutor.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/execution/ant/AntBuildExecutor.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/execution/ant/AntBuildExecutor.java Thu May  6 09:23:13 2010
@@ -27,6 +27,7 @@ import org.apache.maven.continuum.execut
 import org.apache.maven.continuum.installation.InstallationService;
 import org.apache.maven.continuum.model.project.BuildDefinition;
 import org.apache.maven.continuum.model.project.Project;
+import org.apache.maven.continuum.model.scm.ScmResult;
 import org.apache.maven.continuum.model.system.Installation;
 import org.apache.maven.continuum.model.system.Profile;
 import org.codehaus.plexus.util.StringUtils;
@@ -130,7 +131,8 @@ public class AntBuildExecutor
 
     }
 
-    public void updateProjectFromCheckOut( File workingDirectory, Project p, BuildDefinition buildDefinition )
+    public void updateProjectFromCheckOut( File workingDirectory, Project p, BuildDefinition buildDefinition,
+                                           ScmResult scmResult )
         throws ContinuumBuildExecutorException
     {
     }

Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m1/DefaultMavenOneMetadataHelper.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m1/DefaultMavenOneMetadataHelper.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m1/DefaultMavenOneMetadataHelper.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m1/DefaultMavenOneMetadataHelper.java Thu May  6 09:23:13 2010
@@ -61,10 +61,10 @@ public class DefaultMavenOneMetadataHelp
     public void mapMetadata( File metadata, Project project )
         throws MavenOneMetadataHelperException
     {
-        mapMetadata( new ContinuumProjectBuildingResult(), metadata, project );
+        mapMetadata( new ContinuumProjectBuildingResult(), metadata, project, true );
     }
 
-    public void mapMetadata( ContinuumProjectBuildingResult result, File metadata, Project project )
+    public void mapMetadata( ContinuumProjectBuildingResult result, File metadata, Project project, boolean updateDefinition )
         throws MavenOneMetadataHelperException
     {
         Xpp3Dom mavenProject;
@@ -348,10 +348,13 @@ public class DefaultMavenOneMetadataHelp
         project.setGroupId( groupId );
 
         project.setArtifactId( artifactId );
+        
+        if ( updateDefinition )
+        {
+            project.setVersion( version );
 
-        project.setVersion( version );
-
-        project.setName( name );
+            project.setName( name );
+        }
 
         if ( StringUtils.isEmpty( shortDescription ) )
         {

Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m1/MavenOneBuildExecutor.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m1/MavenOneBuildExecutor.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m1/MavenOneBuildExecutor.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m1/MavenOneBuildExecutor.java Thu May  6 09:23:13 2010
@@ -35,6 +35,7 @@ import org.apache.maven.continuum.execut
 import org.apache.maven.continuum.installation.InstallationService;
 import org.apache.maven.continuum.model.project.BuildDefinition;
 import org.apache.maven.continuum.model.project.Project;
+import org.apache.maven.continuum.model.scm.ScmResult;
 import org.apache.maven.continuum.model.system.Installation;
 import org.apache.maven.continuum.model.system.Profile;
 import org.apache.maven.continuum.project.builder.ContinuumProjectBuildingResult;
@@ -149,7 +150,8 @@ public class MavenOneBuildExecutor
 
     }
 
-    public void updateProjectFromCheckOut( File workingDirectory, Project project, BuildDefinition buildDefinition )
+    public void updateProjectFromCheckOut( File workingDirectory, Project project, BuildDefinition buildDefinition,
+                                           ScmResult scmResult )
         throws ContinuumBuildExecutorException
     {
         File projectXmlFile = null;
@@ -176,7 +178,8 @@ public class MavenOneBuildExecutor
 
         try
         {
-            metadataHelper.mapMetadata( new ContinuumProjectBuildingResult(), projectXmlFile, project );
+            boolean update = isDescriptionUpdated( buildDefinition, scmResult, project );
+            metadataHelper.mapMetadata( new ContinuumProjectBuildingResult(), projectXmlFile, project, update );
         }
         catch ( MavenOneMetadataHelperException e )
         {

Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m1/MavenOneMetadataHelper.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m1/MavenOneMetadataHelper.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m1/MavenOneMetadataHelper.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m1/MavenOneMetadataHelper.java Thu May  6 09:23:13 2010
@@ -45,6 +45,6 @@ public interface MavenOneMetadataHelper
      * @throws MavenOneMetadataHelperException
      *
      */
-    void mapMetadata( ContinuumProjectBuildingResult result, File metadata, Project project )
+    void mapMetadata( ContinuumProjectBuildingResult result, File metadata, Project project, boolean updateDefinition)
         throws MavenOneMetadataHelperException;
 }

Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/DefaultMavenBuilderHelper.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/DefaultMavenBuilderHelper.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/DefaultMavenBuilderHelper.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/DefaultMavenBuilderHelper.java Thu May  6 09:23:13 2010
@@ -118,7 +118,7 @@ public class DefaultMavenBuilderHelper
     // MavenBuilderHelper Implementation
     // ----------------------------------------------------------------------
 
-    public void mapMetadataToProject( ContinuumProjectBuildingResult result, File metadata, Project continuumProject )
+    public void mapMetadataToProject( ContinuumProjectBuildingResult result, File metadata, Project continuumProject, boolean update )
     {
         MavenProject mavenProject = getMavenProject( result, metadata );
 
@@ -129,11 +129,11 @@ public class DefaultMavenBuilderHelper
             return;
         }
 
-        mapMavenProjectToContinuumProject( result, mavenProject, continuumProject, false );
+        mapMavenProjectToContinuumProject( result, mavenProject, continuumProject, update);
     }
 
     public void mapMavenProjectToContinuumProject( ContinuumProjectBuildingResult result, MavenProject mavenProject,
-                                                   Project continuumProject, boolean groupPom )
+                                                   Project continuumProject, boolean update)
     {
         if ( mavenProject == null )
         {
@@ -141,18 +141,26 @@ public class DefaultMavenBuilderHelper
             return;
         }
 
-        // ----------------------------------------------------------------------
-        // Name
-        // ----------------------------------------------------------------------
-
-        continuumProject.setName( getProjectName( mavenProject ) );
-
-        // ----------------------------------------------------------------------
-        // Description
-        // ----------------------------------------------------------------------
-
-        continuumProject.setDescription( mavenProject.getDescription() );
-
+         if (update){
+            // ----------------------------------------------------------------------
+            // Name
+            // ----------------------------------------------------------------------
+            
+            continuumProject.setName( getProjectName( mavenProject ) );
+               
+            // ----------------------------------------------------------------------
+            // Version
+            // ----------------------------------------------------------------------
+    
+            continuumProject.setVersion( getVersion( mavenProject ) );
+            
+            // ----------------------------------------------------------------------
+            // Description
+            // ----------------------------------------------------------------------
+
+            continuumProject.setDescription( mavenProject.getDescription() );
+         }
+         
         // ----------------------------------------------------------------------
         // SCM Url
         // ----------------------------------------------------------------------
@@ -171,12 +179,6 @@ public class DefaultMavenBuilderHelper
         }
 
         // ----------------------------------------------------------------------
-        // Version
-        // ----------------------------------------------------------------------
-
-        continuumProject.setVersion( getVersion( mavenProject ) );
-
-        // ----------------------------------------------------------------------
         // GroupId
         // ----------------------------------------------------------------------
 
@@ -387,7 +389,7 @@ public class DefaultMavenBuilderHelper
 
             ProfileManager profileManager = new DefaultProfileManager( container, settings );
 
-            project = projectBuilder.build( file, getLocalRepository(), profileManager, false );
+            project = projectBuilder.build( file, getLocalRepository(), profileManager, true);
 
             if ( log.isDebugEnabled() )
             {

Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/MavenBuilderHelper.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/MavenBuilderHelper.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/MavenBuilderHelper.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/MavenBuilderHelper.java Thu May  6 09:23:13 2010
@@ -35,7 +35,7 @@ public interface MavenBuilderHelper
 {
     String ROLE = MavenBuilderHelper.class.getName();
 
-    void mapMetadataToProject( ContinuumProjectBuildingResult result, File metadata, Project project );
+    void mapMetadataToProject( ContinuumProjectBuildingResult result, File metadata, Project project, boolean updateDefinition);
 
     MavenProject getMavenProject( ContinuumProjectBuildingResult result, File file );
 
@@ -46,7 +46,7 @@ public interface MavenBuilderHelper
      * @param groupPom         map this project as if it is being used to initialize a project group
      */
     void mapMavenProjectToContinuumProject( ContinuumProjectBuildingResult result, MavenProject mavenProject,
-                                            Project continuumProject, boolean groupPom );
+                                            Project continuumProject, boolean updateDefinition);
 
     ArtifactRepository getLocalRepository()
         throws SettingsConfigurationException;

Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/MavenTwoBuildExecutor.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/MavenTwoBuildExecutor.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/MavenTwoBuildExecutor.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/MavenTwoBuildExecutor.java Thu May  6 09:23:13 2010
@@ -25,6 +25,7 @@ import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Enumeration;
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
@@ -32,6 +33,7 @@ import java.util.Properties;
 import org.apache.continuum.model.repository.LocalRepository;
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.metadata.ArtifactMetadata;
+import org.apache.maven.continuum.builddefinition.BuildDefinitionUpdatePolicyConstants;
 import org.apache.maven.continuum.configuration.ConfigurationException;
 import org.apache.maven.continuum.configuration.ConfigurationService;
 import org.apache.maven.continuum.execution.AbstractBuildExecutor;
@@ -44,6 +46,7 @@ import org.apache.maven.continuum.model.
 import org.apache.maven.continuum.model.project.Project;
 import org.apache.maven.continuum.model.scm.ChangeFile;
 import org.apache.maven.continuum.model.scm.ChangeSet;
+import org.apache.maven.continuum.model.scm.ScmResult;
 import org.apache.maven.continuum.model.system.Installation;
 import org.apache.maven.continuum.model.system.Profile;
 import org.apache.maven.continuum.project.builder.ContinuumProjectBuildingResult;
@@ -177,7 +180,8 @@ public class MavenTwoBuildExecutor
         return executeShellCommand( project, executable, arguments.toString(), buildOutput, environments );
     }
 
-    public void updateProjectFromCheckOut( File workingDirectory, Project project, BuildDefinition buildDefinition )
+    public void updateProjectFromCheckOut( File workingDirectory, Project project, BuildDefinition buildDefinition,
+                                           ScmResult scmResult )
         throws ContinuumBuildExecutorException
     {
         File f = getPomFile( getBuildFileForProject( project, buildDefinition ), workingDirectory );
@@ -186,17 +190,16 @@ public class MavenTwoBuildExecutor
         {
             throw new ContinuumBuildExecutorException( "Could not find Maven project descriptor." );
         }
-
         ContinuumProjectBuildingResult result = new ContinuumProjectBuildingResult();
-
-        builderHelper.mapMetadataToProject( result, f, project );
+        boolean update = isDescriptionUpdated( buildDefinition, scmResult, project );
+        builderHelper.mapMetadataToProject( result, f, project, update );
 
         if ( result.hasErrors() )
         {
             throw new ContinuumBuildExecutorException( "Error while mapping metadata:" + result.getErrorsAsString() );
         }
     }
-
+    
     private static File getPomFile( String projectBuildFile, File workingDirectory )
     {
         File f = null;
@@ -335,7 +338,7 @@ public class MavenTwoBuildExecutor
     }
 
     @Override
-    public void backupTestFiles( Project project, int buildId, String projectScmRootUrl, List<Project> projectsWithCommonScmRoot )
+    public void backupTestFiles( Project project, int buildId )
     {
         File backupDirectory = null;
         try
@@ -350,7 +353,7 @@ public class MavenTwoBuildExecutor
         {
             log.info( "error on surefire backup directory creation skip backup " + e.getMessage(), e );
         }
-        backupTestFiles( getWorkingDirectory( project, projectScmRootUrl, projectsWithCommonScmRoot ), backupDirectory );
+        backupTestFiles( getWorkingDirectory( project ), backupDirectory );
     }
 
     private void backupTestFiles( File workingDir, File backupDirectory )
@@ -395,10 +398,10 @@ public class MavenTwoBuildExecutor
         //Check if it's a recursive build
         boolean isRecursive = false;
         if (StringUtils.isNotEmpty( buildDefinition.getArguments() ) )
-            {
+        {
             isRecursive =  buildDefinition.getArguments().indexOf( "-N" ) < 0 &&
                 buildDefinition.getArguments().indexOf( "--non-recursive" ) < 0 ;
-            }
+        }
         if ( isRecursive && changes != null && !changes.isEmpty() )
         {
             if ( log.isInfoEnabled() )
@@ -410,14 +413,7 @@ public class MavenTwoBuildExecutor
 
         MavenProject project = getMavenProject( continuumProject, workingDirectory, buildDefinition );
 
-        //CONTINUUM-1815: additional check for projects recently released
-        if ( !continuumProject.getVersion().equals( project.getVersion() ) )
-        {
-            log.info( "Found changes in project's version ( maybe project was recently released ), building" );
-            return true;
-        }
-        
-        if ( changes.isEmpty() )
+        if ( changes == null || changes.isEmpty() )
         {
             if ( log.isInfoEnabled() )
             {

Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/execution/shell/ShellBuildExecutor.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/execution/shell/ShellBuildExecutor.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/execution/shell/ShellBuildExecutor.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/execution/shell/ShellBuildExecutor.java Thu May  6 09:23:13 2010
@@ -27,6 +27,7 @@ import org.apache.maven.continuum.execut
 import org.apache.maven.continuum.installation.InstallationService;
 import org.apache.maven.continuum.model.project.BuildDefinition;
 import org.apache.maven.continuum.model.project.Project;
+import org.apache.maven.continuum.model.scm.ScmResult;
 import org.apache.maven.continuum.model.system.Installation;
 import org.apache.maven.continuum.model.system.Profile;
 import org.codehaus.plexus.util.StringUtils;
@@ -99,7 +100,8 @@ public class ShellBuildExecutor
 
     }
 
-    public void updateProjectFromCheckOut( File workingDirectory, Project project, BuildDefinition buildDefinition )
+    public void updateProjectFromCheckOut( File workingDirectory, Project project, BuildDefinition buildDefinition,
+                                           ScmResult scmResult )
         throws ContinuumBuildExecutorException
     {
     }

Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/notification/mail/MailContinuumNotifier.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/notification/mail/MailContinuumNotifier.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/notification/mail/MailContinuumNotifier.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/notification/mail/MailContinuumNotifier.java Thu May  6 09:23:13 2010
@@ -27,8 +27,10 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Date;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 import javax.mail.Message;
 import javax.mail.MessagingException;
@@ -136,11 +138,6 @@ public class MailContinuumNotifier
     /**
      * @plexus.configuration
      */
-    private boolean includeBuildResult = true;
-
-    /**
-     * @plexus.configuration
-     */
     private boolean includeBuildSummary = true;
 
     /**
@@ -151,7 +148,7 @@ public class MailContinuumNotifier
     /**
      * @plexus.configuration
      */
-    private boolean includeOutput = false;
+    private boolean includeBuildOutput = false;
 
     /**
      * Customizable mail subject.  Use any combination of literal text, project or build attributes.
@@ -170,7 +167,7 @@ public class MailContinuumNotifier
      *
      * @plexus.configuration
      */
-    private String prepareBuildSubjectFormat = "[continuum] PREPARE BUILD ${state]";
+    private String prepareBuildSubjectFormat = "[continuum] PREPARE BUILD ${state]: ${projectScmRoot.projectGroup.name}";
 
     // ----------------------------------------------------------------------
     //
@@ -254,7 +251,8 @@ public class MailContinuumNotifier
         Project project = context.getProject();
         List<ProjectNotifier> notifiers = context.getNotifiers();
         BuildResult build = context.getBuildResult();
-        String buildOutput = getBuildOutput( project, build );
+        log.error( "br state="+build.getState() );
+        log.error( "project state="+project.getState() );
         BuildDefinition buildDefinition = context.getBuildDefinition();
         ProjectScmRoot projectScmRoot = context.getProjectScmRoot();
 
@@ -281,7 +279,7 @@ public class MailContinuumNotifier
 
         if ( messageId.equals( ContinuumNotificationDispatcher.MESSAGE_ID_BUILD_COMPLETE ) )
         {
-            buildComplete( project, notifiers, build, buildOutput, messageId, context, buildDefinition );
+            buildComplete( project, notifiers, build, messageId, context, buildDefinition );
         }
         else if ( isPrepareBuildComplete )
         {
@@ -289,8 +287,8 @@ public class MailContinuumNotifier
         }
     }
 
-    private void buildComplete( Project project, List<ProjectNotifier> notifiers, BuildResult build, String buildOutput,
-                                String messageId, MessageContext context, BuildDefinition buildDefinition )
+    private void buildComplete( Project project, List<ProjectNotifier> notifiers, BuildResult build, String messageId,
+                                MessageContext context, BuildDefinition buildDefinition )
         throws NotificationException
     {
         BuildResult previousBuild = getPreviousBuild( project, buildDefinition, build );
@@ -307,12 +305,12 @@ public class MailContinuumNotifier
                 notifiersList.add( notifier );
             }
         }
-        buildComplete( project, notifiersList, build, previousBuild, buildOutput, messageId, context, buildDefinition );
+        buildComplete( project, notifiersList, build, previousBuild, messageId, context, buildDefinition );
     }
 
     private void buildComplete( Project project, List<ProjectNotifier> notifiers, BuildResult build,
-                                BuildResult previousBuild, String buildOutput, String messageId,
-                                MessageContext messageContext, BuildDefinition buildDefinition )
+                                BuildResult previousBuild, String messageId, MessageContext messageContext,
+                                BuildDefinition buildDefinition )
         throws NotificationException
     {
         // ----------------------------------------------------------------------
@@ -333,11 +331,11 @@ public class MailContinuumNotifier
 
             context.put( "includeTestSummary", includeTestSummary );
 
-            context.put( "includeOutput", includeOutput );
+            context.put( "includeOutput", includeBuildOutput );
 
-            if ( includeBuildResult )
+            if ( includeBuildOutput )
             {
-                context.put( "buildOutput", buildOutput );
+                context.put( "buildOutput", getBuildOutput( project, build ) );
             }
 
             if ( includeBuildSummary )
@@ -457,8 +455,6 @@ public class MailContinuumNotifier
             context.put( "reportUrl",
                          getReportUrl( projectScmRoot.getProjectGroup(), projectScmRoot, configurationService ) );
 
-            context.put( "projectGroup", projectScmRoot.getProjectGroup() );
-
             context.put( "projectScmRoot", projectScmRoot );
 
             // TODO put other profile env var could be a security if they provide passwords ?
@@ -698,6 +694,7 @@ public class MailContinuumNotifier
 
             if ( StringUtils.isEmpty( toOverride ) )
             {
+                Set<String> listRecipents = new HashSet<String>();
                 for ( ProjectNotifier notifier : notifiers )
                 {
                     Map<String, String> conf = notifier.getConfiguration();
@@ -710,19 +707,45 @@ public class MailContinuumNotifier
                             String[] addresses = StringUtils.split( addressField, "," );
                             for ( String address : addresses )
                             {
-                                // TODO: set a proper name
-                                InternetAddress to = new InternetAddress( address.trim() );
-
-                                log.info( "Recipient: To '" + to + "'." );
-                                message.addRecipient( Message.RecipientType.TO, to );
+                                if (!listRecipents.contains(address.trim())) {
+                                    // [CONTINUUM-2281] Dont repeat addesss in recipents.
+                                    // TODO: set a proper name
+                                    InternetAddress to = new InternetAddress(address.trim());
+
+                                    log.info("Recipient: To '" + to + "'.");
+                                    message.addRecipient(Message.RecipientType.TO, to);
+                                    listRecipents.add(address.trim());
+                                }
                             }
 
                         }
 
-                        String committerField = (String) notifier.getConfiguration().get( COMMITTER_FIELD );
-                        if ( StringUtils.isNotEmpty( committerField ) && context.getBuildResult() != null )
+                        if (context.getBuildResult() != null)
                         {
-                            if ( Boolean.parseBoolean( committerField ) )
+                            String committerField = (String) notifier.getConfiguration().get(COMMITTER_FIELD);
+                            String developerField = (String) notifier.getConfiguration().get(DEVELOPER_FIELD);
+                            // Developers constains committers.
+                            if (StringUtils.isNotEmpty(developerField) && Boolean.parseBoolean(developerField))
+                            {
+                                List<ProjectDeveloper> developers = project.getDevelopers();
+                                if (developers == null || developers.isEmpty())
+                                {
+                                    log.warn("No developers have been configured...notifcation email will not be sent");
+                                    return;
+                                }
+                                Map<String, String> developerToEmailMap = mapDevelopersToRecipients(developers);
+                                for (String email : developerToEmailMap.values())
+                                {
+                                    if (!listRecipents.contains(email.trim()))
+                                    {
+                                        InternetAddress to = new InternetAddress(email.trim());
+                                        log.info("Recipient: To '" + to + "'.");
+                                        message.addRecipient(Message.RecipientType.TO, to);
+                                        listRecipents.add(email.trim());
+                                    }
+                                }
+                            } 
+                            else if (StringUtils.isNotEmpty(committerField) && Boolean.parseBoolean(committerField))
                             {
                                 ScmResult scmResult = context.getBuildResult().getScmResult();
                                 if ( scmResult != null && scmResult.getChanges() != null &&
@@ -743,7 +766,7 @@ public class MailContinuumNotifier
                                     for ( ChangeSet changeSet : changes )
                                     {
                                         String scmId = changeSet.getAuthor();
-                                        if ( StringUtils.isNotEmpty( scmId ) )
+                                        if (StringUtils.isNotEmpty(scmId))
                                         {
                                             String email = developerToEmailMap.get( scmId );
                                             if ( StringUtils.isEmpty( email ) )
@@ -753,13 +776,15 @@ public class MailContinuumNotifier
                                                     "no email address is defined in developers list for '" + scmId +
                                                         "' scm id." );
                                             }
-                                            else
-                                            {
+                                            else if (!listRecipents.contains(email.trim()))
+                                            {  
+                                                // [CONTINUUM-2281] Dont repeat addesss in recipents.)
                                                 // TODO: set a proper name
                                                 InternetAddress to = new InternetAddress( email.trim() );
                                                 log.info( "Recipient: To '" + to + "'." );
 
                                                 message.addRecipient( Message.RecipientType.TO, to );
+                                                listRecipents.add(email.trim());
                                             }
                                         }
                                     }

Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/AbstractContinuumProjectBuilder.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/AbstractContinuumProjectBuilder.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/AbstractContinuumProjectBuilder.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/AbstractContinuumProjectBuilder.java Thu May  6 09:23:13 2010
@@ -109,6 +109,8 @@ public abstract class AbstractContinuumP
             URI uri = metadata.toURI();
             HttpGet httpGet = new HttpGet( uri );
 
+            httpClient.getCredentialsProvider().clear();
+
             // basic auth
             if ( username != null && password != null )
             {
@@ -127,7 +129,7 @@ public abstract class AbstractContinuumP
                 case 200:
                     break;
                 case 401:
-                    log.error( "Error adding project: Unauthorized " + metadata );
+                    log.error( "Error adding project: Unauthorized " + url );
                     result.addError( ContinuumProjectBuildingResult.ERROR_UNAUTHORIZED );
                     return null;
                 default:
@@ -230,38 +232,45 @@ public abstract class AbstractContinuumP
     protected File createMetadataFile( ContinuumProjectBuildingResult result, URL metadata, String username,
                                        String password )
     {
+        String url = metadata.toExternalForm();
+
+        if ( metadata.getProtocol().startsWith( "http" ) )
+        {
+            url = hidePasswordInUrl( url );
+        }
+
         try
         {
             return createMetadataFile( metadata, username, password, result );
         }
         catch ( FileNotFoundException e )
         {
-            log.info( "URL not found: " + metadata, e );
+            log.info( "URL not found: " + url, e );
             result.addError( ContinuumProjectBuildingResult.ERROR_POM_NOT_FOUND );
         }
         catch ( MalformedURLException e )
         {
-            log.info( "Malformed URL: " + metadata, e );
+            log.info( "Malformed URL: " + url, e );
             result.addError( ContinuumProjectBuildingResult.ERROR_MALFORMED_URL );
         }
         catch ( URISyntaxException e )
         {
-            log.info( "Malformed URL: " + metadata, e );
+            log.info( "Malformed URL: " + url, e );
             result.addError( ContinuumProjectBuildingResult.ERROR_MALFORMED_URL );
         }
         catch ( UnknownHostException e )
         {
-            log.info( "Unknown host: " + metadata, e );
+            log.info( "Unknown host: " + url, e );
             result.addError( ContinuumProjectBuildingResult.ERROR_UNKNOWN_HOST );
         }
         catch ( IOException e )
         {
-            log.warn( "Could not download the URL: " + metadata, e );
+            log.warn( "Could not download the URL: " + url, e );
             result.addError( ContinuumProjectBuildingResult.ERROR_UNKNOWN );
         }
         catch ( HttpException e )
         {
-            log.warn( "Could not download the URL: " + metadata, e );
+            log.warn( "Could not download the URL: " + url, e );
             result.addError( ContinuumProjectBuildingResult.ERROR_UNKNOWN );
         }
         return null;

Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilder.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilder.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilder.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilder.java Thu May  6 09:23:13 2010
@@ -67,17 +67,17 @@ public class MavenOneContinuumProjectBui
     public ContinuumProjectBuildingResult buildProjectsFromMetadata( URL url, String username, String password )
         throws ContinuumProjectBuilderException
     {
-        return buildProjectsFromMetadata( url, username, password, true, false );
+        return buildProjectsFromMetadata( url, username, password, true );
     }
 
     public ContinuumProjectBuildingResult buildProjectsFromMetadata( URL url, String username, String password,
-                                                                     boolean recursiveProjects, boolean checkoutInSingleDirectory )
+                                                                     boolean recursiveProjects )
         throws ContinuumProjectBuilderException
     {
         try
         {
             return buildProjectsFromMetadata( url, username, password, recursiveProjects,
-                                              buildDefinitionService.getDefaultMavenOneBuildDefinitionTemplate(), checkoutInSingleDirectory );
+                                              buildDefinitionService.getDefaultMavenOneBuildDefinitionTemplate() );
         }
         catch ( BuildDefinitionServiceException e )
         {
@@ -87,7 +87,7 @@ public class MavenOneContinuumProjectBui
 
     public ContinuumProjectBuildingResult buildProjectsFromMetadata( URL url, String username, String password,
                                                                      boolean recursiveProjects,
-                                                                     BuildDefinitionTemplate buildDefinitionTemplate, boolean checkoutInSingleDirectory )
+                                                                     BuildDefinitionTemplate buildDefinitionTemplate )
         throws ContinuumProjectBuilderException
     {
         ContinuumProjectBuildingResult result = new ContinuumProjectBuildingResult();
@@ -105,7 +105,7 @@ public class MavenOneContinuumProjectBui
 
         try
         {
-            metadataHelper.mapMetadata( result, pomFile, project );
+            metadataHelper.mapMetadata( result, pomFile, project, true);
 
             if ( result.hasErrors() )
             {

Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilder.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilder.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilder.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilder.java Thu May  6 09:23:13 2010
@@ -83,8 +83,6 @@ public class MavenTwoContinuumProjectBui
      * @plexus.configuration
      */
     private List<String> excludedPackagingTypes = new ArrayList<String>();
-    
-    private Project rootProject;
 
     // ----------------------------------------------------------------------
     // AbstractContinuumProjectBuilder Implementation
@@ -92,17 +90,17 @@ public class MavenTwoContinuumProjectBui
     public ContinuumProjectBuildingResult buildProjectsFromMetadata( URL url, String username, String password )
         throws ContinuumProjectBuilderException
     {
-        return buildProjectsFromMetadata( url, username, password, true, false );
+        return buildProjectsFromMetadata( url, username, password, true );
     }
 
     public ContinuumProjectBuildingResult buildProjectsFromMetadata( URL url, String username, String password,
-                                                                     boolean loadRecursiveProjects, boolean checkoutInSingleDirectory )
+                                                                     boolean loadRecursiveProjects )
         throws ContinuumProjectBuilderException
     {
         try
         {
             return buildProjectsFromMetadata( url, username, password, loadRecursiveProjects,
-                                              buildDefinitionService.getDefaultMavenTwoBuildDefinitionTemplate(), checkoutInSingleDirectory );
+                                              buildDefinitionService.getDefaultMavenTwoBuildDefinitionTemplate() );
         }
         catch ( BuildDefinitionServiceException e )
         {
@@ -112,7 +110,7 @@ public class MavenTwoContinuumProjectBui
 
     public ContinuumProjectBuildingResult buildProjectsFromMetadata( URL url, String username, String password,
                                                                      boolean loadRecursiveProjects,
-                                                                     BuildDefinitionTemplate buildDefinitionTemplate, boolean checkoutInSingleDirectory )
+                                                                     BuildDefinitionTemplate buildDefinitionTemplate )
         throws ContinuumProjectBuilderException
     {
         // ----------------------------------------------------------------------
@@ -123,7 +121,7 @@ public class MavenTwoContinuumProjectBui
 
         try
         {
-            readModules( url, result, true, username, password, null, loadRecursiveProjects, buildDefinitionTemplate, checkoutInSingleDirectory );
+            readModules( url, result, true, username, password, null, loadRecursiveProjects, buildDefinitionTemplate );
         }
         catch ( BuildDefinitionServiceException e )
         {
@@ -138,7 +136,7 @@ public class MavenTwoContinuumProjectBui
 
     private void readModules( URL url, ContinuumProjectBuildingResult result, boolean groupPom, String username,
                               String password, String scmUrl, boolean loadRecursiveProjects,
-                              BuildDefinitionTemplate buildDefinitionTemplate, boolean checkoutInSingleDirectory )
+                              BuildDefinitionTemplate buildDefinitionTemplate )
         throws ContinuumProjectBuilderException, BuildDefinitionServiceException
     {
 
@@ -156,7 +154,7 @@ public class MavenTwoContinuumProjectBui
             }
 
             mavenProject = builderHelper.getMavenProject( result, pomFile );
-            
+
             if ( result.hasErrors() )
             {
                 return;
@@ -240,10 +238,8 @@ public class MavenTwoContinuumProjectBui
                     continuumProject.setScmPassword( password );
                 }
             }
-
-            continuumProject.setCheckedOutInSingleDirectory( checkoutInSingleDirectory );
-            
-            builderHelper.mapMavenProjectToContinuumProject( result, mavenProject, continuumProject, groupPom );
+            // New project
+            builderHelper.mapMavenProjectToContinuumProject( result, mavenProject, continuumProject, true);
 
             if ( result.hasErrors() )
             {
@@ -268,12 +264,6 @@ public class MavenTwoContinuumProjectBui
                 continuumProject.setScmTag( mavenProject.getScm().getTag() );
             }
             result.addProject( continuumProject, MavenTwoBuildExecutor.ID );
-            
-            if( checkoutInSingleDirectory && rootProject == null )
-            {
-                rootProject = continuumProject;
-                result.setRootProject( rootProject );
-            }
         }
 
         List<String> modules = mavenProject.getModules();
@@ -299,13 +289,13 @@ public class MavenTwoContinuumProjectBui
 
         prefix = prefix.substring( 0, lastSlash );
         if ( loadRecursiveProjects )
-        {   
+        {
             for ( String module : modules )
             {
                 if ( StringUtils.isNotEmpty( module ) )
-                {   
+                {
                     String urlString = prefix + "/" + module + POM_PART + suffix;
-                 
+
                     URL moduleUrl;
 
                     try
@@ -319,33 +309,18 @@ public class MavenTwoContinuumProjectBui
                         continue;
                     }
 
-                    String moduleScmUrl = "";                    
-                 
-                    String modulePath = StringUtils.replace( new String( module ), '\\', '/' );
-                    
-                    // check if module is relative
-                    if( modulePath.indexOf( "/" ) != -1 )
-                    {   
-                        int depth =
-                            StringUtils.countMatches( StringUtils.substring( modulePath, 0,
-                                                                             modulePath.lastIndexOf( '/' ) + 1 ), "/" );
-                        
-                        String baseUrl = "";
-                        for( int j = 1; j <= depth; j++ )
-                        {
-                            scmUrl = StringUtils.chompLast( new String( scmUrl ), "/" );
-                            baseUrl = StringUtils.substring( scmUrl, 0, scmUrl.lastIndexOf( '/' ) );                            
-                        }
-                        moduleScmUrl = baseUrl + "/" + StringUtils.substring( modulePath, modulePath.lastIndexOf( '/' ) + 1 );
+                    String moduleScmUrl;
+                    if ( scmUrl.endsWith( "/" ) )
+                    {
+                        moduleScmUrl = scmUrl + module;
                     }
                     else
                     {
-                        scmUrl = StringUtils.chompLast( scmUrl, "/" );
                         moduleScmUrl = scmUrl + "/" + module;
                     }
                     // we are in recursive loading mode
                     readModules( moduleUrl, result, false, username, password, moduleScmUrl, true,
-                                 buildDefinitionTemplate, checkoutInSingleDirectory );
+                                 buildDefinitionTemplate );
                 }
             }
         }

Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/scheduler/ContinuumBuildJob.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/scheduler/ContinuumBuildJob.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/scheduler/ContinuumBuildJob.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/scheduler/ContinuumBuildJob.java Thu May  6 09:23:13 2010
@@ -34,6 +34,8 @@ import org.quartz.JobExecutionContext;
 public class ContinuumBuildJob
     extends AbstractJob
 {
+    public static final String BUILD_GROUP = "BUILD_GROUP";
+
     public void execute( JobExecutionContext context )
     {
         if ( isInterrupted() )

Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/scheduler/ContinuumPurgeJob.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/scheduler/ContinuumPurgeJob.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/scheduler/ContinuumPurgeJob.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/scheduler/ContinuumPurgeJob.java Thu May  6 09:23:13 2010
@@ -36,6 +36,8 @@ import org.quartz.JobExecutionContext;
 public class ContinuumPurgeJob
     extends AbstractJob
 {
+    public static final String PURGE_GROUP = "PURGE_GROUP";
+	
     public void execute( JobExecutionContext context )
     {
         if ( isInterrupted() )

Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/CheckOutTaskExecutor.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/CheckOutTaskExecutor.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/CheckOutTaskExecutor.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/CheckOutTaskExecutor.java Thu May  6 09:23:13 2010
@@ -25,6 +25,7 @@ import java.util.Map;
 import org.apache.continuum.dao.ProjectDao;
 import org.apache.continuum.taskqueue.CheckOutTask;
 import org.apache.maven.continuum.core.action.AbstractContinuumAction;
+import org.apache.maven.continuum.core.action.CheckoutProjectContinuumAction;
 import org.apache.maven.continuum.model.project.Project;
 import org.apache.maven.continuum.store.ContinuumStoreException;
 import org.codehaus.plexus.action.ActionManager;
@@ -85,18 +86,16 @@ public class CheckOutTaskExecutor
 
         Map<String, Object> context = new HashMap<String, Object>();
 
-        context.put( AbstractContinuumAction.KEY_PROJECT_ID, projectId );
+        AbstractContinuumAction.setProjectId( context, projectId );
 
-        context.put( AbstractContinuumAction.KEY_PROJECT, project );
+        AbstractContinuumAction.setProject( context, project );
 
-        context.put( AbstractContinuumAction.KEY_WORKING_DIRECTORY, workingDirectory );
+        AbstractContinuumAction.setWorkingDirectory( context, workingDirectory );
 
-        context.put( AbstractContinuumAction.KEY_SCM_USERNAME, task.getScmUserName() );
+        CheckoutProjectContinuumAction.setScmUsername( context, task.getScmUserName() );
 
-        context.put( AbstractContinuumAction.KEY_PROJECT_SCM_ROOT_URL, task.getScmRootUrl() );
+        CheckoutProjectContinuumAction.setScmPassword( context, task.getScmPassword() );
 
-        context.put( AbstractContinuumAction.KEY_PROJECTS_IN_GROUP_WITH_COMMON_SCM_ROOT, task.getProjectsWithCommonScmRoot() );
-        
         try
         {
             actionManager.lookup( "checkout-project" ).execute( context );



Mime
View raw message