continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r690494 - in /continuum/trunk: continuum-api/src/main/java/org/apache/continuum/configuration/ continuum-api/src/main/java/org/apache/maven/continuum/ continuum-base/continuum-configuration/ continuum-base/continuum-configuration/src/main/j...
Date Sat, 30 Aug 2008 11:20:56 GMT
Author: olamy
Date: Sat Aug 30 04:20:55 2008
New Revision: 690494

URL: http://svn.apache.org/viewvc?rev=690494&view=rev
Log:
[CONTINUUM-1252] General Configuration should be pre-configurable in XML

switch to modello


Added:
    continuum/trunk/continuum-base/continuum-configuration/src/main/mdo/
    continuum/trunk/continuum-base/continuum-configuration/src/main/mdo/continuum-configuration.xml
  (with props)
Removed:
    continuum/trunk/continuum-base/continuum-configuration/src/test/resources/META-INF/
Modified:
    continuum/trunk/continuum-api/src/main/java/org/apache/continuum/configuration/ContinuumConfiguration.java
    continuum/trunk/continuum-api/src/main/java/org/apache/continuum/configuration/ProxyConfiguration.java
    continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
    continuum/trunk/continuum-base/continuum-configuration/pom.xml
    continuum/trunk/continuum-base/continuum-configuration/src/main/java/org/apache/continuum/configuration/DefaultContinuumConfiguration.java
    continuum/trunk/continuum-base/continuum-configuration/src/main/resources/META-INF/spring-context.xml
    continuum/trunk/continuum-base/continuum-configuration/src/test/java/org/apache/continuum/configuration/TestDefaultContinuumConfiguration.java
    continuum/trunk/continuum-base/continuum-configuration/src/test/resources/conf/continuum.xml
    continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java

Modified: continuum/trunk/continuum-api/src/main/java/org/apache/continuum/configuration/ContinuumConfiguration.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-api/src/main/java/org/apache/continuum/configuration/ContinuumConfiguration.java?rev=690494&r1=690493&r2=690494&view=diff
==============================================================================
--- continuum/trunk/continuum-api/src/main/java/org/apache/continuum/configuration/ContinuumConfiguration.java
(original)
+++ continuum/trunk/continuum-api/src/main/java/org/apache/continuum/configuration/ContinuumConfiguration.java
Sat Aug 30 04:20:55 2008
@@ -1,5 +1,7 @@
 package org.apache.continuum.configuration;
 
+import java.io.File;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -26,6 +28,10 @@
  */
 public interface ContinuumConfiguration
 {
+    /**
+     * @return an empty or a filled on but never null !
+     * @throws ContinuumConfigurationException
+     */
     GeneralConfiguration getGeneralConfiguration()
         throws ContinuumConfigurationException;
 
@@ -35,6 +41,12 @@
     void save()
         throws ContinuumConfigurationException;
 
-    void reload()
+    void save( File file )
+        throws ContinuumConfigurationException;
+
+    void reload( )
+    throws ContinuumConfigurationException;    
+    
+    void reload( File file )
         throws ContinuumConfigurationException;
 }

Modified: continuum/trunk/continuum-api/src/main/java/org/apache/continuum/configuration/ProxyConfiguration.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-api/src/main/java/org/apache/continuum/configuration/ProxyConfiguration.java?rev=690494&r1=690493&r2=690494&view=diff
==============================================================================
--- continuum/trunk/continuum-api/src/main/java/org/apache/continuum/configuration/ProxyConfiguration.java
(original)
+++ continuum/trunk/continuum-api/src/main/java/org/apache/continuum/configuration/ProxyConfiguration.java
Sat Aug 30 04:20:55 2008
@@ -19,6 +19,8 @@
  * under the License.
  */
 
