continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From och...@apache.org
Subject svn commit: r941625 [21/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-webapp/src/main/java/org/apache/continuum/web/action/admin/PurgeConfigurationAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/continuum/web/action/admin/PurgeConfigurationAction.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/continuum/web/action/admin/PurgeConfigurationAction.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/continuum/web/action/admin/PurgeConfigurationAction.java Thu May  6 09:23:13 2010
@@ -35,15 +35,19 @@ import org.apache.continuum.purge.Contin
 import org.apache.continuum.purge.PurgeConfigurationService;
 import org.apache.continuum.repository.RepositoryService;
 import org.apache.continuum.taskqueue.manager.TaskQueueManager;
+import org.apache.maven.continuum.build.settings.SchedulesActivationException;
 import org.apache.maven.continuum.configuration.ConfigurationService;
 import org.apache.maven.continuum.model.project.Schedule;
 import org.apache.maven.continuum.security.ContinuumRoleConstants;
 import org.apache.maven.continuum.web.action.ContinuumConfirmAction;
+import org.apache.maven.continuum.web.action.ScheduleAction;
 import org.apache.struts2.ServletActionContext;
 import org.codehaus.plexus.redback.rbac.Resource;
 import org.codehaus.redback.integration.interceptor.SecureAction;
 import org.codehaus.redback.integration.interceptor.SecureActionBundle;
 import org.codehaus.redback.integration.interceptor.SecureActionException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * @author Maria Catherine Tan
@@ -55,6 +59,8 @@ public class PurgeConfigurationAction
     extends ContinuumConfirmAction
     implements Preparable, SecureAction
 {
+    private static final Logger logger = LoggerFactory.getLogger( PurgeConfigurationAction.class );
+
     private static final String PURGE_TYPE_REPOSITORY = "repository";
 
     private static final String PURGE_TYPE_DIRECTORY = "directory";
@@ -117,6 +123,7 @@ public class PurgeConfigurationAction
      */
     private RepositoryService repositoryService;
 
+    @Override
     public void prepare()
         throws Exception
     {
@@ -153,6 +160,7 @@ public class PurgeConfigurationAction
         directoryTypes.add( PURGE_DIRECTORY_BUILDOUTPUT );
     }
 
+    @Override
     public String input()
         throws Exception
     {
@@ -258,6 +266,11 @@ public class PurgeConfigurationAction
             updateDefaultPurgeConfiguration();
         }
 
+        if ( purgeConfig.isEnabled() && purgeConfig.getSchedule() != null )
+        {
+            getContinuum().activePurgeSchedule( purgeConfig.getSchedule() );
+        }
+
         return SUCCESS;
     }
 
@@ -379,11 +392,13 @@ public class PurgeConfigurationAction
         this.enabled = enabled;
     }
 
+    @Override
     public boolean isConfirmed()
     {
         return this.confirmed;
     }
 
+    @Override
     public void setConfirmed( boolean confirmed )
     {
         this.confirmed = confirmed;

Modified: continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/continuum/web/startup/ContinuumStartup.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/continuum/web/startup/ContinuumStartup.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/continuum/web/startup/ContinuumStartup.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/continuum/web/startup/ContinuumStartup.java Thu May  6 09:23:13 2010
@@ -82,12 +82,5 @@ public class ContinuumStartup
 
         DistributedBuildManager distributedBuildManager = (DistributedBuildManager) wac.getBean( PlexusToSpringUtils
             .buildSpringId( DistributedBuildManager.class ) );
-
-        TaskQueueExecutor distributedBuildProjectOverall = (TaskQueueExecutor) wac.getBean( PlexusToSpringUtils
-            .buildSpringId( TaskQueueExecutor.class, "distributed-build-project-overall" ) );
-
-        TaskQueueExecutor distributedBuildProjectDeferred = (TaskQueueExecutor) wac.getBean( PlexusToSpringUtils
-            .buildSpringId( TaskQueueExecutor.class, "distributed-build-project-deferred" ) );
     }
-
 }

Modified: continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/continuum/web/util/AuditLogConstants.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/continuum/web/util/AuditLogConstants.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/continuum/web/util/AuditLogConstants.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/continuum/web/util/AuditLogConstants.java Thu May  6 09:23:13 2010
@@ -36,6 +36,14 @@ public class AuditLogConstants
 
     public static final String PROJECT_GROUP = "PROJECT_GROUP";
 
+    public static final String BUILD_RESULT = "BUILD_RESULT";
+
+    public static final String BUILD_QUEUE = "BUILD_QUEUE";
+
+    public static final String BUILD_AGENT = "BUILD_AGENT";
+
+    public static final String LOCAL_REPOSITORY = "LOCAL_REPOSITORY";
+
     // events
     public static final String FORCE_BUILD = "Forced Project Build";
 
@@ -51,6 +59,12 @@ public class AuditLogConstants
 
     public static final String ADD_M2_PROJECT = "Added M2 Project";
 
+    public static final String ADD_M2_PROJECT_FAILED = "Failed Adding M2 Project";
+
+    public static final String ADD_M1_PROJECT = "Added M1 Project";
+
+    public static final String ADD_M1_PROJECT_FAILED = "Failed Adding M1 Project";
+
     public static final String ADD_PROJECT = "Added Project";
 
     public static final String MODIFY_PROJECT = "Modified Project";
@@ -80,5 +94,25 @@ public class AuditLogConstants
     public static final String MODIFY_TEMPLATE = "Modified Build Definition Template";
 
     public static final String REMOVE_TEMPLATE = "Removed Build Definition Template";
+
+    public static final String REMOVE_BUILD_RESULT = "Removed Build Result";
+
+    public static final String ADD_BUILD_QUEUE = "Added Build Queue";
+
+    public static final String REMOVE_BUILD_QUEUE = "Removed Build Queue";
+
+    public static final String PURGE_LOCAL_REPOSITORY = "Purged Local Repository";
+
+    public static final String ADD_BUILD_AGENT = "Added Build Agent";
+
+    public static final String ADD_BUILD_AGENT_GROUP = "Added Build Agent Group";
+
+    public static final String MODIFY_BUILD_AGENT = "Modified Build Agent";
+
+    public static final String MODIFY_BUILD_AGENT_GROUP = "Modified Build Agent Group";
+
+    public static final String REMOVE_BUILD_AGENT = "Removed Build Agent";
+
+    public static final String REMOVE_BUILD_AGENT_GROUP = "Removed Build Agent Group";
 }
 

Modified: continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/continuum/web/util/GenerateRecipentNotifier.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/continuum/web/util/GenerateRecipentNotifier.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/continuum/web/util/GenerateRecipentNotifier.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/continuum/web/util/GenerateRecipentNotifier.java Thu May  6 09:23:13 2010
@@ -62,6 +62,15 @@ public final class GenerateRecipentNotif
                     }
                 }
             }
