continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jvan...@apache.org
Subject svn commit: r220336 - in /maven/continuum/trunk: continuum-api/src/main/java/org/apache/maven/continuum/configuration/ continuum-core-it/src/test/java/org/apache/maven/continuum/it/ continuum-core/src/main/java/org/apache/maven/continuum/ continuum-cor...
Date Fri, 22 Jul 2005 15:13:19 GMT
Author: jvanzyl
Date: Fri Jul 22 08:13:00 2005
New Revision: 220336

URL: http://svn.apache.org/viewcvs?rev=220336&view=rev
Log:
o getting the initializer going and working on integrating the new model

Added:
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/build/
Modified:
    maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/configuration/ConfigurationService.java
    maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/AbstractIntegrationTest.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/configuration/DefaultConfigurationService.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/initialization/DefaultContinuumInitializer.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scheduler/ContinuumBuildJob.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scheduler/ContinuumSchedulerConstants.java
    maven/continuum/trunk/continuum-core/src/main/resources/META-INF/plexus/components.xml
    maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java
    maven/continuum/trunk/continuum-core/src/test/resources/org/apache/maven/continuum/DefaultContinuumTest.xml
    maven/continuum/trunk/continuum-test/src/main/java/org/apache/maven/continuum/AbstractContinuumTest.java

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=220336&r1=220335&r2=220336&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
Fri Jul 22 08:13:00 2005
@@ -23,7 +23,7 @@
 
 /**
  * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
- * @version $Id:$
+ * @version $Id$
  */
 public interface ConfigurationService
 {
@@ -35,6 +35,8 @@
 
     public static final String CONFIGURATION = "configuration";
 
+    public static final String CONFIGURATION_INITIALIZED = "initialized";
+
     public static final String CONFIGURATION_URL = "url";
 
     public static final String CONFIGURATION_BUILD_OUTPUT_DIRECTORY = "build-output-directory";
@@ -51,6 +53,10 @@
     //
     // ----------------------------------------------------------------------
 
+    void setInitialized( boolean initialized );
+
+    boolean isInitialized();
+
     String getUrl();
 
     void setUrl( String url );
@@ -64,6 +70,10 @@
     void addJdk( ContinuumJdk jdk );
 
     void setJdks( Map jdks );
+
+    void setInMemoryMode( boolean inMemoryMode );
+
+    boolean inMemoryMode();
 
     // ----------------------------------------------------------------------
     //

Modified: maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/AbstractIntegrationTest.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/AbstractIntegrationTest.java?rev=220336&r1=220335&r2=220336&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/AbstractIntegrationTest.java
(original)
+++ maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/AbstractIntegrationTest.java
Fri Jul 22 08:13:00 2005
@@ -103,6 +103,12 @@
     protected void customizeContext( Context context )
         throws Exception
     {
+        // ----------------------------------------------------------------------
+        // This level of directory nesting is setup to mimic the continuum
+        // application running in development mode where it picks up resources
+        // in situ like forms, templates and localization resources.
+        // ----------------------------------------------------------------------
+
         File plexusHome = getTestFile( "target/leve1/level2/plexus-home" );
 
         if ( !plexusHome.isDirectory() )

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=220336&r1=220335&r2=220336&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
Fri Jul 22 08:13:00 2005
@@ -17,6 +17,8 @@
  */
 
 import org.apache.maven.continuum.configuration.ConfigurationService;
+import org.apache.maven.continuum.configuration.ConfigurationLoadingException;
+import org.apache.maven.continuum.configuration.ConfigurationStoringException;
 import org.apache.maven.continuum.core.ContinuumCore;
 import org.apache.maven.continuum.core.action.AbstractContinuumAction;
 import org.apache.maven.continuum.core.action.AddProjectToCheckOutQueueAction;
@@ -34,6 +36,8 @@
 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.ContinuumProjectGroup;
+import org.apache.maven.continuum.project.ContinuumBuildSettings;
 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;
@@ -43,11 +47,16 @@
 import org.apache.maven.continuum.store.ContinuumStore;
 import org.apache.maven.continuum.store.ContinuumStoreException;
 import org.apache.maven.continuum.utils.ProjectSorter;
+import org.apache.maven.continuum.initialization.ContinuumInitializer;
+import org.apache.maven.continuum.initialization.ContinuumInitializationException;
 
 import org.codehaus.plexus.action.ActionManager;
 import org.codehaus.plexus.logging.AbstractLogEnabled;
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
+import org.codehaus.plexus.personality.plexus.lifecycle.phase.Startable;
+import org.codehaus.plexus.personality.plexus.lifecycle.phase.StartingException;
+import org.codehaus.plexus.personality.plexus.lifecycle.phase.StoppingException;
 import org.codehaus.plexus.util.dag.CycleDetectedException;
 
 import java.util.Collection;
@@ -64,23 +73,38 @@
  */
 public class DefaultContinuum
     extends AbstractLogEnabled
-    implements Continuum, Initializable
+    implements Continuum, Startable
 {
-    /** @plexus.requirement */
+    /**
+     * @plexus.requirement
+     */
     private ContinuumCore core;
 
-    /** @plexus.requirement */
+    /**
+     * @plexus.requirement
+     */
     private ActionManager actionManager;
 
-    /** @plexus.requirement */
+    /**
+     * @plexus.requirement
+     */
     private ContinuumScheduler scheduler;
 
-    /** @plexus.requirement */
+    /**
+     * @plexus.requirement
+     */
     private ConfigurationService configurationService;
 
-    /** @plexus.requirement */
+    /**
+     * @plexus.requirement
+     */
     private ContinuumStore store;
 
+    /**
+     * @plexus.requirement
+     */
+    private ContinuumInitializer initializer;
+
     // ----------------------------------------------------------------------
     //
     // ----------------------------------------------------------------------
@@ -554,17 +578,40 @@
     // Lifecylce Management
     // ----------------------------------------------------------------------
 
-    public void initialize()
-        throws InitializationException
+    public void start()
+        throws StartingException
     {
-        // ----------------------------------------------------------------------
-        // Make sure that the default schedule exists so that projects being
-        // added to Continuum will participate in a scheduled build by default
-        // ----------------------------------------------------------------------
+        try
+        {
+            configurationService.load();
+
+            if ( !configurationService.isInitialized() )
+            {
+                initializer.initialize();
 
-        if ( !defaultScheduleExists() )
+                configurationService.setInitialized( true );
+            }
+        }
+        catch ( ConfigurationLoadingException e )
+        {
+            throw new StartingException( "Error loading the Continuum configuration.", e
);
+        }
+        catch ( ContinuumInitializationException e )
         {
-            createDefaultSchedule();
+            throw new StartingException( "Cannot initializing Continuum for the first time.",
e );
+        }
+    }
+
+    public void stop()
+        throws StoppingException
+    {
+        try
+        {
+            configurationService.store();
+        }
+        catch ( ConfigurationStoringException e )
+        {
+            throw new StoppingException( "Error storing the Continuum configuration.", e
);
         }
     }
 
@@ -669,6 +716,16 @@
         {
             throw logAndCreateException( "Error while removing project from schedule.", e
);
         }
+    }
+
+    public ContinuumProjectGroup getDefaultProjectGroup()
+    {
+        return initializer.getDefaultProjectGroup();
+    }
+
+    public ContinuumBuildSettings getDefaultBuildSettings()
+    {
+        return initializer.getDefaultBuildSettings();
     }
 
     // ----------------------------------------------------------------------

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/configuration/DefaultConfigurationService.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/configuration/DefaultConfigurationService.java?rev=220336&r1=220335&r2=220336&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/configuration/DefaultConfigurationService.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/configuration/DefaultConfigurationService.java
Fri Jul 22 08:13:00 2005
@@ -46,6 +46,10 @@
     // Continuum specifics we'll refactor out later
     // ----------------------------------------------------------------------
 
+    private boolean inMemoryMode;
+
+    private boolean initialized;
+
     private String url;
 
     private File buildOutputDirectory;
@@ -58,6 +62,16 @@
     //
     // ----------------------------------------------------------------------
 
+    public void setInitialized( boolean initialized )
+    {
+        this.initialized = initialized;
+    }
+
+    public boolean isInitialized()
+    {
+        return initialized;
+    }
+
     public String getUrl()
     {
         return url;
@@ -98,6 +112,16 @@
         this.jdks = jdks;
     }
 
+    public void setInMemoryMode( boolean inMemoryMode )
+    {
+        this.inMemoryMode = inMemoryMode;
+    }
+
+    public boolean inMemoryMode()
+    {
+        return inMemoryMode;
+    }
+
     // ----------------------------------------------------------------------
     // Process configuration to glean application specific values
     // ----------------------------------------------------------------------
@@ -105,6 +129,22 @@
     protected void processInboundConfiguration()
         throws ConfigurationLoadingException
     {
+        Xpp3Dom initializedDom = configuration.getChild( CONFIGURATION_INITIALIZED );
+
+        if ( initializedDom != null )
+        {
+            String booleanString = initializedDom.getValue();
+
+            if ( booleanString.equals( "true" ) || booleanString.equals( "1" ) )
+            {
+                initialized = true;
+            }
+            else
+            {
+                initialized = false;
+            }
+        }
+
         Xpp3Dom urlDom = configuration.getChild( CONFIGURATION_URL );
 
         if ( urlDom != null )
@@ -173,6 +213,8 @@
     {
         configuration = new Xpp3Dom( CONFIGURATION );
 
+        configuration.addChild( createDom( CONFIGURATION_INITIALIZED, Boolean.toString( initialized
) ) );
+
         if ( url != null )
         {
             configuration.addChild( createDom( CONFIGURATION_URL, url ) );
@@ -234,6 +276,11 @@
     public void load()
         throws ConfigurationLoadingException
     {
+        if ( inMemoryMode )
+        {
+            return;
+        }
+
         try
         {
             configuration = Xpp3DomBuilder.build( new FileReader( source ) );
@@ -257,6 +304,11 @@
     public void store()
         throws ConfigurationStoringException
     {
+        if ( inMemoryMode )
+        {
+            return;
+        }
+
         processOutboundConfiguration();
 
         try

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/initialization/DefaultContinuumInitializer.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/initialization/DefaultContinuumInitializer.java?rev=220336&r1=220335&r2=220336&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/initialization/DefaultContinuumInitializer.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/initialization/DefaultContinuumInitializer.java
Fri Jul 22 08:13:00 2005
@@ -5,6 +5,7 @@
 import org.apache.maven.continuum.store.ContinuumStore;
 import org.apache.maven.continuum.store.ContinuumStoreException;
 import org.apache.maven.continuum.build.settings.BuildSettingsConstants;
+import org.codehaus.plexus.logging.AbstractLogEnabled;
 
 /*
  * Copyright 2004-2005 The Apache Software Foundation.
@@ -27,6 +28,7 @@
  * @version $Id:$
  */
 public class DefaultContinuumInitializer
+    extends AbstractLogEnabled
     implements ContinuumInitializer
 {
     // ----------------------------------------------------------------------
@@ -70,6 +72,8 @@
     public void initialize()
         throws ContinuumInitializationException
     {
+        getLogger().info( "Continuum initializer running ..." );
+
         defaultBuildSettings = createDefaultBuildSettings();
 
         try

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scheduler/ContinuumBuildJob.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scheduler/ContinuumBuildJob.java?rev=220336&r1=220335&r2=220336&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scheduler/ContinuumBuildJob.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scheduler/ContinuumBuildJob.java
Fri Jul 22 08:13:00 2005
@@ -5,6 +5,8 @@
 import org.quartz.JobDetail;
 import org.apache.maven.continuum.project.ContinuumProject;
 import org.apache.maven.continuum.project.ContinuumSchedule;
+import org.apache.maven.continuum.project.ContinuumBuildSettings;
+import org.apache.maven.continuum.project.ContinuumProjectGroup;
 import org.apache.maven.continuum.ContinuumException;
 import org.apache.maven.continuum.Continuum;
 import org.codehaus.plexus.logging.Logger;
@@ -36,37 +38,32 @@
 
         Continuum continuum = (Continuum) jobDetail.getJobDataMap().get( ContinuumSchedulerConstants.CONTINUUM
);
 
-        //ContinuumSchedule schedule = (ContinuumSchedule) jobDetail.getJobDataMap().get(
ContinuumSchedulerConstants.SCHEDULE );
+        ContinuumBuildSettings buildSettings = (ContinuumBuildSettings) jobDetail.getJobDataMap().get(
ContinuumSchedulerConstants.BUILD_SETTINGS );
 
         // ----------------------------------------------------------------------
-        // Lookup all projects that belong to this schedule
+        // Lookup all the project groups that belong to these build settings
         // ----------------------------------------------------------------------
 
-        //Set projects = schedule.getProjects();
+        Set projectGroups = buildSettings.getProjectGroups();
 
-        Collection projects = null;
-        try
+        for ( Iterator iterator = projectGroups.iterator(); iterator.hasNext(); )
         {
-            projects = continuum.getProjects();
-        }
-        catch ( ContinuumException e )
-        {
-            logger.error( "Error retrieving projects.", e );
-        }
+            ContinuumProjectGroup projectGroup = (ContinuumProjectGroup) iterator.next();
 
-        for ( Iterator i = projects.iterator(); i.hasNext(); )
-        {
-            ContinuumProject project = (ContinuumProject) i.next();
+            Set projects = projectGroup.getProjects();
 
-            try
-            {
-                continuum.buildProject( project.getId(), false );
-            }
-            catch ( ContinuumException ex )
+            for ( Iterator j = projects.iterator(); j.hasNext(); )
             {
-                logger.error( "Could not enqueue project: " + project.getId() + " ('" + project.getName()
+ "').", ex );
+                ContinuumProject project = (ContinuumProject) j.next();
 
-                continue;
+                try
+                {
+                    continuum.buildProject( project.getId(), false );
+                }
+                catch ( ContinuumException ex )
+                {
+                    logger.error( "Could not enqueue project: " + project.getId() + " ('"
+ project.getName() + "').", ex );
+                }
             }
         }
     }

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scheduler/ContinuumSchedulerConstants.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scheduler/ContinuumSchedulerConstants.java?rev=220336&r1=220335&r2=220336&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scheduler/ContinuumSchedulerConstants.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scheduler/ContinuumSchedulerConstants.java
Fri Jul 22 08:13:00 2005
@@ -2,7 +2,7 @@
 
 /**
  * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
- * @version $Id:$
+ * @version $Id$
  */
 public class ContinuumSchedulerConstants
 {
@@ -37,4 +37,6 @@
     public static final String CONTINUUM = "continuum";
 
     public static final String SCHEDULE = "schedule";
+
+    public static final String BUILD_SETTINGS = "build-settings";
 }

Modified: maven/continuum/trunk/continuum-core/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/resources/META-INF/plexus/components.xml?rev=220336&r1=220335&r2=220336&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/resources/META-INF/plexus/components.xml
(original)
+++ maven/continuum/trunk/continuum-core/src/main/resources/META-INF/plexus/components.xml
Fri Jul 22 08:13:00 2005
@@ -71,6 +71,9 @@
         <requirement>
           <role>org.apache.maven.continuum.store.ContinuumStore</role>
         </requirement>
+        <requirement>
+          <role>org.apache.maven.continuum.initialization.ContinuumInitializer</role>
+        </requirement>
       </requirements>
     </component>
 

Modified: maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java?rev=220336&r1=220335&r2=220336&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java
(original)
+++ maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java
Fri Jul 22 08:13:00 2005
@@ -31,7 +31,7 @@
  * @version $Id$
  */
 public class DefaultContinuumTest
-    extends PlexusTestCase
+    extends AbstractContinuumTest
 {
     public void testContinuumConfiguration()
         throws Exception

Modified: maven/continuum/trunk/continuum-core/src/test/resources/org/apache/maven/continuum/DefaultContinuumTest.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/test/resources/org/apache/maven/continuum/DefaultContinuumTest.xml?rev=220336&r1=220335&r2=220336&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/test/resources/org/apache/maven/continuum/DefaultContinuumTest.xml
(original)
+++ maven/continuum/trunk/continuum-core/src/test/resources/org/apache/maven/continuum/DefaultContinuumTest.xml
Fri Jul 22 08:13:00 2005
@@ -22,5 +22,14 @@
         <workflowDirectory>${basedir}/../continuum-plexus-application/src/conf/workflows</workflowDirectory>
       </configuration>
     </component>
+
+    <component>
+      <role>org.apache.maven.continuum.configuration.ConfigurationService</role>
+      <implementation>org.apache.maven.continuum.configuration.DefaultConfigurationService</implementation>
+      <configuration>
+        <inMemoryMode>true</inMemoryMode>
+      </configuration>
+    </component>
+
   </components>
 </plexus>

Modified: maven/continuum/trunk/continuum-test/src/main/java/org/apache/maven/continuum/AbstractContinuumTest.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-test/src/main/java/org/apache/maven/continuum/AbstractContinuumTest.java?rev=220336&r1=220335&r2=220336&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-test/src/main/java/org/apache/maven/continuum/AbstractContinuumTest.java
(original)
+++ maven/continuum/trunk/continuum-test/src/main/java/org/apache/maven/continuum/AbstractContinuumTest.java
Fri Jul 22 08:13:00 2005
@@ -63,6 +63,8 @@
     public static void setUpConfigurationService( ConfigurationService configurationService
)
         throws Exception
     {
+        configurationService.setInMemoryMode( true );
+
         configurationService.setBuildOutputDirectory( getTestFile( "target/build-output"
) );
     }
 



Mime
View raw message