continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r719477 - in /continuum/branches/continuum-distributed-builds/continuum-distributed-build: ./ continuum-buildagent/ continuum-buildagent/src/ continuum-buildagent/src/main/ continuum-buildagent/src/main/java/ continuum-buildagent/src/main/j...
Date Fri, 21 Nov 2008 04:59:17 GMT
Author: ctan
Date: Thu Nov 20 20:59:16 2008
New Revision: 719477

URL: http://svn.apache.org/viewvc?rev=719477&view=rev
Log:
added build agent

Added:
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/pom.xml
  (with props)
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentException.java
  (with props)
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentService.java
  (with props)
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentServiceImpl.java
  (with props)
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/configuration/
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/configuration/ContinuumBuildAgentConfiguration.java
  (with props)
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/configuration/ContinuumConfiguration.java
  (with props)
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/configuration/ContinuumConfigurationException.java
  (with props)
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/configuration/DefaultContinuumConfiguration.java
  (with props)
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/queue/
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/mdo/
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/mdo/continuum-buildagent.xml
  (with props)
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/resources/
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/resources/META-INF/
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/resources/META-INF/spring-context.xml
  (with props)
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/pom.xml  
(with props)

Added: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/pom.xml
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/pom.xml?rev=719477&view=auto
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/pom.xml
(added)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/pom.xml
Thu Nov 20 20:59:16 2008
@@ -0,0 +1,112 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!--
+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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.continuum</groupId>
+    <artifactId>continuum-distributed-build</artifactId>
+    <version>1.3-SNAPSHOT</version>
+  </parent>
+
+  <groupId>org.apache.continuum</groupId>
+  <artifactId>continuum-buildagent</artifactId>
+  <packaging>jar</packaging>
+  <name>Continuum :: Distributed Build :: Build Agent</name>
+  
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.codehaus.modello</groupId>
+        <artifactId>modello-maven-plugin</artifactId>
+        <configuration>
+          <models>
+            <model>src/main/mdo/continuum-buildagent.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>
+          <execution>
+            <id>site-docs</id>
+            <phase>pre-site</phase>
+            <goals>
+              <goal>xdoc</goal>
+              <goal>xsd</goal>
+            </goals>
+          </execution>
+          <execution>
+            <id>generate-xsd</id>
+            <phase>generate-resources</phase>
+            <goals>
+              <goal>xsd</goal>
+            </goals>
+            <configuration>
+              <outputDirectory>${project.build.outputDirectory}/META-INF/continuum/xsd</outputDirectory>
+            </configuration>
+          </execution>                    
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+  <dependencies>
+    <dependency>
+      <groupId>net.java.dev.stax-utils</groupId>
+      <artifactId>stax-utils</artifactId>
+      <version>20060502</version>
+      <exclusions>
+        <exclusion>
+          <groupId>com.bea.xml</groupId>
+          <artifactId>jsr173-ri</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>stax</groupId>
+      <artifactId>stax-api</artifactId>
+      <version>1.0.1</version>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.plexus</groupId>
+      <artifactId>plexus-utils</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-core</artifactId>
+      <version>${spring.version}</version>
+    </dependency> 
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+    </dependency>      
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-log4j12</artifactId>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+</project>

Propchange: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentException.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentException.java?rev=719477&view=auto
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentException.java
(added)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentException.java
Thu Nov 20 20:59:16 2008
@@ -0,0 +1,20 @@
+package org.apache.continuum.buildagent;
+
+public class ContinuumBuildAgentException
+    extends Exception
+{
+    public ContinuumBuildAgentException( String message )
+    {
+        super( message );
+    }
+
+    public ContinuumBuildAgentException( Throwable cause )
+    {
+        super( cause );
+    }
+
+    public ContinuumBuildAgentException( String message, Throwable cause )
+    {
+        super( message, cause );
+    }
+}

