continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tryg...@apache.org
Subject svn commit: r220126 - in /maven/continuum/trunk: continuum-api/src/main/java/org/apache/maven/continuum/configuration/ continuum-api/src/main/java/org/apache/maven/continuum/project/builder/ continuum-api/src/main/java/org/apache/maven/continuum/store/...
Date Thu, 21 Jul 2005 16:07:10 GMT
Author: trygvis
Date: Thu Jul 21 09:07:07 2005
New Revision: 220126

URL: http://svn.apache.org/viewcvs?rev=220126&view=rev
Log:
o Removing the generation of the JDO store.
o Adding a list of ContinuumProjectGroup objects to the
  ContinuumProjectBuildingResult. Not really hooked up all over yet.
o Adding some code to the MavenTwoContinuumProjectBuilder for creating the
  project groups.
o Adding getProjectGroupByName().
Cleanup in the DefaultContinuum component:
 - Collapsed the addMavenXXProject( url ) methods to
   executeAddProjectsFromMetadataActivity().

Removed:
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/configuration/ConfigurationLoadingException.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/configuration/ConfigurationService.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/configuration/ConfigurationStoringException.java
Modified:
    maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/configuration/ConfigurationService.java
    maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/project/builder/ContinuumProjectBuildingResult.java
    maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CreateProjectsFromMetadata.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ValidateProject.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilder.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java
    maven/continuum/trunk/continuum-model/pom.xml
    maven/continuum/trunk/continuum-model/src/main/resources/continuum.mdo

Modified: maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/configuration/ConfigurationService.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/configuration/ConfigurationService.java?rev=220126&r1=220125&r2=220126&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/configuration/ConfigurationService.java
(original)
+++ maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/configuration/ConfigurationService.java
Thu Jul 21 09:07:07 2005
@@ -16,11 +16,14 @@
  * limitations under the License.
  */
 
+import org.apache.maven.continuum.profile.ContinuumJdk;
+
 import java.io.File;
