You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@continuum.apache.org by jm...@apache.org on 2006/08/22 20:37:46 UTC

svn commit: r433720 [1/3] - in /maven/continuum/branches/continuum-acegi: continuum-api/src/main/java/org/apache/maven/continuum/ continuum-api/src/main/java/org/apache/maven/continuum/project/builder/ continuum-api/src/main/java/org/apache/maven/conti...

Author: jmcconnell
Date: Tue Aug 22 11:37:42 2006
New Revision: 433720

URL: http://svn.apache.org/viewvc?rev=433720&view=rev
Log:
svn merge -r431404:433443 : bringing up the latest changes from the trunk, notably the project grouping ui through to store changes with build definitions

Added:
    maven/continuum/branches/continuum-acegi/continuum-api/src/test/java/org/apache/maven/continuum/project/
      - copied from r433443, maven/continuum/trunk/continuum-api/src/test/java/org/apache/maven/continuum/project/
    maven/continuum/branches/continuum-acegi/continuum-api/src/test/java/org/apache/maven/continuum/project/builder/
      - copied from r433443, maven/continuum/trunk/continuum-api/src/test/java/org/apache/maven/continuum/project/builder/
    maven/continuum/branches/continuum-acegi/continuum-api/src/test/java/org/apache/maven/continuum/project/builder/AbstractContinuumProjectBuilderTest.java
      - copied unchanged from r433443, maven/continuum/trunk/continuum-api/src/test/java/org/apache/maven/continuum/project/builder/AbstractContinuumProjectBuilderTest.java
    maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AbstractBuildDefinitionContinuumAction.java
      - copied unchanged from r433443, maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AbstractBuildDefinitionContinuumAction.java
    maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AddBuildDefinitionToProjectAction.java
      - copied unchanged from r433443, maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AddBuildDefinitionToProjectAction.java
    maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AddBuildDefinitionToProjectGroupAction.java
      - copied unchanged from r433443, maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AddBuildDefinitionToProjectGroupAction.java
    maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/core/action/RemoveBuildDefinitionFromProjectAction.java
      - copied unchanged from r433443, maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/RemoveBuildDefinitionFromProjectAction.java
    maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/core/action/RemoveBuildDefinitionFromProjectGroupAction.java
      - copied unchanged from r433443, maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/RemoveBuildDefinitionFromProjectGroupAction.java
    maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateBuildDefinitionFromProjectAction.java
      - copied unchanged from r433443, maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateBuildDefinitionFromProjectAction.java
    maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateBuildDefinitionFromProjectGroupAction.java
      - copied unchanged from r433443, maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateBuildDefinitionFromProjectGroupAction.java
    maven/continuum/branches/continuum-acegi/continuum-core/src/test/java/org/apache/maven/continuum/core/
      - copied from r433443, maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/core/
    maven/continuum/branches/continuum-acegi/continuum-core/src/test/java/org/apache/maven/continuum/core/action/
      - copied from r433443, maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/core/action/
    maven/continuum/branches/continuum-acegi/continuum-core/src/test/java/org/apache/maven/continuum/core/action/CreateProjectsFromMetadataTest.java
      - copied unchanged from r433443, maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/core/action/CreateProjectsFromMetadataTest.java
    maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenProjectAction.java
      - copied unchanged from r433443, maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenProjectAction.java
    maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildDefinitionAction.java
      - copied unchanged from r433443, maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildDefinitionAction.java
    maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectGroupAction.java
      - copied unchanged from r433443, maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectGroupAction.java
    maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/component/
      - copied from r433443, maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/component/
    maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/component/BuildDefinitionSummaryAction.java
      - copied unchanged from r433443, maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/component/BuildDefinitionSummaryAction.java
    maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/java/org/apache/maven/continuum/web/exception/
      - copied from r433443, maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/exception/
    maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/java/org/apache/maven/continuum/web/exception/ContinuumActionException.java
      - copied unchanged from r433443, maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/exception/ContinuumActionException.java
    maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/components/buildDefinitionGroupSummaryComponent.jsp
      - copied unchanged from r433443, maven/continuum/trunk/continuum-webapp/src/main/webapp/components/buildDefinitionGroupSummaryComponent.jsp
    maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/components/buildDefinitionSummaryComponent.jsp
      - copied unchanged from r433443, maven/continuum/trunk/continuum-webapp/src/main/webapp/components/buildDefinitionSummaryComponent.jsp
    maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/components/failureComponent.jsp
      - copied unchanged from r433443, maven/continuum/trunk/continuum-webapp/src/main/webapp/components/failureComponent.jsp
    maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/components/projectSummaryComponent.jsp
      - copied unchanged from r433443, maven/continuum/trunk/continuum-webapp/src/main/webapp/components/projectSummaryComponent.jsp
    maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/projectGroupBuildDefinition.jsp
      - copied unchanged from r433443, maven/continuum/trunk/continuum-webapp/src/main/webapp/projectGroupBuildDefinition.jsp
    maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/projectGroupMembers.jsp
      - copied unchanged from r433443, maven/continuum/trunk/continuum-webapp/src/main/webapp/projectGroupMembers.jsp
    maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/projectGroupNotifier.jsp
      - copied unchanged from r433443, maven/continuum/trunk/continuum-webapp/src/main/webapp/projectGroupNotifier.jsp
    maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/projectGroupSummary.jsp
      - copied unchanged from r433443, maven/continuum/trunk/continuum-webapp/src/main/webapp/projectGroupSummary.jsp
Removed:
    maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddBuildDefinitionAction.java
    maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddScheduleAction.java
    maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildDefinitionEditAction.java
    maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/DeleteBuildDefinitionAction.java
    maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/EditScheduleAction.java
Modified:
    maven/continuum/branches/continuum-acegi/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
    maven/continuum/branches/continuum-acegi/continuum-api/src/main/java/org/apache/maven/continuum/project/builder/AbstractContinuumProjectBuilder.java
    maven/continuum/branches/continuum-acegi/continuum-api/src/main/java/org/apache/maven/continuum/project/builder/ContinuumProjectBuildingResult.java
    maven/continuum/branches/continuum-acegi/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java
    maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
    maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AbstractContinuumAction.java
    maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CreateProjectsFromMetadata.java
    maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/core/action/StoreProjectGroupAction.java
    maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m1/DefaultMavenOneMetadataHelper.java
    maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/DefaultMavenBuilderHelper.java
    maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/MavenBuilderHelper.java
    maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/initialization/DefaultContinuumInitializer.java
    maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilder.java
    maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilder.java
    maven/continuum/branches/continuum-acegi/continuum-core/src/main/resources/META-INF/plexus/components.xml
    maven/continuum/branches/continuum-acegi/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java
    maven/continuum/branches/continuum-acegi/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilderTest.java
    maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/src/test/java/org/apache/maven/continuum/security/acegi/aspectj/ContinuumStub.java
    maven/continuum/branches/continuum-acegi/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java
    maven/continuum/branches/continuum-acegi/continuum-store/src/test/java/org/apache/maven/continuum/store/ContinuumStoreTest.java
    maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenOneProjectAction.java
    maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenTwoProjectAction.java
    maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildResultsListAction.java
    maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/GroupSummaryAction.java
    maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ScheduleAction.java
    maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/SummaryAction.java
    maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/WorkingCopyAction.java
    maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/mdo/view-models.xml
    maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/resources/META-INF/plexus/application.xml
    maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/resources/localization/Continuum.properties
    maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/resources/xwork.xml
    maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/WEB-INF/   (props changed)
    maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/WEB-INF/web.xml
    maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/addMavenOneProject.jsp
    maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/addMavenTwoProject.jsp
    maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/buildDefinitionEdit.jsp
    maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/buildResults.jsp
    maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/deleteBuildDefinition.jsp
    maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/editSchedule.jsp
    maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/error.jsp
    maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/groupSummary.jsp
    maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/navigations/DefaultTop.jsp
    maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/navigations/Menu.jsp
    maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/projectView.jsp
    maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/schedules.jsp
    maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/summary.jsp
    maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/workingCopy.jsp

Modified: maven/continuum/branches/continuum-acegi/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-acegi/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java?rev=433720&r1=433719&r2=433720&view=diff
==============================================================================
--- maven/continuum/branches/continuum-acegi/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java (original)
+++ maven/continuum/branches/continuum-acegi/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java Tue Aug 22 11:37:42 2006
@@ -22,6 +22,7 @@
 import org.apache.maven.continuum.model.project.Project;
 import org.apache.maven.continuum.model.project.ProjectNotifier;
 import org.apache.maven.continuum.model.project.Schedule;
+import org.apache.maven.continuum.model.project.ProjectGroup;
 import org.apache.maven.continuum.model.system.ContinuumUser;
 import org.apache.maven.continuum.model.system.UserGroup;
 import org.apache.maven.continuum.project.builder.ContinuumProjectBuildingResult;
