continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r292511 - in /maven/continuum/trunk: continuum-api/src/main/java/org/apache/maven/continuum/configuration/ continuum-api/src/main/java/org/apache/maven/continuum/store/ continuum-api/src/main/resources/META-INF/plexus/ continuum-api/src/tes...
Date Thu, 29 Sep 2005 19:04:21 GMT
Author: evenisse
Date: Thu Sep 29 12:03:46 2005
New Revision: 292511

URL: http://svn.apache.org/viewcvs?rev=292511&view=rev
Log:
o Break configurationService dependency in ContinuumStore
o Start to refactor configurationService to store conf in database instead of configuration.xml

Added:
    maven/continuum/trunk/continuum-core/src/test/resources/configuration.xml
      - copied unchanged from r290941, maven/continuum/trunk/continuum-api/src/test/resources/configuration.xml
Removed:
    maven/continuum/trunk/continuum-api/src/test/resources/configuration.xml
Modified:
    maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/configuration/ConfigurationLoadingException.java
    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/configuration/ConfigurationStoringException.java
    maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java
    maven/continuum/trunk/continuum-api/src/main/resources/META-INF/plexus/components.xml
    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/core/action/ExecuteBuilderContinuumAction.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/notification/DefaultContinuumNotificationDispatcher.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/configuration/ConfigurationServiceTest.java
    maven/continuum/trunk/continuum-core/src/test/resources/org/apache/maven/continuum/DefaultContinuumTest.xml
    maven/continuum/trunk/continuum-core/src/test/resources/org/apache/maven/continuum/configuration/ConfigurationServiceTest.xml
    maven/continuum/trunk/continuum-model/src/main/mdo/continuum.mdo
    maven/continuum/trunk/continuum-store/src/main/java/org/apache/maven/continuum/store/AbstractContinuumStore.java
    maven/continuum/trunk/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java
    maven/continuum/trunk/continuum-store/src/main/resources/META-INF/plexus/components.xml
    maven/continuum/trunk/continuum-test/src/main/java/org/apache/maven/continuum/AbstractContinuumTest.java
    maven/continuum/trunk/continuum-web/src/main/java/org/apache/maven/continuum/web/pipeline/valve/LoginValve.java
    maven/continuum/trunk/continuum-xmlrpc/src/test/resources/org/apache/maven/continuum/xmlrpc/ContinuumXmlRpcTest.xml

Modified: maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/configuration/ConfigurationLoadingException.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/configuration/ConfigurationLoadingException.java?rev=292511&r1=292510&r2=292511&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/configuration/ConfigurationLoadingException.java
(original)
+++ maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/configuration/ConfigurationLoadingException.java
Thu Sep 29 12:03:46 2005
@@ -1,5 +1,21 @@
 package org.apache.maven.continuum.configuration;
 