+            if (StringUtils.isNotEmpty(configuration.get(AbstractContinuumNotifier.DEVELOPER_FIELD))) {
+                if (Boolean.parseBoolean(configuration.get(AbstractContinuumNotifier.DEVELOPER_FIELD))) {
+                    if ("unknown".equals(recipent)) {
+                        recipent = "project developers";
+                    } else {
+                        recipent += ", " + "project developers";
+                    }
+                }
+            }
         }
         if ( "irc".equals( notifier.getType() ) )
         {

Modified: continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AboutAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AboutAction.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AboutAction.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AboutAction.java Thu May  6 09:23:13 2010
@@ -23,7 +23,7 @@ package org.apache.maven.continuum.web.a
  * AboutAction:
  *
  * @author: Jesse McConnell <jmcconnell@apache.org>
- * @version: $ID:$
+ * @version: $Id$
  * @plexus.component role="com.opensymphony.xwork2.Action"
  * role-hint="about"
  */

Modified: continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AbstractBuildAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AbstractBuildAction.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AbstractBuildAction.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AbstractBuildAction.java Thu May  6 09:23:13 2010
@@ -22,6 +22,7 @@ import java.util.Map;
 import java.util.Set;
 
 import org.apache.continuum.buildmanager.BuildManagerException;
+import org.apache.continuum.buildmanager.BuildsManager;
 import org.apache.continuum.taskqueue.BuildProjectTask;
 import org.apache.maven.continuum.model.project.BuildResult;
 import org.apache.maven.continuum.project.ContinuumProjectState;
@@ -41,7 +42,9 @@ public abstract class AbstractBuildActio
     protected boolean canRemoveBuildResult( BuildResult buildResult )
         throws BuildManagerException
     {
-        Map<String, BuildProjectTask> currentBuilds = getContinuum().getBuildsManager().getCurrentBuilds();
+        BuildsManager buildsManager = getContinuum().getBuildsManager();
+
+        Map<String, BuildProjectTask> currentBuilds = buildsManager.getCurrentBuilds();
         Set<String> keySet = currentBuilds.keySet();
         for ( String key : keySet )
         {

Modified: continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenOneProjectAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenOneProjectAction.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenOneProjectAction.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenOneProjectAction.java Thu May  6 09:23:13 2010
@@ -21,6 +21,8 @@ package org.apache.maven.continuum.web.a
 
 import java.io.File;
 
+import org.apache.continuum.web.util.AuditLog;
+import org.apache.continuum.web.util.AuditLogConstants;
 import org.apache.maven.continuum.ContinuumException;
 import org.apache.maven.continuum.project.builder.ContinuumProjectBuildingResult;
 
@@ -40,8 +42,21 @@ public class AddMavenOneProjectAction
                                                         boolean scmUseCache )
         throws ContinuumException
     {
-        return getContinuum().addMavenOneProject( pomUrl, selectedProjectGroup, checkProtocol, scmUseCache,
+        ContinuumProjectBuildingResult result = getContinuum().addMavenOneProject( pomUrl, selectedProjectGroup, checkProtocol, scmUseCache,
                                                   this.getBuildDefinitionTemplateId() );
+
+        AuditLog event = new AuditLog( hidePasswordInUrl( pomUrl ), AuditLogConstants.ADD_M1_PROJECT );
+        event.setCategory( AuditLogConstants.PROJECT );
+        event.setCurrentUser( getPrincipal() );
+
+        if ( result == null || result.hasErrors() )
+        {
+            event.setAction( AuditLogConstants.ADD_M1_PROJECT_FAILED );
+        }
+
+        event.log();
+
+        return result;
     }
 
     /**

Modified: continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenProjectAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenProjectAction.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenProjectAction.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenProjectAction.java Thu May  6 09:23:13 2010
@@ -291,6 +291,22 @@ public abstract class AddMavenProjectAct
         return INPUT;
     }
 
+    protected String hidePasswordInUrl( String url )
+    {
+        int indexAt = url.indexOf( "@" );
+
+        if ( indexAt < 0 )
+        {
+            return url;
+        }
+
+        String s = url.substring( 0, indexAt );
+
+        int pos = s.lastIndexOf( ":" );
+
+        return s.substring( 0, pos + 1 ) + "*****" + url.substring( indexAt );
+    }
+
     private void initializeProjectGroupName()
     {
         if ( disableGroupSelection && selectedProjectGroup != DEFINED_BY_POM_GROUP_ID )

Modified: continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenTwoProjectAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenTwoProjectAction.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenTwoProjectAction.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenTwoProjectAction.java Thu May  6 09:23:13 2010
@@ -53,8 +53,6 @@ public class AddMavenTwoProjectAction
     public static final String FILE_SCHEME = "file:/";
 
     private boolean nonRecursiveProject;
-    
-    private boolean checkoutInSingleDirectory;
 
     protected ContinuumProjectBuildingResult doExecute( String pomUrl, int selectedProjectGroup, boolean checkProtocol,
                                                         boolean scmUseCache )
@@ -106,26 +104,23 @@ public class AddMavenTwoProjectAction
             }
         }
 
-        // force set checkoutInCingleDirectory to false if adding the project as non-recursive
-        if( this.isNonRecursiveProject() )
-        {
-            this.setCheckoutInSingleDirectory( false );
-        }
-        
         if ( result == null )
         {
             result = getContinuum().addMavenTwoProject( pomUrl, selectedProjectGroup, checkProtocol, scmUseCache,
                                                         !this.isNonRecursiveProject(),
-                                                        this.getBuildDefinitionTemplateId(), this.isCheckoutInSingleDirectory() );
+                                                        this.getBuildDefinitionTemplateId() );
         }
-        
-        String projectUrl = hidePasswordInUrl( pomUrl );
-        
-        AuditLog event = new AuditLog( projectUrl, AuditLogConstants.ADD_M2_PROJECT );
+
+        AuditLog event = new AuditLog( hidePasswordInUrl( pomUrl ), AuditLogConstants.ADD_M2_PROJECT );
         event.setCategory( AuditLogConstants.PROJECT );
         event.setCurrentUser( getPrincipal() );
-        event.log();
 
+        if ( result == null || result.hasErrors() )
+        {
+            event.setAction( AuditLogConstants.ADD_M2_PROJECT_FAILED );
+        }
+
+        event.log();
         return result;
     }
 
@@ -170,42 +165,4 @@ public class AddMavenTwoProjectAction
     {
         this.nonRecursiveProject = nonRecursiveProject;
     }
-
-    public boolean isCheckoutInSingleDirectory()
-    {
-        return checkoutInSingleDirectory;
-    }
-
-    public void setCheckoutInSingleDirectory( boolean checkoutInSingleDirectory )
-    {
-        this.checkoutInSingleDirectory = checkoutInSingleDirectory;
-    }
-    
-    private String hidePasswordInUrl( String pomUrl )
-    {
-        String projectUrl = pomUrl;
-        
-        int idx = projectUrl.indexOf( "@" );
-        
-        if ( idx > 0 )
-        {
-            int pwdIndex = projectUrl.lastIndexOf( ":" );
-            
-            if ( ( pwdIndex > 0 ) && ( pwdIndex > projectUrl.indexOf( "://" ) ) )
-            {
-                String password = projectUrl.substring( pwdIndex, idx + 1 );
-                
-                String newPwd = "@";
-                
-                if ( ( password.length() ) > 2 )
-                {
-                    newPwd = ":*****@";
-                }
-                
-                projectUrl = projectUrl.replace( password, newPwd );
-            }
-        }
-        
-        return projectUrl;
-    }
 }

Modified: continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectAction.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectAction.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectAction.java Thu May  6 09:23:13 2010
@@ -87,24 +87,26 @@ public class AddProjectAction
 
     private List<BuildDefinitionTemplate> buildDefinitionTemplates;
 
+    private boolean emptyProjectGroups;
+
     public void validate()
     {
         clearErrorsAndMessages();
         try
         {
-            if ( !( projectName.trim().length() > 0 ) )
+            if ( ( projectName != null ) && !( projectName.trim().length() > 0 ) )
             {
                 addActionError( getText( "addProject.name.required" ) );
             }
-            if ( !( projectVersion.trim().length() > 0 ) )
+            if ( ( projectVersion != null ) && !( projectVersion.trim().length() > 0 ) )
             {
                 addActionError( getText( "addProject.version.required" ) );
             }
-            if ( !( projectScmUrl.trim().length() > 0 ) )
+            if ( ( projectScmUrl != null ) && !( projectScmUrl.trim().length() > 0 ) )
             {
                 addActionError( getText( "addProject.scmUrl.required" ) );
             }
-            if ( selectedProjectGroup == 0 )
+            if ( isEmptyProjectGroups() )
             {
                 addActionError( getText( "addProject.projectGroup.required" ) );
             }
@@ -148,6 +150,7 @@ public class AddProjectAction
         String projectNameTrim = projectName.trim();
         String versionTrim = projectVersion.trim();
         String scmTrim = projectScmUrl.trim();
+        //TODO: Instead of get all projects then test them, it would be better to check it directly in the DB
         for ( Project project : getContinuum().getProjects() )
         {
             // CONTINUUM-1445
@@ -190,8 +193,8 @@ public class AddProjectAction
             this.setProjectGroupId( this.getSelectedProjectGroup() );
             return "projectGroupSummary";
         }
-        
-        AuditLog event = new AuditLog( projectNameTrim, AuditLogConstants.ADD_PROJECT );
+
+        AuditLog event = new AuditLog( "Project id=" + project.getId(), AuditLogConstants.ADD_PROJECT );
         event.setCategory( AuditLogConstants.PROJECT );
         event.setCurrentUser( getPrincipal() );
         event.log();
@@ -433,4 +436,14 @@ public class AddProjectAction
     {
         this.projectDescription = projectDescription;
     }
+
+    public boolean isEmptyProjectGroups()
+    {
+        return emptyProjectGroups;
+    }
+
+    public void setEmptyProjectGroups( boolean emptyProjectGroups )
+    {
+        this.emptyProjectGroups = emptyProjectGroups;
+    }
 }

Modified: continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectGroupAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectGroupAction.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectGroupAction.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectGroupAction.java Thu May  6 09:23:13 2010
@@ -154,7 +154,7 @@ public class AddProjectGroupAction
             return ERROR;
         }
         
-        AuditLog event = new AuditLog( name, AuditLogConstants.ADD_PROJECT_GROUP );
+        AuditLog event = new AuditLog( "Project Group id=" + projectGroup.getId(), AuditLogConstants.ADD_PROJECT_GROUP );
         event.setCategory( AuditLogConstants.PROJECT );
         event.setCurrentUser( getPrincipal() );
         event.log();

Modified: continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildDefinitionAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildDefinitionAction.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildDefinitionAction.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildDefinitionAction.java Thu May  6 09:23:13 2010
@@ -28,6 +28,7 @@ import java.util.Map;
 import org.apache.maven.continuum.ContinuumException;
 import org.apache.maven.continuum.builddefinition.BuildDefinitionService;
 import org.apache.maven.continuum.builddefinition.BuildDefinitionServiceException;
+import org.apache.maven.continuum.builddefinition.BuildDefinitionUpdatePolicyConstants;
 import org.apache.maven.continuum.execution.ContinuumBuildExecutorConstants;
 import org.apache.maven.continuum.model.project.BuildDefinition;
 import org.apache.maven.continuum.model.project.Project;
@@ -92,6 +93,10 @@ public class BuildDefinitionAction
     private String buildDefinitionType;
 
     private boolean alwaysBuild;
+    
+    private int updatePolicy = BuildDefinitionUpdatePolicyConstants.UPDATE_DESCRIPTION_ALWAYS;
+    
+    private Map<Integer, String> buildDefinitionUpdatePolicies;
 
     /**
      * @plexus.requirement
@@ -127,6 +132,15 @@ public class BuildDefinitionAction
         buildDefinitionTypes.add( ContinuumBuildExecutorConstants.MAVEN_ONE_BUILD_EXECUTOR );
         buildDefinitionTypes.add( ContinuumBuildExecutorConstants.MAVEN_TWO_BUILD_EXECUTOR );
         buildDefinitionTypes.add( ContinuumBuildExecutorConstants.SHELL_BUILD_EXECUTOR );
+        
+        buildDefinitionUpdatePolicies = new HashMap<Integer, String>();
+        String text = getText( "buildDefinition.updatePolicy.always" );
+        buildDefinitionUpdatePolicies.put( BuildDefinitionUpdatePolicyConstants.UPDATE_DESCRIPTION_ALWAYS, text );
+        text = getText( "buildDefinition.updatePolicy.never" );
+        buildDefinitionUpdatePolicies.put( BuildDefinitionUpdatePolicyConstants.UPDATE_DESCRIPTION_NEVER, text );
+        text = getText( "buildDefinition.updatePolicy.newPom" );
+        buildDefinitionUpdatePolicies.put( BuildDefinitionUpdatePolicyConstants.UPDATE_DESCRIPTION_ONLY_FOR_NEW_POM,
+                                           text );
     }
 
     /**
@@ -184,6 +198,7 @@ public class BuildDefinitionAction
                 description = buildDefinition.getDescription();
                 buildDefinitionType = buildDefinition.getType();
                 alwaysBuild = buildDefinition.isAlwaysBuild();
+                updatePolicy = buildDefinition.getUpdatePolicy();
             }
             else
             {
@@ -315,7 +330,7 @@ public class BuildDefinitionAction
             return REQUIRES_AUTHORIZATION;
         }
         
-        String resource = getProjectGroupName() + ":" +  goals + " " + arguments;
+        String resource = "Project id=" + projectId + ":" +  goals + " " + arguments;
         AuditLog event = new AuditLog( resource, AuditLogConstants.ADD_GOAL );
         event.setCategory( AuditLogConstants.BUILD_DEFINITION );
         event.setCurrentUser( getPrincipal() );
@@ -367,7 +382,7 @@ public class BuildDefinitionAction
 
         if ( projectId != 0 )
         {
-            String resource = getProjectGroupName() + ":" +  goals + " " + arguments;
+            String resource = "Project id=" + projectId + ":" +  goals + " " + arguments;
             AuditLog event = new AuditLog( resource, AuditLogConstants.ADD_GOAL );
             event.setCategory( AuditLogConstants.BUILD_DEFINITION );
             event.setCurrentUser( getPrincipal() );
@@ -376,6 +391,11 @@ public class BuildDefinitionAction
         }
         else
         {
+            String resource = "Project Group id=" + projectGroupId + ":" + goals + " " + arguments;
+            AuditLog event = new AuditLog( resource, AuditLogConstants.ADD_GOAL );
+            event.setCategory( AuditLogConstants.BUILD_DEFINITION );
+            event.setCurrentUser( getPrincipal() );
+            event.log();
             return "success_group";
         }
     }
@@ -391,7 +411,7 @@ public class BuildDefinitionAction
             {
                 getContinuum().removeBuildDefinitionFromProject( projectId, buildDefinitionId );
                 
-                String resource = getProjectGroupName() + ":" +  goals + " " + arguments;
+                String resource = "Project id=" + projectId + ":" +  goals + " " + arguments;
                 AuditLog event = new AuditLog( resource, AuditLogConstants.REMOVE_GOAL );
                 event.setCategory( AuditLogConstants.BUILD_DEFINITION );
                 event.setCurrentUser( getPrincipal() );
@@ -425,7 +445,7 @@ public class BuildDefinitionAction
             {
                 getContinuum().removeBuildDefinitionFromProjectGroup( projectGroupId, buildDefinitionId );
                 
-                String resource = getProjectGroupName() + ":" +  goals + " " + arguments;
+                String resource = "Project Group id=" + projectGroupId + ":" +  goals + " " + arguments;
                 AuditLog event = new AuditLog( resource, AuditLogConstants.REMOVE_GOAL );
                 event.setCategory( AuditLogConstants.BUILD_DEFINITION );
                 event.setCurrentUser( getPrincipal() );
@@ -487,6 +507,7 @@ public class BuildDefinitionAction
         buildDefinition.setDescription( description );
         buildDefinition.setType( buildDefinitionType );
         buildDefinition.setAlwaysBuild( alwaysBuild );
+        buildDefinition.setUpdatePolicy( updatePolicy );
         return buildDefinition;
     }
 
@@ -705,4 +726,18 @@ public class BuildDefinitionAction
         this.groupBuildView = groupBuildView;
     }
 
+    public int getUpdatePolicy()
+    {
+        return updatePolicy;
+    }
+
+    public void setUpdatePolicy( int updatePolicy )
+    {
+        this.updatePolicy = updatePolicy;
+    }
+
+    public Map<Integer, String> getBuildDefinitionUpdatePolicies()
+    {
+        return buildDefinitionUpdatePolicies;
+    }
 }

Modified: continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildProjectAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildProjectAction.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildProjectAction.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildProjectAction.java Thu May  6 09:23:13 2010
@@ -20,7 +20,12 @@ package org.apache.maven.continuum.web.a
  */
 
 import org.apache.maven.continuum.ContinuumException;
+import org.apache.maven.continuum.model.project.ProjectGroup;
+import org.apache.maven.continuum.project.ContinuumProjectState;
 import org.apache.maven.continuum.web.exception.AuthorizationRequiredException;
+import org.apache.continuum.buildagent.NoBuildAgentException;
+import org.apache.continuum.buildagent.NoBuildAgentInGroupException;
+import org.apache.continuum.utils.build.BuildTrigger;
 import org.apache.continuum.web.util.AuditLog;
 import org.apache.continuum.web.util.AuditLogConstants;
 import org.codehaus.plexus.util.StringUtils;
@@ -56,30 +61,45 @@ public class BuildProjectAction
         {
             return REQUIRES_AUTHORIZATION;
         }
+        
+        BuildTrigger buildTrigger = new BuildTrigger( ContinuumProjectState.TRIGGER_FORCED, getPrincipal() );
 
-        if ( projectId > 0 )
+        try
         {
-            if ( buildDefinitionId > 0 )
+            if ( projectId > 0 )
             {
-                getContinuum().buildProjectWithBuildDefinition( projectId, buildDefinitionId );
+                if ( buildDefinitionId > 0 )
+                {
+                	getContinuum().buildProjectWithBuildDefinition( projectId, buildDefinitionId, buildTrigger );
+                }
+                else
+                {
+                	getContinuum().buildProject( projectId, buildTrigger.getUsername() );
+                }
             }
             else
             {
-                getContinuum().buildProject( projectId );
+                if ( buildDefinitionId > 0 )
+                {
+                	getContinuum().buildProjectGroupWithBuildDefinition( projectGroupId, buildDefinitionId, buildTrigger );
+                }
+                else
+                {
+                    //TODO: Check if this code is called, I don't think
+                    //If it is, it should used the projectId
+                	getContinuum().buildProjects( buildTrigger.getUsername() );
+                }
             }
         }
-        else
+        catch ( NoBuildAgentException e )
         {
-            if ( buildDefinitionId > 0 )
-            {
-                getContinuum().buildProjectGroupWithBuildDefinition( projectGroupId, buildDefinitionId );
-            }
-            else
-            {
-                getContinuum().buildProjects();
-            }
+            addActionError( getText( "projectGroup.build.error.noBuildAgent" ) );
         }
-        
+        catch ( NoBuildAgentInGroupException e )
+        {
+            addActionError( getText( "projectGroup.build.error.noBuildAgentInGroup" ) );
+        }
+
         AuditLog event = new AuditLog( AuditLogConstants.FORCE_BUILD );
         event.setCurrentUser( getPrincipal() );
 
@@ -89,7 +109,7 @@ public class BuildProjectAction
             event.setCategory( AuditLogConstants.PROJECT );
             event.log();
 
-            if ( fromGroupPage )
+            if ( fromGroupPage || hasActionErrors() )
             {
                 return "to_group_page";
             }
@@ -103,6 +123,10 @@ public class BuildProjectAction
             event.setResource( "Project Group id=" + projectGroupId );
             event.setCategory( AuditLogConstants.PROJECT_GROUP );
             event.log();
+            if ( fromGroupPage )
+            {
+                return "to_group_page";
+            }
         }
 
         return SUCCESS;
@@ -169,7 +193,10 @@ public class BuildProjectAction
             }
             else
             {
-                projectGroupName = getContinuum().getProjectGroupByProjectId( projectId ).getName();
+                ProjectGroup projectGroup = getContinuum().getProjectGroupByProjectId( projectId );
+
+                projectGroupName = projectGroup.getName();
+                projectGroupId = projectGroup.getId();
             }
         }
 