@@ -46,10 +47,19 @@
     // Project Groups
     // ----------------------------------------------------------------------
 
+    public ProjectGroup getProjectGroup( int projectGroupId )
+        throws ContinuumException;
+
     public Collection getAllProjectGroupsWithProjects();
 
+    public ProjectGroup getProjectGroupByProjectId( int projectId )
+        throws ContinuumException;
+
     public Collection getProjectsInGroup( int projectGroupId )
         throws ContinuumException;
+
+    public void removeProjectGroup( int projectGroupId )
+        throws ContinuumException;
     
     // ----------------------------------------------------------------------
     // Project
@@ -118,6 +128,9 @@
     void buildProject( int projectId, int buildDefinitionId, int trigger )
         throws ContinuumException;
 
+    public void buildProjectGroup( int projectGroupId )
+        throws ContinuumException;
+
     // ----------------------------------------------------------------------
     // Build information
     // ----------------------------------------------------------------------
@@ -144,10 +157,24 @@
     int addProject( Project project, String executorId )
         throws ContinuumException;
 
+    /**
+     * Add a Maven 2 project to the list of projects. 
+     * 
+     * @param metadataUrl url of the pom.xml
+     * @return a holder with the projects, project groups and errors occurred during the project adding
+     * @throws ContinuumException
+     */
     ContinuumProjectBuildingResult addMavenTwoProject( String metadataUrl )
         throws ContinuumException;
 
-    ContinuumProjectBuildingResult addMavenOneProject( String metadataUrl )
+    /**
+     * Add a Maven 1 project to the list of projects. 
+     * 
+     * @param metadataUrl url of the project.xml
+     * @return a holder with the projects, project groups and errors occurred during the project adding
+     * @throws ContinuumException
+     */
+   ContinuumProjectBuildingResult addMavenOneProject( String metadataUrl )
         throws ContinuumException;
 
     void updateProject( Project project )
@@ -188,29 +215,70 @@
     // Build Definition
     // ----------------------------------------------------------------------
 
+    /**
+     * @deprecated
+     */
     List getBuildDefinitions( int projectId )
         throws ContinuumException;
 
+    /**
+     * @deprecated
+     */
+    BuildDefinition getBuildDefinition( int projectId, int buildDefinitionId )
+        throws ContinuumException;
+
+    /**
+     * @deprecated
+     */
+    void removeBuildDefinition( int projectId, int buildDefinitionId )
+        throws ContinuumException;
+
+    /**
+     * returns the build definition from either the project or the project group it is a part of
+     *
+     * @param buildDefinitionId
+     * @return
+     */
+    BuildDefinition getBuildDefinition( int buildDefinitionId )
+        throws ContinuumException;
+
+    /**
+     * returns the default build definition for the project
+     *
+     * 1) if project has default build definition, return that
+     * 2) otherwise return default build definition for parent project group
+     *
+     * @param projectId
+     * @return
+     * @throws ContinuumException
+     */
     BuildDefinition getDefaultBuildDefinition( int projectId )
         throws ContinuumException;
 
-    BuildDefinition getBuildDefinition( int projectId, int buildDefinitionId )
+    void addBuildDefinitionToProject( int projectId, BuildDefinition buildDefinition )
         throws ContinuumException;
 
-    void updateBuildDefinition( BuildDefinition buildDefinition, int projectId )
+    void addBuildDefinitionToProjectGroup( int projectGroupId, BuildDefinition buildDefinition )
+        throws ContinuumException;    
+
+    List getBuildDefinitionsForProject( int projectId )
         throws ContinuumException;
 
-    void updateBuildDefinition( int projectId, int buildDefinitionId, Map configuration )
+    List getBuildDefinitionsForProjectGroup( int projectGroupId )
         throws ContinuumException;
 
-    void addBuildDefinition( int projectId, BuildDefinition buildDefinition )
+    void removeBuildDefinitionFromProject( int projectId, int buildDefinitionId )
         throws ContinuumException;
 
-    void addBuildDefinitionFromParams( int projectId, Map configuration )
+    void removeBuildDefinitionFromProjectGroup( int projectGroupId, int buildDefinitionId )
         throws ContinuumException;
 
-    void removeBuildDefinition( int projectId, int buildDefinitionId )
+    void updateBuildDefinitionForProject( int projectId, BuildDefinition buildDefinition )
         throws ContinuumException;
+
+    void updateBuildDefinitionForProjectGroup( int projectGroupId, BuildDefinition buildDefinition )
+        throws ContinuumException;
+
 
     // ----------------------------------------------------------------------
     // Schedule

Modified: maven/continuum/branches/continuum-acegi/continuum-api/src/main/java/org/apache/maven/continuum/project/builder/AbstractContinuumProjectBuilder.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-acegi/continuum-api/src/main/java/org/apache/maven/continuum/project/builder/AbstractContinuumProjectBuilder.java?rev=433720&r1=433719&r2=433720&view=diff
==============================================================================
--- maven/continuum/branches/continuum-acegi/continuum-api/src/main/java/org/apache/maven/continuum/project/builder/AbstractContinuumProjectBuilder.java (original)
+++ maven/continuum/branches/continuum-acegi/continuum-api/src/main/java/org/apache/maven/continuum/project/builder/AbstractContinuumProjectBuilder.java Tue Aug 22 11:37:42 2006
@@ -23,6 +23,7 @@
 import org.codehaus.plexus.util.StringUtils;
 
 import java.io.File;
+import java.io.FileNotFoundException;
 import java.io.FileWriter;
 import java.io.IOException;
 import java.io.InputStream;