+/*
+ * Copyright 2004-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 /**
  * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
  * @version $Id$

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=292511&r1=292510&r2=292511&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 Sep 29 12:03:46 2005
@@ -33,8 +33,6 @@
 
     String CONFIGURATION = "configuration";
 
-    String CONFIGURATION_INITIALIZED = "initialized";
-
     String CONFIGURATION_URL = "url";
 
     String CONFIGURATION_BUILD_OUTPUT_DIRECTORY = "build-output-directory";
@@ -47,16 +45,14 @@
 
     String CONFIGURATION_COMPANY_URL = "company-url";
 
-    String CONFIGURATION_ALLOW_GUEST = "allow-guest";
-
     // ----------------------------------------------------------------------
     //
     // ----------------------------------------------------------------------
 
-    void setInitialized( boolean initialized );
-
     boolean isInitialized();
 
+    void setInitialized( boolean initialized );
+
     String getUrl();
 
     void setUrl( String url );
@@ -87,9 +83,15 @@
 
     void setCompanyUrl( String companyUrl );
 
-    boolean isAllowedGuest();
+    boolean isGuestAccountEnabled();
+
+    void setGuestAccountEnabled( boolean enabled );
+
+    String getBuildOutput( int buildId, int projectId )
+        throws ConfigurationException;
 
-    void setAllowGuest( boolean allow );
+    File getBuildOutputFile( int buildId, int projectId )
+        throws ConfigurationException;
 
     // ----------------------------------------------------------------------
     //

Modified: maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/configuration/ConfigurationStoringException.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/configuration/ConfigurationStoringException.java?rev=292511&r1=292510&r2=292511&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/configuration/ConfigurationStoringException.java
(original)
+++ maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/configuration/ConfigurationStoringException.java
Thu Sep 29 12:03:46 2005
@@ -1,5 +1,21 @@
 package org.apache.maven.continuum.configuration;
 
+/*
+ * Copyright 2004-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 /**
  * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
  * @version $Id$

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=292511&r1=292510&r2=292511&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 Sep 29 12:03:46 2005
@@ -24,6 +24,7 @@
 import org.apache.maven.continuum.model.project.ProjectNotifier;
 import org.apache.maven.continuum.model.project.Schedule;
 import org.apache.maven.continuum.model.system.Installation;
+import org.apache.maven.continuum.model.system.SystemConfiguration;
 
 import java.io.File;
 import java.util.Collection;
@@ -41,12 +42,6 @@
     Project getProjectByName( String name )
         throws ContinuumStoreException;
 
-    String getBuildOutput( int buildId, int projectId )
-        throws ContinuumStoreException;
-
-    File getBuildOutputFile( int buildId, int projectId )
-        throws ContinuumStoreException;
-
     void removeNotifier( ProjectNotifier notifier )
         throws ContinuumStoreException;
 
@@ -150,5 +145,13 @@
         throws ContinuumObjectNotFoundException, ContinuumStoreException;
 
     ProjectGroup getDefaultProjectGroup()
+        throws ContinuumStoreException;
+
+    SystemConfiguration addSystemConfiguration( SystemConfiguration systemConf );
+
+    void updateSystemConfiguration( SystemConfiguration systemConf )
+        throws ContinuumStoreException;
+
+    SystemConfiguration getSystemConfiguration()
         throws ContinuumStoreException;
 }

Modified: maven/continuum/trunk/continuum-api/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-api/src/main/resources/META-INF/plexus/components.xml?rev=292511&r1=292510&r2=292511&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-api/src/main/resources/META-INF/plexus/components.xml
(original)
+++ maven/continuum/trunk/continuum-api/src/main/resources/META-INF/plexus/components.xml
Thu Sep 29 12:03:46 2005
@@ -1,12 +1,4 @@
 <component-set>
   <components>
-    <component>
-      <role>org.apache.maven.continuum.configuration.ConfigurationService</role>
-      <implementation>org.apache.maven.continuum.configuration.DefaultConfigurationService</implementation>
-      <configuration>
-        <source>${plexus.home}/conf/configuration.xml</source>
-        <application-home>${plexus.home}</application-home>
-      </configuration>
-    </component>
   </components>
 </component-set>

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=292511&r1=292510&r2=292511&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
Thu Sep 29 12:03:46 2005
@@ -64,6 +64,8 @@
 public abstract class AbstractIntegrationTest
     extends PlexusTestCase
 {
+    private ConfigurationService configurationService;
+
     private static final DateFormat progressDateFormat = new SimpleDateFormat( "yyyy.MM.dd
HH:mm:ss" );
 
     private Date startTime;
@@ -177,6 +179,8 @@
         }
 
         AbstractContinuumTest.setUpConfigurationService( (ConfigurationService) lookup( ConfigurationService.ROLE
) );
+
+        configurationService = (ConfigurationService) lookup( ConfigurationService.ROLE );
     }
 
     public final void tearDown()
@@ -602,13 +606,13 @@
             line();
             print( "Output" );
             line();
-            print( getStore().getBuildOutput( buildId, projectId ) );
+            print( configurationService.getBuildOutput( buildId, projectId ) );
             line();
 
             fail( "The build was not successful" );
         }
 
-        String output = getStore().getBuildOutput( buildId, projectId );
+        String output = configurationService.getBuildOutput( buildId, projectId );
 
         assertNotNull( "Output was null.", output );
 
@@ -632,7 +636,7 @@
     {
         BuildResult build = assertSuccessfulBuild( buildId, projectId );
 
-        String output = getStore().getBuildOutput( buildId, projectId );
+        String output = configurationService.getBuildOutput( buildId, projectId );
 
         if ( output.indexOf( "BUILD SUCCESSFUL" ) < 0 )
         {
@@ -648,7 +652,7 @@
     {
         BuildResult build = assertSuccessfulBuild( buildId, projectId );
 
-        String output = getStore().getBuildOutput( buildId, projectId );
+        String output = configurationService.getBuildOutput( buildId, projectId );
 
         assertEquals( "Standard output didn't contain the expected output.", expectedStandardOutput,
output );
 

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=292511&r1=292510&r2=292511&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 Sep 29 12:03:46 2005
@@ -21,6 +21,7 @@
 import org.apache.maven.continuum.buildqueue.BuildProjectTask;
 import org.apache.maven.continuum.configuration.ConfigurationLoadingException;
 import org.apache.maven.continuum.configuration.ConfigurationService;
+import org.apache.maven.continuum.configuration.ConfigurationException;
 import org.apache.maven.continuum.configuration.ConfigurationStoringException;
 import org.apache.maven.continuum.core.action.AbstractContinuumAction;
 import org.apache.maven.continuum.core.action.AddProjectToCheckOutQueueAction;
@@ -334,9 +335,9 @@
     {
         try
         {
-            return store.getBuildOutput( buildId, projectId );
+            return configurationService.getBuildOutput( buildId, projectId );
         }
-        catch ( ContinuumStoreException e )
+        catch ( ConfigurationException e )
         {
             throw logAndCreateException( "Exception while getting build result for project.",
e );
         }
@@ -1102,14 +1103,9 @@
 
         try
         {
-            configurationService.load();
-
-            if ( !configurationService.isInitialized() )
-            {
-                initializer.initialize();
+            initializer.initialize();
 
-                configurationService.setInitialized( true );
-            }
+            configurationService.load();
 
             // ----------------------------------------------------------------------
             // Activate all the Build settings in the system

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=292511&r1=292510&r2=292511&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
Thu Sep 29 12:03:46 2005
@@ -16,6 +16,10 @@
  * limitations under the License.
  */
 
