continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r724132 - in /continuum/branches/continuum-distributed-builds: ./ continuum-api/src/main/java/org/apache/continuum/builder/ continuum-api/src/main/java/org/apache/continuum/builder/distributed/ continuum-api/src/main/java/org/apache/continu...
Date Sun, 07 Dec 2008 13:54:42 GMT
Author: ctan
Date: Sun Dec  7 05:54:40 2008
New Revision: 724132

URL: http://svn.apache.org/viewvc?rev=724132&view=rev
Log:
- refactor classes

Added:
    continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/continuum/builder/
    continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/continuum/builder/ContinuumBuilder.java   (with props)
    continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/continuum/builder/distributed/
    continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/continuum/builder/distributed/BuildAgentListener.java   (with props)
    continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/continuum/builder/distributed/manager/
    continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/continuum/builder/distributed/manager/DistributedBuildManager.java   (with props)
    continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/continuum/scm/
    continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/continuum/scm/queue/
    continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/continuum/scm/queue/PrepareBuildProjectsTask.java   (contents, props changed)
      - copied, changed from r722808, continuum/branches/continuum-distributed-builds/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTask.java
    continuum/branches/continuum-distributed-builds/continuum-builder/
    continuum/branches/continuum-distributed-builds/continuum-builder/pom.xml   (with props)
    continuum/branches/continuum-distributed-builds/continuum-builder/src/
    continuum/branches/continuum-distributed-builds/continuum-builder/src/main/
    continuum/branches/continuum-distributed-builds/continuum-builder/src/main/java/
    continuum/branches/continuum-distributed-builds/continuum-builder/src/main/java/org/
    continuum/branches/continuum-distributed-builds/continuum-builder/src/main/java/org/apache/
    continuum/branches/continuum-distributed-builds/continuum-builder/src/main/java/org/apache/continuum/
    continuum/branches/continuum-distributed-builds/continuum-builder/src/main/java/org/apache/continuum/builder/
    continuum/branches/continuum-distributed-builds/continuum-builder/src/main/java/org/apache/continuum/builder/AbstractContinuumBuilder.java   (with props)
    continuum/branches/continuum-distributed-builds/continuum-builder/src/main/java/org/apache/continuum/builder/distributed/
    continuum/branches/continuum-distributed-builds/continuum-builder/src/main/java/org/apache/continuum/builder/distributed/DefaultBuildAgentListener.java   (with props)
    continuum/branches/continuum-distributed-builds/continuum-builder/src/main/java/org/apache/continuum/builder/distributed/manager/
    continuum/branches/continuum-distributed-builds/continuum-builder/src/main/java/org/apache/continuum/builder/distributed/manager/DefaultDistributedBuildManager.java   (with props)
    continuum/branches/continuum-distributed-builds/continuum-builder/src/main/resources/
    continuum/branches/continuum-distributed-builds/continuum-builder/src/main/resources/META-INF/
    continuum/branches/continuum-distributed-builds/continuum-builder/src/main/resources/META-INF/spring-context.xml   (with props)
    continuum/branches/continuum-distributed-builds/continuum-builder/src/test/
    continuum/branches/continuum-distributed-builds/continuum-builder/src/test/java/
    continuum/branches/continuum-distributed-builds/continuum-builder/src/test/java/org/
    continuum/branches/continuum-distributed-builds/continuum-builder/src/test/java/org/apache/
    continuum/branches/continuum-distributed-builds/continuum-builder/src/test/java/org/apache/continuum/
    continuum/branches/continuum-distributed-builds/continuum-builder/src/test/java/org/apache/continuum/builder/
    continuum/branches/continuum-distributed-builds/continuum-builder/src/test/java/org/apache/continuum/builder/distributed/
    continuum/branches/continuum-distributed-builds/continuum-builder/src/test/java/org/apache/continuum/builder/distributed/manager/
    continuum/branches/continuum-distributed-builds/continuum-builder/src/test/java/org/apache/continuum/builder/distributed/manager/DefaultDistributedBuildManagerTest.java   (with props)
    continuum/branches/continuum-distributed-builds/continuum-commons/src/main/java/org/apache/continuum/utils/ProjectSorter.java   (with props)
    continuum/branches/continuum-distributed-builds/continuum-commons/src/test/java/org/apache/continuum/utils/
    continuum/branches/continuum-distributed-builds/continuum-commons/src/test/java/org/apache/continuum/utils/ProjectSorterTest.java   (contents, props changed)
      - copied, changed from r724086, continuum/branches/continuum-distributed-builds/continuum-core/src/test/java/org/apache/maven/continuum/utils/ProjectSorterTest.java
Removed:
    continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/continuum/distributed/
    continuum/branches/continuum-distributed-builds/continuum-core/src/main/java/org/apache/continuum/distributed/
    continuum/branches/continuum-distributed-builds/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTask.java
    continuum/branches/continuum-distributed-builds/continuum-core/src/test/java/org/apache/continuum/distributed/
    continuum/branches/continuum-distributed-builds/continuum-core/src/test/java/org/apache/maven/continuum/utils/ProjectSorterTest.java
Modified:
    continuum/branches/continuum-distributed-builds/continuum-core/pom.xml
    continuum/branches/continuum-distributed-builds/continuum-core/src/main/java/org/apache/continuum/taskqueue/manager/DefaultTaskQueueManager.java
    continuum/branches/continuum-distributed-builds/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
    continuum/branches/continuum-distributed-builds/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateWorkingDirectoryFromScmContinuumAction.java
    continuum/branches/continuum-distributed-builds/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutor.java
    continuum/branches/continuum-distributed-builds/continuum-core/src/main/resources/META-INF/spring-context.xml
    continuum/branches/continuum-distributed-builds/continuum-webapp/src/main/java/org/apache/continuum/web/action/admin/BuildAgentAction.java
    continuum/branches/continuum-distributed-builds/continuum-webapp/src/main/java/org/apache/continuum/web/action/admin/DistributedBuildAction.java
    continuum/branches/continuum-distributed-builds/pom.xml

Added: continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/continuum/builder/ContinuumBuilder.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/continuum/builder/ContinuumBuilder.java?rev=724132&view=auto
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/continuum/builder/ContinuumBuilder.java (added)
+++ continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/continuum/builder/ContinuumBuilder.java Sun Dec  7 05:54:40 2008
@@ -0,0 +1,32 @@
+package org.apache.continuum.builder;
+
+/*
+ * 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.
+ */
+
+import java.util.Map;
+
+import org.apache.maven.continuum.ContinuumException;
+
+public interface ContinuumBuilder
+{
+    String ROLE = ContinuumBuilder.class.getName();
+
+    void buildProjects( Map<Integer, Integer> projectsAndBuildDefinitionsMap, int trigger )
+        throws ContinuumException;
+}

Propchange: continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/continuum/builder/ContinuumBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/continuum/builder/ContinuumBuilder.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/continuum/builder/distributed/BuildAgentListener.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/continuum/builder/distributed/BuildAgentListener.java?rev=724132&view=auto
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/continuum/builder/distributed/BuildAgentListener.java (added)
+++ continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/continuum/builder/distributed/BuildAgentListener.java Sun Dec  7 05:54:40 2008
@@ -0,0 +1,45 @@
+package org.apache.continuum.builder.distributed;
+
+/*
+ * 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.
+ */
+
+import java.util.List;
+
+import org.apache.maven.continuum.model.project.Project;
+
+public interface BuildAgentListener
+{
+    String getUrl();
+
+    void setUrl( String url );
+
+    boolean isBusy();
+
+    void setBusy( boolean busy );
+
+    boolean isEnabled();
+
+    void setEnabled( boolean enabled );
+
+    List<Project> getProjects();
+
+    void setProjects( List<Project> projects );
+
+    boolean hasProjects();
+}

Propchange: continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/continuum/builder/distributed/BuildAgentListener.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/continuum/builder/distributed/BuildAgentListener.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/continuum/builder/distributed/manager/DistributedBuildManager.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/continuum/builder/distributed/manager/DistributedBuildManager.java?rev=724132&view=auto
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/continuum/builder/distributed/manager/DistributedBuildManager.java (added)
+++ continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/continuum/builder/distributed/manager/DistributedBuildManager.java Sun Dec  7 05:54:40 2008
@@ -0,0 +1,20 @@
+package org.apache.continuum.builder.distributed.manager;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.continuum.builder.distributed.BuildAgentListener;
+import org.apache.maven.continuum.ContinuumException;
+
+public interface DistributedBuildManager
+{
+    void updateProjectScmRoot( Map context )
+        throws ContinuumException;
+
+    void updateBuildResult( Map context )
+        throws ContinuumException;
+
+    List<BuildAgentListener> getBuildAgentListeners();
+
+    void reload();
+}