@@ -38,6 +39,9 @@
     extends AbstractLogEnabled
     implements ContinuumProjectBuilder
 {
+    
+    private static final String TMP_DIR = System.getProperty( "java.io.tmpdir" );
+
     protected File createMetadataFile( URL metadata, String username, String password )
         throws IOException
     {
@@ -47,7 +51,7 @@
 
         if ( metadata.getProtocol().startsWith( "http" ) )
         {
-            is = new MungedHttpsURL( metadata.toExternalForm(), username, password ).getURL().openStream();
+            is = new MungedHttpsURL( metadata.toExternalForm(), username, password ).getURLConnection().getInputStream();
         }
         else
         {
@@ -86,7 +90,7 @@
         // Little hack for URLs that contains '*' like "http://svn.codehaus.org/*checkout*/trunk/pom.xml?root=plexus"
         baseDirectory = StringUtils.replace( baseDirectory, "*", "" );
 
-        File continuumTmpDir = new File( System.getProperty( "java.io.tmpdir" ), "continuum" );
+        File continuumTmpDir = new File( TMP_DIR, "continuum" );
 
         File uploadDirectory = new File( continuumTmpDir, baseDirectory );
 
@@ -124,6 +128,11 @@
         try
         {
             return createMetadataFile( metadata, username, password );
+        }
+        catch ( FileNotFoundException e )
+        {
+            getLogger().info( "URL not found: " + metadata, e );
+            result.addError( ContinuumProjectBuildingResult.ERROR_POM_NOT_FOUND );
         }
         catch ( MalformedURLException e )
         {

Modified: maven/continuum/branches/continuum-acegi/continuum-api/src/main/java/org/apache/maven/continuum/project/builder/ContinuumProjectBuildingResult.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-acegi/continuum-api/src/main/java/org/apache/maven/continuum/project/builder/ContinuumProjectBuildingResult.java?rev=433720&r1=433719&r2=433720&view=diff
==============================================================================
--- maven/continuum/branches/continuum-acegi/continuum-api/src/main/java/org/apache/maven/continuum/project/builder/ContinuumProjectBuildingResult.java (original)
+++ maven/continuum/branches/continuum-acegi/continuum-api/src/main/java/org/apache/maven/continuum/project/builder/ContinuumProjectBuildingResult.java Tue Aug 22 11:37:42 2006
@@ -44,8 +44,28 @@
 
     public static final String ERROR_MISSING_ARTIFACTID = "add.project.missing.artifactid.error";
 
-    public static final String ERROR_UNKNOWN = "add.project.unknown.error";
+    public static final String ERROR_POM_NOT_FOUND = "add.project.missing.pom.error";
+    
+    public static final String ERROR_MISSING_VERSION = "add.project.missing.version.error";
+
+    public static final String ERROR_MISSING_NAME = "add.project.missing.name.error";
+
+    public static final String ERROR_MISSING_REPOSITORY = "add.project.missing.repository.error";
+
+    public static final String ERROR_MISSING_SCM = "add.project.missing.scm.error";
+    
+    public static final String ERROR_MISSING_SCM_CONNECTION = "add.project.missing.scm.connection.error";
+
+    public static final String ERROR_MISSING_NOTIFIER_TYPE = "add.project.missing.notifier.type.error";
+
+    public static final String ERROR_MISSING_NOTIFIER_CONFIGURATION = "add.project.missing.notifier.configuration.error";
+    
+    public static final String ERROR_METADATA_TRANSFER = "add.project.metadata.transfer.error";
+    
+    public static final String ERROR_VALIDATION = "add.project.validation.error";
     
+    public static final String ERROR_UNKNOWN = "add.project.unknown.error";
+
     private List projects = new ArrayList();
 
     private List projectGroups = new ArrayList();
@@ -99,7 +119,29 @@
     {
         errors.add( errorKey );
     }
-
+    
+    /**
+     * Add an error that happened during adding the project to Continuum.
+     * 
+     * @param errorKey error id (so it can be internationalized later)
+     */
+    public void addError( String errorKey, Object param )
+    {
+        // TODO: store the parameters.
+        errors.add( errorKey );
+    }
+    
+    /**
+     * Add an error that happened during adding the project to Continuum.
+     * 
+     * @param errorKey error id (so it can be internationalized later)
+     */
+    public void addError( String errorKey, Object params[] )
+    {
+        // TODO: store the parameters.
+        errors.add( errorKey );
+    }
+    
     /**
      * Get the warnings that happened during adding the project to Continuum.
      * There is an entry with the warning key (so it can be internationalized later) for each warning.
@@ -121,5 +163,15 @@
     public List getErrors()
     {
         return errors;
+    }
+
+    /**
+     * Quick check to see if there are any errors.
+     * 
+     * @return boolean indicating if there are any errors.
+     */
+    public boolean hasErrors()
+    {
+        return ( errors != null ) && ( !errors.isEmpty() );
     }
 }

Modified: maven/continuum/branches/continuum-acegi/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-acegi/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java?rev=433720&r1=433719&r2=433720&view=diff
==============================================================================
--- maven/continuum/branches/continuum-acegi/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java (original)
+++ maven/continuum/branches/continuum-acegi/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java Tue Aug 22 11:37:42 2006
@@ -53,7 +53,41 @@
 
     Map getDefaultBuildDefinitions();
 
-    BuildDefinition getDefaultBuildDefinition( int projectId );
+    /**
+     * returns the default build definition of the project, if the project doesn't have on declared the default
+     * of the project group will be returned
+     *
+     * this should be the most common usage of the default build definition accessing methods
+     *
+     * @param projectId
+     * @return
+     * @throws ContinuumStoreException
+     * @throws ContinuumObjectNotFoundException
+     */
+    BuildDefinition getDefaultBuildDefinition( int projectId )
+        throws ContinuumStoreException, ContinuumObjectNotFoundException;
+
+    /**
+     * returns the default build definition for the project without consulting the project group
+     *
+     * @param projectId
+     * @return
+     * @throws ContinuumStoreException
+     * @throws ContinuumObjectNotFoundException
+     */
+    BuildDefinition getDefaultBuildDefinitionForProject( int projectId )
+        throws ContinuumStoreException, ContinuumObjectNotFoundException;
+
+    /**
+     * returns the default build definition for the project group and there should always be one declared
+     * 
+     * @param projectGroupId
+     * @return
+     * @throws ContinuumStoreException
+     * @throws ContinuumObjectNotFoundException
+     */
+    BuildDefinition getDefaultBuildDefinitionForProjectGroup( int projectGroupId )
+        throws ContinuumStoreException, ContinuumObjectNotFoundException;
 
     BuildDefinition getBuildDefinition( int buildDefinitionId )
         throws ContinuumStoreException, ContinuumObjectNotFoundException;
@@ -69,6 +103,9 @@
     ProjectGroup getProjectGroup( int projectGroupId )
         throws ContinuumStoreException, ContinuumObjectNotFoundException;
 
+    public ProjectGroup getProjectGroupByProjectId( int projectId )
+        throws ContinuumObjectNotFoundException;
+
     void updateProjectGroup( ProjectGroup group )
         throws ContinuumStoreException;
 
@@ -78,6 +115,8 @@
 
     List getAllProjectsByNameWithDependencies();
 
+    public List getProjectsWithDependenciesByGroupId( int projectGroupId );
+
     List getAllProjectsByNameWithBuildDetails();
 
     List getAllSchedulesByName();
@@ -104,6 +143,9 @@
         throws ContinuumStoreException, ContinuumObjectNotFoundException;
 
     Map getProjectIdsAndBuildDefinitionsIdsBySchedule( int scheduleId )
+        throws ContinuumStoreException;
+
+    Map getProjectGroupIdsAndBuildDefinitionsIdsBySchedule( int scheduleId )
         throws ContinuumStoreException;
 
     void updateProject( Project project )

Modified: maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java?rev=433720&r1=433719&r2=433720&view=diff
==============================================================================
--- maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java (original)
+++ maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java Tue Aug 22 11:37:42 2006
@@ -181,6 +181,49 @@
     }
 
     // ----------------------------------------------------------------------
+    // Project Groups
+    // ----------------------------------------------------------------------
+    public ProjectGroup getProjectGroup( int projectGroupId )
+        throws ContinuumException
+    {
+        List projectGroups = store.getAllProjectGroupsWithBuildDetails();
+
+        for ( Iterator i = projectGroups.iterator(); i.hasNext(); )
+        {
+            ProjectGroup pg = (ProjectGroup) i.next();
+
+            if ( pg.getId() == projectGroupId )
+            {
+                return pg;
+            }
+        }
+
+        throw new ContinuumException( "invalid group id" );
+    }
+
+
+    public ProjectGroup getProjectGroupByProjectId( int projectId )
+        throws ContinuumException
+    {
+        try
+        {
+            return store.getProjectGroupByProjectId( projectId );
+        }
+        catch ( ContinuumObjectNotFoundException e )
+        {
+            throw new ContinuumException( "could not find project group containing " + projectId );
+        }
+    }
+
+    public void removeProjectGroup( int projectGroupId )
+        throws ContinuumException
+    {
+        ProjectGroup projectGroup = getProjectGroup( projectGroupId );
+
+        store.removeProjectGroup( projectGroup );
+    }
+
+    // ----------------------------------------------------------------------
     // Projects
     // ----------------------------------------------------------------------
 
@@ -382,6 +425,13 @@
         buildProjects( ContinuumProjectState.TRIGGER_FORCED );
     }
 
+
+    /**
+     * fire of the builds of all projects across all project groups using their default build definitions
+     *
+     * @param trigger
+     * @throws ContinuumException
+     */
     public void buildProjects( int trigger )
         throws ContinuumException
     {
@@ -398,24 +448,89 @@
             projectsList = getProjects();
         }
 
-        Map buildDefinitionsIds = store.getDefaultBuildDefinitions();
+        //Map buildDefinitionsIds = store.getDefaultBuildDefinitions();
 
         for ( Iterator i = projectsList.iterator(); i.hasNext(); )
         {
             Project project = (Project) i.next();
 
-            Integer buildDefId = (Integer) buildDefinitionsIds.get( new Integer( project.getId() ) );
+            Integer buildDefId = null;
 
+            try
+            {
+                buildDefId = new Integer( store.getDefaultBuildDefinition( project.getId() ).getId() );
+            }
+            catch (ContinuumStoreException e)
+            {
+                throw new ContinuumException(
+                    "Project (id=" + project.getId() + " doens't have a default build definition, this should be impossible, parent should have default definition set." );
+            }
             if ( buildDefId == null )
             {
-                throw new ContinuumException( "Project (id=" + project.getId()
-                    + " doens't have a default build definition." );
+                throw new ContinuumException(
+                    "Project (id=" + project.getId() + " doens't have a default build definition, this should be even more impossible since store should have throw exception" );
             }
 
             buildProject( project, buildDefId.intValue(), trigger );
         }
     }
 