Modified: continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildResultAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildResultAction.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildResultAction.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildResultAction.java Thu May  6 09:23:13 2010
@@ -30,8 +30,12 @@ import org.apache.commons.lang.StringEsc
 import org.apache.continuum.builder.distributed.manager.DistributedBuildManager;
 import org.apache.continuum.builder.utils.ContinuumBuildConstant;
 import org.apache.continuum.buildmanager.BuildManagerException;
+import org.apache.continuum.web.util.AuditLog;
+import org.apache.continuum.web.util.AuditLogConstants;
+import org.apache.continuum.buildmanager.BuildManagerException;
 import org.apache.maven.continuum.ContinuumException;
 import org.apache.maven.continuum.configuration.ConfigurationException;
+import org.apache.maven.continuum.configuration.ConfigurationService;
 import org.apache.maven.continuum.model.project.BuildResult;
 import org.apache.maven.continuum.model.project.Project;
 import org.apache.maven.continuum.model.scm.ChangeSet;
@@ -90,9 +94,14 @@ public class BuildResultAction
         // check if there are surefire results to display
         project = getContinuum().getProject( getProjectId() );
 
-        if ( getContinuum().getConfiguration().isDistributedBuildEnabled() &&
-            project.getState() == ContinuumProjectState.BUILDING )
+        ConfigurationService configuration = getContinuum().getConfiguration();
+
+        // view build result of the current build from the distributed build agent
+        if ( configuration.isDistributedBuildEnabled() &&
+            project.getState() == ContinuumProjectState.BUILDING && getBuildId() == 0 )
         {
+            // if the project is currently building in distributed build agent, the build result will be stored in the database after the build is finished. 
+            // it's safe to assume that the build result will be null at this point
             Map<String, Object> map = distributedBuildManager.getBuildResult( project.getId() );
 
             if ( map == null )
@@ -107,6 +116,12 @@ public class BuildResultAction
                 buildResult = ContinuumBuildConstant.getBuildResult( map, null );
 
                 buildOutput = ContinuumBuildConstant.getBuildOutput( map );
+
+                if ( ServletActionContext.getRequest() != null )
+                {
+                    state =
+                        StateGenerator.generate( buildResult.getState(), ServletActionContext.getRequest().getContextPath() );
+                }
             }
             changeSet = null;
 