Propchange: continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/continuum/builder/distributed/manager/DistributedBuildManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/continuum/builder/distributed/manager/DistributedBuildManager.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Copied: continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/continuum/scm/queue/PrepareBuildProjectsTask.java (from r722808, continuum/branches/continuum-distributed-builds/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTask.java)
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/continuum/scm/queue/PrepareBuildProjectsTask.java?p2=continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/continuum/scm/queue/PrepareBuildProjectsTask.java&p1=continuum/branches/continuum-distributed-builds/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTask.java&r1=722808&r2=724132&rev=724132&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTask.java (original)
+++ continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/continuum/scm/queue/PrepareBuildProjectsTask.java Sun Dec  7 05:54:40 2008
@@ -1,4 +1,4 @@
-package org.apache.maven.continuum.scm.queue;
+package org.apache.continuum.scm.queue;
 
 import java.util.Map;
 

Propchange: continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/continuum/scm/queue/PrepareBuildProjectsTask.java
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Sun Dec  7 05:54:40 2008
@@ -0,0 +1 @@
+/continuum/branches/continuum-1.2.x/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTask.java:690684,690689-690799,698449-698533,698817-698819,699529,700250,700273,700936,705894,705910,708339

Added: continuum/branches/continuum-distributed-builds/continuum-builder/pom.xml
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-builder/pom.xml?rev=724132&view=auto
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-builder/pom.xml (added)
+++ continuum/branches/continuum-distributed-builds/continuum-builder/pom.xml Sun Dec  7 05:54:40 2008
@@ -0,0 +1,70 @@
+<?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>
+    <artifactId>continuum</artifactId>
+    <groupId>org.apache.continuum</groupId>
+    <version>1.3-SNAPSHOT</version>
+  </parent>
+  <artifactId>continuum-builder</artifactId>
+  <name>Continuum :: Builder</name>
+  <version>1.3-SNAPSHOT</version>
+  <url>http://maven.apache.org</url>
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.continuum</groupId>
+      <artifactId>continuum-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.continuum</groupId>
+      <artifactId>continuum-commons</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.continuum</groupId>
+      <artifactId>continuum-store</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.plexus</groupId>
+      <artifactId>plexus-spring</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.xmlrpc</groupId>
+      <artifactId>xmlrpc-server</artifactId>
+      <version>3.0</version>
+    </dependency>
+    <dependency>
+      <groupId>hsqldb</groupId>
+      <artifactId>hsqldb</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.continuum</groupId>
+      <artifactId>continuum-test</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-log4j12</artifactId>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+</project>

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

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

Added: continuum/branches/continuum-distributed-builds/continuum-builder/src/main/java/org/apache/continuum/builder/AbstractContinuumBuilder.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-builder/src/main/java/org/apache/continuum/builder/AbstractContinuumBuilder.java?rev=724132&view=auto
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-builder/src/main/java/org/apache/continuum/builder/AbstractContinuumBuilder.java (added)
+++ continuum/branches/continuum-distributed-builds/continuum-builder/src/main/java/org/apache/continuum/builder/AbstractContinuumBuilder.java Sun Dec  7 05:54:40 2008
@@ -0,0 +1,215 @@
+package org.apache.continuum.builder;
+
+import java.util.Map;
+
+import org.apache.continuum.builder.ContinuumBuilder;
+
+public abstract class AbstractContinuumBuilder
+    implements ContinuumBuilder
+{
+    public static final String KEY_PROJECT_ID = "project-id";
+
+    public static final String KEY_BUILD_DEFINITION_ID = "builddefinition-id";
+
+    public static final String KEY_TRIGGER = "trigger";
+
+    public static final String KEY_EXECUTOR_ID = "executor-id";
+
+    public static final String KEY_SCM_URL = "scm-url";
+
+    public static final String KEY_SCM_USERNAME = "scm-username";
+
+    public static final String KEY_SCM_PASSWORD = "scm-password";
+
+    public static final String KEY_BUILD_FILE = "build-file";
+
+    public static final String KEY_GOALS = "goals";
+
+    public static final String KEY_ARGUMENTS = "arguments";
+
+    public static final String KEY_BUILD_FRESH = "build-fresh";
+
+    public static final String KEY_BUILD_START = "build-start";
+
+    public static final String KEY_BUILD_END = "build-end";
+
+    public static final String KEY_BUILD_ERROR = "build-error";
+
+    public static final String KEY_BUILD_EXIT_CODE = "build-exit-code";
+
+    public static final String KEY_BUILD_STATE = "build-state";
+
+    public static final String KEY_SCM_COMMAND_OUTPUT = "scm-command-output";
+
+    public static final String KEY_SCM_COMMAND_LINE = "scm-command-line";
+
+    public static final String KEY_SCM_PROVIDER_MESSAGE = "scm-provider-message";
+
+    public static final String KEY_SCM_EXCEPTION = "scm-exception";
+
+    public static final String KEY_PREPARE_BUILD_FINISHED = "prepare-build-finished";
+
+    public static int getProjectId( Map context )
+    {
+        return getInteger( context, KEY_PROJECT_ID );
+    }
+
+    public static int getBuildDefinitionId( Map context )
+    {
+        return getInteger( context, KEY_BUILD_DEFINITION_ID );
+    }
+
+    public static String getBuildError( Map context )
+    {
+        return getString( context, KEY_BUILD_ERROR );
+    }
+
+    public static int getTrigger( Map context )
+    {
+        return getInteger( context, KEY_TRIGGER );
+    }
+
+    public static long getBuildStart( Map context )
+    {
+        return getLong( context, KEY_BUILD_START );
+    }
+
+    public static long getBuildEnd( Map context )
+    {
+        return getLong( context, KEY_BUILD_END );
+    }
+
+    public static int getBuildExitCode( Map context )
+    {
+        return getInteger( context, KEY_BUILD_EXIT_CODE );
+    }
+
+    public static int getBuildState( Map context )
+    {
+        return getInteger( context, KEY_BUILD_STATE );
+    }
+
+    public static String getScmCommandLine( Map context )
+    {
+        return getString( context, KEY_SCM_COMMAND_LINE );
+    }
+
+    public static String getScmCommandOutput( Map context )
+    {
+        return getString( context, KEY_SCM_COMMAND_OUTPUT );
+    }
+
+    public static String getScmException( Map context )
+    {
+        return getString( context, KEY_SCM_EXCEPTION );
+    }
+
+    public static String getScmProviderMessage( Map context )
+    {
+        return getString( context, KEY_SCM_PROVIDER_MESSAGE );
+    }
+
+    public static boolean isPrepareBuildFinished( Map context )
+    {
+        return getBoolean( context, KEY_PREPARE_BUILD_FINISHED );
+    }
+
+    // ----------------------------------------------------------------------
+    //
+    // ----------------------------------------------------------------------
+
+    protected static String getString( Map context, String key )
+    {
+        Object obj = getObject( context, key, null );
+
+        if ( obj == null )
+        {
+            return null;
+        }
+        else
+        {
+            return (String) obj;
+        }
+    }
+
+    protected static String getString( Map context, String key, String defaultValue )
+    {
+        return (String) getObject( context, key, defaultValue );
+    }
+
+    protected static boolean getBoolean( Map context, String key )
+    {
+        Object obj = getObject( context, key, null );
+        
+        if ( obj == null )
+        {
+            return false;
+        }
+        else
+        {
+            return ( (Boolean) obj ).booleanValue();
+        }
+    }
+    
+    protected static boolean getBoolean( Map context, String key, boolean defaultValue )
+    {
+        return ( (Boolean) getObject( context, key, Boolean.valueOf( defaultValue ) ) ).booleanValue();
+    }    
+
+    protected static int getInteger( Map context, String key )
+    {
+        Object obj = getObject( context, key, null );
+        
+        if ( obj == null )
+        {
+            return 0;
+        }
+        else
+        {
+            return ( (Integer) obj ).intValue();
+        }
+    }
+
+    protected static long getLong( Map context, String key )
+    {
+        Object obj = getObject( context, key, null );
+        
+        if ( obj == null )
+        {
+            return 0;
+        }
+        else
+        {
+            return ( (Long) obj ).longValue();
+        }
+    }
+
+    protected static Object getObject( Map context, String key )
+    {
+        if ( !context.containsKey( key ) )
+        {
+            throw new RuntimeException( "Missing key '" + key + "'." );
+        }
+
+        Object value = context.get( key );
+
+        if ( value == null )
+        {
+            throw new RuntimeException( "Missing value for key '" + key + "'." );
+        }
+
+        return value;
+    }
+
+    protected static Object getObject( Map context, String key, Object defaultValue )
+    {
+        Object value = context.get( key );
+
+        if ( value == null )
+        {
+            return defaultValue;
+        }
+
+        return value;
+    }
+}