+    /**
+     * fire off a build for all of the projects in a project group using their default builds
+     *
+     * @param projectGroupId
+     * @param trigger
+     * @throws ContinuumException
+     */
+    public void buildProjectGroup( int projectGroupId )
+        throws ContinuumException
+    {
+        Collection projectsList;
+
+        try
+        {
+            projectsList = getProjectsInBuildOrder( store.getProjectsWithDependenciesByGroupId( projectGroupId ));
+        }
+        catch ( CycleDetectedException e )
+        {
+            getLogger().warn( "Cycle detected while sorting projects for building, falling back to unsorted build." );
+
+            projectsList = getProjects();
+        }
+
+        //Map buildDefinitionsIds = store.getDefaultBuildDefinitions();
+
+        for ( Iterator i = projectsList.iterator(); i.hasNext(); )
+        {
+            Project project = (Project) i.next();
+
+            Integer buildDefId = null;
+
+            try
+            {
+                buildDefId = new Integer( store.getDefaultBuildDefinition( project.getId() ).getId() );
+            }
+            catch (ContinuumStoreException e)
+            {
+                throw new ContinuumException(
+                    "Project (id=" + project.getId() + " doens't have a default build definition, this should be impossible, parent should have default definition set." );
+            }
+            if ( buildDefId == null )
+            {
+                throw new ContinuumException(
+                    "Project (id=" + project.getId() + " doens't have a default build definition, this should be even more impossible since store should have throw exception" );
+            }
+
+            buildProject( project, buildDefId.intValue(), ContinuumProjectState.TRIGGER_FORCED );
+        }
+    }
+
+    /**
+     * takes a given schedule and determines which projects need to build
+     *
+     * @param schedule
+     * @throws ContinuumException
+     */
     public void buildProjects( Schedule schedule )
         throws ContinuumException
     {
@@ -423,57 +538,98 @@
 
         Map projectsMap = null;
 
+        Map projectGroupsMap = null;
+
         try
         {
+            // todo the store should get cleaned up some so this isn't as clunky, I think the store should be able to return all of these info
             projectsMap = store.getProjectIdsAndBuildDefinitionsIdsBySchedule( schedule.getId() );
 
-            if ( projectsMap == null )
+            projectGroupsMap = store.getProjectGroupIdsAndBuildDefinitionsIdsBySchedule( schedule.getId() );
+
+            if ( projectsMap == null && projectGroupsMap == null )
             {
                 // We don't have projects attached to this schedule
                 getLogger().info( "No projects to build for schedule " + schedule );
                 return;
             }
 
-            projectsList = getProjectsInBuildOrder();
+
         }
         catch ( ContinuumStoreException e )
         {
             throw new ContinuumException( "Can't get project list for schedule " + schedule.getName(), e );
         }
-        catch ( CycleDetectedException e )
+
+        Collection projectGroups = getAllProjectGroupsWithProjects();
+
+        for ( Iterator i = projectGroups.iterator(); i.hasNext(); )
         {
-            getLogger().warn( "Cycle detected while sorting projects for building, falling back to unsorted build." );
+            ProjectGroup projectGroup = (ProjectGroup) i.next();
 
-            projectsList = getProjects();
-        }
+            try
+            {
+                projectsList = getProjectsInBuildOrder( store.getProjectsWithDependenciesByGroupId( projectGroup.getId() ) );
+            }
+            catch ( CycleDetectedException e )
+            {
+                getLogger().warn(
+                    "Cycle detected while sorting projects for building, falling back to unsorted build." );
 
-        getLogger().info( "Building " + projectsList.size() + " projects" );
+                projectsList = getProjects();
+            }
 
-        for ( Iterator projectIterator = projectsList.iterator(); projectIterator.hasNext(); )
-        {
-            Project project = (Project) projectIterator.next();
+            getLogger().info( "Building " + projectsList.size() + " projects" );
 
-            // FIXME: if store.getProjectIdsAndBuildDefinitionsIdsBySchedule above throws a CycleDetectedException,
-            // then projectsMap is null.
-            List buildDefIds = (List) projectsMap.get( new Integer( project.getId() ) );
+            List groupBuildDefinitionIds = (List) projectGroupsMap.get( new Integer( projectGroup.getId() ) );
 
-            if ( buildDefIds != null && !buildDefIds.isEmpty() )
+            for ( Iterator j = projectsList.iterator(); j.hasNext(); )
             {
-                getLogger().info( "Processing " + buildDefIds.size() + " build definitions for project " + project );
-                for ( Iterator buildDefinitionIterator = buildDefIds.iterator(); buildDefinitionIterator.hasNext(); )
+                Project project = (Project) j.next();
+
+                // iterate through the project group build definitions and build
+                if ( groupBuildDefinitionIds != null && !groupBuildDefinitionIds.isEmpty() )
                 {
-                    Integer buildDefId = (Integer) buildDefinitionIterator.next();
+                    getLogger().info(
+                        "Processing " + groupBuildDefinitionIds.size() + " build definitions for project " + project );
+                    for ( Iterator buildDefinitionIterator = groupBuildDefinitionIds.iterator();
+                          buildDefinitionIterator.hasNext(); )
+                    {
+                        Integer buildDefId = (Integer) buildDefinitionIterator.next();
 
-                    if ( buildDefId != null && !isInBuildingQueue( project.getId(), buildDefId.intValue() )
-                        && !isInCheckoutQueue( project.getId() ) )
+                        if ( buildDefId != null && !isInBuildingQueue( project.getId(), buildDefId.intValue() ) &&
+                            !isInCheckoutQueue( project.getId() ) )
+                        {
+                            buildProject( project, buildDefId.intValue(), ContinuumProjectState.TRIGGER_SCHEDULED,
+                                          false );
+                        }
+                    }
+                }
+
+                // iterate through the project build definitions and build
+                List buildDefIds = (List) projectsMap.get( new Integer( project.getId() ) );
+
+                if ( buildDefIds != null && !buildDefIds.isEmpty() )
+                {
+                    getLogger().info(
+                        "Processing " + buildDefIds.size() + " build definitions for project " + project );
+                    for ( Iterator buildDefinitionIterator = buildDefIds.iterator();
+                          buildDefinitionIterator.hasNext(); )
                     {
-                        buildProject( project, buildDefId.intValue(), ContinuumProjectState.TRIGGER_SCHEDULED, false );
+                        Integer buildDefId = (Integer) buildDefinitionIterator.next();
+
+                        if ( buildDefId != null && !isInBuildingQueue( project.getId(), buildDefId.intValue() ) &&
+                            !isInCheckoutQueue( project.getId() ) )
+                        {
+                            buildProject( project, buildDefId.intValue(), ContinuumProjectState.TRIGGER_SCHEDULED,
+                                          false );
+                        }
                     }
                 }
-            }
-            else
-            {
-                getLogger().info( "No build definitions, not building for project " + project );
+                else
+                {
+                    getLogger().info( "No build definitions, not building for project " + project );
+                }
             }
         }
     }
@@ -550,10 +706,10 @@
 
         try
         {
-            if ( project.getState() != ContinuumProjectState.NEW
-                && project.getState() != ContinuumProjectState.CHECKEDOUT
-                && project.getState() != ContinuumProjectState.OK && project.getState() != ContinuumProjectState.FAILED
-                && project.getState() != ContinuumProjectState.ERROR )
+            if ( project.getState() != ContinuumProjectState.NEW &&
+                project.getState() != ContinuumProjectState.CHECKEDOUT &&
+                project.getState() != ContinuumProjectState.OK && project.getState() != ContinuumProjectState.FAILED &&
+                project.getState() != ContinuumProjectState.ERROR )
             {
                 ContinuumBuildExecutor executor = executorManager.getBuildExecutor( project.getExecutorId() );
 
@@ -574,7 +730,8 @@
                 }
             }
 
-            getLogger().info( "Enqueuing '" + project.getName() + "' (Build definition id=" + buildDefinitionId + ")." );
+            getLogger().info(
+                "Enqueuing '" + project.getName() + "' (Build definition id=" + buildDefinitionId + ")." );
 
             buildQueue.put( new BuildProjectTask( project.getId(), buildDefinitionId, trigger ) );
         }
@@ -623,6 +780,10 @@
         {
             buildResults = new ArrayList( store.getProjectWithBuilds( projectId ).getBuildResults() );
         }
+        catch ( ContinuumObjectNotFoundException e )
+        {
+            return Collections.EMPTY_LIST;
+        }
         catch ( ContinuumStoreException e )
         {
             throw logAndCreateException( "Exception while getting build results for project.", e );
@@ -799,6 +960,15 @@
         return ( (Integer) context.get( AbstractContinuumAction.KEY_PROJECT_ID ) ).intValue();
     }
 
+    /**
+     * Add a Maven 1 / Maven 2 project to Continuum
+     *
+     * @param metadataUrl      url of the pom
+     * @param projectBuilderId {@link MavenTwoContinuumProjectBuilder#ID} for Maven 2 project
+     *                         or {@link MavenOneContinuumProjectBuilder#ID} for Maven 1 project.
+     * @return a holder with the projects, project groups and errors occurred during the project adding
+     * @throws ContinuumException
+     */
     private ContinuumProjectBuildingResult executeAddProjectsFromMetadataActivity( String metadataUrl,
                                                                                    String projectBuilderId )
         throws ContinuumException
@@ -820,28 +990,33 @@
         ContinuumProjectBuildingResult result = (ContinuumProjectBuildingResult) context
             .get( CreateProjectsFromMetadata.KEY_PROJECT_BUILDING_RESULT );
 
-        if ( result.getProjects() != null )
+        if ( getLogger().isInfoEnabled() )
         {
-            getLogger().info( "Created " + result.getProjects().size() + " projects." );
-        }
-        if ( result.getProjectGroups() != null )
-        {
-            getLogger().info( "Created " + result.getProjectGroups().size() + " project groups." );
-        }
-        getLogger().info( result.getErrors().size() + " errors." );
+            if ( result.getProjects() != null )
+            {
+                getLogger().info( "Created " + result.getProjects().size() + " projects." );
+            }
+            if ( result.getProjectGroups() != null )
+            {
+                getLogger().info( "Created " + result.getProjectGroups().size() + " project groups." );
+            }
+            getLogger().info( result.getErrors().size() + " errors." );
 
-        // ----------------------------------------------------------------------
-        // Look for any warnings.
-        // ----------------------------------------------------------------------
+            // ----------------------------------------------------------------------
+            // Look for any errors.
+            // ----------------------------------------------------------------------
 
-        if ( result.getErrors().size() > 0 )
-        {
-            for ( Iterator i = result.getErrors().iterator(); i.hasNext(); )
+            if ( result.hasErrors() )
             {
-                getLogger().info( (String) i.next() );
-            }
+                getLogger().info( result.getErrors().size() + " errors during project add: " );
 
-            return result;
+                for ( Iterator i = result.getErrors().iterator(); i.hasNext(); )
+                {
+                    getLogger().info( (String) i.next() );
+                }
+
+                return result;
+            }
         }
 
         // ----------------------------------------------------------------------