@@ -120,15 +135,18 @@ public class BuildResultAction
 
             // directory contains files ?
             File surefireReportsDirectory =
-                getContinuum().getConfiguration().getTestReportsDirectory( buildId, getProjectId() );
+                configuration.getTestReportsDirectory( buildId, getProjectId() );
             File[] files = surefireReportsDirectory.listFiles();
             hasSurefireResults = files != null && files.length > 0;
             changeSet = getContinuum().getChangesSinceLastSuccess( getProjectId(), getBuildId() );
 
             buildOutput = getBuildOutputText();
 
-            state =
-                StateGenerator.generate( buildResult.getState(), ServletActionContext.getRequest().getContextPath() );
+            if ( ServletActionContext.getRequest() != null )
+            {
+                state =
+                    StateGenerator.generate( buildResult.getState(), ServletActionContext.getRequest().getContextPath() );
+            }
 
             this.setCanDelete( this.canRemoveBuildResult( buildResult ) );
         }
@@ -149,7 +167,32 @@ public class BuildResultAction
         }
         if ( this.isConfirmed() )
         {
-            getContinuum().removeBuildResult( buildId );
+            try
+            {
+                if ( canRemoveBuildResult( getContinuum().getBuildResult( buildId ) ) )
+                {
+                    getContinuum().removeBuildResult( buildId );
+                }
+                else
+                {
+                    addActionError( getText( "buildResult.cannot.delete" ) );
+                }
+            }
+            catch ( ContinuumException e )
+            {
+                addActionError( getText( "buildResult.delete.error", "Unable to delete build result",
+                                         new Integer( buildId ).toString() ) );
+            }
+            catch ( BuildManagerException e )
+            {
+                throw new ContinuumException( e.getMessage(), e );
+            }
+
+            AuditLog event = new AuditLog( "Build Result id=" + buildId, AuditLogConstants.REMOVE_BUILD_RESULT );
+            event.setCategory( AuditLogConstants.BUILD_RESULT );
+            event.setCurrentUser( getPrincipal() );
+            event.log();
+            
             return SUCCESS;
         }
 
@@ -174,7 +217,8 @@ public class BuildResultAction
     private String getBuildOutputText()
         throws ConfigurationException, IOException
     {
-        File buildOutputFile = getContinuum().getConfiguration().getBuildOutputFile( getBuildId(), getProjectId() );
+        ConfigurationService configuration = getContinuum().getConfiguration();
+        File buildOutputFile = configuration.getBuildOutputFile( getBuildId(), getProjectId() );
 
         if ( buildOutputFile.exists() )
         {
@@ -244,4 +288,10 @@ public class BuildResultAction
     {
         return projectGroupId;
     }
+
+    // for testing
+    public void setDistributedBuildManager( DistributedBuildManager distributedBuildManager )
+    {
+        this.distributedBuildManager = distributedBuildManager;
+    }
 }

Modified: continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildResultsListAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildResultsListAction.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildResultsListAction.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildResultsListAction.java Thu May  6 09:23:13 2010
@@ -24,6 +24,8 @@ import java.util.Collection;
 import java.util.List;
 
 import org.apache.continuum.buildmanager.BuildManagerException;
+import org.apache.continuum.web.util.AuditLog;
+import org.apache.continuum.web.util.AuditLogConstants;
 import org.apache.maven.continuum.ContinuumException;
 import org.apache.maven.continuum.model.project.BuildResult;
 import org.apache.maven.continuum.model.project.Project;
@@ -99,11 +101,17 @@ public class BuildResultsListAction
                         logger.info( "Removing BuildResult with id=" + buildId );
 
                         getContinuum().removeBuildResult( buildId );
+
+                        AuditLog event = new AuditLog( "Build Result id=" + buildId, AuditLogConstants.REMOVE_BUILD_RESULT );
+                        event.setCategory( AuditLogConstants.BUILD_RESULT );
+                        event.setCurrentUser( getPrincipal() );
+                        event.log();
                     }
                     catch ( ContinuumException e )
                     {
                         logger.error( "Error removing BuildResult with id=" + buildId );
-                        addActionError( getText( "Unable to remove BuildResult with id=" + buildId ) );
+                        addActionError( getText( "buildResult.delete.error", "Unable to delete build result",
+                                                 new Integer( buildId ).toString() ) );
                     }
                 }
             }
@@ -127,6 +135,7 @@ public class BuildResultsListAction
                         else
                         {
                             this.addActionMessage( getResourceBundle().getString( "buildResult.cannot.delete" ) );
+                            return SUCCESS;
                         }
                     }
                     catch ( BuildManagerException e )