+
+
 import org.apache.commons.lang.builder.ReflectionToStringBuilder;
 
 /**
@@ -35,11 +37,20 @@
     private String proxyUser;
 
     private String proxyPassword;
-
+    
     public ProxyConfiguration()
     {
         // nothing here
     }
+    
+    public ProxyConfiguration( String proxyHost, String proxyPassword, int proxyPort, String
proxyUser )
+    {
+        super();
+        this.proxyHost = proxyHost;
+        this.proxyPassword = proxyPassword;
+        this.proxyPort = proxyPort;
+        this.proxyUser = proxyUser;
+    }
 
     public String getProxyHost()
     {
@@ -86,4 +97,5 @@
     {
         return ReflectionToStringBuilder.toString( this );
     }
+
 }

Modified: continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java?rev=690494&r1=690493&r2=690494&view=diff
==============================================================================
--- continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
(original)
+++ continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
Sat Aug 30 04:20:55 2008
@@ -615,9 +615,6 @@
 
     ConfigurationService getConfiguration();
 
-    void updateConfiguration( Map<String, Object> parameters )
-        throws ContinuumException;
-
     void reloadConfiguration()
         throws ContinuumException;
 

Modified: continuum/trunk/continuum-base/continuum-configuration/pom.xml
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-base/continuum-configuration/pom.xml?rev=690494&r1=690493&r2=690494&view=diff
==============================================================================
--- continuum/trunk/continuum-base/continuum-configuration/pom.xml (original)
+++ continuum/trunk/continuum-base/continuum-configuration/pom.xml Sat Aug 30 04:20:55 2008
@@ -26,6 +26,31 @@
   <modelVersion>4.0.0</modelVersion>
   <artifactId>continuum-configuration</artifactId>
   <name>Continuum :: Configuration</name>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.codehaus.modello</groupId>
+        <artifactId>modello-maven-plugin</artifactId>
+        <configuration>
+          <models>
+            <model>src/main/mdo/continuum-configuration.xml</model>
+          </models>
+          <version>1.0.0</version>
+        </configuration>
+        <executions>
+          <execution>
+            <id>continuum-modello</id>
+            <phase>generate-sources</phase>
+            <goals>
+              <goal>java</goal>
+              <goal>xpp3-reader</goal>
+              <goal>xpp3-writer</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
   <dependencies>
     <dependency>
       <groupId>org.apache.continuum</groupId>

Modified: continuum/trunk/continuum-base/continuum-configuration/src/main/java/org/apache/continuum/configuration/DefaultContinuumConfiguration.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-base/continuum-configuration/src/main/java/org/apache/continuum/configuration/DefaultContinuumConfiguration.java?rev=690494&r1=690493&r2=690494&view=diff
==============================================================================
--- continuum/trunk/continuum-base/continuum-configuration/src/main/java/org/apache/continuum/configuration/DefaultContinuumConfiguration.java
(original)
+++ continuum/trunk/continuum-base/continuum-configuration/src/main/java/org/apache/continuum/configuration/DefaultContinuumConfiguration.java
Sat Aug 30 04:20:55 2008
@@ -19,16 +19,19 @@
  * under the License.
  */
 
-import org.apache.commons.configuration.CombinedConfiguration;
-import org.apache.commons.configuration.Configuration;
-import org.apache.commons.configuration.DefaultConfigurationBuilder;
-import org.apache.commons.configuration.FileConfiguration;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.core.io.ClassPathResource;
-
 import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileWriter;
 import java.io.IOException;