+import java.util.Map;
 
 /**
  * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
- * @version $Id$
+ * @version $Id:$
  */
 public interface ConfigurationService
 {
@@ -30,10 +33,20 @@
     //
     // ----------------------------------------------------------------------
 
+    public static final String CONFIGURATION = "configuration";
+
     public static final String CONFIGURATION_URL = "url";
 
     public static final String CONFIGURATION_BUILD_OUTPUT_DIRECTORY = "build-output-directory";
 
+    public static final String CONFIGURATION_JDKS = "jdks";
+
+    public static final String CONFIGURATION_JDK = "jdk";
+
+    public static final String CONFIGURATION_JDK_VERSION = "jdk-version";
+
+    public static final String CONFIGURATION_JDK_HOME = "jdk-home";
+
     // ----------------------------------------------------------------------
     //
     // ----------------------------------------------------------------------
@@ -45,6 +58,12 @@
     File getBuildOutputDirectory();
 
     void setBuildOutputDirectory( File buildOutputDirectory );
+
+    Map getJdks();
+
+    void addJdk( ContinuumJdk jdk );
+
+    void setJdks( Map jdks );
 
     // ----------------------------------------------------------------------
     //

Modified: maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/project/builder/ContinuumProjectBuildingResult.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/project/builder/ContinuumProjectBuildingResult.java?rev=220126&r1=220125&r2=220126&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/project/builder/ContinuumProjectBuildingResult.java
(original)
+++ maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/project/builder/ContinuumProjectBuildingResult.java
Thu Jul 21 09:07:07 2005
@@ -20,6 +20,7 @@
 import java.util.List;
 
 import org.apache.maven.continuum.project.ContinuumProject;
+import org.apache.maven.continuum.project.ContinuumProjectGroup;
 
 /**
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
@@ -29,6 +30,8 @@
 {
     private List projects = new ArrayList();
 
+    private List projectGroups = new ArrayList();
+
     private List warnings = new ArrayList();
 
     public void addProject( ContinuumProject project )
@@ -36,6 +39,11 @@
         projects.add( project );
     }
 
+    public void addProjectGroup( ContinuumProjectGroup projectGroup )
+    {
+        projectGroups.add( projectGroup );
+    }
+
     public void addProject( ContinuumProject project, String executorId )
     {
         project.setExecutorId( executorId );
@@ -46,6 +54,11 @@
     public List getProjects()
     {
         return projects;
+    }
+
+    public List getProjectGroups()
+    {
+        return projectGroups;
     }
 
     public void addWarning( String warning )

Modified: maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java?rev=220126&r1=220125&r2=220126&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java
(original)
+++ maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java
Thu Jul 21 09:07:07 2005
@@ -137,10 +137,13 @@
     void updateProjectGroup( ContinuumProjectGroup projectGroup )
         throws ContinuumStoreException;
 
+    void removeProjectGroup( String projectGroupId )
+        throws ContinuumStoreException;
+
     ContinuumProjectGroup getProjectGroup( String projectGroupId )
         throws ContinuumStoreException;
 
-    void removeProjectGroup( String projectGroupId )
+    ContinuumProjectGroup getProjectGroupByName( String name )
         throws ContinuumStoreException;
 
     Collection getProjectGroups()

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java?rev=220126&r1=220125&r2=220126&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
Thu Jul 21 09:07:07 2005
@@ -16,6 +16,7 @@
  * limitations under the License.
  */
 
+import org.apache.maven.continuum.configuration.ConfigurationService;
 import org.apache.maven.continuum.core.ContinuumCore;
 import org.apache.maven.continuum.core.action.AbstractContinuumAction;
 import org.apache.maven.continuum.core.action.AddProjectToCheckOutQueueAction;
@@ -29,26 +30,25 @@
 import org.apache.maven.continuum.project.ContinuumBuild;
 import org.apache.maven.continuum.project.ContinuumNotifier;
 import org.apache.maven.continuum.project.ContinuumProject;
+import org.apache.maven.continuum.project.ContinuumSchedule;
 import org.apache.maven.continuum.project.MavenOneProject;
 import org.apache.maven.continuum.project.MavenTwoProject;
 import org.apache.maven.continuum.project.ShellProject;
-import org.apache.maven.continuum.project.ContinuumSchedule;
 import org.apache.maven.continuum.project.builder.ContinuumProjectBuildingResult;
 import org.apache.maven.continuum.project.builder.maven.MavenOneContinuumProjectBuilder;
 import org.apache.maven.continuum.project.builder.maven.MavenTwoContinuumProjectBuilder;
-import org.apache.maven.continuum.scm.ScmResult;
-import org.apache.maven.continuum.utils.ProjectSorter;
 import org.apache.maven.continuum.scheduler.ContinuumScheduler;
 import org.apache.maven.continuum.scheduler.ContinuumSchedulerConstants;
-import org.apache.maven.continuum.configuration.ConfigurationService;
+import org.apache.maven.continuum.scm.ScmResult;
 import org.apache.maven.continuum.store.ContinuumStore;
 import org.apache.maven.continuum.store.ContinuumStoreException;
+import org.apache.maven.continuum.utils.ProjectSorter;
+
 import org.codehaus.plexus.action.ActionManager;
 import org.codehaus.plexus.logging.AbstractLogEnabled;
-import org.codehaus.plexus.util.dag.CycleDetectedException;
-import org.codehaus.plexus.util.StringUtils;
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
+import org.codehaus.plexus.util.dag.CycleDetectedException;
 
 import java.util.Collection;
 import java.util.HashMap;
@@ -82,6 +82,12 @@
     private ContinuumStore store;
 
     // ----------------------------------------------------------------------
+    //
+    // ----------------------------------------------------------------------
+
+    private static final String DEFAULT_PROJECT_GROUP_NAME = "Default Project";
+
+    // ----------------------------------------------------------------------
     // Projects
     // ----------------------------------------------------------------------
 
@@ -269,62 +275,9 @@
     public ContinuumProjectBuildingResult addMavenOneProject( String metadataUrl )
         throws ContinuumException
     {
-        Map context = new HashMap();
-
-        context.put( CreateProjectsFromMetadata.KEY_PROJECT_BUILDER_ID, MavenOneContinuumProjectBuilder.ID
);
-
-        context.put( CreateProjectsFromMetadata.KEY_URL, metadataUrl );
-
-        context.put( CreateProjectsFromMetadata.KEY_WORKING_DIRECTORY, core.getWorkingDirectory()
);
-
-        ContinuumProjectBuildingResult result;
-
-        try
-        {
-            // ----------------------------------------------------------------------
-            // During the execution of the this action we may find that the metadata
-            // isn't good enough for the following reasons:
-            //
-            // 1) No scm element (repository element for m1)
-            // 2) Invalid scm element (repository element for m1)
-            // 3) No ciManagement (m2)
-            // 4) Invalid ciManagement element (m2)
-            // ----------------------------------------------------------------------
-
-            actionManager.lookup( "create-projects-from-metadata" ).execute( context );
-
-            result = (ContinuumProjectBuildingResult) context.get( CreateProjectsFromMetadata.KEY_PROJECT_BUILDING_RESULT
);
-
-            if ( result.getWarnings().size() > 0 )
-            {
-                return result;
-            }
-
-            List projects = result.getProjects();
-
-            for ( Iterator i = projects.iterator(); i.hasNext(); )
-            {
-                ContinuumProject project = (ContinuumProject) i.next();
-
-                project.setExecutorId( MavenOneBuildExecutor.ID );
-
-                context.put( AbstractContinuumAction.KEY_UNVALIDATED_PROJECT, project );
-
-                actionManager.lookup( "validate-project" ).execute( context );
-
-                actionManager.lookup( "store-project" ).execute( context );
-
-                project.setId( (String) context.get( StoreProjectAction.KEY_PROJECT_ID )
);
-
-                actionManager.lookup( "add-project-to-checkout-queue" ).execute( context
);
-            }
-        }
-        catch ( Exception e )
-        {
-            throw new ContinuumException( "Error adding Maven 1 project.", e );
-        }
-
-        return result;
+        return executeAddProjectsFromMetadataActivity( metadataUrl,
+                                                       MavenOneContinuumProjectBuilder.ID,
+                                                       MavenOneBuildExecutor.ID );
     }
 
     public String addMavenOneProject( MavenOneProject project )
@@ -332,30 +285,7 @@
     {
         project.setExecutorId( MavenOneBuildExecutor.ID );
 
-        // ----------------------------------------------------------------------
-        //
-        // ----------------------------------------------------------------------
-
-        Map context = new HashMap();
-
-        context.put( AbstractContinuumAction.KEY_UNVALIDATED_PROJECT, project );
-
-        try
-        {
-            actionManager.lookup( "validate-project" ).execute( context );
-
-            actionManager.lookup( "store-project" ).execute( context );
-
-            project.setId( (String) context.get( StoreProjectAction.KEY_PROJECT_ID ) );
-
-            actionManager.lookup( "add-project-to-checkout-queue" ).execute( context );
-
-            return project.getId();
-        }
-        catch ( Exception e )
-        {
-            throw new ContinuumException( "Error adding Maven 1 project.", e );
-        }
+        return executeAddProjectFromScmActivity( project );
     }
 
     public MavenOneProject getMavenOneProject( String projectId )
@@ -377,70 +307,9 @@
     public ContinuumProjectBuildingResult addMavenTwoProject( String metadataUrl )
         throws ContinuumException
     {
-        // ----------------------------------------------------------------------
-        // Initialize the context
-        // ----------------------------------------------------------------------
-
-        Map context = new HashMap();
-
-        context.put( CreateProjectsFromMetadata.KEY_PROJECT_BUILDER_ID, MavenTwoContinuumProjectBuilder.ID
);
-
-        context.put( CreateProjectsFromMetadata.KEY_URL, metadataUrl );
-
-        context.put( CreateProjectsFromMetadata.KEY_WORKING_DIRECTORY, core.getWorkingDirectory()
);
-
-        // ----------------------------------------------------------------------
-        //
-        // ----------------------------------------------------------------------
-
-        ContinuumProjectBuildingResult result;
-
-        try
-        {
-            // ----------------------------------------------------------------------
-            // During the execution of the this action we may find that the metadata
-            // isn't good enough for the following reasons:
-            //
-            // 1) No scm element (repository element for m1)
-            // 2) Invalid scm element (repository element for m1)
-            // 3) No ciManagement (m2)
-            // 4) Invalid ciManagement element (m2)
-            // ----------------------------------------------------------------------
-
-            actionManager.lookup( "create-projects-from-metadata" ).execute( context );
-
-            result = (ContinuumProjectBuildingResult) context.get( CreateProjectsFromMetadata.KEY_PROJECT_BUILDING_RESULT
);
-
-            if ( result.getWarnings().size() > 0 )
-            {
-                return result;
-            }
-
-            List projects = result.getProjects();
-
-            for ( Iterator i = projects.iterator(); i.hasNext(); )
-            {
-                ContinuumProject project = (ContinuumProject) i.next();
-
-                project.setExecutorId( MavenTwoBuildExecutor.ID );
-
-                context.put( AbstractContinuumAction.KEY_UNVALIDATED_PROJECT, project );
-
-                actionManager.lookup( "validate-project" ).execute( context );
-
-                actionManager.lookup( "store-project" ).execute( context );
-
-                project.setId( (String) context.get( StoreProjectAction.KEY_PROJECT_ID )
);
-
-                actionManager.lookup( "add-project-to-checkout-queue" ).execute( context
);
-            }
-        }
-        catch ( Exception e )
-        {
-            throw new ContinuumException( "Error adding Maven 2 project.", e );
-        }
-
-        return result;
+        return executeAddProjectsFromMetadataActivity( metadataUrl,
+                                                       MavenTwoContinuumProjectBuilder.ID,
+                                                       MavenTwoBuildExecutor.ID );
     }
 
     public String addMavenTwoProject( MavenTwoProject project )
@@ -448,30 +317,7 @@
     {
         project.setExecutorId( MavenTwoBuildExecutor.ID );
 
-        // ----------------------------------------------------------------------
-        //
-        // ----------------------------------------------------------------------
-
-        Map context = new HashMap();
-
-        context.put( AbstractContinuumAction.KEY_UNVALIDATED_PROJECT, project );
-
-        try
-        {
-            actionManager.lookup( "validate-project" ).execute( context );
-
-            actionManager.lookup( "store-project" ).execute( context );
-
-            project.setId( (String) context.get( StoreProjectAction.KEY_PROJECT_ID ) );
-
-            actionManager.lookup( "add-project-to-checkout-queue" ).execute( context );
-        }
-        catch ( Exception e )
-        {
-            throw new ContinuumException( "Error adding Maven 2 project.", e );
-        }
-
-        return project.getId();
+        return executeAddProjectFromScmActivity( project );
     }
 
     public MavenTwoProject getMavenTwoProject( String projectId )
@@ -486,19 +332,16 @@
         executeUpdateProjectActivity( project );
     }
 