@@ -863,8 +1038,7 @@
                 projectGroup = store.getProjectGroupByGroupIdWithProjects( projectGroup.getGroupId() );
 
                 getLogger().info(
-                                  "Using existing project group with the group id: '" + projectGroup.getGroupId()
-                                      + "'." );
+                    "Using existing project group with the group id: '" + projectGroup.getGroupId() + "'." );
             }
             catch ( ContinuumObjectNotFoundException e )
             {
@@ -1007,8 +1181,8 @@
             if ( value instanceof String )
             {
                 String val = (String) value;
-                if ( !"sendOnSuccess".equals( val ) && !"sendOnFailure".equals( val ) && !"sendOnError".equals( val )
-                    && !"sendOnWarning".equals( val ) )
+                if ( !"sendOnSuccess".equals( val ) && !"sendOnFailure".equals( val ) && !"sendOnError".equals( val ) &&
+                    !"sendOnWarning".equals( val ) )
                 {
                     if ( !StringUtils.isEmpty( val ) )
                     {
@@ -1117,12 +1291,6 @@
         return project.getBuildDefinitions();
     }
 
-    public BuildDefinition getDefaultBuildDefinition( int projectId )
-        throws ContinuumException
-    {
-        return store.getDefaultBuildDefinition( projectId );
-    }
-
     public BuildDefinition getBuildDefinition( int projectId, int buildDefinitionId )
         throws ContinuumException
     {
@@ -1143,133 +1311,124 @@
         return buildDefinition;
     }
 
-    public void updateBuildDefinition( BuildDefinition buildDefinition, int projectId )
+    public BuildDefinition getDefaultBuildDefinition( int projectId )
         throws ContinuumException
     {
-        BuildDefinition bd = getBuildDefinition( projectId, buildDefinition.getId() );
-
-        bd.setBuildFile( buildDefinition.getBuildFile() );
-
-        bd.setGoals( buildDefinition.getGoals() );
-
-        bd.setArguments( buildDefinition.getArguments() );
-
-        Schedule schedule;
-
-        if ( buildDefinition.getSchedule() == null )
+        try
         {
-            try
-            {
-                schedule = store.getScheduleByName( DefaultContinuumInitializer.DEFAULT_SCHEDULE_NAME );
-            }
-            catch ( ContinuumStoreException e )
-            {
-                throw new ContinuumException( "Can't get default schedule.", e );
-            }
+            return store.getDefaultBuildDefinition( projectId );
         }
-        else
+        catch ( ContinuumObjectNotFoundException cne )
         {
-            schedule = getSchedule( buildDefinition.getSchedule().getId() );
+            throw new ContinuumException( "no default build definition for project", cne );
         }
-
-        bd.setSchedule( schedule );
-
-        if ( buildDefinition.isDefaultForProject() && !bd.isDefaultForProject() )
+        catch ( ContinuumStoreException cse )
         {
-            bd.setDefaultForProject( true );
-
-            BuildDefinition defaultBd = getDefaultBuildDefinition( projectId );
-
-            if ( defaultBd != null )
-            {
-                defaultBd.setDefaultForProject( false );
-
-                storeBuildDefinition( defaultBd );
-            }
+            throw new ContinuumException(
+                "error attempting to access default build definition for project + " + projectId, cse );
         }
 
-        storeBuildDefinition( bd );
     }
 
-    public void updateBuildDefinition( int projectId, int buildDefinitionId, Map configuration )
+    public BuildDefinition getBuildDefinition( int buildDefinitionId )
         throws ContinuumException
     {
-        BuildDefinition buildDefinition = getBuildDefinition( projectId, buildDefinitionId );
-
-        buildDefinition.setBuildFile( (String) configuration.get( "buildFile" ) );
+        try
+        {
+            return store.getBuildDefinition( buildDefinitionId );
+        }
+        catch ( ContinuumObjectNotFoundException cne )
+        {
+            throw new ContinuumException( "no build definition found", cne );
+        }
+        catch ( ContinuumStoreException cse )
+        {
+            throw new ContinuumException( "error attempting to access build definition", cse );
+        }
+    }
 
-        buildDefinition.setGoals( (String) configuration.get( "goals" ) );
 
-        buildDefinition.setArguments( (String) configuration.get( "arguments" ) );
+    public List getBuildDefinitionsForProject( int projectId )
+        throws ContinuumException
+    {
+        Project project = getProjectWithAllDetails( projectId );
 
-        Schedule schedule = getSchedule( Integer.parseInt( (String) configuration.get( "schedule" ) ) );
+        return project.getBuildDefinitions();
+    }
 
-        buildDefinition.setSchedule( schedule );
+    public List getBuildDefinitionsForProjectGroup( int projectGroupId )
+        throws ContinuumException
+    {
 
-        if ( convertBoolean( (String) configuration.get( "defaultForProject" ) ) )
-        {
-            buildDefinition.setDefaultForProject( true );
-        }
+        ProjectGroup projectGroup = getProjectGroupWithBuildDetails( projectGroupId );
 
-        updateBuildDefinition( buildDefinition, projectId );
+        return projectGroup.getBuildDefinitions();
     }
 
-    public BuildDefinition storeBuildDefinition( BuildDefinition buildDefinition )
+    public void addBuildDefinitionToProject( int projectId, BuildDefinition buildDefinition )
         throws ContinuumException
     {
-        try
-        {
-            return store.storeBuildDefinition( buildDefinition );
-        }
-        catch ( ContinuumStoreException ex )
-        {
-            throw logAndCreateException( "Error while storing buildDefinition.", ex );
-        }
+        HashMap context = new HashMap();
+
+        context.put( AbstractContinuumAction.KEY_BUILD_DEFINITION, buildDefinition );
+        context.put( AbstractContinuumAction.KEY_PROJECT_ID, new Integer( projectId ) );
+
+        executeAction( "add-build-definition-to-project", context );
     }
 
-    public void addBuildDefinition( int projectId, BuildDefinition buildDefinition )
+    public void removeBuildDefinitionFromProject( int projectId, int buildDefinitionId )
         throws ContinuumException
     {
-        if ( buildDefinition.isDefaultForProject() )
-        {
-            BuildDefinition bd = getDefaultBuildDefinition( projectId );
+        HashMap context = new HashMap();
 
-            if ( bd != null )
-            {
-                bd.setDefaultForProject( false );
+        context.put( AbstractContinuumAction.KEY_BUILD_DEFINITION, getBuildDefinition( buildDefinitionId ) );
+        context.put( AbstractContinuumAction.KEY_PROJECT_ID, new Integer( projectId ) );
 
-                storeBuildDefinition( bd );
-            }
-        }
+        executeAction( "remove-build-definition-from-project", context );
+    }
 
-        Project project = getProjectWithAllDetails( projectId );
+    public void updateBuildDefinitionForProject( int projectId, BuildDefinition buildDefinition )
+        throws ContinuumException
+    {
+        HashMap context = new HashMap();
 
-        project.addBuildDefinition( buildDefinition );
+        context.put( AbstractContinuumAction.KEY_BUILD_DEFINITION, buildDefinition );
+        context.put( AbstractContinuumAction.KEY_PROJECT_ID, new Integer( projectId ) );
 
-        updateProject( project );
+        executeAction( "update-build-definition-from-project", context );
     }
 
-    public void addBuildDefinitionFromParams( int projectId, Map configuration )
+    public void addBuildDefinitionToProjectGroup( int projectGroupId, BuildDefinition buildDefinition )
         throws ContinuumException
     {
-        BuildDefinition buildDefinition = new BuildDefinition();
+        HashMap context = new HashMap();
 
-        buildDefinition.setBuildFile( (String) configuration.get( "buildFile" ) );
+        context.put( AbstractContinuumAction.KEY_BUILD_DEFINITION, buildDefinition );
+        context.put( AbstractContinuumAction.KEY_PROJECT_GROUP_ID, new Integer( projectGroupId ) );
 
-        buildDefinition.setGoals( (String) configuration.get( "goals" ) );
+        executeAction( "add-build-definition-to-project-group", context );
+    }
 
-        buildDefinition.setArguments( (String) configuration.get( "arguments" ) );
+    public void removeBuildDefinitionFromProjectGroup( int projectGroupId, int buildDefinitionId )
+        throws ContinuumException
+    {
+        HashMap context = new HashMap();
 
-        Schedule schedule = getSchedule( Integer.parseInt( (String) configuration.get( "schedule" ) ) );
+        context.put( AbstractContinuumAction.KEY_BUILD_DEFINITION, getBuildDefinition( buildDefinitionId ) );
+        context.put( AbstractContinuumAction.KEY_PROJECT_GROUP_ID, new Integer( projectGroupId ) );
 
-        buildDefinition.setSchedule( schedule );
+        executeAction( "remove-build-definition-from-project-group", context );
+    }
 
-        if ( convertBoolean( (String) configuration.get( "defaultForProject" ) ) )
-        {
-            buildDefinition.setDefaultForProject( true );
-        }
+    public void updateBuildDefinitionForProjectGroup( int projectGroupId, BuildDefinition buildDefinition )
+        throws ContinuumException
+    {
+        HashMap context = new HashMap();
+
+        context.put( AbstractContinuumAction.KEY_BUILD_DEFINITION, buildDefinition );
+        context.put( AbstractContinuumAction.KEY_PROJECT_GROUP_ID, new Integer( projectGroupId ) );
 
-        addBuildDefinition( projectId, buildDefinition );
+        executeAction( "update-build-definition-from-project-group", context );
     }
 
     public void removeBuildDefinition( int projectId, int buildDefinitionId )
@@ -1827,9 +1986,9 @@
             perms.add( store.getPermission( "showProject" ) );
         }
 
-        if ( convertBoolean( (String) configuration.get( "group.permission.addBuildDefinition" ) ) )
+        if ( convertBoolean( (String) configuration.get( "group.permission.addBuildDefinitionToProject" ) ) )
         {
-            perms.add( store.getPermission( "addBuildDefinition" ) );
+            perms.add( store.getPermission( "addBuildDefinitionToProject" ) );
         }
 
         if ( convertBoolean( (String) configuration.get( "group.permission.editBuildDefinition" ) ) )
@@ -1924,16 +2083,16 @@
         {
             if ( !wdFile.isDirectory() )
             {
-                throw new InitializationException( "The specified working directory isn't a directory: " + "'"
-                    + wdFile.getAbsolutePath() + "'." );
+                throw new InitializationException(
+                    "The specified working directory isn't a directory: " + "'" + wdFile.getAbsolutePath() + "'." );
             }
         }
         else
         {
             if ( !wdFile.mkdirs() )
             {
-                throw new InitializationException( "Could not making the working directory: " + "'"
-                    + wdFile.getAbsolutePath() + "'." );
+                throw new InitializationException(
+                    "Could not making the working directory: " + "'" + wdFile.getAbsolutePath() + "'." );
             }
         }
 
@@ -1960,10 +2119,10 @@
                 }
             }
 