Propchange: continuum/branches/continuum-distributed-builds/continuum-builder/src/main/java/org/apache/continuum/builder/AbstractContinuumBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

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

Added: continuum/branches/continuum-distributed-builds/continuum-builder/src/main/java/org/apache/continuum/builder/distributed/DefaultBuildAgentListener.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-builder/src/main/java/org/apache/continuum/builder/distributed/DefaultBuildAgentListener.java?rev=724132&view=auto
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-builder/src/main/java/org/apache/continuum/builder/distributed/DefaultBuildAgentListener.java (added)
+++ continuum/branches/continuum-distributed-builds/continuum-builder/src/main/java/org/apache/continuum/builder/distributed/DefaultBuildAgentListener.java Sun Dec  7 05:54:40 2008
@@ -0,0 +1,78 @@
+package org.apache.continuum.builder.distributed;
+
+import java.util.List;
+
+import org.apache.maven.continuum.model.project.Project;
+
+public class DefaultBuildAgentListener
+    implements BuildAgentListener
+{
+    private String url;
+
+    private boolean busy;
+
+    private boolean enabled;
+
+    private List<Project> projects;
+
+    public DefaultBuildAgentListener()
+    {
+    }
+
+    public DefaultBuildAgentListener( String url, boolean busy, boolean enabled )
+    {
+        this.url = url;
+        this.busy = busy;
+        this.enabled = enabled;
+    }
+
+    public String getUrl()
+    {
+        return url;
+    }
+
+    public void setUrl( String url )
+    {
+        this.url = url;
+    }
+
+    public boolean isBusy()
+    {
+        return busy;
+    }
+
+    public void setBusy( boolean busy )
+    {
+        this.busy = busy;
+    }
+
+    public boolean isEnabled()
+    {
+        return enabled;
+    }
+
+    public void setEnabled( boolean enabled )
+    {
+        this.enabled = enabled;
+    }
+
+    public List<Project> getProjects()
+    {
+        return projects;
+    }
+
+    public boolean hasProjects()
+    {
+        if ( projects != null || projects.size() > 0 )
+        {
+            return true;
+        }
+
+        return false;
+    }
+
+    public void setProjects( List<Project> projects )
+    {
+        this.projects = projects;
+    }
+}

Propchange: continuum/branches/continuum-distributed-builds/continuum-builder/src/main/java/org/apache/continuum/builder/distributed/DefaultBuildAgentListener.java
------------------------------------------------------------------------------
    svn:eol-style = native

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