+import org.apache.maven.continuum.model.system.SystemConfiguration;
+import org.apache.maven.continuum.store.ContinuumStore;
+import org.apache.maven.continuum.store.ContinuumStoreException;
+import org.codehaus.plexus.logging.AbstractLogEnabled;
 import org.codehaus.plexus.util.FileUtils;
 import org.codehaus.plexus.util.StringUtils;
 import org.codehaus.plexus.util.xml.Xpp3Dom;
@@ -37,6 +41,7 @@
  * @version $Id$
  */
 public class DefaultConfigurationService
+    extends AbstractLogEnabled
     implements ConfigurationService
 {
     /**
@@ -49,12 +54,19 @@
      */
     private File applicationHome;
 
+    /**
+     * @plexus.requirement
+     */
+    private ContinuumStore store;
+
     // ----------------------------------------------------------------------
     //
     // ----------------------------------------------------------------------
 
     private Xpp3Dom configuration;
 
+    private SystemConfiguration systemConf;
+
     // ----------------------------------------------------------------------
     // Continuum specifics we'll refactor out later
     // ----------------------------------------------------------------------
@@ -77,7 +89,7 @@
 
     private String companyUrl;
 
-    private boolean allowGuest;
+    private boolean guestAccountEnabled;
 
     private static final String LS = System.getProperty( "line.separator" );
 
@@ -87,12 +99,12 @@
 
     public void setInitialized( boolean initialized )
     {
-        this.initialized = initialized;
+        systemConf.setInitialized( initialized );
     }
 
     public boolean isInitialized()
     {
-        return initialized;
+        return systemConf.isInitialized();
     }
 
     public String getUrl()
@@ -170,32 +182,58 @@
         this.companyUrl = companyUrl;
     }
 
-    public boolean isAllowedGuest()
+    public boolean isGuestAccountEnabled()
     {
-        return allowGuest;
+        return systemConf.isGuestAccountEnabled();
     }
 
-    public void setAllowGuest( boolean allow )
+    public void setGuestAccountEnabled( boolean enabled )
     {
-        allowGuest = allow;
+        systemConf.setGuestAccountEnabled( enabled );
+    }
+
+    public String getBuildOutput( int buildId, int projectId )
+        throws ConfigurationException
+    {
+        File file = getBuildOutputFile( buildId, projectId );
+
+        try
+        {
+            return FileUtils.fileRead( file.getAbsolutePath() );
+        }
+        catch ( IOException e )
+        {
+            getLogger().warn( "Error reading build output for build '" + buildId + "'.",
e );
+
+            return null;
+        }
     }
 
     // ----------------------------------------------------------------------
-    // Process configuration to glean application specific values
+    //
     // ----------------------------------------------------------------------
 