-            if ( project.getState() != ContinuumProjectState.NEW
-                && project.getState() != ContinuumProjectState.CHECKEDOUT
-                && project.getState() != ContinuumProjectState.OK && project.getState() != ContinuumProjectState.FAILED
-                && project.getState() != ContinuumProjectState.ERROR )
+            if ( project.getState() != ContinuumProjectState.NEW &&
+                project.getState() != ContinuumProjectState.CHECKEDOUT &&
+                project.getState() != ContinuumProjectState.OK && project.getState() != ContinuumProjectState.FAILED &&
+                project.getState() != ContinuumProjectState.ERROR )
             {
                 int state = project.getState();
 
@@ -1973,9 +2132,8 @@
 
                 try
                 {
-                    getLogger().info(
-                                      "Fix project state for project " + project.getId() + ":" + project.getName()
-                                          + ":" + project.getVersion() );
+                    getLogger().info( "Fix project state for project " + project.getId() + ":" + project.getName() +
+                        ":" + project.getVersion() );
 
                     store.updateProject( project );
 
@@ -1992,9 +2150,8 @@
                 }
             }
 
-            getLogger().info(
-                              " " + project.getId() + ":" + project.getName() + ":" + project.getVersion() + ":"
-                                  + project.getExecutorId() );
+            getLogger().info( " " + project.getId() + ":" + project.getName() + ":" + project.getVersion() + ":" +
+                project.getExecutorId() );
         }
     }
 
@@ -2115,6 +2272,7 @@
         }
         catch ( Exception e )
         {
+            getLogger().info( "exception", e );
             throw new ContinuumException( "Error while executing the action '" + actionName + "'.", e );
         }
     }
@@ -2251,6 +2409,23 @@
         try
         {
             return store.getProjectWithAllDetails( projectId );
+        }
+        catch ( ContinuumObjectNotFoundException e )
+        {
+            throw new ContinuumException( "Unable to find the requested project", e );
+        }
+        catch ( ContinuumStoreException e )
+        {
+            throw new ContinuumException( "Error retrieving the requested project", e );
+        }
+    }
+
+    public ProjectGroup getProjectGroupWithBuildDetails( int projectGroupId )
+        throws ContinuumException
+    {
+        try
+        {
+            return store.getProjectGroupWithBuildDetails( projectGroupId );
         }
         catch ( ContinuumObjectNotFoundException e )
         {

Modified: maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AbstractContinuumAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AbstractContinuumAction.java?rev=433720&r1=433719&r2=433720&view=diff
==============================================================================
--- maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AbstractContinuumAction.java (original)
+++ maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AbstractContinuumAction.java Tue Aug 22 11:37:42 2006
@@ -95,7 +95,7 @@
 
     public static int getProjectGroupId( Map context )
     {
-        return Integer.valueOf( getString( context, KEY_PROJECT_GROUP_ID ) ).intValue();
+        return getInteger( context, KEY_PROJECT_GROUP_ID );
     }
 
     public static int getBuildDefinitionId( Map context )

Modified: maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CreateProjectsFromMetadata.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CreateProjectsFromMetadata.java?rev=433720&r1=433719&r2=433720&view=diff
==============================================================================
--- maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CreateProjectsFromMetadata.java (original)
+++ maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CreateProjectsFromMetadata.java Tue Aug 22 11:37:42 2006
@@ -15,6 +15,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 import org.apache.maven.continuum.ContinuumException;
 import org.apache.maven.continuum.project.builder.ContinuumProjectBuilder;
 import org.apache.maven.continuum.project.builder.ContinuumProjectBuilderException;
@@ -42,6 +43,16 @@
 
     public static final String KEY_PROJECT_BUILDING_RESULT = "projectBuildingResult";
 
+    public void setProjectBuilderManager( ContinuumProjectBuilderManager projectBuilderManager )
+    {
+        this.projectBuilderManager = projectBuilderManager;
+    }
+
+    public ContinuumProjectBuilderManager getProjectBuilderManager()
+    {
+        return projectBuilderManager;
+    }
+
     public void execute( Map context )
         throws ContinuumException, ContinuumProjectBuilderManagerException, ContinuumProjectBuilderException
     {
@@ -51,7 +62,7 @@
 
         URL url;
 
-        ContinuumProjectBuilder projectBuilder = projectBuilderManager.getProjectBuilder( projectBuilderId );
+        ContinuumProjectBuilder projectBuilder = getProjectBuilderManager().getProjectBuilder( projectBuilderId );
 
         ContinuumProjectBuildingResult result;
 
@@ -77,7 +88,7 @@
                 else
                 {
                     result = new ContinuumProjectBuildingResult();
-
+                    getLogger().info( "Malformed URL (MungedHttpsURL is not valid): " + u );
                     result.addError( ContinuumProjectBuildingResult.ERROR_MALFORMED_URL );
                 }
             }
@@ -85,8 +96,8 @@
         }
         catch ( MalformedURLException e )
         {
+            getLogger().info( "Malformed URL: " + u, e );
             result = new ContinuumProjectBuildingResult();
-
             result.addError( ContinuumProjectBuildingResult.ERROR_MALFORMED_URL );
         }
 

Modified: maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/core/action/StoreProjectGroupAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/core/action/StoreProjectGroupAction.java?rev=433720&r1=433719&r2=433720&view=diff
==============================================================================
--- maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/core/action/StoreProjectGroupAction.java (original)
+++ maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/core/action/StoreProjectGroupAction.java Tue Aug 22 11:37:42 2006
@@ -27,6 +27,6 @@
 
         projectGroup = store.addProjectGroup( projectGroup );
 
-        context.put( KEY_PROJECT_GROUP_ID, Integer.toString( projectGroup.getId() ) );
+        context.put( KEY_PROJECT_GROUP_ID, new Integer( projectGroup.getId() ) );
     }
 }

Modified: maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m1/DefaultMavenOneMetadataHelper.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m1/DefaultMavenOneMetadataHelper.java?rev=433720&r1=433719&r2=433720&view=diff
==============================================================================
--- maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m1/DefaultMavenOneMetadataHelper.java (original)
+++ maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m1/DefaultMavenOneMetadataHelper.java Tue Aug 22 11:37:42 2006
@@ -29,6 +29,7 @@
 import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
 
 import java.io.File;
+import java.io.FileNotFoundException;
 import java.io.FileReader;
 import java.io.IOException;
 import java.util.ArrayList;
@@ -74,7 +75,14 @@
             
             return;
         }
-        // TODO catch other IO exceptions and handle them more appropiately?
+        catch ( FileNotFoundException e )
+        {
+            result.addError( ContinuumProjectBuildingResult.ERROR_POM_NOT_FOUND );
+
+            getLogger().info( "Error while reading maven POM (" + e.getMessage() + ").", e );
+
+            return;
+        }
         catch ( IOException e )
         {
             result.addError( ContinuumProjectBuildingResult.ERROR_UNKNOWN );
@@ -127,7 +135,7 @@
 
                 getLogger().info( "Missing 'groupId' element in the POM." );
 
-                return;
+                // Do not throw an exception or return here, gather up as many results as possible first.
             }
 
             artifactId = getValue( mavenProject, "artifactId", project.getArtifactId() );