+    // ----------------------------------------------------------------------
+    // Shell projects
+    // ----------------------------------------------------------------------
+
     public String addShellProject( ShellProject project )
         throws ContinuumException
     {
         project.setExecutorId( ShellBuildExecutor.ID );
 
-        try
-        {
-            return executeAddProjectFromScmActivity( project );
-        }
-        catch ( Exception e )
-        {
-            throw new ContinuumException( "Error adding Shell project.", e );
-        }
+        return executeAddProjectFromScmActivity( project );
     }
 
     public ShellProject getShellProject( String projectId )
@@ -550,6 +393,70 @@
         }
     }
 
+    private ContinuumProjectBuildingResult executeAddProjectsFromMetadataActivity( String
metadataUrl,
+                                                                                   String
projectBuilderId,
+                                                                                   String
buildExecutorId )
+        throws ContinuumException
+    {
+        Map context = new HashMap();
+
+        context.put( CreateProjectsFromMetadata.KEY_PROJECT_BUILDER_ID, projectBuilderId
);
+
+        context.put( CreateProjectsFromMetadata.KEY_URL, metadataUrl );
+
+        context.put( CreateProjectsFromMetadata.KEY_WORKING_DIRECTORY, core.getWorkingDirectory()
);
+
+        ContinuumProjectBuildingResult result;
+
+        try
+        {
+            // ----------------------------------------------------------------------
+            // During the execution of the this action we may find that the metadata
+            // isn't good enough for the following reasons:
+            //
+            // 1) No scm element (repository element for m1)
+            // 2) Invalid scm element (repository element for m1)
+            // 3) No ciManagement (m2)
+            // 4) Invalid ciManagement element (m2)
+            // ----------------------------------------------------------------------
+
+            actionManager.lookup( "create-projects-from-metadata" ).execute( context );
+
+            result = (ContinuumProjectBuildingResult)
+                context.get( CreateProjectsFromMetadata.KEY_PROJECT_BUILDING_RESULT );
+
+            if ( result.getWarnings().size() > 0 )
+            {
+                return result;
+            }
+
+            List projects = result.getProjects();
+
+            for ( Iterator i = projects.iterator(); i.hasNext(); )
+            {
+                ContinuumProject project = (ContinuumProject) i.next();
+
+                project.setExecutorId( buildExecutorId );
+
+                context.put( AbstractContinuumAction.KEY_UNVALIDATED_PROJECT, project );
+
+                actionManager.lookup( "validate-project" ).execute( context );
+
+                actionManager.lookup( "store-project" ).execute( context );
+
+                project.setId( (String) context.get( StoreProjectAction.KEY_PROJECT_ID )
);
+
+//                actionManager.lookup( "add-project-to-checkout-queue" ).execute( context
);
+            }
+        }
+        catch ( Exception e )
+        {
+            throw new ContinuumException( "Error adding projects from metadata '" + metadataUrl
+ "'.", e );
+        }
+
+        return result;
+    }
+
     // ----------------------------------------------------------------------
     // Notification
     // ----------------------------------------------------------------------