Modified: continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/CancelBuildAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/CancelBuildAction.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/CancelBuildAction.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/CancelBuildAction.java Thu May  6 09:23:13 2010
@@ -68,7 +68,7 @@ public class CancelBuildAction
 
             buildsManager.cancelBuild( projectId );
 
-            AuditLog event = new AuditLog( getProjectGroupName(), AuditLogConstants.CANCEL_BUILD );
+            AuditLog event = new AuditLog( "Project id=" + projectId, AuditLogConstants.CANCEL_BUILD );
             event.setCategory( AuditLogConstants.PROJECT );
             event.setCurrentUser( getPrincipal() );
             event.log();

Modified: continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/DeleteProjectAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/DeleteProjectAction.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/DeleteProjectAction.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/DeleteProjectAction.java Thu May  6 09:23:13 2010
@@ -24,6 +24,8 @@ import org.apache.continuum.web.util.Aud
 import org.apache.maven.continuum.ContinuumException;
 import org.apache.maven.continuum.model.project.Project;
 import org.apache.maven.continuum.web.exception.AuthorizationRequiredException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
@@ -33,6 +35,8 @@ import org.apache.maven.continuum.web.ex
 public class DeleteProjectAction
     extends ContinuumActionSupport
 {
+    private Logger logger = LoggerFactory.getLogger( this.getClass() );
+
     private int projectId;
 
     private String projectName;
@@ -58,7 +62,16 @@ public class DeleteProjectAction
         event.setCategory( AuditLogConstants.PROJECT );
         event.log();
 
-        getContinuum().removeProject( projectId );
+        try
+        {
+            getContinuum().removeProject( projectId );
+        }
+        catch ( ContinuumException e )
+        {
+            logger.error( "Error removing project with id " + projectId, e );
+            addActionError( getText( "deleteProject.error", "Unable to delete project", 
+                                     new Integer( projectId ).toString() ) );
+        }
 
         return SUCCESS;
     }

Modified: continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/GroupSummaryAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/GroupSummaryAction.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/GroupSummaryAction.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/GroupSummaryAction.java Thu May  6 09:23:13 2010
@@ -22,9 +22,10 @@ package org.apache.maven.continuum.web.a
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
+import java.util.Map;
 
+import org.apache.continuum.model.project.ProjectGroupSummary;
 import org.apache.maven.continuum.ContinuumException;
-import org.apache.maven.continuum.model.project.Project;
 import org.apache.maven.continuum.model.project.ProjectGroup;
 import org.apache.maven.continuum.web.exception.AuthorizationRequiredException;
 import org.apache.maven.continuum.web.model.GroupSummary;
@@ -50,14 +51,19 @@ public class GroupSummaryAction
     {
         groups = new ArrayList<GroupSummary>();
 
-        Collection<ProjectGroup> projectGroups = getContinuum().getAllProjectGroupsWithProjects();
+        //TODO: Merge this two requests to one
+        Collection<ProjectGroup> projectGroups = getContinuum().getAllProjectGroups();
+        Map<Integer, ProjectGroupSummary> summaries = getContinuum().getProjectsSummaryByGroups();
 
         for ( ProjectGroup projectGroup : projectGroups )
         {
 
             if ( isAuthorized( projectGroup.getName() ) )
             {
-                logger.debug( "GroupSummaryAction: building group " + projectGroup.getName() );
+                if ( logger.isDebugEnabled() )
+                {
+                    logger.debug( "GroupSummaryAction: building group " + projectGroup.getName() );
+                }
 
                 GroupSummary groupModel = new GroupSummary();
                 groupModel.setId( projectGroup.getId() );
@@ -65,40 +71,23 @@ public class GroupSummaryAction
                 groupModel.setName( projectGroup.getName() );
                 groupModel.setDescription( projectGroup.getDescription() );
 
-                //TODO: Create a summary jpox request so code will be more simple and performance will be better
-                Collection<Project> projects = projectGroup.getProjects();
-
-                groupModel.setNumProjects( projects.size() );
-
-                int numSuccesses = 0;
-                int numFailures = 0;
-                int numErrors = 0;
+                ProjectGroupSummary summary = summaries.get( projectGroup.getId() );
 
-                for ( Project project : projects )
+                if ( summary != null )
                 {
-
-                    if ( project.getState() == 2 )
-                    {
-                        numSuccesses++;
-                    }
-                    else if ( project.getState() == 3 )
-                    {
-                        numFailures++;
-                    }
-                    else if ( project.getState() == 4 )
-                    {
-                        numErrors++;
-                    }
+                    groupModel.setNumProjects( summary.getNumberOfProjects() );
+                    groupModel.setNumErrors( summary.getNumberOfErrors() );
+                    groupModel.setNumFailures( summary.getNumberOfFailures() );
+                    groupModel.setNumSuccesses( summary.getNumberOfSuccesses() );
                 }
 
                 //todo wire in the next scheduled build for the project group and a meaningful status message
                 //groupModel.setNextScheduledBuild( "unknown" );
                 //groupModel.setStatusMessage( "none" );
-
-                groupModel.setNumSuccesses( numSuccesses );
-                groupModel.setNumFailures( numFailures );
-                groupModel.setNumErrors( numErrors );
-                logger.debug( "GroupSummaryAction: adding group to groups list " + groupModel.getName() );
+                if ( logger.isDebugEnabled() )
+                {
+                    logger.debug( "GroupSummaryAction: adding group to groups list " + groupModel.getName() );
+                }
                 groups.add( groupModel );
             }
         }

Modified: continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectEditAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectEditAction.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectEditAction.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectEditAction.java Thu May  6 09:23:13 2010
@@ -80,9 +80,8 @@ public class ProjectEditAction
         project.setScmTag( scmTag );
 
         getContinuum().updateProject( project );
-        
-        String resource = project.getGroupId() + ":" + project.getArtifactId();
-        AuditLog event = new AuditLog( resource, AuditLogConstants.MODIFY_PROJECT );
+
+        AuditLog event = new AuditLog( "Project id=" + projectId, AuditLogConstants.MODIFY_PROJECT );
         event.setCategory( AuditLogConstants.PROJECT );
         event.setCurrentUser( getPrincipal() );
         event.log();

Modified: continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectGroupAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectGroupAction.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectGroupAction.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectGroupAction.java Thu May  6 09:23:13 2010
@@ -30,10 +30,14 @@ import java.util.List;
 import java.util.Map;
 
 import org.apache.commons.collections.ComparatorUtils;
+import org.apache.commons.lang.StringUtils;
+import org.apache.continuum.buildagent.NoBuildAgentException;
+import org.apache.continuum.buildagent.NoBuildAgentInGroupException;
 import org.apache.continuum.buildmanager.BuildManagerException;
 import org.apache.continuum.buildmanager.BuildsManager;
 import org.apache.continuum.model.project.ProjectScmRoot;
 import org.apache.continuum.model.repository.LocalRepository;
+import org.apache.continuum.utils.build.BuildTrigger;
 import org.apache.continuum.web.util.AuditLog;
 import org.apache.continuum.web.util.AuditLogConstants;
 import org.apache.maven.continuum.ContinuumException;
@@ -53,7 +57,6 @@ import org.codehaus.plexus.redback.rbac.
 import org.codehaus.plexus.redback.role.RoleManager;
 import org.codehaus.plexus.redback.role.RoleManagerException;
 import org.codehaus.plexus.redback.users.User;
-import org.codehaus.plexus.util.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -156,6 +159,12 @@ public class ProjectGroupAction
             addActionError( authzE.getMessage() );
             return REQUIRES_AUTHORIZATION;
         }
+        catch ( ContinuumException e )
+        {
+            addActionError( getText( "projectGroup.invalid.id", "Invalid Project Group Id: " + projectGroupId,
+                                     Integer.toString( projectGroupId ) ) );
+            return "to_summary_page";
+        }
 
         projectGroup = getContinuum().getProjectGroupWithProjects( projectGroupId );
 
@@ -296,7 +305,16 @@ public class ProjectGroupAction
 
         if ( confirmed )
         {
-            getContinuum().removeProjectGroup( projectGroupId );
+            try
+            {
+                getContinuum().removeProjectGroup( projectGroupId );
+            }
+            catch ( ContinuumException e )
+            {
+                logger.error( "Error while removing project group with id " + projectGroupId, e );
+                addActionError( getText( "projectGroup.delete.error", "Unable to remove project group",
+                                         Integer.toString( projectGroupId ) ) );
+            }
         }
         else
         {
@@ -304,7 +322,7 @@ public class ProjectGroupAction
             return CONFIRM;
         }
 