-    protected void processInboundConfiguration()
-        throws ConfigurationLoadingException
+    public File getBuildOutputFile( int buildId, int projectId )
+        throws ConfigurationException
     {
-        Xpp3Dom initializedDom = configuration.getChild( CONFIGURATION_INITIALIZED );
+        File dir = new File( getBuildOutputDirectory(), Integer.toString( projectId ) );
 
-        if ( initializedDom != null )
+        if ( !dir.exists() && !dir.mkdirs() )
         {
-            String booleanString = initializedDom.getValue();
-
-            initialized = "true".equals( booleanString ) || "1".equals( booleanString );
+            throw new ConfigurationException(
+                "Could not make the build output directory: " + "'" + dir.getAbsolutePath()
+ "'." );
         }
 
+        return new File( dir, buildId + ".log.txt" );
+    }
+
+    // ----------------------------------------------------------------------
+    // Process configuration to glean application specific values
+    // ----------------------------------------------------------------------
+
+    protected void processInboundConfiguration()
+        throws ConfigurationLoadingException
+    {
         Xpp3Dom urlDom = configuration.getChild( CONFIGURATION_URL );
 
         if ( urlDom != null )
@@ -232,13 +270,6 @@
         {
             companyUrl = companyUrlDom.getValue();
         }
-
-        Xpp3Dom allowGuestDom = configuration.getChild( CONFIGURATION_ALLOW_GUEST );
-
-        if ( allowGuestDom != null )
-        {
-            allowGuest = Boolean.valueOf( allowGuestDom.getValue() ).booleanValue();
-        }
     }
 
     private File getFile( Xpp3Dom configuration, String elementName )