@@ -138,7 +146,7 @@
 
                 getLogger().info( "Missing 'artifactId' element in the POM." );
 
-                return;
+                // Do not throw an exception or return here, gather up as many results as possible first.
             }
         }
 
@@ -150,8 +158,9 @@
 
         if ( StringUtils.isEmpty( project.getVersion() ) && StringUtils.isEmpty( version ) )
         {
-            // TODO add to result and don't throw exception
-            throw new MavenOneMetadataHelperException( "Missing 'version' element in the POM." );
+            result.addError( ContinuumProjectBuildingResult.ERROR_MISSING_VERSION );
+            
+            // Do not throw an exception or return here, gather up as many results as possible first.
         }
 
         // ----------------------------------------------------------------------
@@ -162,8 +171,9 @@
 
         if ( StringUtils.isEmpty( project.getName() ) && StringUtils.isEmpty( name ) )
         {
-            // TODO add to result and don't throw exception
-            throw new MavenOneMetadataHelperException( "Missing 'name' element in POM." );
+            result.addError( ContinuumProjectBuildingResult.ERROR_MISSING_NAME );
+            
+            // Do not throw an exception or return here, gather up as many results as possible first.
         }
 
         // ----------------------------------------------------------------------
@@ -180,7 +190,7 @@
 
         Xpp3Dom repository = mavenProject.getChild( "repository" );
 
-        String scmConnection;
+        String scmConnection = null;
 
         if ( repository == null )
         {
@@ -190,8 +200,9 @@
             }
             else
             {
-                // TODO add to result and don't throw exception
-                throw new MavenOneMetadataHelperException( "Missing 'repository' element in the POM." );
+                result.addError( ContinuumProjectBuildingResult.ERROR_MISSING_REPOSITORY );
+
+                // Do not throw an exception or return here, gather up as many results as possible first.
             }
         }
         else
@@ -202,9 +213,9 @@
 
             if ( StringUtils.isEmpty( scmConnection ) )
             {
-                // TODO add to result and don't throw exception
-                throw new MavenOneMetadataHelperException(
-                    "Missing both anonymous and developer SCM connection URLs." );
+                result.addError( ContinuumProjectBuildingResult.ERROR_MISSING_SCM );
+                
+                // Do not throw an exception or return here, gather up as many results as possible first.
             }
         }
 
@@ -318,6 +329,16 @@
                     notifiers.add( notif );
                 }
             }
+        }
+        
+        // ----------------------------------------------------------------------
+        // Handle Errors / Results
+        // ----------------------------------------------------------------------
+        
+        if ( result.hasErrors() )
+        {
+            // prevent project creation if there are errors.
+            return;
         }
 
         // ----------------------------------------------------------------------

Modified: maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/DefaultMavenBuilderHelper.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/DefaultMavenBuilderHelper.java?rev=433720&r1=433719&r2=433720&view=diff
==============================================================================
--- maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/DefaultMavenBuilderHelper.java (original)
+++ maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/DefaultMavenBuilderHelper.java Tue Aug 22 11:37:42 2006
@@ -24,6 +24,7 @@
 import org.apache.maven.continuum.model.project.ProjectDependency;
 import org.apache.maven.continuum.model.project.ProjectDeveloper;
 import org.apache.maven.continuum.model.project.ProjectNotifier;
+import org.apache.maven.continuum.project.builder.ContinuumProjectBuildingResult;
 import org.apache.maven.model.Dependency;
 import org.apache.maven.model.Developer;
 import org.apache.maven.model.Model;
@@ -112,9 +113,18 @@
         mapMavenProjectToContinuumProject( getMavenProject( metadata ), continuumProject );
     }
 
+    /**
+     * @deprecated use {@link #mapMavenProjectToContinuumProject(ContinuumProjectBuildingResult, MavenProject, Project)} instead.
+     */
     public void mapMavenProjectToContinuumProject( MavenProject mavenProject, Project continuumProject )
         throws MavenBuilderHelperException
     {
+        mapMavenProjectToContinuumProject( new ContinuumProjectBuildingResult(), mavenProject, continuumProject );
+    }
+    
+    public void mapMavenProjectToContinuumProject( ContinuumProjectBuildingResult result, MavenProject mavenProject, Project continuumProject )
+    {
+    
         // ----------------------------------------------------------------------
         // Name
         // ----------------------------------------------------------------------
@@ -144,7 +154,8 @@
         }
         else
         {
-            throw new MavenBuilderHelperException( "Missing 'groupId' element in the POM." );
+            result.addError( ContinuumProjectBuildingResult.ERROR_MISSING_GROUPID );
+            return;
         }
 
         // ----------------------------------------------------------------------
@@ -157,7 +168,8 @@
         }
         else
         {
-            throw new MavenBuilderHelperException( "Missing 'artifactId' element in the POM." );
+            result.addError( ContinuumProjectBuildingResult.ERROR_MISSING_ARTIFACTID );
+            return;
         }
 
         // ----------------------------------------------------------------------
@@ -276,7 +288,11 @@
             }
         }
 
-        continuumProject.setNotifiers( getNotifiers( mavenProject ) );
+        List notifiers = getNotifiers( result, mavenProject );
+        if ( notifiers != null )
+        {
+            continuumProject.setNotifiers( notifiers );
+        }
 
         for ( Iterator i = userNotifiers.iterator(); i.hasNext(); )
         {
@@ -285,12 +301,20 @@
             continuumProject.addNotifier( notifier );
         }
     }
-
+    
+    /**
+     * @deprecated use {@link #getMavenProject(ContinuumProjectBuildingResult, File)} instead.
+     */
     public MavenProject getMavenProject( File file )
-        throws MavenBuilderHelperException
+    throws MavenBuilderHelperException
     {
-        MavenProject project;
+        return getMavenProject( new ContinuumProjectBuildingResult(), file );
+    }
 
+    public MavenProject getMavenProject( ContinuumProjectBuildingResult result, File file )
+    {
+        MavenProject project;
+        
         try
         {
             //   TODO: This seems like code that is shared with DefaultMaven, so it should be moved to the project
@@ -326,7 +350,9 @@
                 {
                     for ( Iterator i = validationResult.getMessages().iterator(); i.hasNext(); )
                     {
-                        messages.append( (String) i.next() );
+                        String valmsg = (String) i.next();
+                        result.addError( ContinuumProjectBuildingResult.ERROR_VALIDATION, valmsg );
+                        messages.append( valmsg );
                         messages.append( "\n" );
                     }
                 }
@@ -335,9 +361,8 @@
             String msg = "Cannot build maven project from " + file + " (" + e.getMessage() + ").\n" + messages;
 
             getLogger().error( msg, e );
-
-            // TODO add to result and don't throw exception
-            throw new MavenBuilderHelperException( msg, e );
+            
+            return null;
         }
 
         // ----------------------------------------------------------------------
@@ -349,18 +374,22 @@
 
         if ( scm == null )
         {
-            // TODO add to result and don't throw exception
-            throw new MavenBuilderHelperException(
-                "Missing 'scm' element in the " + getProjectName( project ) + " POM." );
+            result.addError( ContinuumProjectBuildingResult.ERROR_MISSING_SCM, getProjectName( project ) );
+            
+            getLogger().error( "Missing 'scm' element in the " + getProjectName( project ) + " POM." );
+            
+            return null;
         }
 
         String url = scm.getConnection();
 
         if ( StringUtils.isEmpty( url ) )
         {
-            // TODO add to result and don't throw exception
-            throw new MavenBuilderHelperException(
-                "Missing 'connection' element in the 'scm' element in the " + getProjectName( project ) + " POM." );
+            result.addError( ContinuumProjectBuildingResult.ERROR_MISSING_SCM_CONNECTION, getProjectName( project ) );
+            
+            getLogger().error( "Missing 'connection' element in the 'scm' element in the " + getProjectName( project ) + " POM." );
+            
+            return null;
         }
 
         return project;
@@ -392,8 +421,7 @@
         return project.getScm().getConnection();
     }
 