Added: continuum/branches/continuum-distributed-builds/continuum-builder/src/main/java/org/apache/continuum/builder/distributed/manager/DefaultDistributedBuildManager.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-builder/src/main/java/org/apache/continuum/builder/distributed/manager/DefaultDistributedBuildManager.java?rev=724132&view=auto
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-builder/src/main/java/org/apache/continuum/builder/distributed/manager/DefaultDistributedBuildManager.java (added)
+++ continuum/branches/continuum-distributed-builds/continuum-builder/src/main/java/org/apache/continuum/builder/distributed/manager/DefaultDistributedBuildManager.java Sun Dec  7 05:54:40 2008
@@ -0,0 +1,585 @@
+package org.apache.continuum.builder.distributed.manager;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.continuum.builder.AbstractContinuumBuilder;
+import org.apache.continuum.builder.distributed.BuildAgentListener;
+import org.apache.continuum.builder.distributed.DefaultBuildAgentListener;
+import org.apache.continuum.builder.distributed.manager.DistributedBuildManager;
+import org.apache.continuum.configuration.BuildAgentConfiguration;
+import org.apache.continuum.dao.BuildDefinitionDao;
+import org.apache.continuum.dao.BuildResultDao;
+import org.apache.continuum.dao.ProjectDao;
+import org.apache.continuum.dao.ProjectScmRootDao;
+import org.apache.continuum.model.project.ProjectScmRoot;
+import org.apache.continuum.scm.queue.PrepareBuildProjectsTask;
+import org.apache.continuum.utils.ProjectSorter;
+//import org.apache.continuum.xmlrpc.distributed.client.ContinuumDistributedBuildClient;
+import org.apache.maven.continuum.ContinuumException;
+import org.apache.maven.continuum.configuration.ConfigurationService;
+import org.apache.maven.continuum.model.project.BuildDefinition;
+import org.apache.maven.continuum.model.project.BuildResult;
+import org.apache.maven.continuum.model.project.Project;
+import org.apache.maven.continuum.model.project.ProjectDependency;
+import org.apache.maven.continuum.model.scm.ScmResult;
+import org.apache.maven.continuum.project.ContinuumProjectState;
+import org.apache.maven.continuum.store.ContinuumStoreException;
+import org.apache.xmlrpc.XmlRpcException;
+
+import org.codehaus.plexus.util.StringUtils;
+import org.codehaus.plexus.util.dag.CycleDetectedException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @author Maria Catherine Tan
+ */
+public class DefaultDistributedBuildManager
+    extends AbstractContinuumBuilder
+    implements DistributedBuildManager
+{
+    private Logger log = LoggerFactory.getLogger( this.getClass() );
+
+    /**
+     * @plexus.requirement
+     */
+    private ConfigurationService configurationService;
+
+    /**
+     * @plexus.requirement
+     */
+    private ProjectDao projectDao;
+
+    /**
+     * @plexus.requirement
+     */
+    private BuildDefinitionDao buildDefinitionDao;
+
+    /**
+     * @plexus.requirement
+     */
+    private ProjectScmRootDao projectScmRootDao;
+
+    /**
+     * @plexus.requirement
+     */
+    private BuildResultDao buildResultDao;
+
+    private List<PrepareBuildProjectsTask> projectsBuildInQueue;
+    
+    private List<BuildAgentListener> listeners;
+
+    public void initialize()
+    {
+        List<BuildAgentConfiguration> agents = configurationService.getBuildAgents();
+
+        if ( listeners == null )
+        {
+            listeners = new ArrayList<BuildAgentListener>();
+        }
+        
+        if ( agents != null )
+        {
+            for ( BuildAgentConfiguration agent : agents )
+            {
+                boolean found = false;
+
+                for ( BuildAgentListener listener : listeners )
+                {
+                    if ( listener.getUrl().equals( agent.getUrl() ) )
+                    {
+                        found = true;
+                        listener.setEnabled( agent.isEnabled() );
+                        break;
+                    }
+                }
+
+                if ( !found )
+                {
+                    BuildAgentListener listener = new DefaultBuildAgentListener( agent.getUrl(), false, agent.isEnabled() );
+                    listeners.add( listener );
+                }
+            }
+        }
+    }
+
+    public ConfigurationService getConfigurationService()
+    {
+        return configurationService;
+    }
+
+    public void setConfigurationService( ConfigurationService configurationService )
+    {
+        this.configurationService = configurationService;
+    }
+
+    public ProjectDao getProjectDao()
+    {
+        return projectDao;
+    }
+
+    public void setProjectDao( ProjectDao projectDao )
+    {
+        this.projectDao = projectDao;
+    }
+
+    public BuildDefinitionDao getBuildDefinitionDao()
+    {
+        return buildDefinitionDao;
+    }
+
+    public void setBuildDefinitionDao( BuildDefinitionDao buildDefinitionDao )
+    {
+        this.buildDefinitionDao = buildDefinitionDao;
+    }
+
+    public BuildResultDao getBuildResultDao()
+    {
+        return buildResultDao;
+    }
+
+    public void setBuildResultDao( BuildResultDao buildResultDao )
+    {
+        this.buildResultDao = buildResultDao;
+    }
+
+    public ProjectScmRootDao getProjectScmRootDao()
+    {
+        return projectScmRootDao;
+    }
+
+    public void setProjectScmRootDao( ProjectScmRootDao projectScmRootDao )
+    {
+        this.projectScmRootDao = projectScmRootDao;
+    }
+
+    public void buildProjects( Map<Integer, Integer> projectsAndBuildDefinitionsMap, int trigger )
+        throws ContinuumException
+    {
+        buildProjects( projectsAndBuildDefinitionsMap, trigger, false );
+    }
+
+    public void buildProjectsInQueue()
+        throws ContinuumException
+    {
+        for ( PrepareBuildProjectsTask task : projectsBuildInQueue )
+        {
+            Map projectsAndBuildDefinitions = task.getProjectsBuildDefinitionsMap();
+            int trigger = task.getTrigger();
+            
+            buildProjects( projectsAndBuildDefinitions, trigger, true );
+        }
+    }
+
+    public synchronized void buildProjects( Map<Integer, Integer> projectsAndBuildDefinitionsMap, int trigger, boolean inBuildQueue )
+        throws ContinuumException
+    {
+        boolean found = false;
+        
+        for ( BuildAgentListener listener : listeners )
+        {
+            if ( !listener.isBusy() && listener.isEnabled() )
+            {
+                List buildContext = initializeBuildContext( projectsAndBuildDefinitionsMap, trigger, listener );
+/*
+                try
+                {
+                    ContinuumDistributedBuildClient client = new ContinuumDistributedBuildClient( new URL( listener.getUrl() ) );
+                    client.ping();
+                }
+                catch ( MalformedURLException e )
+                {
+                    throw new ContinuumException( "Invalid url", e );
+                }
+                catch ( XmlRpcException e )
+                {
+                    throw new ContinuumException( "", e );
+                }
+                catch ( Exception e )
+                {
+                    
+                }*/
+
+                //{
+                    //client.ping();
+                    //found = true; 
+                    //client.buildProjects( buildContext );
+                //}
+                //catch ( XmlRpcException e )
+                //{
+                    //do something about the server Url
+                    //client.getServerUrl();
+                    //get projects of buildagent and set to build error the first project.
+                //}
+                log.info( "dispatched build to " + listener.getUrl() );
+                found = true;
+            }
+        }
+
+        if ( !found && !inBuildQueue )
+        {
+            // all build agents are busy, put into projectBuildQueue for now
+            if ( projectsBuildInQueue == null )
+            {
+                projectsBuildInQueue = new ArrayList<PrepareBuildProjectsTask>();
+            }
+
+            PrepareBuildProjectsTask prepareBuildTask = new PrepareBuildProjectsTask( projectsAndBuildDefinitionsMap, trigger );
+            projectsBuildInQueue.add( prepareBuildTask );
+        }
+    }
+
+    public void updateProjectScmRoot( Map context )
+        throws ContinuumException
+    {
+        try
+        {
+            int projectId = getProjectId( context );
+            
+            Project project = projectDao.getProjectWithScmDetails( projectId );
+            
+            ScmResult scmResult = new ScmResult();
+            scmResult.setCommandLine( getScmCommandLine( context ) );
+            scmResult.setCommandOutput( getScmCommandOutput( context ) );
+            scmResult.setException( getScmException( context ) );
+            scmResult.setProviderMessage( getScmProviderMessage( context ) );
+
+            String error = convertScmResultToError( scmResult );
+
+            if ( error == null )
+            {
+                scmResult.setSuccess( true );
+            }
+            else
+            {
+                scmResult.setSuccess( false );
+            }
+
+            project.setScmResult( scmResult );
+            projectDao.updateProject( project );
+
+            if ( error != null || isPrepareBuildFinished( context ) )
+            {
+                List<ProjectScmRoot> scmRoots = projectScmRootDao.getProjectScmRootByProjectGroup( project.getProjectGroup().getId() );
+                
+                for ( ProjectScmRoot scmRoot : scmRoots )
+                {
+                    if ( project.getScmUrl().startsWith( scmRoot.getScmRootAddress() ) )
+                    {
+                        if ( error != null )
+                        {
+                            scmRoot.setError( error );
+                            scmRoot.setState( ContinuumProjectState.ERROR );
+                        }
+                        else
+                        {
+                            scmRoot.setState( ContinuumProjectState.UPDATED );
+                        }
+                        projectScmRootDao.updateProjectScmRoot( scmRoot );
+                    }
+                }
+            }
+
+            if ( error != null )
+            {
+                updateBuildAgent( project.getId(), true );
+            }
+        }
+        catch ( ContinuumStoreException e )
+        {
+            throw new ContinuumException( "Error updating project scm root", e );
+        }
+    }
+
+    public void updateBuildResult( Map context )
+        throws ContinuumException
+    {
+        try
+        {
+            int projectId = getProjectId( context );
+            int buildDefinitionId = getBuildDefinitionId( context );
+
+            Project project = projectDao.getProjectWithAllDetails( projectId );
+            BuildDefinition buildDefinition = buildDefinitionDao.getBuildDefinition( buildDefinitionId );
+
+            BuildResult oldBuildResult =
+                buildResultDao.getLatestBuildResultForBuildDefinition( projectId, buildDefinitionId );
+
+            int buildNumber;
+
+            if ( getBuildState( context ) == ContinuumProjectState.OK )
+            {
+                buildNumber = project.getBuildNumber() + 1;
+            }
+            else
+            {
+                buildNumber = project.getBuildNumber();
+            }
+
+            // ----------------------------------------------------------------------
+            // Make the buildResult
+            // ----------------------------------------------------------------------
+
+            BuildResult buildResult = new BuildResult();
+
+            buildResult.setStartTime( getBuildStart( context ) );
+            buildResult.setEndTime( getBuildEnd( context ) );
+            buildResult.setBuildDefinition( buildDefinition );
+            buildResult.setBuildNumber( buildNumber );
+            buildResult.setError( getBuildError( context ) );
+            buildResult.setExitCode( getBuildExitCode( context ) );
+            buildResult.setModifiedDependencies( getModifiedDependencies( oldBuildResult, context ) );
+            buildResult.setState( getBuildState( context ) );
+            buildResult.setTrigger( getTrigger( context ) );
+            
+            buildResultDao.addBuildResult( project, buildResult );
+            
+            project.setBuildNumber( buildNumber );
+            project.setLatestBuildId( buildResult.getId() );
+            project.setOldState( project.getState() );
+            project.setState( getBuildState( context ) );
+
+            projectDao.updateProject( project );
+
+            updateBuildAgent( project.getId(), false );
+        }
+        catch ( ContinuumStoreException e )
+        {
+            throw new ContinuumException( "Error while updating build result for project", e );
+        }
+    }
+
+    public void reload()
+    {
+        this.initialize();
+    }
+
+    private List initializeBuildContext( Map<Integer, Integer> projectsAndBuildDefinitions, 
+                                         int trigger, BuildAgentListener listener )
+        throws ContinuumException
+    {
+        List buildContext = new ArrayList();
+        List<Project> projects = new ArrayList<Project>();
+
+        try
+        {
+            for ( Integer projectId : projectsAndBuildDefinitions.keySet() )
+            {
+                Project project = projectDao.getProjectWithDependencies( projectId );
+                projects.add( project );
+            }
+
+            try
+            {
+                projects = ProjectSorter.getSortedProjects( projects, null );
+            }
+            catch ( CycleDetectedException e )
+            {
+                log.info( "Cycle Detected" );
+            }
+
+            int ctr = 0;
+            
+            for ( Project project : projects )
+            {
+                if ( ctr == 0 )
+                {
+                    List<ProjectScmRoot> scmRoots = projectScmRootDao.getProjectScmRootByProjectGroup( project.getProjectGroup().getId() );
+                    for ( ProjectScmRoot scmRoot : scmRoots )
+                    {
+                        if ( project.getScmUrl().startsWith( scmRoot.getScmRootAddress() ) )
+                        {
+                            scmRoot.setOldState( scmRoot.getState() );
+                            scmRoot.setState( ContinuumProjectState.UPDATING );
+                            projectScmRootDao.updateProjectScmRoot( scmRoot );
+                            break;
+                        }
+                    }
+                }
+                
+                int buildDefinitionId = projectsAndBuildDefinitions.get( project.getId() );
+                BuildDefinition buildDef = buildDefinitionDao.getBuildDefinition( buildDefinitionId );
+                BuildResult oldBuildResult =
+                    buildResultDao.getLatestBuildResultForBuildDefinition( project.getId(), buildDefinitionId );
+
+                Map context = new HashMap();
+                context.put( KEY_PROJECT_ID, project.getId() );
+                context.put( KEY_EXECUTOR_ID, project.getExecutorId() );
+                context.put( KEY_SCM_URL, project.getScmUrl() );
+                context.put( KEY_SCM_USERNAME, project.getScmUsername() );
+                context.put( KEY_SCM_PASSWORD, project.getScmPassword() );
+                context.put( KEY_BUILD_DEFINITION_ID, buildDefinitionId );
+                context.put( KEY_BUILD_FILE, buildDef.getBuildFile() );
+                context.put( KEY_GOALS, buildDef.getGoals() );
+                context.put( KEY_ARGUMENTS, buildDef.getArguments() );
+                context.put( KEY_TRIGGER, trigger );
+                context.put( KEY_BUILD_FRESH, buildDef.isBuildFresh() );
+                
+                buildContext.add( context );
+                ctr++;
+            }
+            
+            listener.setBusy( true );
+            listener.setProjects( projects );
+
+            return buildContext;
+        }
+        catch ( ContinuumStoreException e )
+        {
+            throw new ContinuumException( "Error while initializing build context", e );
+        }
+    }
+
+    private List<ProjectDependency> getModifiedDependencies( BuildResult oldBuildResult, Map context )
+        throws ContinuumException
+    {
+        if ( oldBuildResult == null )
+        {
+            return null;
+        }
+
+        try
+        {
+            Project project = projectDao.getProjectWithAllDetails( getProjectId( context ) );
+            List<ProjectDependency> dependencies = project.getDependencies();
+
+            if ( dependencies == null )
+            {
+                dependencies = new ArrayList<ProjectDependency>();
+            }
+
+            if ( project.getParent() != null )
+            {
+                dependencies.add( project.getParent() );
+            }
+
+            if ( dependencies.isEmpty() )
+            {
+                return null;
+            }
+
+            List<ProjectDependency> modifiedDependencies = new ArrayList<ProjectDependency>();
+
+            for ( ProjectDependency dep : dependencies )
+            {
+                Project dependencyProject =
+                    projectDao.getProject( dep.getGroupId(), dep.getArtifactId(), dep.getVersion() );
+
+                if ( dependencyProject != null )
+                {
+                    List buildResults = buildResultDao.getBuildResultsInSuccessForProject( dependencyProject.getId(),
+                                                                                           oldBuildResult.getEndTime() );
+                    if ( buildResults != null && !buildResults.isEmpty() )
+                    {
+                        log.debug( "Dependency changed: " + dep.getGroupId() + ":" + dep.getArtifactId() + ":" +
+                            dep.getVersion() );
+                        modifiedDependencies.add( dep );
+                    }
+                    else
+                    {
+                        log.debug( "Dependency not changed: " + dep.getGroupId() + ":" + dep.getArtifactId() +
+                            ":" + dep.getVersion() );
+                    }
+                }
+                else
+                {
+                    log.debug( "Skip non Continuum project: " + dep.getGroupId() + ":" + dep.getArtifactId() +
+                        ":" + dep.getVersion() );
+                }
+            }
+
+            return modifiedDependencies;
+        }
+        catch ( ContinuumStoreException e )
+        {
+            log.warn( "Can't get the project dependencies", e );
+        }
+
+        return null;
+    }
+
+    private String convertScmResultToError( ScmResult result )
+    {
+        String error = "";
+
+        if ( result == null )
+        {
+            error = "Scm result is null.";
+        }
+        else
+        {
+            if ( result.getCommandLine() != null )
+            {
+                error = "Command line: " + StringUtils.clean( result.getCommandLine() ) +
+                    System.getProperty( "line.separator" );
+            }
+
+            if ( result.getProviderMessage() != null )
+            {
+                error = "Provider message: " + StringUtils.clean( result.getProviderMessage() ) +
+                    System.getProperty( "line.separator" );
+            }
+
+            if ( result.getCommandOutput() != null )
+            {
+                error += "Command output: " + System.getProperty( "line.separator" );
+                error += "-------------------------------------------------------------------------------" +
+                    System.getProperty( "line.separator" );
+                error += StringUtils.clean( result.getCommandOutput() ) + System.getProperty( "line.separator" );
+                error += "-------------------------------------------------------------------------------" +
+                    System.getProperty( "line.separator" );
+            }
+
+            if ( result.getException() != null )
+            {
+                error += "Exception:" + System.getProperty( "line.separator" );
+                error += result.getException();
+            }
+        }
+
+        return error;
+    }
+
+    private void updateBuildAgent( int projectId, boolean removeAll )
+        throws ContinuumException
+    {
+        for ( BuildAgentListener listener : listeners )
+        {
+            for ( Project project : listener.getProjects() )
+            {
+                if ( project.getId() == projectId )
+                {
+                    if ( removeAll )
+                    {
+                        listener.setProjects( null );
+                        listener.setBusy( false );
+
+                        buildProjectsInQueue();
+                    }
+                    else
+                    {
+                        listener.getProjects().remove( project );
+
+                        if ( !listener.hasProjects() )
+                        {
+                            listener.setBusy( false );
+
+                            buildProjectsInQueue();
+                        }
+                    }
+                    return;
+                }
+            }
+        }
+    }
+
+    public List<BuildAgentListener> getBuildAgentListeners()
+    {
+        return listeners;
+    }
+}