@@ -272,8 +303,6 @@
     {
         configuration = new Xpp3Dom( CONFIGURATION );
 
-        configuration.addChild( createDom( CONFIGURATION_INITIALIZED, Boolean.toString( initialized
) ) );
-
         if ( url != null )
         {
             configuration.addChild( createDom( CONFIGURATION_URL, url ) );
@@ -303,8 +332,6 @@
         {
             configuration.addChild( createDom( CONFIGURATION_COMPANY_URL, companyUrl ) );
         }
-
-        configuration.addChild( createDom( CONFIGURATION_ALLOW_GUEST, String.valueOf( allowGuest
) ) );
     }
 
     protected Xpp3Dom createDom( String elementName, String value )
@@ -335,6 +362,22 @@
     public void load()
         throws ConfigurationLoadingException
     {
+        try
+        {
+            systemConf = store.getSystemConfiguration();
+
+            if ( systemConf == null )
+            {
+                systemConf = new SystemConfiguration();
+
+                systemConf = store.addSystemConfiguration( systemConf );
+            }
+        }
+        catch ( ContinuumStoreException e )
+        {
+            throw new ConfigurationLoadingException( "Error reading configuration from database.",
e );
+        }
+
         if ( inMemoryMode )
         {
             return;
@@ -364,6 +407,15 @@
     public void store()
         throws ConfigurationStoringException
     {
+        try
+        {
+            store.updateSystemConfiguration( systemConf );
+        }
+        catch ( ContinuumStoreException e )
+        {
+            throw new ConfigurationStoringException( "Error writting configuration to database.",
e );
+        }
+
         if ( inMemoryMode )
         {
             return;
@@ -389,7 +441,7 @@
         }
         catch ( IOException e )
         {
-            throw new ConfigurationStoringException( "Error reading configuration '" + source
+ "'.", e );
+            throw new ConfigurationStoringException( "Error writting configuration '" + source
+ "'.", e );
         }
     }
 }

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java?rev=292511&r1=292510&r2=292511&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java
Thu Sep 29 12:03:46 2005
@@ -16,6 +16,7 @@
  * limitations under the License.
  */
 
+import org.apache.maven.continuum.configuration.ConfigurationService;
 import org.apache.maven.continuum.execution.ContinuumBuildExecutionResult;
 import org.apache.maven.continuum.execution.ContinuumBuildExecutor;
 import org.apache.maven.continuum.execution.manager.BuildExecutorManager;
@@ -40,10 +41,24 @@
 public class ExecuteBuilderContinuumAction
     extends AbstractContinuumAction
 {
+    /**
+     * @plexus.requirement
+     */
+    private ConfigurationService configurationService;
+
+    /**
+     * @plexus.requirement
+     */
     private BuildExecutorManager buildExecutorManager;
 
+    /**
+     * @plexus.requirement
+     */
     private ContinuumStore store;
 
+    /**
+     * @plexus.requirement
+     */
     private ContinuumNotificationDispatcher notifier;
 
     public void execute( Map context )
@@ -102,7 +117,7 @@
         {
             notifier.runningGoals( project, build );
 
-            File buildOutputFile = store.getBuildOutputFile( build.getId(), project.getId()
);
+            File buildOutputFile = configurationService.getBuildOutputFile( build.getId(),
project.getId() );
 
             ContinuumBuildExecutionResult result = buildExecutor.build( project, buildDefinition,
buildOutputFile );
 

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=292511&r1=292510&r2=292511&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
Thu Sep 29 12:03:46 2005
@@ -17,6 +17,7 @@
  */
 
 import org.apache.maven.continuum.model.project.Schedule;
+import org.apache.maven.continuum.model.system.SystemConfiguration;
 import org.apache.maven.continuum.store.ContinuumStore;
 import org.apache.maven.continuum.store.ContinuumStoreException;
 import org.codehaus.plexus.logging.AbstractLogEnabled;
@@ -47,13 +48,10 @@
     //TODO: move this to an other place
     public static final String DEFAULT_SCHEDULE_NAME = "DEFAULT_SCHEDULE";
 
-    public static final String DEFAULT_SCHEDULE_DESCRIPTION = "Run hourly";
-
-    // Cron expression for execution every hour.
-    public static final String DEFAULT_SCHEDULE_CRON_EXPRESSION = "0 0 * * * ?";
-
     private Schedule defaultSchedule;
 
+    private SystemConfiguration systemConf;
+
     // ----------------------------------------------------------------------
     //  Requirements
     // ----------------------------------------------------------------------
@@ -74,11 +72,28 @@
 
         try
         {
+            // System Configuration
+            systemConf = store.getSystemConfiguration();
+
+            if ( systemConf == null )
+            {
+                systemConf = new SystemConfiguration();
+
+                systemConf = store.addSystemConfiguration( systemConf );
+            }
+
+            // Schedule
             Schedule s = store.getScheduleByName( DEFAULT_SCHEDULE_NAME );
 
             if ( s != null )
             {
                 defaultSchedule = s;
+
+                defaultSchedule.setDescription( systemConf.getDefaultScheduleDescription()
);
+
+                defaultSchedule.setCronExpression( systemConf.getDefaultScheduleCronExpression()
);
+
+                defaultSchedule = store.storeSchedule( defaultSchedule );
             }
             else
             {
@@ -104,9 +119,9 @@
 
         schedule.setName( DEFAULT_SCHEDULE_NAME );
 
-        schedule.setDescription( DEFAULT_SCHEDULE_DESCRIPTION );
+        schedule.setDescription( systemConf.getDefaultScheduleDescription() );
 
-        schedule.setCronExpression( DEFAULT_SCHEDULE_CRON_EXPRESSION );
+        schedule.setCronExpression( systemConf.getDefaultScheduleCronExpression() );
 
         schedule.setActive( true );
 

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/notification/DefaultContinuumNotificationDispatcher.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/notification/DefaultContinuumNotificationDispatcher.java?rev=292511&r1=292510&r2=292511&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/notification/DefaultContinuumNotificationDispatcher.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/notification/DefaultContinuumNotificationDispatcher.java
Thu Sep 29 12:03:46 2005
@@ -16,6 +16,8 @@
  * limitations under the License.
  */
 
+import org.apache.maven.continuum.configuration.ConfigurationService;
+import org.apache.maven.continuum.configuration.ConfigurationException;
 import org.apache.maven.continuum.model.project.BuildResult;
 import org.apache.maven.continuum.model.project.Project;
 import org.apache.maven.continuum.model.project.ProjectNotifier;
@@ -43,6 +45,11 @@
     /**
      * @plexus.requirement
      */
+    private ConfigurationService configurationService;
+
+    /**
+     * @plexus.requirement
+     */
     private NotifierManager notifierManager;
 
     /**
@@ -119,13 +126,19 @@
 
                 if ( build.getEndTime() != 0 )
                 {
-                    context.put( CONTEXT_BUILD_OUTPUT, store.getBuildOutput( build.getId(),
project.getId() ) );
+                    context.put( CONTEXT_BUILD_OUTPUT, configurationService.getBuildOutput(
build.getId(), project.getId() ) );
                 }
 
                 context.put( CONTEXT_UPDATE_SCM_RESULT, build.getScmResult() );
             }
         }
         catch ( ContinuumStoreException e )
+        {
+            getLogger().error( "Error while population the notification context.", e );
+
+            return;
+        }
+        catch ( ConfigurationException e )
         {
             getLogger().error( "Error while population the notification context.", e );
 

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=292511&r1=292510&r2=292511&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
Thu Sep 29 12:03:46 2005
@@ -37,6 +37,11 @@
     <component>
       <role>org.apache.maven.continuum.configuration.ConfigurationService</role>
       <implementation>org.apache.maven.continuum.configuration.DefaultConfigurationService</implementation>
+      <requirements>
+        <requirement>
+          <role>org.apache.maven.continuum.store.ContinuumStore</role>
+        </requirement>
+      </requirements>
       <configuration>
         <source>${plexus.home}/conf/configuration.xml</source>
         <application-home>${plexus.home}</application-home>
@@ -113,6 +118,9 @@
       <implementation>org.apache.maven.continuum.notification.DefaultContinuumNotificationDispatcher</implementation>
       <requirements>
         <requirement>
+          <role>org.apache.maven.continuum.configuration.ConfigurationService</role>
+        </requirement>
+        <requirement>
           <role>org.codehaus.plexus.notification.notifier.manager.NotifierManager</role>
         </requirement>
         <requirement>
@@ -599,6 +607,9 @@
       <role-hint>execute-builder</role-hint>
       <implementation>org.apache.maven.continuum.core.action.ExecuteBuilderContinuumAction</implementation>
       <requirements>
+        <requirement>
+          <role>org.apache.maven.continuum.configuration.ConfigurationService</role>
+        </requirement>
         <requirement>
           <role>org.apache.maven.continuum.execution.manager.BuildExecutorManager</role>
         </requirement>

Modified: maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/configuration/ConfigurationServiceTest.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/configuration/ConfigurationServiceTest.java?rev=292511&r1=292510&r2=292511&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/configuration/ConfigurationServiceTest.java
(original)
+++ maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/configuration/ConfigurationServiceTest.java
Thu Sep 29 12:03:46 2005
@@ -16,7 +16,7 @@
  * limitations under the License.
  */
 
-import org.codehaus.plexus.PlexusTestCase;
+import org.apache.maven.continuum.AbstractContinuumTest;
 import org.codehaus.plexus.util.FileUtils;
 
 import java.io.File;
@@ -26,7 +26,7 @@
  * @version $Id$
  */
 public class ConfigurationServiceTest
-    extends PlexusTestCase
+    extends AbstractContinuumTest
 {
     protected void setUp()
         throws Exception
@@ -44,6 +44,8 @@
         throws Exception
     {
         ConfigurationService service = (ConfigurationService) lookup( ConfigurationService.ROLE
);
+
+        service.setInMemoryMode( false );
 
         service.load();
 

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=292511&r1=292510&r2=292511&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
Thu Sep 29 12:03:46 2005
@@ -26,6 +26,11 @@
     <component>
       <role>org.apache.maven.continuum.configuration.ConfigurationService</role>
       <implementation>org.apache.maven.continuum.configuration.DefaultConfigurationService</implementation>
+      <requirements>
+        <requirement>
+          <role>org.apache.maven.continuum.store.ContinuumStore</role>
+        </requirement>
+      </requirements>
       <configuration>
         <inMemoryMode>true</inMemoryMode>
       </configuration>

Modified: maven/continuum/trunk/continuum-core/src/test/resources/org/apache/maven/continuum/configuration/ConfigurationServiceTest.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/test/resources/org/apache/maven/continuum/configuration/ConfigurationServiceTest.xml?rev=292511&r1=292510&r2=292511&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/test/resources/org/apache/maven/continuum/configuration/ConfigurationServiceTest.xml
(original)
+++ maven/continuum/trunk/continuum-core/src/test/resources/org/apache/maven/continuum/configuration/ConfigurationServiceTest.xml
Thu Sep 29 12:03:46 2005
@@ -3,6 +3,11 @@
     <component>
       <role>org.apache.maven.continuum.configuration.ConfigurationService</role>
       <implementation>org.apache.maven.continuum.configuration.DefaultConfigurationService</implementation>
+      <requirements>
+        <requirement>
+          <role>org.apache.maven.continuum.store.ContinuumStore</role>
+        </requirement>
+      </requirements>
       <configuration>
         <application-home>${basedir}/target/continuum</application-home>
         <source>${basedir}/target/configuration.xml</source>

Modified: maven/continuum/trunk/continuum-model/src/main/mdo/continuum.mdo
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-model/src/main/mdo/continuum.mdo?rev=292511&r1=292510&r2=292511&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-model/src/main/mdo/continuum.mdo (original)
+++ maven/continuum/trunk/continuum-model/src/main/mdo/continuum.mdo Thu Sep 29 12:03:46 2005
@@ -682,6 +682,24 @@
           <type>boolean</type>
           <defaultValue>true</defaultValue>
         </field>
+        <field>
+          <name>defaultScheduleDescription</name>
+          <version>1.0.0+</version>
+          <type>String</type>
+          <defaultValue>Run hourly</defaultValue>
+        </field>
+        <field>
+          <name>defaultScheduleCronExpression</name>
+          <version>1.0.0+</version>
+          <type>String</type>
+          <defaultValue>0 0 * * * ?</defaultValue>
+        </field>
+        <field>
+          <name>initialized</name>
+          <version>1.0.0+</version>
+          <type>boolean</type>
+          <defaultValue>false</defaultValue>
+        </field>
       </fields>
     </class>
 

Modified: maven/continuum/trunk/continuum-store/src/main/java/org/apache/maven/continuum/store/AbstractContinuumStore.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-store/src/main/java/org/apache/maven/continuum/store/AbstractContinuumStore.java?rev=292511&r1=292510&r2=292511&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-store/src/main/java/org/apache/maven/continuum/store/AbstractContinuumStore.java
(original)
+++ maven/continuum/trunk/continuum-store/src/main/java/org/apache/maven/continuum/store/AbstractContinuumStore.java
Thu Sep 29 12:03:46 2005
@@ -32,43 +32,4 @@
     extends AbstractLogEnabled
     implements ContinuumStore
 {
-    /**
-     * @plexus.requirement
-     */
-    private ConfigurationService configurationService;
-
-    public String getBuildOutput( int buildId, int projectId )
-        throws ContinuumStoreException
-    {
-        File file = getBuildOutputFile( buildId, projectId );
-
-        try
-        {
-            return FileUtils.fileRead( file.getAbsolutePath() );
-        }
-        catch ( IOException e )
-        {
-            getLogger().warn( "Error reading build output for build '" + buildId + "'.",
e );
-
-            return null;
-        }
-    }
-
-    // ----------------------------------------------------------------------
-    //
-    // ----------------------------------------------------------------------
-
-    public File getBuildOutputFile( int buildId, int projectId )
-        throws ContinuumStoreException
-    {
-        File dir = new File( configurationService.getBuildOutputDirectory(), Integer.toString(
projectId ) );
-
-        if ( !dir.exists() && !dir.mkdirs() )
-        {
-            throw new ContinuumStoreException(
-                "Could not make the build output directory: " + "'" + dir.getAbsolutePath()
+ "'." );
-        }
-
-        return new File( dir, buildId + ".log.txt" );
-    }
 }

Modified: maven/continuum/trunk/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java?rev=292511&r1=292510&r2=292511&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java
(original)
+++ maven/continuum/trunk/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java
Thu Sep 29 12:03:46 2005
@@ -24,6 +24,7 @@
 import org.apache.maven.continuum.model.project.ProjectNotifier;
 import org.apache.maven.continuum.model.project.Schedule;
 import org.apache.maven.continuum.model.system.Installation;
+import org.apache.maven.continuum.model.system.SystemConfiguration;
 import org.apache.maven.continuum.project.ContinuumProjectState;
 import org.codehaus.plexus.jdo.JdoFactory;
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
@@ -732,6 +733,16 @@
         }
     }
 
+    private List getAllObjectsDetached( Class clazz )
+    {
+        return getAllObjectsDetached( clazz, null, null );
+    }
+
+    private List getAllObjectsDetached( Class clazz, String fetchGroup )
+    {
+        return getAllObjectsDetached( clazz, null, fetchGroup );
+    }
+
     private List getAllObjectsDetached( Class clazz, String ordering, String fetchGroup )
     {
         PersistenceManager pm = pmf.getPersistenceManager();
@@ -746,7 +757,10 @@
 
             Query query = pm.newQuery( extent );
 
-            query.setOrdering( ordering );
+            if ( ordering != null )
+            {
+                query.setOrdering( ordering );
+            }
 
             if ( fetchGroup != null )
             {
@@ -825,5 +839,35 @@
             group = addProjectGroup( group );
         }
         return group;
+    }
+
+    public SystemConfiguration addSystemConfiguration( SystemConfiguration systemConf )
+    {
+        return (SystemConfiguration) addObject( systemConf );
+    }
+
+    public void updateSystemConfiguration( SystemConfiguration systemConf )
+        throws ContinuumStoreException
+    {
+        updateObject( systemConf );
+    }
+
+    public SystemConfiguration getSystemConfiguration()
+        throws ContinuumStoreException
+    {
+        List systemConfs = getAllObjectsDetached( SystemConfiguration.class );
+
+        if ( systemConfs == null || systemConfs.isEmpty() )
+        {
+            return null;
+        }
+        else if ( systemConfs.size() > 1 )
+        {
+            throw new ContinuumStoreException( "Database is corrupted. There are more than
one systemConfiguration object." );
+        }
+        else
+        {
+            return (SystemConfiguration) systemConfs.get( 0 );
+        }
     }
 }

Modified: maven/continuum/trunk/continuum-store/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-store/src/main/resources/META-INF/plexus/components.xml?rev=292511&r1=292510&r2=292511&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-store/src/main/resources/META-INF/plexus/components.xml
(original)
+++ maven/continuum/trunk/continuum-store/src/main/resources/META-INF/plexus/components.xml
Thu Sep 29 12:03:46 2005
@@ -1,18 +1,5 @@
 <component-set>
   <components>
-    <!-- 
-    <component>
-      <role>org.apache.maven.continuum.store.ContinuumStore</role>
-      <role-hint>modello</role-hint>
-      <implementation>org.apache.maven.continuum.store.ModelloJPoxContinuumStore</implementation>
-      <requirements>
-        <requirement>
-          <role>org.codehaus.plexus.jdo.JdoFactory</role>
-        </requirement>
-      </requirements>
-    </component>
-    -->
-
     <component>
       <role>org.apache.maven.continuum.store.ContinuumStore</role>
       <role-hint>jdo</role-hint>
@@ -20,9 +7,6 @@
       <requirements>
         <requirement>
           <role>org.codehaus.plexus.jdo.JdoFactory</role>
-        </requirement>
-        <requirement>
-          <role>org.apache.maven.continuum.configuration.ConfigurationService</role>
         </requirement>
       </requirements>
     </component>

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=292511&r1=292510&r2=292511&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
Thu Sep 29 12:03:46 2005
@@ -58,9 +58,9 @@
     {
         super.setUp();
 
-        setUpConfigurationService( (ConfigurationService) lookup( ConfigurationService.ROLE
) );
-
         getStore();
+
+        setUpConfigurationService( (ConfigurationService) lookup( ConfigurationService.ROLE
) );
     }
 
     public static void setUpConfigurationService( ConfigurationService configurationService
)

Modified: maven/continuum/trunk/continuum-web/src/main/java/org/apache/maven/continuum/web/pipeline/valve/LoginValve.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-web/src/main/java/org/apache/maven/continuum/web/pipeline/valve/LoginValve.java?rev=292511&r1=292510&r2=292511&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-web/src/main/java/org/apache/maven/continuum/web/pipeline/valve/LoginValve.java
(original)
+++ maven/continuum/trunk/continuum-web/src/main/java/org/apache/maven/continuum/web/pipeline/valve/LoginValve.java
Thu Sep 29 12:03:46 2005
@@ -34,6 +34,6 @@
 
     public boolean isAllowedGuest()
     {
-        return configurationService.isAllowedGuest();
+        return configurationService.isGuestAccountEnabled();
     }
 }

Modified: maven/continuum/trunk/continuum-xmlrpc/src/test/resources/org/apache/maven/continuum/xmlrpc/ContinuumXmlRpcTest.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-xmlrpc/src/test/resources/org/apache/maven/continuum/xmlrpc/ContinuumXmlRpcTest.xml?rev=292511&r1=292510&r2=292511&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-xmlrpc/src/test/resources/org/apache/maven/continuum/xmlrpc/ContinuumXmlRpcTest.xml
(original)
+++ maven/continuum/trunk/continuum-xmlrpc/src/test/resources/org/apache/maven/continuum/xmlrpc/ContinuumXmlRpcTest.xml
Thu Sep 29 12:03:46 2005
@@ -3,6 +3,11 @@
     <component>
       <role>org.apache.maven.continuum.configuration.ConfigurationService</role>
       <implementation>org.apache.maven.continuum.configuration.DefaultConfigurationService</implementation>
+      <requirements>
+        <requirement>
+          <role>org.apache.maven.continuum.store.ContinuumStore</role>
+        </requirement>
+      </requirements>
       <configuration>
         <inMemoryMode>true</inMemoryMode>
       </configuration>



Mime
View raw message