-        AuditLog event = new AuditLog( getProjectGroupName(), AuditLogConstants.REMOVE_PROJECT_GROUP );
+        AuditLog event = new AuditLog( "Project Group id=" + projectGroupId, AuditLogConstants.REMOVE_PROJECT_GROUP );
         event.setCategory( AuditLogConstants.PROJECT );
         event.setCurrentUser( getPrincipal() );
         event.log();
@@ -348,7 +366,7 @@ public class ProjectGroupAction
             }
         }
 
-        for ( ProjectGroup pg : getContinuum().getAllProjectGroupsWithProjects() )
+        for ( ProjectGroup pg : getContinuum().getAllProjectGroups() )
         {
             if ( isAuthorized( projectGroup.getName() ) )
             {
@@ -467,15 +485,12 @@ public class ProjectGroupAction
 
         projectGroup.setDescription( description );
 
+        // [CONTINUUM-2228]. In select field can't select empty values.
         if ( repositoryId > 0 )
         {
             LocalRepository repository = getContinuum().getRepositoryService().getLocalRepository( repositoryId );
             projectGroup.setLocalRepository( repository );
         }
-        else
-        {
-            projectGroup.setLocalRepository( null );
-        }
 
         getContinuum().updateProjectGroup( projectGroup );
 
@@ -527,7 +542,7 @@ public class ProjectGroupAction
             }
         }
 
-        AuditLog event = new AuditLog( getProjectGroupName(), AuditLogConstants.MODIFY_PROJECT_GROUP );
+        AuditLog event = new AuditLog( "Project Group id=" + projectGroupId, AuditLogConstants.MODIFY_PROJECT_GROUP );
         event.setCategory( AuditLogConstants.PROJECT );
         event.setCurrentUser( getPrincipal() );
         event.log();
@@ -547,17 +562,30 @@ public class ProjectGroupAction
             addActionError( authzE.getMessage() );
             return REQUIRES_AUTHORIZATION;
         }
+        
+        BuildTrigger buildTrigger = new BuildTrigger( ContinuumProjectState.TRIGGER_FORCED, getPrincipal() );
 
-        if ( this.getBuildDefinitionId() == -1 )
+        try
         {
-            getContinuum().buildProjectGroup( projectGroupId );
+            if ( this.getBuildDefinitionId() == -1 )
+            {
+            	getContinuum().buildProjectGroup( projectGroupId, buildTrigger );
+            }
+            else
+            {
+            	getContinuum().buildProjectGroupWithBuildDefinition( projectGroupId, buildDefinitionId, buildTrigger );
+            }
         }
-        else
+        catch ( NoBuildAgentException e )
         {
-            getContinuum().buildProjectGroupWithBuildDefinition( projectGroupId, buildDefinitionId );
+            addActionError( getText( "projectGroup.build.error.noBuildAgent" ) );
+        }
+        catch ( NoBuildAgentInGroupException e )
+        {
+            addActionError( getText( "projectGroup.build.error.noBuildAgentInGroup" ) );
         }
 
-        AuditLog event = new AuditLog( getProjectGroupName(), AuditLogConstants.FORCE_BUILD );
+        AuditLog event = new AuditLog( "Project Group id=" + projectGroupId, AuditLogConstants.FORCE_BUILD );
         event.setCategory( AuditLogConstants.PROJECT );
         event.setCurrentUser( getPrincipal() );
         event.log();
@@ -602,6 +630,9 @@ public class ProjectGroupAction
             {
                 if ( p.getState() != ContinuumProjectState.OK )
                 {
+                    logger.info(
+                        "Attempt to release group '" + projectGroup.getName() + "' failed as project '" + p.getName() +
+                            "' is in state " + p.getState() );
                     allBuildsOk = false;
                 }
 
@@ -613,6 +644,9 @@ public class ProjectGroupAction
                     }
                     else
                     {
+                        logger.info( "Attempt to release group '" + projectGroup.getName() + "' failed as project '" +
+                            p.getName() + "' and project '" + parent.getName() + "' are both parents" );
+
                         // currently, we have no provisions for releasing 2 or more parents
                         // at the same time, this will be implemented in the future
                         addActionError( getText( "projectGroup.release.error.severalParentProjects" ) );
@@ -622,6 +656,9 @@ public class ProjectGroupAction
 
                 if ( !"maven2".equals( p.getExecutorId() ) )
                 {
+                    logger.info(
+                        "Attempt to release group '" + projectGroup.getName() + "' failed as project '" + p.getName() +
+                            "' is not a Maven 2 project (executor '" + p.getExecutorId() + "')" );
                     allMavenTwo = false;
                 }
             }
@@ -677,7 +714,9 @@ public class ProjectGroupAction
             List<String> roleNames = new ArrayList<String>();
             for ( Role r : roles )
             {
-                if ( r.getName().indexOf( projectGroup.getName() ) > -1 )
+                String projectGroupName = StringUtils.substringAfter( r.getName(), "-" ).trim();
+
+                if ( projectGroupName.equals( group.getName() ) )
                 {
                     roleNames.add( r.getName() );
                 }
@@ -976,7 +1015,6 @@ public class ProjectGroupAction
     public String getProjectGroupName()
         throws ContinuumException
     {
-
         return getProjectGroup( projectGroupId ).getName();
     }
 

Modified: continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectsListAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectsListAction.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectsListAction.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectsListAction.java Thu May  6 09:23:13 2010
@@ -22,12 +22,16 @@ package org.apache.maven.continuum.web.a
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.continuum.buildagent.NoBuildAgentException;
+import org.apache.continuum.buildagent.NoBuildAgentInGroupException;
 import org.apache.continuum.web.util.AuditLog;
 import org.apache.continuum.web.util.AuditLogConstants;
 import org.apache.maven.continuum.ContinuumException;
 import org.apache.maven.continuum.model.project.BuildDefinition;
 import org.apache.maven.continuum.model.project.Project;
 import org.apache.maven.continuum.web.exception.AuthorizationRequiredException;
+import org.apache.continuum.web.util.AuditLog;
+import org.apache.continuum.web.util.AuditLogConstants;
 import org.codehaus.plexus.util.StringUtils;
 import org.codehaus.plexus.util.dag.CycleDetectedException;
 import org.slf4j.Logger;
@@ -99,7 +103,7 @@ public class ProjectsListAction
 
                 try
                 {
-                    AuditLog event = new AuditLog( "Project id=" + selectedProject, AuditLogConstants.REMOVE_PROJECT );
+                    AuditLog event = new AuditLog( "Project id=" + projectId, AuditLogConstants.REMOVE_PROJECT );
                     event.setCategory( AuditLogConstants.PROJECT );
                     event.setCurrentUser( getPrincipal() );
                     event.log();
@@ -109,7 +113,8 @@ public class ProjectsListAction
                 catch ( ContinuumException e )
                 {
                     logger.error( "Error removing Project with id=" + projectId );
-                    addActionError( getText( "Unable to remove Project with id=" + projectId ) );
+                    addActionError( getText( "deleteProject.error", "Unable to delete project",
+                                             new Integer( projectId ).toString() ) );
                 }
             }
         }
@@ -152,19 +157,35 @@ public class ProjectsListAction
                 int projectId = Integer.parseInt( pId );
                 Project p = getContinuum().getProjectWithAllDetails( projectId );
                 projectsList.add( p );
+
+                AuditLog event = new AuditLog( "Project id=" + projectId, AuditLogConstants.FORCE_BUILD );
+                event.setCategory( AuditLogConstants.PROJECT );
+                event.setCurrentUser( getPrincipal() );
+                event.log();
             }
 
             List<Project> sortedProjects = getContinuum().getProjectsInBuildOrder( projectsList );
 
-            if ( this.getBuildDefinitionId() <= 0 )
+            try
+            {
+                if ( this.getBuildDefinitionId() <= 0 )
+                {
+                    List<BuildDefinition> groupDefaultBDs =
+                        getContinuum().getDefaultBuildDefinitionsForProjectGroup( projectGroupId );
+                    getContinuum().buildProjectsWithBuildDefinition( sortedProjects, groupDefaultBDs );
+                }
+                else
+                {
+                    getContinuum().buildProjectsWithBuildDefinition( sortedProjects, buildDefinitionId );
+                }
+            }
+            catch ( NoBuildAgentException e )
             {
-                List<BuildDefinition> groupDefaultBDs =
-                    getContinuum().getDefaultBuildDefinitionsForProjectGroup( projectGroupId );
-                getContinuum().buildProjectsWithBuildDefinition( sortedProjects, groupDefaultBDs );
+                addActionError( getText( "projectGroup.build.error.noBuildAgent" ) );
             }