+import java.io.InputStreamReader;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.continuum.configuration.model.ContinuumConfigurationModel;
+import org.apache.continuum.configuration.model.io.xpp3.ContinuumConfigurationModelXpp3Reader;
+import org.apache.continuum.configuration.model.io.xpp3.ContinuumConfigurationModelXpp3Writer;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * @author <a href="mailto:olamy@apache.org">olamy</a>
@@ -40,28 +43,10 @@
 {
     private Logger log = LoggerFactory.getLogger( getClass() );
 
-    private ClassPathResource classPathResource;
-
-    private Configuration configuration;
+    private File configurationFile;
 
     private GeneralConfiguration generalConfiguration;
 
-    public static final String BASE_URL_KEY = "continuum.baseUrl";
-
-    public static final String BUILDOUTPUT_DIR_KEY = "continuum.buildOutputDirectory";
-
-    public static final String DEPLOYMENT_REPOSITORY_DIR_KEY = "continuum.deploymentRepositoryDirectory";
-
-    public static final String WORKING_DIR_KEY = "continuum.workingDirectory";
-
-    public static final String PROXY_HOST_KEY = "continuum.proxyHost";
-
-    public static final String PROXY_PORT_KEY = "continuum.proxyPort";
-
-    public static final String PROXY_USER_KEY = "continuum.proxyUser";
-
-    public static final String PROXY_PASSWORD_KEY = "continuum.proxyPassword";
-
     //----------------------------------------------------
     //  Initialize method configured in the Spring xml 
     //   configuration file
@@ -70,70 +55,25 @@
     {
         if ( log.isDebugEnabled() )
         {
-            log.debug( "classPathResource null " + ( classPathResource == null ) );
+            log.debug( "configurationFile null " + ( configurationFile.getPath() == null
) );
         }
-
-        try
+        if ( configurationFile != null && configurationFile.exists() )
         {
-            DefaultConfigurationBuilder defaultConfigurationBuilder =
-                new DefaultConfigurationBuilder( classPathResource.getURL() );
-            defaultConfigurationBuilder.load( classPathResource.getInputStream() );
-
-            CombinedConfiguration combinedConfiguration = defaultConfigurationBuilder.getConfiguration(
false );
-            configuration = combinedConfiguration.getConfiguration( "org.apache.continuum"
);
-
-            this.generalConfiguration = new GeneralConfiguration();
-            this.generalConfiguration.setBaseUrl( getConfigurationString( BASE_URL_KEY )
);
-            log.info( "BaseUrl=" + this.generalConfiguration.getBaseUrl() );
-            // TODO check if files exists ?
-            String buildOutputDirectory = getConfigurationString( BUILDOUTPUT_DIR_KEY );
-            if ( buildOutputDirectory != null )
-            {
-                this.generalConfiguration.setBuildOutputDirectory( new File( buildOutputDirectory
) );
-            }
-            String deploymentRepositoryDirectory = getConfigurationString( DEPLOYMENT_REPOSITORY_DIR_KEY
);
-            if ( deploymentRepositoryDirectory != null )
+            try
             {
-                this.generalConfiguration.setDeploymentRepositoryDirectory( new File( deploymentRepositoryDirectory
) );
+                reload( configurationFile );
             }
-            String workingDirectory = getConfigurationString( WORKING_DIR_KEY );
-            if ( workingDirectory != null )
+            catch ( ContinuumConfigurationException e )
             {
-                this.generalConfiguration.setWorkingDirectory( new File( workingDirectory
) );
+                // skip this and only log a warn
+                log.warn( " error on loading configuration from file " + configurationFile.getPath()
);
             }
-
-            this.generalConfiguration.setProxyConfiguration( new ProxyConfiguration() );
-            this.generalConfiguration.getProxyConfiguration().setProxyHost( getConfigurationString(
PROXY_HOST_KEY ) );
-            this.generalConfiguration.getProxyConfiguration().setProxyPort(
-                getConfigurationValue( PROXY_PORT_KEY, 0 ) );
-            this.generalConfiguration.getProxyConfiguration().setProxyUser( getConfigurationString(
PROXY_USER_KEY ) );
-            this.generalConfiguration.getProxyConfiguration().setProxyPassword( configuration
-                .getString( PROXY_PASSWORD_KEY ) );
-        }
-        catch ( org.apache.commons.configuration.ConfigurationException e )
-        {
-            log.error( e.getMessage(), e );
-            throw new RuntimeException( e.getMessage(), e );
         }
-        catch ( IOException e )
+        else
         {
-            log.error( e.getMessage(), e );
-            throw new RuntimeException( e.getMessage(), e );
-        }
-    }
-
-    private String getConfigurationString( String key )
-    {
-        if ( log.isDebugEnabled() )
-        {
-            log.debug( "Configuration=" + configuration );
+            log.info( "configuration file not exists" );
+            this.generalConfiguration = new GeneralConfiguration();
         }
-        return configuration.getString( key );
-    }
-
-    private int getConfigurationValue( String key, int defaultValue )
-    {
-        return configuration.getInt( key, defaultValue );
     }
 
     public void reload()
@@ -145,15 +85,11 @@
     public void save()
         throws ContinuumConfigurationException
     {
-        FileConfiguration fileConfiguration = (FileConfiguration) configuration;
-        try
+        if ( !configurationFile.exists() )
         {
-            fileConfiguration.save();
-        }
-        catch ( org.apache.commons.configuration.ConfigurationException e )
-        {
-            throw new ContinuumConfigurationException( e.getMessage(), e );
+            configurationFile.getParentFile().mkdir();
         }
+        save( configurationFile );
     }
 
     /**
@@ -169,44 +105,124 @@
         throws ContinuumConfigurationException
     {
         this.generalConfiguration = generalConfiguration;
-        this.configuration.setProperty( BASE_URL_KEY, generalConfiguration.getBaseUrl() );
-        if ( generalConfiguration.getBuildOutputDirectory() != null )
+    }
+    
+    public void reload( File file )
+        throws ContinuumConfigurationException
+    {
+        try
         {
-            this.configuration.setProperty( BUILDOUTPUT_DIR_KEY, generalConfiguration.getBuildOutputDirectory()
-                .getPath() );
+            ContinuumConfigurationModelXpp3Reader configurationXpp3Reader = new ContinuumConfigurationModelXpp3Reader();
+            ContinuumConfigurationModel configuration = configurationXpp3Reader
+                .read( new InputStreamReader( new FileInputStream( file ) ) );
+
+            this.generalConfiguration = new GeneralConfiguration();
+            this.generalConfiguration.setBaseUrl( configuration.getBaseUrl() );
+            if ( StringUtils.isNotEmpty( configuration.getBuildOutputDirectory() ) )
+            {
+                // TODO take care if file exists ?
+                this.generalConfiguration.setBuildOutputDirectory( new File( configuration
+                    .getBuildOutputDirectory() ) );
+            }
+            if ( StringUtils.isNotEmpty( configuration.getDeploymentRepositoryDirectory()
) )
+            {
+                // TODO take care if file exists ?
+                this.generalConfiguration.setDeploymentRepositoryDirectory( new File( configuration
+                    .getDeploymentRepositoryDirectory() ) );
+            }
+            if ( StringUtils.isNotEmpty( configuration.getWorkingDirectory() ) )
+            {
+                // TODO take care if file exists ?
+                this.generalConfiguration.setWorkingDirectory( new File( configuration.getWorkingDirectory()
) );
+            }
+            if ( configuration.getProxyConfiguration() != null )
+            {
+                ProxyConfiguration proxyConfiguration = new ProxyConfiguration( configuration
+                    .getProxyConfiguration().getProxyHost(), configuration.getProxyConfiguration()
+                    .getProxyPassword(), configuration.getProxyConfiguration().getProxyPort(),
configuration
+                    .getProxyConfiguration().getProxyUser() );
+                this.generalConfiguration.setProxyConfiguration( proxyConfiguration );
+            }
+        }
+        catch ( IOException e )
+        {
+            log.error( e.getMessage(), e );
+            throw new RuntimeException( e.getMessage(), e );
         }
-        if ( generalConfiguration.getDeploymentRepositoryDirectory() != null )
+        catch ( XmlPullParserException e )
         {
-            this.configuration.setProperty( DEPLOYMENT_REPOSITORY_DIR_KEY, generalConfiguration
-                .getDeploymentRepositoryDirectory().getPath() );
+            log.error( e.getMessage(), e );
+            throw new RuntimeException( e.getMessage(), e );
         }
-        if ( generalConfiguration.getWorkingDirectory() != null )
+        
+    }
+
+    public void save( File file )
+        throws ContinuumConfigurationException
+    {
+        try
         {
-            this.configuration.setProperty( WORKING_DIR_KEY, generalConfiguration.getWorkingDirectory().getPath()
);
+            ContinuumConfigurationModel configurationModel = new ContinuumConfigurationModel();
+            configurationModel.setBaseUrl( this.generalConfiguration.getBaseUrl() );
+            // normally not null but NPE free is better !
+            if ( this.generalConfiguration.getBuildOutputDirectory() != null )
+            {
+                configurationModel.setBuildOutputDirectory( this.generalConfiguration.getBuildOutputDirectory()
+                    .getPath() );
+            }
+            if ( this.generalConfiguration.getWorkingDirectory() != null )
+            {
+                configurationModel.setWorkingDirectory( this.generalConfiguration.getWorkingDirectory().getPath()
);
+            }
+            if ( this.generalConfiguration.getDeploymentRepositoryDirectory() != null )
+            {
+                configurationModel.setDeploymentRepositoryDirectory( this.generalConfiguration
+                    .getDeploymentRepositoryDirectory().getPath() );
+            }
+            if ( this.generalConfiguration.getProxyConfiguration() != null )
+            {
+                configurationModel
+                    .setProxyConfiguration( new org.apache.continuum.configuration.model.ProxyConfiguration()
);
+                configurationModel.getProxyConfiguration().setProxyHost(
+                                                                         this.generalConfiguration
+                                                                             .getProxyConfiguration().getProxyHost()
);
+                configurationModel.getProxyConfiguration().setProxyPassword(
+                                                                             this.generalConfiguration
+                                                                                 .getProxyConfiguration()
+                                                                                 .getProxyPassword()
);
+                configurationModel.getProxyConfiguration().setProxyPort(
+                                                                         this.generalConfiguration
+                                                                             .getProxyConfiguration().getProxyPort()
);
+                configurationModel.getProxyConfiguration().setProxyHost(
+                                                                         this.generalConfiguration
+                                                                             .getProxyConfiguration().getProxyHost()
);
+            }
+
+            ContinuumConfigurationModelXpp3Writer writer = new ContinuumConfigurationModelXpp3Writer();
+            FileWriter fileWriter = new FileWriter( file );
+            writer.write( fileWriter, configurationModel );
         }
-        ProxyConfiguration proxyConfiguration = this.generalConfiguration.getProxyConfiguration();
-        if ( proxyConfiguration != null )
+        catch ( IOException e )
         {
-            this.configuration.setProperty( PROXY_HOST_KEY, proxyConfiguration.getProxyHost()
);
-            this.configuration.setProperty( PROXY_PORT_KEY, proxyConfiguration.getProxyPort()
);
-            this.configuration.setProperty( PROXY_USER_KEY, proxyConfiguration.getProxyUser()
);
-            this.configuration.setProperty( PROXY_PASSWORD_KEY, proxyConfiguration.getProxyPassword()
);
+            throw new ContinuumConfigurationException( e.getMessage(), e );
         }
+        
     }
-
+    
+    
     // ----------------------------------------
     //  Spring injection
     // ----------------------------------------
 
-    public ClassPathResource getClassPathResource()
+
+    public File getConfigurationFile()
     {
-        return classPathResource;
+        return configurationFile;
     }
 
-
-    public void setClassPathResource( ClassPathResource classPathResource )
+    public void setConfigurationFile( File configurationFile )
     {
-        this.classPathResource = classPathResource;
+        this.configurationFile = configurationFile;
     }
-
+    
 }

Added: continuum/trunk/continuum-base/continuum-configuration/src/main/mdo/continuum-configuration.xml
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-base/continuum-configuration/src/main/mdo/continuum-configuration.xml?rev=690494&view=auto
==============================================================================
--- continuum/trunk/continuum-base/continuum-configuration/src/main/mdo/continuum-configuration.xml
(added)
+++ continuum/trunk/continuum-base/continuum-configuration/src/main/mdo/continuum-configuration.xml
Sat Aug 30 04:20:55 2008
@@ -0,0 +1,93 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you 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.
+  -->
+
+<model>
+  <id>continuum-configuration</id>
+  <name>ContinuumConfigurationModel</name>
+  <description>Continuum Configuration object model.</description>
+  <defaults>
+    <default>
+      <key>package</key>
+      <value>org.apache.continuum.configuration.model</value>
+    </default>
+  </defaults>
+
+  <classes>
+    <class rootElement="true" xml.tagName="continuum-configuration">
+      <name>ContinuumConfigurationModel</name>
+      <version>1.0.0+</version>
+      <fields>
+        <field>
+          <name>baseUrl</name>
+          <version>1.0.0+</version>
+          <type>String</type>
+        </field>
+        <field>
+          <name>buildOutputDirectory</name>
+          <version>1.0.0+</version>
+          <type>String</type>
+        </field>
+        <field>
+          <name>deploymentRepositoryDirectory</name>
+          <version>1.0.0+</version>
+          <type>String</type>
+        </field>   
+        <field>
+          <name>workingDirectory</name>
+          <version>1.0.0+</version>
+          <type>String</type>
+        </field>
+        <field>
+          <name>proxyConfiguration</name>
+          <version>1.0.0+</version>
+          <association>
+            <type>ProxyConfiguration</type>
+            <multiplicity>1</multiplicity>
+          </association>          
+        </field>                     
+      </fields>
+    </class>
+    <class xml.tagName="proxy-configuration">
+      <name>ProxyConfiguration</name>
+      <version>1.0.0+</version>
+      <fields>
+        <field>
+          <name>proxyHost</name>
+          <version>1.0.0+</version>
+          <type>String</type>
+        </field>
+        <field>
+          <name>proxyPort</name>
+          <version>1.0.0+</version>
+          <type>int</type>
+        </field>
+        <field>
+          <name>proxyUser</name>
+          <version>1.0.0+</version>
+          <type>String</type>
+        </field>   
+        <field>
+          <name>proxyPassword</name>
+          <version>1.0.0+</version>
+          <type>String</type>
+        </field>                     
+      </fields>
+    </class>    
+  </classes>
+</model>

Propchange: continuum/trunk/continuum-base/continuum-configuration/src/main/mdo/continuum-configuration.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/trunk/continuum-base/continuum-configuration/src/main/mdo/continuum-configuration.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: continuum/trunk/continuum-base/continuum-configuration/src/main/resources/META-INF/spring-context.xml
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-base/continuum-configuration/src/main/resources/META-INF/spring-context.xml?rev=690494&r1=690493&r2=690494&view=diff
==============================================================================
--- continuum/trunk/continuum-base/continuum-configuration/src/main/resources/META-INF/spring-context.xml
(original)
+++ continuum/trunk/continuum-base/continuum-configuration/src/main/resources/META-INF/spring-context.xml
Sat Aug 30 04:20:55 2008
@@ -25,6 +25,6 @@
 
   <bean id="continuumConfiguration" class="org.apache.continuum.configuration.DefaultContinuumConfiguration"
         init-method="initialize">
-    <property name="classPathResource" value="classpath:META-INF/continuum/continuum-configuration.xml"/>
+    <property name="configurationFile" value="file:${appserver.base}/conf/continuum.xml"/>
   </bean>
 </beans>
\ No newline at end of file

Modified: continuum/trunk/continuum-base/continuum-configuration/src/test/java/org/apache/continuum/configuration/TestDefaultContinuumConfiguration.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-base/continuum-configuration/src/test/java/org/apache/continuum/configuration/TestDefaultContinuumConfiguration.java?rev=690494&r1=690493&r2=690494&view=diff
==============================================================================
--- continuum/trunk/continuum-base/continuum-configuration/src/test/java/org/apache/continuum/configuration/TestDefaultContinuumConfiguration.java
(original)
+++ continuum/trunk/continuum-base/continuum-configuration/src/test/java/org/apache/continuum/configuration/TestDefaultContinuumConfiguration.java
Sat Aug 30 04:20:55 2008
@@ -42,14 +42,17 @@
     protected void setUp()
         throws Exception
     {
+        log.info( "appserver.base : " + System.getProperty( "appserver.base" ) );
+        
         File originalConf = new File( getBasedir(), "src/test/resources/conf/continuum.xml"
);
-
+        
         File confUsed = new File( getBasedir(), confFile );
         if ( confUsed.exists() )
         {
             confUsed.delete();
         }
         FileUtils.copyFile( originalConf, confUsed );
+        
         super.setUp();
     }
 
@@ -82,6 +85,8 @@
         generalConfiguration.setProxyConfiguration( new ProxyConfiguration() );
         generalConfiguration.getProxyConfiguration().setProxyHost( "localhost" );
         generalConfiguration.getProxyConfiguration().setProxyPort( 8080 );
+        File targetDir = new File(getBasedir(), "target");
+        generalConfiguration.setBuildOutputDirectory( targetDir );
         configuration.setGeneralConfiguration( generalConfiguration );
         configuration.save();
 
@@ -94,6 +99,7 @@
         assertEquals( "http://test/zloug", configuration.getGeneralConfiguration().getBaseUrl()
);
         assertEquals( "localhost", configuration.getGeneralConfiguration().getProxyConfiguration().getProxyHost()
);
         assertEquals( 8080, configuration.getGeneralConfiguration().getProxyConfiguration().getProxyPort()
);
+        assertEquals(targetDir.getPath(), configuration.getGeneralConfiguration().getBuildOutputDirectory().getPath());
         log.info( "generalConfiguration " + configuration.getGeneralConfiguration().toString()
);
     }
 }

Modified: continuum/trunk/continuum-base/continuum-configuration/src/test/resources/conf/continuum.xml
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-base/continuum-configuration/src/test/resources/conf/continuum.xml?rev=690494&r1=690493&r2=690494&view=diff
==============================================================================
--- continuum/trunk/continuum-base/continuum-configuration/src/test/resources/conf/continuum.xml
(original)
+++ continuum/trunk/continuum-base/continuum-configuration/src/test/resources/conf/continuum.xml
Sat Aug 30 04:20:55 2008
@@ -1,7 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<configuration>
-  <continuum>
-    <baseUrl>http://test</baseUrl>
-    <buildOutputDirectory>myBuildOutputDir</buildOutputDirectory>
-  </continuum>
-</configuration>
\ No newline at end of file
+<continuum-configuration>
+  <baseUrl>http://test</baseUrl>
+  <buildOutputDirectory>myBuildOutputDir</buildOutputDirectory>
+</continuum-configuration>
\ No newline at end of file

Modified: continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java?rev=690494&r1=690493&r2=690494&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
(original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
Sat Aug 30 04:20:55 2008
@@ -2702,54 +2702,6 @@
         return configurationService;
     }
 
-    public void updateConfiguration( Map<String, Object> configuration )
-        throws ContinuumException
-    {
-        try
-        {
-            if ( configuration.get( "conf.workingDirectory" ) != null )
-            {
-                configurationService.setWorkingDirectory( configurationService.getFile( (String)
configuration
-                    .get( "conf.workingDirectory" ) ) );
-            }
-            else
-            {
-                throw new ContinuumException( "working directory can't be null" );
-            }
-
-            if ( configuration.get( "conf.buildOutputDirectory" ) != null )
-            {
-                configurationService.setBuildOutputDirectory( configurationService.getFile(
(String) configuration
-                    .get( "conf.buildOutputDirectory" ) ) );
-            }
-            else
-            {
-                throw new ContinuumException( "build output directory can't be null" );
-            }
-
-            if ( configuration.get( "conf.deploymentRepositoryDirectory" ) != null )
-            {
-                configurationService.setDeploymentRepositoryDirectory( configurationService
-                    .getFile( (String) configuration.get( "conf.deploymentRepositoryDirectory"
) ) );
-            }
-
-            if ( configuration.get( "conf.url" ) != null )
-            {
-                configurationService.setUrl( (String) configuration.get( "conf.url" ) );
-            }
-            else
-            {
-                throw new ContinuumException( "base url can't be null" );
-            }
-
-            configurationService.store();
-        }
-        catch ( Exception e )
-        {
-            throw new ContinuumException( "Can't store configuration.", e );
-        }
-    }
-
     public void reloadConfiguration()
         throws ContinuumException
     {



Mime
View raw message