Propchange: continuum/branches/continuum-distributed-builds/continuum-builder/src/main/java/org/apache/continuum/builder/distributed/manager/DefaultDistributedBuildManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/branches/continuum-distributed-builds/continuum-builder/src/main/java/org/apache/continuum/builder/distributed/manager/DefaultDistributedBuildManager.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: continuum/branches/continuum-distributed-builds/continuum-builder/src/main/resources/META-INF/spring-context.xml
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-builder/src/main/resources/META-INF/spring-context.xml?rev=724132&view=auto
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-builder/src/main/resources/META-INF/spring-context.xml (added)
+++ continuum/branches/continuum-distributed-builds/continuum-builder/src/main/resources/META-INF/spring-context.xml Sun Dec  7 05:54:40 2008
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xmlns:aop="http://www.springframework.org/schema/aop"
+	xmlns:util="http://www.springframework.org/schema/util"
+	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+		http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
+		http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd">
+
+  <bean id="distributedBuildManager"
+    class="org.apache.continuum.builder.distributed.manager.DefaultDistributedBuildManager" init-method="initialize">
+    <property name="configurationService" ref="configurationService"/>
+    <property name="projectDao" ref="projectDao"/>
+    <property name="buildDefinitionDao" ref="buildDefinitionDao"/>
+    <property name="buildResultDao" ref="buildResultDao"/>
+    <property name="projectScmRootDao" ref="projectScmRootDao"/>
+  </bean>
+
+</beans>

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

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