@@ -670,9 +577,7 @@
     {
         try
         {
-            ContinuumSchedule schedule = store.getSchedule( scheduleId );
-
-            return schedule;
+            return store.getSchedule( scheduleId );
         }
         catch ( ContinuumStoreException ex )
         {
@@ -767,7 +672,7 @@
     }
 
     // ----------------------------------------------------------------------
-    // Internal Build Scheduling
+    // Default Object Management
     // ----------------------------------------------------------------------
 
     private boolean defaultScheduleExists()

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CreateProjectsFromMetadata.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CreateProjectsFromMetadata.java?rev=220126&r1=220125&r2=220126&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CreateProjectsFromMetadata.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CreateProjectsFromMetadata.java
Thu Jul 21 09:07:07 2005
@@ -5,6 +5,8 @@
 
 import org.apache.maven.continuum.project.builder.ContinuumProjectBuilder;
 import org.apache.maven.continuum.project.builder.ContinuumProjectBuildingResult;
+import org.apache.maven.continuum.project.builder.ContinuumProjectBuilderException;
+import org.apache.maven.continuum.project.builder.manager.ContinuumProjectBuilderManagerException;
 import org.apache.maven.continuum.ContinuumException;
 
 import java.net.URL;
@@ -24,8 +26,10 @@
 
     public static final String KEY_PROJECT_BUILDING_RESULT = "projectBuildingResult";
 
-    public  void execute( Map context )
-        throws Exception
+    public void execute( Map context )
+        throws ContinuumException,
+               ContinuumProjectBuilderManagerException,
+               ContinuumProjectBuilderException
     {
         String projectBuilderId = getString( context, KEY_PROJECT_BUILDER_ID );
 

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ValidateProject.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ValidateProject.java?rev=220126&r1=220125&r2=220126&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ValidateProject.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ValidateProject.java
Thu Jul 21 09:07:07 2005
@@ -46,6 +46,17 @@
             throw new ContinuumException( "The SCM URL has to be set." );
         }
 
+        // TODO: Enable
+//        if ( StringUtils.isEmpty( project.getGroupId() ) )
+//        {
+//            throw new ContinuumException( "The group id has to be set." );
+//        }
+//
+//        if ( StringUtils.isEmpty( project.getArtifactId() ) )
+//        {
+//            throw new ContinuumException( "The artifact id has to be set." );
+//        }
+
         // TODO: validate that the SCM provider id
 
         // ----------------------------------------------------------------------

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilder.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilder.java?rev=220126&r1=220125&r2=220126&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilder.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilder.java
Thu Jul 21 09:07:07 2005
@@ -16,23 +16,27 @@
  * limitations under the License.
  */
 
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Iterator;
-import java.util.List;
-import java.io.IOException;
-
 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.project.ContinuumProjectGroup;
 import org.apache.maven.continuum.project.MavenTwoProject;
 import org.apache.maven.continuum.project.builder.AbstractContinuumProjectBuilder;
 import org.apache.maven.continuum.project.builder.ContinuumProjectBuilder;
 import org.apache.maven.continuum.project.builder.ContinuumProjectBuilderException;
 import org.apache.maven.continuum.project.builder.ContinuumProjectBuildingResult;
 import org.apache.maven.continuum.utils.ContinuumUtils;
+import org.apache.maven.model.IssueManagement;
 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.Iterator;
+import java.util.List;
+
 /**
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
  * @version $Id$
@@ -68,7 +72,7 @@
 
         ContinuumProjectBuildingResult result = new ContinuumProjectBuildingResult();
 
-        readModules( url, result );
+        readModules( url, result, true );
 
         return result;
     }
@@ -77,7 +81,9 @@
     //
     // ----------------------------------------------------------------------
 
-    private void readModules( URL url, ContinuumProjectBuildingResult result )
+    private void readModules( URL url,
+                              ContinuumProjectBuildingResult result,
+                              boolean groupPom )
     {
         MavenProject mavenProject;
 
@@ -100,6 +106,16 @@
             return;
         }
 
+        if ( groupPom )
+        {
+            ContinuumProjectGroup projectGroup = buildProjectGroup( mavenProject );
+
+            if ( projectGroup != null )
+            {
+                result.addProjectGroup( projectGroup );
+            }
+        }
+
         if ( !excludedPackagingTypes.contains( mavenProject.getPackaging() ) )
         {
             MavenTwoProject continuumProject = new MavenTwoProject();
@@ -139,10 +155,10 @@
         {
             String module = (String) it.next();
 
-            URL moduleUrl = null;
-
             String urlString = prefix + "/" + module + POM_PART + suffix;
 
+            URL moduleUrl;
+
             try
             {
                 moduleUrl = new URL( urlString );
@@ -154,7 +170,65 @@
                 continue;
             }
 
-            readModules( moduleUrl, result );
+            readModules( moduleUrl, result, false );
         }
+    }
+
+    private ContinuumProjectGroup buildProjectGroup( MavenProject mavenProject )
+    {
+        ContinuumProjectGroup projectGroup = new ContinuumProjectGroup();
+
+        // ----------------------------------------------------------------------
+        // Group id
+        // ----------------------------------------------------------------------
+
+        if ( StringUtils.isEmpty( mavenProject.getGroupId() ) )
+        {
+            return null;
+        }
+
+        projectGroup.setGroupId( projectGroup.getGroupId() );
+
+        // ----------------------------------------------------------------------
+        // Name
+        // ----------------------------------------------------------------------
+
+        String name = mavenProject.getName();
+
+        if ( StringUtils.isEmpty( name ) )
+        {
+            name = mavenProject.getId();
+        }
+
+        projectGroup.setName( name );
+
+        // ----------------------------------------------------------------------
+        // Description
+        // ----------------------------------------------------------------------
+
+        projectGroup.setDescription( mavenProject.getDescription() );
+
+        // ----------------------------------------------------------------------
+        // URL
+        // ----------------------------------------------------------------------
+
+        projectGroup.setUrl( mavenProject.getUrl() );
+
+        // ----------------------------------------------------------------------
+        //
+        // ----------------------------------------------------------------------
+
+        String issueManagementUrl = null;
+
+        IssueManagement issueManagement = mavenProject.getIssueManagement();
+
+        if( issueManagement != null )
+        {
+            issueManagementUrl = issueManagement.getUrl();
+        }
+
+        projectGroup.setIssueManagementUrl( issueManagementUrl );
+
+        return projectGroup;
     }
 }

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java?rev=220126&r1=220125&r2=220126&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java
Thu Jul 21 09:07:07 2005
@@ -28,7 +28,6 @@
 import javax.jdo.PersistenceManagerFactory;
 import javax.jdo.Query;
 import javax.jdo.Transaction;
-import javax.jdo.JDOHelper;
 
 import org.apache.maven.continuum.project.ContinuumBuild;
 import org.apache.maven.continuum.project.ContinuumProject;
@@ -806,13 +805,52 @@
         }
     }
 
-
     public ContinuumProjectGroup getProjectGroup( String projectGroupId )
         throws ContinuumStoreException
     {
         return (ContinuumProjectGroup) getDetailedObject( ContinuumProjectGroup.class,
                                                           projectGroupId,
                                                           "project-group-detail" );
+    }
+
+    public ContinuumProjectGroup getProjectGroupByName( String name )
+        throws ContinuumStoreException
+    {
+        PersistenceManager pm = pmf.getPersistenceManager();
+
+        Transaction tx = pm.currentTransaction();
+
+        try
+        {
+            tx.begin();
+
+            Extent extent = pm.getExtent( ContinuumProjectGroup.class, true );
+
+            Query query = pm.newQuery( extent );
+
+            query.setOrdering( "name ascending" );
+
+            query.declareParameters( "String filter" );
+
+            query.setFilter( "this.name == name" );
+
+            Collection result = (Collection) query.execute( name );
+
+            if ( result.size() == 0 )
+            {
+                throw new ContinuumObjectNotFoundException( ContinuumProjectGroup.class.getName(),
name );
+            }
+
+            Object object = pm.detachCopy( result.iterator().next() );
+
+            commit( tx );
+
+            return (ContinuumProjectGroup) object;
+        }
+        finally
+        {
+            rollback( tx );
+        }
     }
 
     // ----------------------------------------------------------------------

Modified: maven/continuum/trunk/continuum-model/pom.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-model/pom.xml?rev=220126&r1=220125&r2=220126&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-model/pom.xml (original)
+++ maven/continuum/trunk/continuum-model/pom.xml Thu Jul 21 09:07:07 2005
@@ -45,8 +45,8 @@
               <goal>java</goal>
               <!--
               <goal>jpox-jdo-mapping</goal>
-              -->
               <goal>jpox-store</goal>
+              -->
             </goals>
           </execution>
         </executions>

Modified: maven/continuum/trunk/continuum-model/src/main/resources/continuum.mdo
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-model/src/main/resources/continuum.mdo?rev=220126&r1=220125&r2=220126&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-model/src/main/resources/continuum.mdo (original)
+++ maven/continuum/trunk/continuum-model/src/main/resources/continuum.mdo Thu Jul 21 09:07:07
2005
@@ -304,7 +304,6 @@
       <fields>
         <field>
           <name>groupId</name>
-          <identifier>true</identifier>
           <version>1.0.0</version>
           <type>String</type>
         </field>



Mime
View raw message