-    private List getNotifiers( MavenProject mavenProject )
-        throws MavenBuilderHelperException
+    private List getNotifiers( ContinuumProjectBuildingResult result, MavenProject mavenProject )
     {
         List notifiers = new ArrayList();
 
@@ -407,14 +435,16 @@
 
                 if ( StringUtils.isEmpty( projectNotifier.getType() ) )
                 {
-                    throw new MavenBuilderHelperException( "Missing type from notifier." );
+                    result.addError( ContinuumProjectBuildingResult.ERROR_MISSING_NOTIFIER_TYPE );
+                    return null;
                 }
 
                 notifier.setType( projectNotifier.getType() );
 
                 if ( projectNotifier.getConfiguration() == null )
                 {
-                    throw new MavenBuilderHelperException( "Notifier configuration cannot be null." );
+                    result.addError( ContinuumProjectBuildingResult.ERROR_MISSING_NOTIFIER_CONFIGURATION );
+                    return null;
                 }
 
                 notifier.setConfiguration( projectNotifier.getConfiguration() );

Modified: maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/MavenBuilderHelper.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/MavenBuilderHelper.java?rev=433720&r1=433719&r2=433720&view=diff
==============================================================================
--- maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/MavenBuilderHelper.java (original)
+++ maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/MavenBuilderHelper.java Tue Aug 22 11:37:42 2006
@@ -17,6 +17,7 @@
  */
 
 import org.apache.maven.continuum.model.project.Project;
+import org.apache.maven.continuum.project.builder.ContinuumProjectBuildingResult;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.artifact.repository.ArtifactRepository;
 
@@ -32,12 +33,22 @@
 
     void mapMetadataToProject( File metadata, Project project )
         throws MavenBuilderHelperException;
-
+    
+    /**
+     * @deprecated use {@link #getMavenProject(ContinuumProjectBuildingResult, File)} instead.
+     */
     MavenProject getMavenProject( File file )
-        throws MavenBuilderHelperException;
+    throws MavenBuilderHelperException;
+
+    MavenProject getMavenProject( ContinuumProjectBuildingResult result, File file );
 
+    /**
+     * @deprecated use {@link #mapMavenProjectToContinuumProject(ContinuumProjectBuildingResult, MavenProject, Project)} instead.
+     */
     void mapMavenProjectToContinuumProject( MavenProject mavenProject, Project continuumProject )
         throws MavenBuilderHelperException;
+    
+    void mapMavenProjectToContinuumProject( ContinuumProjectBuildingResult result, MavenProject mavenProject, Project continuumProject );
 
     ArtifactRepository getLocalRepository();
 }

Modified: maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/initialization/DefaultContinuumInitializer.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/initialization/DefaultContinuumInitializer.java?rev=433720&r1=433719&r2=433720&view=diff
==============================================================================
--- maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/initialization/DefaultContinuumInitializer.java (original)
+++ maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/initialization/DefaultContinuumInitializer.java Tue Aug 22 11:37:42 2006
@@ -144,7 +144,7 @@
 
         createPermission( "showProject", "Show Projects" );
 
-        createPermission( "addBuildDefinition", "Add Build Definitions" );
+        createPermission( "addBuildDefinitionToProject", "Add Build Definitions" );
 
         createPermission( "editBuildDefinition", "Edit Build Definitions" );
 

Modified: maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilder.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilder.java?rev=433720&r1=433719&r2=433720&view=diff
==============================================================================
--- maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilder.java (original)
+++ maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilder.java Tue Aug 22 11:37:42 2006
@@ -32,7 +32,6 @@
 import org.codehaus.plexus.util.StringUtils;
 
 import java.io.File;
-import java.io.IOException;
 import java.net.URL;
 
 /**
@@ -78,7 +77,7 @@
         {
             metadataHelper.mapMetadata( result, pomFile, project );
             
-            if ( result.getErrors().size() > 0 )
+            if ( result.hasErrors() )
             {
                 return result;
             }

Modified: maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilder.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilder.java?rev=433720&r1=433719&r2=433720&view=diff
==============================================================================
--- maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilder.java (original)
+++ maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilder.java Tue Aug 22 11:37:42 2006
@@ -17,7 +17,6 @@
  */
 
 import org.apache.maven.continuum.execution.maven.m2.MavenBuilderHelper;
-import org.apache.maven.continuum.execution.maven.m2.MavenBuilderHelperException;
 import org.apache.maven.continuum.execution.maven.m2.MavenTwoBuildExecutor;
 import org.apache.maven.continuum.initialization.DefaultContinuumInitializer;
 import org.apache.maven.continuum.model.project.BuildDefinition;
@@ -30,13 +29,13 @@
 import org.apache.maven.continuum.project.builder.ContinuumProjectBuildingResult;
 import org.apache.maven.continuum.store.ContinuumStore;
 import org.apache.maven.continuum.store.ContinuumStoreException;
-import org.apache.maven.continuum.utils.ContinuumUtils;
 import org.apache.maven.project.MavenProject;
 import org.codehaus.plexus.util.StringUtils;
 
 import java.io.IOException;
 import java.net.MalformedURLException;
 import java.net.URL;
+import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 
@@ -94,22 +93,24 @@
     {
         MavenProject mavenProject;
 
-        try
-        {
-            mavenProject = builderHelper.getMavenProject( createMetadataFile( url, username, password ) );
+        try {
+            mavenProject = builderHelper.getMavenProject( result, createMetadataFile( url, username, password ) );
+            
+            if( (result != null) && result.hasErrors())
+            {
+                return;
+            }
         }
-        catch ( MavenBuilderHelperException e )
+        catch (MalformedURLException e)
         {
-            // TODO add to result with error key
-            result.addWarning( e.getMessage() );
-
+            getLogger().debug( "Error adding project: Malformed URL " + url, e );
+            result.addError( ContinuumProjectBuildingResult.ERROR_MALFORMED_URL );
             return;
         }
         catch ( IOException e )
         {
-            // TODO add to result with error key
-            result.addWarning( "Could not download " + url + ": " + e.getMessage() );
-
+            getLogger().debug( "Error adding project: Unknown error downloading from " + url, e );
+            result.addError( ContinuumProjectBuildingResult.ERROR_UNKNOWN );
             return;
         }
 
@@ -117,56 +118,54 @@
         {
             ProjectGroup projectGroup = buildProjectGroup( mavenProject, result );
 
+            // project groups have the top lvl build definition which is the default build defintion for the sub projects
             if ( projectGroup != null )
             {
-                result.addProjectGroup( projectGroup );
-            }
-        }
+                BuildDefinition bd = new BuildDefinition();
 
-        if ( !excludedPackagingTypes.contains( mavenProject.getPackaging() ) )
-        {
-            String defaultGoal = "clean install";
+                bd.setDefaultForProject( true );
 
-            if ( mavenProject.getBuild() != null && mavenProject.getBuild().getDefaultGoal() != null )
-            {
-                defaultGoal = mavenProject.getBuild().getDefaultGoal();
-            }
+                bd.setArguments( "--batch-mode --non-recursive" );
 
-            Project continuumProject = new Project();
+                bd.setGoals( "clean install" );
 
-            BuildDefinition bd = new BuildDefinition();
+                bd.setBuildFile( "pom.xml" );
 
-            bd.setDefaultForProject( true );
+                try
+                {
+                    Schedule schedule = store.getScheduleByName( DefaultContinuumInitializer.DEFAULT_SCHEDULE_NAME );
 
-            bd.setArguments( "--batch-mode --non-recursive" );
+                    bd.setSchedule( schedule );
+                }
+                catch ( ContinuumStoreException e )
+                {
+                    getLogger().warn( "Can't get default schedule.", e );
+                }
 
-            bd.setGoals( defaultGoal );
+                // jdo complains that Collections.singletonList(bd) is a second class object and fails.
+                ArrayList arrayList = new ArrayList();
 
-            bd.setBuildFile( "pom.xml" );
+                arrayList.add(bd);
 
-            try
-            {
-                Schedule schedule = store.getScheduleByName( DefaultContinuumInitializer.DEFAULT_SCHEDULE_NAME );
+                projectGroup.setBuildDefinitions( arrayList );
 
-                bd.setSchedule( schedule );
-            }
-            catch ( ContinuumStoreException e )
-            {
-                getLogger().warn( "Can't get default schedule.", e );
+                result.addProjectGroup( projectGroup );
             }
+        }
 
-            continuumProject.addBuildDefinition( bd );
+        if ( !excludedPackagingTypes.contains( mavenProject.getPackaging() ) )
+        {
+            String defaultGoal = "clean install";
 
-            try
-            {
-                builderHelper.mapMavenProjectToContinuumProject( mavenProject, continuumProject );
-            }
-            catch ( MavenBuilderHelperException e )
+            if ( mavenProject.getBuild() != null && mavenProject.getBuild().getDefaultGoal() != null )
             {
-                // TODO add to result with error key
-                result.addError( ContinuumUtils.throwableToString( e ) );
+                defaultGoal = mavenProject.getBuild().getDefaultGoal();
             }
 
+            Project continuumProject = new Project();            
+
+            builderHelper.mapMavenProjectToContinuumProject( result, mavenProject, continuumProject );
+
             result.addProject( continuumProject, MavenTwoBuildExecutor.ID );
         }
 
@@ -203,9 +202,8 @@
             }
             catch ( MalformedURLException e )
             {
-                // TODO add to result with error key
-                result.addError( "Could not download project from '" + urlString + "'." );
-
+                getLogger().debug( "Error adding project module: Malformed URL " + urlString, e );
+                result.addError( ContinuumProjectBuildingResult.ERROR_MALFORMED_URL, urlString );
                 continue;
             }
 
@@ -223,8 +221,7 @@
 
         if ( StringUtils.isEmpty( mavenProject.getGroupId() ) )
         {
-            // TODO add to result with error key
-            result.addError( "groupId is null." );
+            result.addError( ContinuumProjectBuildingResult.ERROR_MISSING_GROUPID );
 
             return null;
         }