Added: continuum/branches/continuum-distributed-builds/continuum-builder/src/test/java/org/apache/continuum/builder/distributed/manager/DefaultDistributedBuildManagerTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-builder/src/test/java/org/apache/continuum/builder/distributed/manager/DefaultDistributedBuildManagerTest.java?rev=724132&view=auto
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-builder/src/test/java/org/apache/continuum/builder/distributed/manager/DefaultDistributedBuildManagerTest.java (added)
+++ continuum/branches/continuum-distributed-builds/continuum-builder/src/test/java/org/apache/continuum/builder/distributed/manager/DefaultDistributedBuildManagerTest.java Sun Dec  7 05:54:40 2008
@@ -0,0 +1,133 @@
+package org.apache.continuum.builder.distributed.manager;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.continuum.builder.ContinuumBuilder;
+import org.apache.continuum.dao.BuildDefinitionDao;
+import org.apache.continuum.dao.BuildResultDao;
+import org.apache.continuum.dao.ProjectScmRootDao;
+import org.apache.continuum.model.project.ProjectScmRoot;
+import org.apache.maven.continuum.AbstractContinuumTest;
+import org.apache.maven.continuum.model.project.BuildDefinition;
+import org.apache.maven.continuum.model.project.BuildResult;
+import org.apache.maven.continuum.model.project.Project;
+import org.apache.maven.continuum.model.scm.ScmResult;
+import org.apache.maven.continuum.project.ContinuumProjectState;
+
+public class DefaultDistributedBuildManagerTest
+    extends AbstractContinuumTest
+{
+    DistributedBuildManager distributedBuildManager;
+
+    @Override
+    protected void setUp()
+        throws Exception
+    {
+        super.setUp();
+
+        distributedBuildManager = (DistributedBuildManager) lookup( "distributedBuildManager" );
+    }
+
+    public void testUpdateScmResult()
+        throws Exception
+    {
+        ProjectScmRootDao projectScmRootDao = (ProjectScmRootDao) lookup( ProjectScmRootDao.class.getName() );
+        
+        Project project = addProject( "project1" );
+        project.setScmUrl( "http://sample/scmurl" );
+        getProjectDao().updateProject( project );
+
+        ProjectScmRoot scmRoot = new ProjectScmRoot();
+        scmRoot.setScmRootAddress( "http://sample/scmurl" );
+        scmRoot.setProjectGroup( project.getProjectGroup() );
+        projectScmRootDao.addProjectScmRoot( scmRoot );
+
+        ScmResult expectedScmResult = new ScmResult();
+        expectedScmResult.setSuccess( true );
+
+        Map context = new HashMap();
+        context.put( "project-id", project.getId() );
+        context.put( "scm-command-line", null );
+        context.put( "scm-command-output", null );
+        context.put( "scm-exception", null );
+        context.put( "scm-provider-message", null );
+        context.put( "prepare-build-finished", true );
+
+        distributedBuildManager.updateProjectScmRoot( context );
+
+        project = getProjectDao().getProjectWithScmDetails( project.getId() );
+
+        assertNotNull( project.getScmResult() );
+        assertScmResultEquals( expectedScmResult, project.getScmResult() );
+    }
+
+    public void testUpdateBuildResult()
+        throws Exception
+    {
+        Project project = addProject( "project1" );
+        project = getProjectDao().getProjectWithAllDetails( project.getId() );
+        
+        BuildDefinition buildDef = new BuildDefinition();
+        buildDef.setBuildFile( "pom.xml" );
+        buildDef.setGoals( "mvn clean" );
+        buildDef.setType( "maven2" );
+        buildDef.setTemplate( false );
+        
+        BuildDefinitionDao buildDefinitionDao = (BuildDefinitionDao) lookup( BuildDefinitionDao.class.getName() );
+        buildDef = buildDefinitionDao.addBuildDefinition( buildDef );
+        
+        BuildResult expectedBuildResult = new BuildResult();
+        expectedBuildResult.setBuildNumber( project.getBuildNumber() + 1 );
+        expectedBuildResult.setBuildDefinition( buildDef );
+        expectedBuildResult.setError( null );
+        expectedBuildResult.setExitCode( 0 );
+        expectedBuildResult.setTrigger( ContinuumProjectState.TRIGGER_FORCED );
+        expectedBuildResult.setEndTime( new Long( "3456789012345" ) );
+        expectedBuildResult.setStartTime( new Long( "1234567890123" ) );
+        expectedBuildResult.setState( ContinuumProjectState.OK );
+
+        Map context = new HashMap();
+        context.put( "project-id", project.getId() );
+        context.put( "builddefinition-id", buildDef.getId() );
+        context.put( "build-start", expectedBuildResult.getStartTime() );
+        context.put( "build-end", expectedBuildResult.getEndTime() );
+        context.put( "build-error", expectedBuildResult.getError() );
+        context.put( "build-exit-code", expectedBuildResult.getExitCode() );
+        context.put( "build-state", expectedBuildResult.getState() );
+        context.put( "trigger", expectedBuildResult.getTrigger() );
+        
+        distributedBuildManager.updateBuildResult( context );
+
+        project = getProjectDao().getProjectWithBuildDetails( project.getId() );
+
+        BuildResultDao buildResultDao = (BuildResultDao) lookup( BuildResultDao.class.getName() );
+        BuildResult buildResult = buildResultDao.getBuildResult( project.getLatestBuildId() );
+
+        assertNotNull( buildResult );
+        assertBuildResultEquals( expectedBuildResult, buildResult );
+    }
+    
+    private void assertBuildResultEquals( BuildResult expected, BuildResult actual )
+        throws Exception
+    {
+        assertEquals( expected.getEndTime(), actual.getEndTime() );
+        assertEquals( expected.getStartTime(), actual.getStartTime() );
+        assertEquals( expected.getState(), actual.getState() );
+        assertEquals( expected.getBuildNumber(), actual.getBuildNumber() );
+        assertEquals( expected.getError(), actual.getError() );
+        assertEquals( expected.getExitCode(), actual.getExitCode() );
+        assertEquals( expected.getTrigger(), actual.getTrigger() );
+        assertEquals( expected.getBuildDefinition().getId(), actual.getBuildDefinition().getId() );
+    }
+
+    private void assertScmResultEquals( ScmResult expected, ScmResult actual )
+        throws Exception
+    {
+        assertEquals( expected.getChanges(), actual.getChanges() );
+        assertEquals( expected.getCommandLine(), actual.getCommandLine() );
+        assertEquals( expected.getCommandOutput(), actual.getCommandOutput() );
+        assertEquals( expected.getException(), actual.getException() );
+        assertEquals( expected.getProviderMessage(), actual.getProviderMessage() );
+    }
+}

Propchange: continuum/branches/continuum-distributed-builds/continuum-builder/src/test/java/org/apache/continuum/builder/distributed/manager/DefaultDistributedBuildManagerTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/branches/continuum-distributed-builds/continuum-builder/src/test/java/org/apache/continuum/builder/distributed/manager/DefaultDistributedBuildManagerTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: continuum/branches/continuum-distributed-builds/continuum-commons/src/main/java/org/apache/continuum/utils/ProjectSorter.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-commons/src/main/java/org/apache/continuum/utils/ProjectSorter.java?rev=724132&view=auto
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-commons/src/main/java/org/apache/continuum/utils/ProjectSorter.java (added)
+++ continuum/branches/continuum-distributed-builds/continuum-commons/src/main/java/org/apache/continuum/utils/ProjectSorter.java Sun Dec  7 05:54:40 2008
@@ -0,0 +1,159 @@
+package org.apache.continuum.utils;
+
+/*
+ * 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.
+ */
+
+import org.apache.maven.continuum.model.project.Project;
+import org.apache.maven.continuum.model.project.ProjectDependency;
+import org.codehaus.plexus.logging.Logger;
+import org.codehaus.plexus.util.dag.CycleDetectedException;
+import org.codehaus.plexus.util.dag.DAG;
+import org.codehaus.plexus.util.dag.TopologicalSorter;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Sort projects by dependencies.
+ *
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ * @version $Id$
+ */
+public class ProjectSorter
+{
+    private ProjectSorter()
+    {
+        // no touchy...
+    }
+
+    /**
+     * Sort a list of projects.
+     * <ul>
+     * <li>collect all the vertices for the projects that we want to build.</li>
+     * <li>iterate through the deps of each project and if that dep is within
+     * the set of projects we want to build then add an edge, otherwise throw
+     * the edge away because that dependency is not within the set of projects
+     * we are trying to build. we assume a closed set.</li>
+     * <li>do a topo sort on the graph that remains.</li>
+     * </ul>
+     */
+    public static List<Project> getSortedProjects( Collection<Project> projects, Logger logger )
+        throws CycleDetectedException
+    {
+        DAG dag = new DAG();
+
+        Map<String, Project> projectMap = new HashMap<String, Project>();
+
+        for ( Project project : projects )
+        {
+            String id = getProjectId( project );
+
+            if ( dag.getVertex( id ) != null )
+            {
+                logger.warn( "Project '" + id + "' is duplicated in the reactor" );
+            }
+
+            dag.addVertex( id );
+
+            projectMap.put( id, project );
+        }
+
+        for ( Project project : projects )
+        {
+            String id = getProjectId( project );
+
+            // Dependencies
+            for ( Object o : project.getDependencies() )
+            {
+                ProjectDependency dependency = (ProjectDependency) o;
+
+                String dependencyId = getDependencyId( dependency );
+
+                if ( dag.getVertex( dependencyId ) != null )
+                {
+                    dag.addEdge( id, dependencyId );
+                }
+            }
+
+            // Parent
+            ProjectDependency parent = project.getParent();
+
+            if ( parent != null )
+            {
+                String parentId = getDependencyId( parent );
+
+                if ( dag.getVertex( parentId ) != null )
+                {
+                    // Parent is added as an edge, but must not cause a cycle - so we remove any other edges it has in conflict
+                    if ( dag.hasEdge( parentId, id ) )
+                    {
+                        dag.removeEdge( parentId, id );
+                    }
+                    dag.addEdge( id, parentId );
+                }
+            }
+        }
+
+        List<Project> sortedProjects = new ArrayList<Project>();
+
+        for ( Object o : TopologicalSorter.sort( dag ) )
+        {
+            String id = (String) o;
+
+            sortedProjects.add( projectMap.get( id ) );
+        }
+
+        return sortedProjects;
+    }
+
+    private static String getProjectId( Project project )
+    {
+        String groupId;
+
+        String artifactId;
+
+        if ( project.getGroupId() == null )
+        {
+            groupId = project.getName();
+        }
+        else
+        {
+            groupId = project.getGroupId();
+        }
+
+        if ( project.getArtifactId() == null )
+        {
+            artifactId = project.getName();
+        }
+        else
+        {
+            artifactId = project.getArtifactId();
+        }
+
+        return groupId + ":" + artifactId + ":" + project.getVersion();
+    }
+
+    private static String getDependencyId( ProjectDependency project )
+    {
+        return project.getGroupId() + ":" + project.getArtifactId() + ":" + project.getVersion();
+    }
+}