-            else
+            catch ( NoBuildAgentInGroupException e )
             {
-                getContinuum().buildProjectsWithBuildDefinition( sortedProjects, buildDefinitionId );
+                addActionError( getText( "projectGroup.build.error.noBuildAgentInGroup" ) );
             }
         }
 

Modified: continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseInProgressAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseInProgressAction.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseInProgressAction.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseInProgressAction.java Thu May  6 09:23:13 2010
@@ -62,6 +62,8 @@ public class ReleaseInProgressAction
     private String projectGroupName = "";
 
     private ReleaseListenerSummary listenerSummary;
+    
+    private String username = "";
 
     public String execute()
         throws Exception
@@ -94,13 +96,15 @@ public class ReleaseInProgressAction
                 List<String> args = new ArrayList<String>();
                 args.add( e.getMessage() );
 
-                addActionError( getText( "releaseInProgress.error", args ) );
+                addActionError( getText( "distributedBuild.releaseInProgress.error", args ) );
                 return ERROR;
             }
 
             if ( map != null && !map.isEmpty() )
             {
                 int state = DistributedReleaseUtil.getReleaseState( map );
+                
+                username = DistributedReleaseUtil.getUsername( map );
 
                 if ( state == ContinuumReleaseManagerListener.LISTENING )
                 {
@@ -144,6 +148,8 @@ public class ReleaseInProgressAction
     
             if ( listener != null )
             {
+            	username = listener.getUsername();
+            	
                 if ( listener.getState() == ContinuumReleaseManagerListener.LISTENING )
                 {
                     status = "inProgress";
@@ -212,6 +218,8 @@ public class ReleaseInProgressAction
                     listenerSummary.setCompletedPhases( DistributedReleaseUtil.getCompletedReleasePhases( map ) );
                     listenerSummary.setInProgress( DistributedReleaseUtil.getReleaseInProgress( map ) );
                     listenerSummary.setError( DistributedReleaseUtil.getReleaseError( map ) );
+                    
+                    username = DistributedReleaseUtil.getUsername( map );
     
                     if ( state == ContinuumReleaseManagerListener.FINISHED )
                     {
@@ -250,6 +258,8 @@ public class ReleaseInProgressAction
                 listenerSummary.setCompletedPhases( listener.getCompletedPhases() );
                 listenerSummary.setInProgress( listener.getInProgress() );
                 listenerSummary.setError( listener.getError() );
+                
+                username = listener.getUsername();
 
                 if ( listener.getState() == ContinuumReleaseManagerListener.FINISHED )
                 {
@@ -353,6 +363,7 @@ public class ReleaseInProgressAction
         releaseResult.setProjectGroup( projectGroup );
         releaseResult.setProject( project );
         releaseResult.setReleaseGoal( releaseGoal );
+        releaseResult.setUsername( username );
 
         String releaseName = "releases-" + result.getStartTime();
 
@@ -375,5 +386,16 @@ public class ReleaseInProgressAction
 
         return releaseResult;
     }
+    
+    public String getProjectName()
+        throws ContinuumException
+    {
+        return getProjectGroupName();
+    }
+    
+    public String getUsername()
+    {
+        return this.username;
+    }
 
 }

Modified: continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePerformAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePerformAction.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePerformAction.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePerformAction.java Thu May  6 09:23:13 2010
@@ -234,6 +234,8 @@ public class ReleasePerformAction
         Project project = getContinuum().getProject( projectId );
 
         LocalRepository repository = project.getProjectGroup().getLocalRepository();
+        
+        String username = getPrincipal();
 
         if ( getContinuum().getConfiguration().isDistributedBuildEnabled() )
         {
@@ -241,7 +243,7 @@ public class ReleasePerformAction
 
             try
             {
-                releaseManager.releasePerform( projectId, releaseId, goals, arguments, useReleaseProfile, repository );
+                releaseManager.releasePerform( projectId, releaseId, goals, arguments, useReleaseProfile, repository, username );
             }
             catch ( BuildAgentConfigurationException e )
             {
@@ -255,6 +257,8 @@ public class ReleasePerformAction
         else
         {
             listener = new DefaultReleaseManagerListener();
+            
+            listener.setUsername( username );
     
             ContinuumReleaseManager releaseManager = getContinuum().getReleaseManager();
 
@@ -266,11 +270,10 @@ public class ReleasePerformAction
             releaseManager.perform( releaseId, performDirectory, goals, arguments, useReleaseProfile, listener,
                                     repository );
         }
-        
-        String resource = project.getGroupId() + ":" + project.getArtifactId() + ":" + project.getVersion();
-        AuditLog event = new AuditLog( resource, AuditLogConstants.PERFORM_RELEASE );
+
+        AuditLog event = new AuditLog( "ReleaseId=" + releaseId, AuditLogConstants.PERFORM_RELEASE );
         event.setCategory( AuditLogConstants.PROJECT );
-        event.setCurrentUser( getPrincipal() );
+        event.setCurrentUser( username );
         event.log();
 
         return SUCCESS;
@@ -291,13 +294,13 @@ public class ReleasePerformAction
             if ( profileId != -1 )
             {
                 Profile profile = getContinuum().getProfileService().getProfile( profileId );
-                environments = getEnvironments( profile );
+                environments = getEnvironments( profile, releaseManager.getDefaultBuildagent( projectId ) );
             }
 
             try
             {
-                releaseManager.releasePerformFromScm( projectId, goals, arguments, useReleaseProfile, repository, scmUrl, 
-                                                      scmUsername, scmPassword, scmTag, scmTagBase, environments );
+                releaseId = releaseManager.releasePerformFromScm( projectId, goals, arguments, useReleaseProfile, repository, scmUrl, 
+                                                                  scmUsername, scmPassword, scmTag, scmTagBase, environments, getPrincipal() );
             }
             catch ( BuildAgentConfigurationException e )
             {
@@ -324,7 +327,7 @@ public class ReleasePerformAction
             if ( profileId != -1 )
             {
                 Profile profile = getContinuum().getProfileService().getProfile( profileId );
-                descriptor.setEnvironments( getEnvironments( profile ) );
+                descriptor.setEnvironments( getEnvironments( profile, null ) );
             }
     
             do

Modified: continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePrepareAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePrepareAction.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePrepareAction.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePrepareAction.java Thu May  6 09:23:13 2010
@@ -304,21 +304,25 @@ public class ReleasePrepareAction
         {
             profile = getContinuum().getProfileService().getProfile( profileId );
         }
+        
+        String username = getPrincipal();
 
-        Map<String, String> environments = getEnvironments( profile );
+        Map<String, String> environments = new HashMap<String, String>();
 
         if ( getContinuum().getConfiguration().isDistributedBuildEnabled() )
         {
             DistributedReleaseManager distributedReleaseManager = getContinuum().getDistributedReleaseManager();
+            
+            environments = getEnvironments( profile, distributedReleaseManager.getDefaultBuildagent( projectId ) );
 
             try
             {
                 releaseId = distributedReleaseManager.releasePrepare( project, getReleaseProperties(), getRelVersionMap(), getDevVersionMap(), 
-                                                                      environments );
+                                                                      environments, username );
 
                 if ( releaseId == null )
                 {
-                    addActionError( "" );
+                    addActionError( "Failed to release project" );
                     return ERROR;
                 }
             }
@@ -333,7 +337,11 @@ public class ReleasePrepareAction
         }
         else
         {
+            environments = getEnvironments( profile, null );
+            
             listener = new DefaultReleaseManagerListener();
+            
+            listener.setUsername( username );
 
             String workingDirectory = getContinuum().getWorkingDirectory( projectId ).getPath();
 
@@ -356,10 +364,9 @@ public class ReleasePrepareAction
                                         workingDirectory, environments, executable );
         }
         
-        String resource = project.getGroupId() + ":" + project.getArtifactId() + ":" + project.getVersion();
-        AuditLog event = new AuditLog( resource, AuditLogConstants.PREPARE_RELEASE );
+        AuditLog event = new AuditLog( "Release id=" + releaseId, AuditLogConstants.PREPARE_RELEASE );
         event.setCategory( AuditLogConstants.PROJECT );
-        event.setCurrentUser( getPrincipal() );
+        event.setCurrentUser( username );
         event.log();
 
         return SUCCESS;

Modified: continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseRollbackAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseRollbackAction.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseRollbackAction.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseRollbackAction.java Thu May  6 09:23:13 2010
@@ -90,9 +90,11 @@ public class ReleaseRollbackAction
             ContinuumReleaseManager releaseManager = getContinuum().getReleaseManager();
     
             ContinuumReleaseManagerListener listener = new DefaultReleaseManagerListener();
+            
+            listener.setUsername( getPrincipal() );
     
             Project project = getContinuum().getProject( projectId );
-            
+    
             releaseManager.rollback( releaseId, workingDirectoryService.getWorkingDirectory( project ).getPath(), listener );
     
             //recurse until rollback is finished
@@ -108,8 +110,7 @@ public class ReleaseRollbackAction
                 }
             }
             
-            String resource = project.getGroupId() + ":" + project.getArtifactId() + ":" + project.getVersion();
-            AuditLog event = new AuditLog( resource, AuditLogConstants.ROLLBACK_RELEASE );
+            AuditLog event = new AuditLog( "Release id=" + releaseId, AuditLogConstants.ROLLBACK_RELEASE );
             event.setCategory( AuditLogConstants.PROJECT );
             event.setCurrentUser( getPrincipal() );
             event.log();

Modified: continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ScheduleAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ScheduleAction.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ScheduleAction.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ScheduleAction.java Thu May  6 09:23:13 2010
@@ -23,6 +23,7 @@ import com.opensymphony.xwork2.Preparabl
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.List;
 
 import org.apache.commons.lang.StringUtils;
@@ -79,9 +80,11 @@ public class ScheduleAction
 
     private String year;
 
-    private List<String> availableBuildQueues;
+    private List<BuildQueue> availableBuildQueues;
 
-    private List<String> selectedBuildQueues = new ArrayList<String>();
+    private List<BuildQueue> selectedBuildQueues = new ArrayList<BuildQueue>();
+    
+    private List<String> selectedBuildQueuesIds = new ArrayList<String>();
 
     public void prepare()
         throws Exception
@@ -94,27 +97,19 @@ public class ScheduleAction
     private void populateBuildQueues()
         throws ContinuumException
     {
-        List<BuildQueue> buildQueues;
         if ( schedule != null )
         {
-            buildQueues = schedule.getBuildQueues();
-            for ( BuildQueue buildQueue : buildQueues )
+            selectedBuildQueues = schedule.getBuildQueues();
+            for ( BuildQueue bq : selectedBuildQueues )
             {
-                selectedBuildQueues.add( buildQueue.getName() );
+                this.selectedBuildQueuesIds.add( Integer.toString( bq.getId() ) );
             }
-
         }
 
-        availableBuildQueues = new ArrayList<String>();
-
-        buildQueues = getContinuum().getAllBuildQueues();
-        for ( BuildQueue buildQueue : buildQueues )
-        {
-            availableBuildQueues.add( buildQueue.getName() );
-        }
+        availableBuildQueues = getContinuum().getAllBuildQueues();
 
         // remove selected build queues from available build queues
-        for ( String buildQueue : selectedBuildQueues )
+        for ( BuildQueue buildQueue : selectedBuildQueues )
         {
             if ( availableBuildQueues.contains( buildQueue ) )
             {
@@ -222,24 +217,30 @@ public class ScheduleAction
         {
             logger.error( "Can't create schedule. No schedule name was supplied." );
             addActionError( getText( "buildDefinition.noname.save.error.message" ) );
+        }
+        if ( !getContinuum().getConfiguration().isDistributedBuildEnabled()
+            && ( selectedBuildQueuesIds == null || selectedBuildQueuesIds.isEmpty() ) )
+        {
+            addActionError( getText( "schedule.buildqueues.empty.error" ) );
+        }
+        if ( hasErrors() )
+        {
             return ERROR;
         }
-        else
+
+        try
         {
-            try
-            {
-                Schedule s = getContinuum().getScheduleByName( name );
-                if ( s != null && id != s.getId() )
-                {
-                    addActionError( getText( "schedule.name.already.exists" ) );
-                    return ERROR;
-                }
-            }
-            catch ( ContinuumException e )
+            Schedule s = getContinuum().getScheduleByName( name );
+            if ( s != null && id != s.getId() )
             {
-                logger.debug( "Unexpected error getting schedule" );
+                addActionError( getText( "schedule.name.already.exists" ) );
+                return ERROR;
             }
         }
+        catch ( ContinuumException e )
+        {
+            logger.debug( "Unexpected error getting schedule" );
+        }
         
         AuditLog event = new AuditLog( getName(), AuditLogConstants.ADD_SCHEDULE );
         event.setCategory( AuditLogConstants.SCHEDULE );
@@ -284,15 +285,14 @@ public class ScheduleAction
         schedule.setDelay( delay );
         schedule.setDescription( description );
         schedule.setName( name );
-        schedule.setMaxJobExecutionTime( maxJobExecutionTime );
-
-        // remove old build queues
-        schedule.setBuildQueues( null );
-
-        for ( String name : selectedBuildQueues )
-        {
-            BuildQueue buildQueue = getContinuum().getBuildQueueByName( name );
-            schedule.addBuildQueue( buildQueue );
+        schedule.setMaxJobExecutionTime(maxJobExecutionTime);
+        if (!getContinuum().getConfiguration().isDistributedBuildEnabled()) {
+            // if distributed build don't update schedules
+            schedule.setBuildQueues(null);
+            for (String id : selectedBuildQueuesIds) {
+                BuildQueue buildQueue = getContinuum().getBuildQueue(Integer.parseInt(id));
+                schedule.addBuildQueue(buildQueue);
+            }
         }
 
         return schedule;
@@ -529,23 +529,33 @@ public class ScheduleAction
             year ).trim();
     }
 
-    public List<String> getAvailableBuildQueues()
+    public List<BuildQueue> getAvailableBuildQueues()
     {
         return availableBuildQueues;
     }
 
-    public void setAvailableBuildQueues( List<String> availableBuildQueues )
+    public void setAvailableBuildQueues( List<BuildQueue> availableBuildQueues )
     {
         this.availableBuildQueues = availableBuildQueues;
     }
 
-    public List<String> getSelectedBuildQueues()
+    public List<BuildQueue> getSelectedBuildQueues()
     {
         return selectedBuildQueues;
     }
 
-    public void setSelectedBuildQueues( List<String> selectedBuildQueues )
+    public void setSelectedBuildQueues( List<BuildQueue> selectedBuildQueues )
     {
         this.selectedBuildQueues = selectedBuildQueues;
     }
+
+    public List<String> getSelectedBuildQueuesIds()
+    {
+        return selectedBuildQueuesIds;
+    }
+
+    public void setSelectedBuildQueuesIds( List<String> selectedBuildQueuesIds )
+    {
+        this.selectedBuildQueuesIds = selectedBuildQueuesIds;
+    }
 }

Modified: continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/SummaryAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/SummaryAction.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/SummaryAction.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/SummaryAction.java Thu May  6 09:23:13 2010
@@ -29,6 +29,7 @@ import java.util.Map;
 import org.apache.continuum.buildmanager.BuildManagerException;
 import org.apache.continuum.buildmanager.BuildsManager;
 import org.apache.maven.continuum.ContinuumException;
+import org.apache.maven.continuum.configuration.ConfigurationService;
 import org.apache.maven.continuum.model.project.BuildResult;
 import org.apache.maven.continuum.model.project.Project;
 import org.apache.maven.continuum.project.ContinuumProjectState;
@@ -112,7 +113,7 @@ public class SummaryAction
 
             try
             {
-                if ( parallelBuildsManager.isInAnyBuildQueue( project.getId() ) )
+                if ( parallelBuildsManager.isInAnyBuildQueue( project.getId() ) || parallelBuildsManager.isInPrepareBuildQueue( project.getId() ) )
                 {
                     model.setInBuildingQueue( true );
                 }
@@ -156,6 +157,14 @@ public class SummaryAction
                     model.setLastBuildDateTime( latestBuild.getEndTime() );
                     model.setLastBuildDuration( latestBuild.getDurationTime() );
                 }
+
+                ConfigurationService configuration = getContinuum().getConfiguration();
+
+                if ( configuration.isDistributedBuildEnabled() && 
+                                project.getState() == ContinuumProjectState.BUILDING )
+                {
+                    model.setLatestBuildId( 0 );
+                }
             }
 
             summary.add( model );
@@ -230,4 +239,10 @@ public class SummaryAction
     {
         this.groupSummary = groupSummary;
     }
+
+    // test
+    public void setParallelBuildsManager( BuildsManager parallelBuildsManager )
+    {
+        this.parallelBuildsManager = parallelBuildsManager;
+    }
 }



Mime
View raw message