Propchange: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentException.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentService.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentService.java?rev=719477&view=auto
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentService.java
(added)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentService.java
Thu Nov 20 20:59:16 2008
@@ -0,0 +1,21 @@
+package org.apache.continuum.buildagent;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.continuum.buildagent.model.Installation;
+
+public interface ContinuumBuildAgentService
+{
+    void buildProject( List<Map> projectsBuildContext )
+        throws ContinuumBuildAgentException;
+
+    List<Installation> getAvailableInstallations()
+        throws ContinuumBuildAgentException;
+    
+    boolean isBusy()
+        throws ContinuumBuildAgentException;
+
+    Map getBuildResult( int projectId )
+        throws ContinuumBuildAgentException;
+}

Propchange: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentService.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentServiceImpl.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentServiceImpl.java?rev=719477&view=auto
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentServiceImpl.java
(added)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentServiceImpl.java
Thu Nov 20 20:59:16 2008
@@ -0,0 +1,67 @@
+package org.apache.continuum.buildagent;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.continuum.buildagent.configuration.ContinuumBuildAgentConfiguration;
+import org.apache.continuum.buildagent.configuration.ContinuumConfiguration;
+import org.apache.continuum.buildagent.configuration.ContinuumConfigurationException;
+import org.apache.continuum.buildagent.model.Installation;
+
+public class ContinuumBuildAgentServiceImpl
+    implements ContinuumBuildAgentService
+{
+    /**
+     * @plexus.requirement
+     */
+    private ContinuumConfiguration configuration;
+
+    private ContinuumBuildAgentConfiguration buildAgentConfiguration;
+
+    public void initialize()
+        throws ContinuumBuildAgentException
+    {
+        loadData();
+    }
+
+    public void buildProject( List<Map> projectsBuildContext )
+        throws ContinuumBuildAgentException
+    {
+        // TODO Auto-generated method stub
+        
+    }
+
+    public List<Installation> getAvailableInstallations()
+        throws ContinuumBuildAgentException
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Map getBuildResult( int projectId )
+        throws ContinuumBuildAgentException
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public boolean isBusy()
+        throws ContinuumBuildAgentException
+    {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    private void loadData()
+        throws ContinuumBuildAgentException
+    {
+        try
+        {
+            buildAgentConfiguration = configuration.getContinuumBuildAgentConfiguration();
+        }
+        catch ( ContinuumConfigurationException e )
+        {
+            throw new ContinuumBuildAgentException( "Unable to load build agent configuration",
e );
+        }
+    }
+}

Propchange: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentServiceImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentServiceImpl.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/configuration/ContinuumBuildAgentConfiguration.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/configuration/ContinuumBuildAgentConfiguration.java?rev=719477&view=auto
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/configuration/ContinuumBuildAgentConfiguration.java
(added)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/configuration/ContinuumBuildAgentConfiguration.java
Thu Nov 20 20:59:16 2008
@@ -0,0 +1,57 @@
+package org.apache.continuum.buildagent.configuration;
+
+import java.io.File;
+import java.util.List;
+
+import org.apache.continuum.buildagent.model.Installation;
+
+public class ContinuumBuildAgentConfiguration
+{
+    private File workingDirectory;
+
+    private File buildOutputDirectory;
+
+    private String continuumServerUrl;
+
+    private List<Installation> installations;
+
+    public File getWorkingDirectory()
+    {
+        return workingDirectory;
+    }
+
+    public void setWorkingDirectory( File workingDirectory )
+    {
+        this.workingDirectory = workingDirectory;
+    }
+
+    public File getBuildOutputDirectory()
+    {
+        return buildOutputDirectory;
+    }
+
+    public void setBuildOutputDirectory( File buildOutputDirectory )
+    {
+        this.buildOutputDirectory = buildOutputDirectory;
+    }
+
+    public String getContinuumServerUrl()
+    {
+        return continuumServerUrl;
+    }
+
+    public void setContinuumServerUrl( String continuumServerUrl )
+    {
+        this.continuumServerUrl = continuumServerUrl;
+    }
+
+    public List<Installation> getInstallations()
+    {
+        return installations;
+    }
+
+    public void setInstallations( List<Installation> installations )
+    {
+        this.installations = installations;
+    }
+}

Propchange: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/configuration/ContinuumBuildAgentConfiguration.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/configuration/ContinuumBuildAgentConfiguration.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/configuration/ContinuumConfiguration.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/configuration/ContinuumConfiguration.java?rev=719477&view=auto
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/configuration/ContinuumConfiguration.java
(added)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/configuration/ContinuumConfiguration.java
Thu Nov 20 20:59:16 2008
@@ -0,0 +1,43 @@
+package org.apache.continuum.buildagent.configuration;
+
+import java.io.File;
+
+/*
+ * 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.
+ */
+
+public interface ContinuumConfiguration
+{
+    ContinuumBuildAgentConfiguration getContinuumBuildAgentConfiguration()
+        throws ContinuumConfigurationException;
+
+    void setContinuumBuildAgentConfiguration( ContinuumBuildAgentConfiguration configuration
)
+        throws ContinuumConfigurationException;
+
+    void save()
+        throws ContinuumConfigurationException;
+    
+    void save( File file )
+        throws ContinuumConfigurationException;
+    
+    void reload( )
+        throws ContinuumConfigurationException;    
+    
+    void reload( File file )
+        throws ContinuumConfigurationException;
+}

Propchange: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/configuration/ContinuumConfiguration.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/configuration/ContinuumConfiguration.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/configuration/ContinuumConfigurationException.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/configuration/ContinuumConfigurationException.java?rev=719477&view=auto
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/configuration/ContinuumConfigurationException.java
(added)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/configuration/ContinuumConfigurationException.java
Thu Nov 20 20:59:16 2008
@@ -0,0 +1,20 @@
+package org.apache.continuum.buildagent.configuration;
+
+public class ContinuumConfigurationException
+    extends Exception
+{
+    public ContinuumConfigurationException( String message )
+    {
+        super( message );
+    }
+
+    public ContinuumConfigurationException( Throwable cause )
+    {
+        super( cause );
+    }
+
+    public ContinuumConfigurationException( String message, Throwable cause )
+    {
+        super( message, cause );
+    }
+}

Propchange: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/configuration/ContinuumConfigurationException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/configuration/ContinuumConfigurationException.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/configuration/DefaultContinuumConfiguration.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/configuration/DefaultContinuumConfiguration.java?rev=719477&view=auto
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/configuration/DefaultContinuumConfiguration.java
(added)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/configuration/DefaultContinuumConfiguration.java
Thu Nov 20 20:59:16 2008
@@ -0,0 +1,140 @@
+package org.apache.continuum.buildagent.configuration;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStreamReader;
+
+import org.apache.continuum.buildagent.model.ContinuumBuildAgentConfigurationModel;
+import org.apache.continuum.buildagent.model.io.xpp3.ContinuumBuildAgentConfigurationModelXpp3Reader;
+import org.apache.continuum.buildagent.model.io.xpp3.ContinuumBuildAgentConfigurationModelXpp3Writer;
+import org.codehaus.plexus.util.StringUtils;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DefaultContinuumConfiguration
+    //implements ContinuumConfiguration
+{
+    private Logger log = LoggerFactory.getLogger( getClass() );
+
+    private File configurationFile;
+
+    private ContinuumBuildAgentConfiguration buildAgentConfiguration;
+
+    protected void initialize()
+    {
+        if ( log.isDebugEnabled() )
+        {
+            log.debug( "configurationFile null " + ( configurationFile.getPath() == null
) );
+        }
+        if ( configurationFile != null && configurationFile.exists() )
+        {
+            try
+            {
+                reload( configurationFile );
+            }
+            catch ( ContinuumConfigurationException e )
+            {
+                // skip this and only log a warn
+                log.warn( " error on loading configuration from file " + configurationFile.getPath()
);
+            }
+        }
+        else
+        {
+            log.info( "build agent configuration file does not exists" );
+            this.buildAgentConfiguration = new ContinuumBuildAgentConfiguration();
+        }
+    }
+
+    public ContinuumBuildAgentConfiguration getContinuumBuildAgentConfiguration()
+        throws ContinuumConfigurationException
+    {
+        return buildAgentConfiguration;
+    }
+
+    public void reload()
+        throws ContinuumConfigurationException
+    {
+        this.initialize();
+    }
+
+    public void reload( File file )
+        throws ContinuumConfigurationException
+    {
+        try
+        {
+            ContinuumBuildAgentConfigurationModelXpp3Reader configurationXpp3Reader = 
+                new ContinuumBuildAgentConfigurationModelXpp3Reader();
+            ContinuumBuildAgentConfigurationModel configuration = configurationXpp3Reader
+                .read( new InputStreamReader( new FileInputStream( file ) ) );
+
+            this.buildAgentConfiguration = new ContinuumBuildAgentConfiguration();
+            if ( StringUtils.isNotEmpty( configuration.getBuildOutputDirectory() ) )
+            {
+                this.buildAgentConfiguration.setBuildOutputDirectory( new File( configuration.getBuildOutputDirectory()
) );
+            }
+            if ( StringUtils.isNotEmpty( configuration.getWorkingDirectory() ) )
+            {
+                this.buildAgentConfiguration.setWorkingDirectory( new File( configuration.getWorkingDirectory()
) );
+            }
+            this.buildAgentConfiguration.setContinuumServerUrl( configuration.getContinuumServerUrl()
);
+            this.buildAgentConfiguration.setInstallations( configuration.getInstallations()
);
+        }
+        catch ( IOException e )
+        {
+            log.error( e.getMessage(), e );
+            throw new ContinuumConfigurationException( e.getMessage(), e );
+        }
+        catch ( XmlPullParserException e )
+        {
+            log.error( e.getMessage(), e );
+            throw new ContinuumConfigurationException( e.getMessage(), e );
+        }
+    }
+
+    public void save()
+        throws ContinuumConfigurationException
+    {
+        if ( !configurationFile.exists() )
+        {
+            configurationFile.getParentFile().mkdir();
+        }
+        save( configurationFile );
+    }
+
+    public void save( File file )
+        throws ContinuumConfigurationException
+    {
+        try
+        {
+            ContinuumBuildAgentConfigurationModel configurationModel = new ContinuumBuildAgentConfigurationModel();
+            if ( this.buildAgentConfiguration.getBuildOutputDirectory() != null )
+            {
+                configurationModel.setBuildOutputDirectory( this.buildAgentConfiguration.getBuildOutputDirectory().getPath()
);
+            }
+            if ( this.buildAgentConfiguration.getWorkingDirectory() != null )
+            {
+                configurationModel.setWorkingDirectory( this.buildAgentConfiguration.getWorkingDirectory().getPath()
);
+            }
+            configurationModel.setContinuumServerUrl( this.buildAgentConfiguration.getContinuumServerUrl()
);
+            configurationModel.setInstallations( this.buildAgentConfiguration.getInstallations()
);
+
+            ContinuumBuildAgentConfigurationModelXpp3Writer writer = new ContinuumBuildAgentConfigurationModelXpp3Writer();
+            FileWriter fileWriter = new FileWriter( file );
+            writer.write( fileWriter, configurationModel );
+        }
+        catch ( IOException e )
+        {
+            log.error( e.getMessage(), e );
+            throw new ContinuumConfigurationException( e.getMessage(), e );
+        }
+    }
+
+    public void setContinuumBuildAgentConfiguration( ContinuumBuildAgentConfiguration buildAgentConfiguration
)
+        throws ContinuumConfigurationException
+    {
+        this.buildAgentConfiguration = buildAgentConfiguration;
+    }
+}

Propchange: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/configuration/DefaultContinuumConfiguration.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/configuration/DefaultContinuumConfiguration.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/mdo/continuum-buildagent.xml
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/mdo/continuum-buildagent.xml?rev=719477&view=auto
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/mdo/continuum-buildagent.xml
(added)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/mdo/continuum-buildagent.xml
Thu Nov 20 20:59:16 2008
@@ -0,0 +1,88 @@
+<!--
+  ~ 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-buildagent</id>
+  <name>ContinuumBuildAgentConfigurationModel</name>
+  <description>Continuum Build Agent object model.</description>
+  <defaults>
+    <default>
+      <key>package</key>
+      <value>org.apache.continuum.buildagent.model</value>
+    </default>
+  </defaults>
+
+  <classes>
+    <class rootElement="true" xml.tagName="continuum-buildagent-configuration">
+      <name>ContinuumBuildAgentConfigurationModel</name>
+      <version>1.0.0+</version>
+      <fields>
+        <field>
+          <name>buildOutputDirectory</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>continuumServerUrl</name>
+          <version>1.0.0+</version>
+          <type>String</type>
+        </field>
+        <field>
+          <name>installations</name>
+          <version>1.0.0+</version>
+          <association>
+            <type>Installation</type>
+            <multiplicity>*</multiplicity>
+          </association>
+        </field>
+      </fields>
+    </class>
+    <class xml.tagName="buildagent-installation">
+      <name>Installation</name>
+      <version>1.0.0+</version>
+      <fields>
+        <field>
+          <name>type</name>
+          <version>1.0.0+</version>
+          <type>String</type>
+        </field>
+        <field>
+          <name>varValue</name>
+          <version>1.0.0+</version>
+          <type>String</type>
+        </field>
+        <field>
+          <name>varName</name>
+          <version>1.0.0+</version>
+          <type>String</type>
+        </field>   
+        <field>
+          <name>name</name>
+          <version>1.0.0+</version>
+          <type>String</type>
+        </field>                     
+      </fields>
+    </class>
+  </classes>
+</model>
+  
\ No newline at end of file

Propchange: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/mdo/continuum-buildagent.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/mdo/continuum-buildagent.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/resources/META-INF/spring-context.xml
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/resources/META-INF/spring-context.xml?rev=719477&view=auto
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/resources/META-INF/spring-context.xml
(added)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/resources/META-INF/spring-context.xml
Thu Nov 20 20:59:16 2008
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+
+<!--
+  ~ 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.
+  -->
+  <beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans
+           http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
+
+  <bean id="continuumBuildAgentConfiguration" class="org.apache.continuum.buildagent.configuration.DefaultContinuumConfiguration"
+        init-method="initialize">
+    <property name="configurationFile" value="file:${appserver.base}/conf/continuum.xml"/>
+  </bean>
+
+  <bean id="continuumBuildAgentService" class="org.apache.continuum.buildagent.ContinuumBuildAgentServiceImpl"
+        init-method="initialize">
+    <property name="configuration" ref="continuumBuildAgentConfiguration"/>
+  </bean>
+</beans>
\ No newline at end of file

Propchange: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/resources/META-INF/spring-context.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/resources/META-INF/spring-context.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: continuum/branches/continuum-distributed-builds/continuum-distributed-build/pom.xml
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-distributed-build/pom.xml?rev=719477&view=auto
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/pom.xml (added)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/pom.xml Thu
Nov 20 20:59:16 2008
@@ -0,0 +1,35 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!--
+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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.continuum</groupId>
+    <artifactId>continuum</artifactId>
+    <version>1.3-SNAPSHOT</version>
+  </parent>
+
+  <groupId>org.apache.continuum</groupId>
+  <artifactId>continuum-distributed-build</artifactId>
+  <packaging>pom</packaging>
+  <name>Continuum :: Distributed Build</name>
+  <modules>
+    <module>continuum-buildagent</module>
+  </modules>
+</project>

Propchange: continuum/branches/continuum-distributed-builds/continuum-distributed-build/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/branches/continuum-distributed-builds/continuum-distributed-build/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision



Mime
View raw message