Propchange: continuum/branches/continuum-distributed-builds/continuum-commons/src/main/java/org/apache/continuum/utils/ProjectSorter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/branches/continuum-distributed-builds/continuum-commons/src/main/java/org/apache/continuum/utils/ProjectSorter.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Copied: continuum/branches/continuum-distributed-builds/continuum-commons/src/test/java/org/apache/continuum/utils/ProjectSorterTest.java (from r724086, continuum/branches/continuum-distributed-builds/continuum-core/src/test/java/org/apache/maven/continuum/utils/ProjectSorterTest.java)
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-commons/src/test/java/org/apache/continuum/utils/ProjectSorterTest.java?p2=continuum/branches/continuum-distributed-builds/continuum-commons/src/test/java/org/apache/continuum/utils/ProjectSorterTest.java&p1=continuum/branches/continuum-distributed-builds/continuum-core/src/test/java/org/apache/maven/continuum/utils/ProjectSorterTest.java&r1=724086&r2=724132&rev=724132&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-core/src/test/java/org/apache/maven/continuum/utils/ProjectSorterTest.java (original)
+++ continuum/branches/continuum-distributed-builds/continuum-commons/src/test/java/org/apache/continuum/utils/ProjectSorterTest.java Sun Dec  7 05:54:40 2008
@@ -1,4 +1,4 @@
-package org.apache.maven.continuum.utils;
+package org.apache.continuum.utils;
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one

Propchange: continuum/branches/continuum-distributed-builds/continuum-commons/src/test/java/org/apache/continuum/utils/ProjectSorterTest.java
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Sun Dec  7 05:54:40 2008
@@ -0,0 +1 @@
+/continuum/branches/continuum-1.2.x/continuum-core/src/test/java/org/apache/maven/continuum/utils/ProjectSorterTest.java:690684,690689-690799,698449-698533,698817-698819,699529,700250,700273,700936,705894,705910,708339

Modified: continuum/branches/continuum-distributed-builds/continuum-core/pom.xml
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-core/pom.xml?rev=724132&r1=724131&r2=724132&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-core/pom.xml (original)
+++ continuum/branches/continuum-distributed-builds/continuum-core/pom.xml Sun Dec  7 05:54:40 2008
@@ -172,6 +172,10 @@
       <artifactId>mail</artifactId>
       <version>1.4</version>
       <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.continuum</groupId>
+      <artifactId>continuum-builder</artifactId>
     </dependency>    
     <!-- === Testing Dependencies === -->
     <dependency>

Modified: continuum/branches/continuum-distributed-builds/continuum-core/src/main/java/org/apache/continuum/taskqueue/manager/DefaultTaskQueueManager.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-core/src/main/java/org/apache/continuum/taskqueue/manager/DefaultTaskQueueManager.java?rev=724132&r1=724131&r2=724132&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-core/src/main/java/org/apache/continuum/taskqueue/manager/DefaultTaskQueueManager.java (original)
+++ continuum/branches/continuum-distributed-builds/continuum-core/src/main/java/org/apache/continuum/taskqueue/manager/DefaultTaskQueueManager.java Sun Dec  7 05:54:40 2008
@@ -12,12 +12,12 @@
 import org.apache.continuum.model.repository.RepositoryPurgeConfiguration;
 import org.apache.continuum.purge.PurgeConfigurationService;
 import org.apache.continuum.purge.task.PurgeTask;
+import org.apache.continuum.scm.queue.PrepareBuildProjectsTask;
 import org.apache.maven.continuum.buildqueue.BuildProjectTask;
 import org.apache.maven.continuum.model.project.BuildDefinition;
 import org.apache.maven.continuum.model.project.Project;
 import org.apache.maven.continuum.release.tasks.PerformReleaseProjectTask;
 import org.apache.maven.continuum.scm.queue.CheckOutTask;
-import org.apache.maven.continuum.scm.queue.PrepareBuildProjectsTask;
 import org.apache.maven.continuum.store.ContinuumStoreException;
 import org.codehaus.plexus.PlexusConstants;
 import org.codehaus.plexus.PlexusContainer;

Modified: continuum/branches/continuum-distributed-builds/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java?rev=724132&r1=724131&r2=724132&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java (original)
+++ continuum/branches/continuum-distributed-builds/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java Sun Dec  7 05:54:40 2008
@@ -33,6 +33,7 @@
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
+import org.apache.continuum.builder.ContinuumBuilder;
 import org.apache.continuum.configuration.ContinuumConfigurationException;
 import org.apache.continuum.dao.BuildDefinitionDao;
 import org.apache.continuum.dao.BuildResultDao;
@@ -43,14 +44,15 @@
 import org.apache.continuum.dao.ProjectGroupDao;
 import org.apache.continuum.dao.ProjectScmRootDao;
 import org.apache.continuum.dao.ScheduleDao;
-import org.apache.continuum.distributed.manager.DistributedBuildManager;
 import org.apache.continuum.model.project.ProjectScmRoot;
 import org.apache.continuum.model.release.ContinuumReleaseResult;
 import org.apache.continuum.purge.ContinuumPurgeManager;
 import org.apache.continuum.purge.PurgeConfigurationService;
 import org.apache.continuum.repository.RepositoryService;
+import org.apache.continuum.scm.queue.PrepareBuildProjectsTask;
 import org.apache.continuum.taskqueue.manager.TaskQueueManager;
 import org.apache.continuum.taskqueue.manager.TaskQueueManagerException;
+import org.apache.continuum.utils.ProjectSorter;
 import org.apache.maven.continuum.build.settings.SchedulesActivationException;
 import org.apache.maven.continuum.build.settings.SchedulesActivator;
 import org.apache.maven.continuum.builddefinition.BuildDefinitionService;
@@ -80,11 +82,9 @@
 import org.apache.maven.continuum.project.builder.maven.MavenOneContinuumProjectBuilder;
 import org.apache.maven.continuum.project.builder.maven.MavenTwoContinuumProjectBuilder;
 import org.apache.maven.continuum.release.ContinuumReleaseManager;
-import org.apache.maven.continuum.scm.queue.PrepareBuildProjectsTask;
 import org.apache.maven.continuum.store.ContinuumObjectNotFoundException;
 import org.apache.maven.continuum.store.ContinuumStoreException;
 import org.apache.maven.continuum.utils.ContinuumUrlValidator;
-import org.apache.maven.continuum.utils.ProjectSorter;
 import org.apache.maven.continuum.utils.WorkingDirectoryService;
 import org.codehaus.plexus.PlexusConstants;
 import org.codehaus.plexus.PlexusContainer;
@@ -249,9 +249,9 @@
     private TaskQueueManager taskQueueManager;
 
     /**
-     * @plexus.requirement
+     * @plexus.requirement role-hint="distributedBuild"
      */
-    private DistributedBuildManager distributedBuildManager;
+    private ContinuumBuilder distributedBuilder;
 
     public DefaultContinuum()
     {
@@ -3359,7 +3359,7 @@
     {
         if ( configurationService.isDistributedBuildEnabled() )
         {
-            distributedBuildManager.buildProjects( projectsBuildDefinitionsMap, trigger );
+            distributedBuilder.buildProjects( projectsBuildDefinitionsMap, trigger );
         }
         else
         {

Modified: continuum/branches/continuum-distributed-builds/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateWorkingDirectoryFromScmContinuumAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateWorkingDirectoryFromScmContinuumAction.java?rev=724132&r1=724131&r2=724132&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateWorkingDirectoryFromScmContinuumAction.java (original)
+++ continuum/branches/continuum-distributed-builds/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateWorkingDirectoryFromScmContinuumAction.java Sun Dec  7 05:54:40 2008
@@ -30,7 +30,6 @@
 import org.apache.maven.continuum.model.scm.ChangeSet;
 import org.apache.maven.continuum.model.scm.ScmResult;
 import org.apache.maven.continuum.notification.ContinuumNotificationDispatcher;
-import org.apache.maven.continuum.project.ContinuumProjectState;
 import org.apache.maven.continuum.store.ContinuumObjectNotFoundException;
 import org.apache.maven.continuum.store.ContinuumStoreException;
 import org.apache.maven.continuum.utils.ContinuumUtils;
@@ -88,11 +87,13 @@
 
         BuildDefinition buildDefinition = getBuildDefinition( context );
 
-        int state = project.getState();
+        // do not set state of project to updating
 
-        project.setState( ContinuumProjectState.UPDATING );
+        //int state = project.getState();
 
-        projectDao.updateProject( project );
+        //project.setState( ContinuumProjectState.UPDATING );
+
+        //projectDao.updateProject( project );
 
         UpdateScmResult scmResult;
 
@@ -175,19 +176,19 @@
         {
             // set back to the original state
             // TODO: transient states!
-            try
-            {
-                project = projectDao.getProject( project.getId() );
-
-                project.setState( state );
-
-                projectDao.updateProject( project );
-            }
-            catch ( Exception e )
-            {
+            //try
+            //{
+            //    project = projectDao.getProject( project.getId() );
+
+            //    project.setState( state );
+
+            //    projectDao.updateProject( project );
+            //}
+            //catch ( Exception e )
+            //{
                 // nasty nasty, but we're in finally, so just sacrifice the state to keep the original exception
-                getLogger().error( e.getMessage(), e );
-            }
+            //    getLogger().error( e.getMessage(), e );
+            //}
 
             notifier.checkoutComplete( project, buildDefinition );
         }

Modified: continuum/branches/continuum-distributed-builds/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutor.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutor.java?rev=724132&r1=724131&r2=724132&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutor.java (original)
+++ continuum/branches/continuum-distributed-builds/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutor.java Sun Dec  7 05:54:40 2008
@@ -9,6 +9,8 @@
 import org.apache.continuum.dao.ProjectDao;
 import org.apache.continuum.dao.ProjectScmRootDao;
 import org.apache.continuum.model.project.ProjectScmRoot;
+import org.apache.continuum.scm.queue.PrepareBuildProjectsTask;
+import org.apache.continuum.utils.ProjectSorter;
 import org.apache.maven.continuum.core.action.AbstractContinuumAction;
 import org.apache.maven.continuum.model.project.Project;
 import org.apache.maven.continuum.model.project.ProjectGroup;
@@ -18,7 +20,6 @@
 import org.apache.maven.continuum.project.ContinuumProjectState;
 import org.apache.maven.continuum.store.ContinuumStoreException;
 import org.apache.maven.continuum.utils.ContinuumUtils;
-import org.apache.maven.continuum.utils.ProjectSorter;
 import org.apache.maven.continuum.utils.WorkingDirectoryService;
 import org.codehaus.plexus.action.ActionManager;
 import org.codehaus.plexus.action.ActionNotFoundException;

Modified: continuum/branches/continuum-distributed-builds/continuum-core/src/main/resources/META-INF/spring-context.xml
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-core/src/main/resources/META-INF/spring-context.xml?rev=724132&r1=724131&r2=724132&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-core/src/main/resources/META-INF/spring-context.xml (original)
+++ continuum/branches/continuum-distributed-builds/continuum-core/src/main/resources/META-INF/spring-context.xml Sun Dec  7 05:54:40 2008
@@ -33,8 +33,9 @@
     </property>
   </bean>
 
-  <bean id="distributedBuildManager"
-    class="org.apache.continuum.distributed.manager.DefaultDistributedBuildManager" init-method="initialize">
+  <bean name="continuumBuilder#distributedBuild"
+        class="org.apache.continuum.builder.distributed.manager.DefaultDistributedBuildManager"
+        init-method="initialize">
     <property name="configurationService" ref="configurationService"/>
     <property name="projectDao" ref="projectDao"/>
     <property name="buildDefinitionDao" ref="buildDefinitionDao"/>

Modified: continuum/branches/continuum-distributed-builds/continuum-webapp/src/main/java/org/apache/continuum/web/action/admin/BuildAgentAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-webapp/src/main/java/org/apache/continuum/web/action/admin/BuildAgentAction.java?rev=724132&r1=724131&r2=724132&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-webapp/src/main/java/org/apache/continuum/web/action/admin/BuildAgentAction.java (original)
+++ continuum/branches/continuum-distributed-builds/continuum-webapp/src/main/java/org/apache/continuum/web/action/admin/BuildAgentAction.java Sun Dec  7 05:54:40 2008
@@ -20,8 +20,8 @@
  */
 
 import org.apache.continuum.configuration.BuildAgentConfiguration;
-import org.apache.continuum.distributed.BuildAgent;
-import org.apache.continuum.distributed.manager.DistributedBuildManager;
+import org.apache.continuum.builder.distributed.BuildAgentListener;
+import org.apache.continuum.builder.distributed.manager.DistributedBuildManager;
 import org.apache.maven.continuum.configuration.ConfigurationService;
 import org.apache.maven.continuum.model.system.Installation;
 import org.apache.maven.continuum.security.ContinuumRoleConstants;
@@ -148,20 +148,20 @@
             return CONFIRM;
         }
 
-        List<BuildAgent> agents = distributedBuildManager.getBuildAgents();
+        List<BuildAgentListener> listeners = distributedBuildManager.getBuildAgentListeners();
 
-        for ( BuildAgent agent : agents )
+        for ( BuildAgentListener listener : listeners )
         {
-            if ( agent.getUrl().equals( buildAgent.getUrl() ) )
+            if ( listener.getUrl().equals( buildAgent.getUrl() ) )
             {
-                if ( agent.isBusy() )
+                if ( listener.isBusy() )
                 {
                     message = getText( "buildAgent.error.delete.busy" );
                     return ERROR;
                 }
                 else
                 {
-                    agents.remove( agent );
+                    listeners.remove( listener );
                     break;
                 }
             }

Modified: continuum/branches/continuum-distributed-builds/continuum-webapp/src/main/java/org/apache/continuum/web/action/admin/DistributedBuildAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-webapp/src/main/java/org/apache/continuum/web/action/admin/DistributedBuildAction.java?rev=724132&r1=724131&r2=724132&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-webapp/src/main/java/org/apache/continuum/web/action/admin/DistributedBuildAction.java (original)
+++ continuum/branches/continuum-distributed-builds/continuum-webapp/src/main/java/org/apache/continuum/web/action/admin/DistributedBuildAction.java Sun Dec  7 05:54:40 2008
@@ -22,8 +22,8 @@
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.continuum.distributed.BuildAgent;
-import org.apache.continuum.distributed.manager.DistributedBuildManager;
+import org.apache.continuum.builder.distributed.BuildAgentListener;
+import org.apache.continuum.builder.distributed.manager.DistributedBuildManager;
 import org.apache.maven.continuum.model.project.Project;
 import org.apache.maven.continuum.security.ContinuumRoleConstants;
 import org.apache.maven.continuum.web.action.ContinuumActionSupport;
@@ -54,20 +54,18 @@
 
     public String view()
     {
-        List<BuildAgent> buildAgents = distributedBuildManager.getBuildAgents();
-        
         distributedBuildSummary = new ArrayList<DistributedBuildSummary>();
         
-        for ( BuildAgent buildAgent : buildAgents )
+        for ( BuildAgentListener listener : distributedBuildManager.getBuildAgentListeners() )
         {
-            if ( buildAgent.getProjects() != null )
+            if ( listener.hasProjects() )
             {
-                for ( Project project : buildAgent.getProjects() )
+                for ( Project project : listener.getProjects() )
                 {
                     DistributedBuildSummary summary = new DistributedBuildSummary();
                     summary.setProjectId( project.getId() );
                     summary.setProjectName( project.getName() );
-                    summary.setUrl( buildAgent.getUrl() );
+                    summary.setUrl( listener.getUrl() );
                     
                     distributedBuildSummary.add( summary );
                 }

Modified: continuum/branches/continuum-distributed-builds/pom.xml
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/pom.xml?rev=724132&r1=724131&r2=724132&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/pom.xml (original)
+++ continuum/branches/continuum-distributed-builds/pom.xml Sun Dec  7 05:54:40 2008
@@ -1,4 +1,4 @@
-<?xml version='1.0' encoding='UTF-8'?>
+<?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
@@ -16,8 +16,7 @@
 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">
+--><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>
@@ -219,6 +218,8 @@
     <module>continuum-docs</module>
     <module>continuum-jetty</module>
     <module>continuum-purge</module>
+    <module>continuum-distributed-build</module>
+    <module>continuum-builder</module>
   </modules>
   <!-- TODO: confirm whether these are needed -->
   <repositories>
@@ -565,6 +566,11 @@
         <version>${pom.version}</version>
       </dependency>
       <dependency>
+        <groupId>org.apache.continuum</groupId>
+        <artifactId>continuum-builder</artifactId>
+        <version>${pom.version}</version>
+      </dependency>
+      <dependency>
         <groupId>net.sf.ehcache</groupId>
         <artifactId>ehcache</artifactId>
         <version>1.5.0</version>



Mime
View raw message