continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r725665 [1/2] - in /continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent: ./ src/main/java/org/apache/continuum/buildagent/ src/main/java/org/apache/continuum/buildagent/action/ src/main/java/org/...
Date Thu, 11 Dec 2008 11:36:43 GMT
Author: ctan
Date: Thu Dec 11 03:36:41 2008
New Revision: 725665

URL: http://svn.apache.org/viewvc?rev=725665&view=rev
Log:
-added core implementation of slave agent

Submitted By: Jan Stevens Ancajas

Added:
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/action/
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/action/AbstractContinuumAction.java   (with props)
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/action/AddProjectToCheckOutQueueAction.java   (with props)
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/action/CheckWorkingDirectoryAction.java   (with props)
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/action/CheckoutProjectContinuumAction.java   (with props)
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/action/CleanWorkingDirectoryAction.java   (with props)
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/action/CreateBuildProjectTaskAction.java   (with props)
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/action/ExecuteBuilderContinuumAction.java   (with props)
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/action/UpdateProjectFromWorkingDirectoryContinuumAction.java   (with props)
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/action/UpdateWorkingDirectoryFromScmContinuumAction.java   (with props)
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/buildcontext/
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/buildcontext/manager/
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/buildcontext/manager/BuildContextManager.java   (with props)
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/buildcontext/manager/DefaultBuildContextManager.java   (with props)
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/continuum/
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/continuum/Continuum.java   (with props)
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/continuum/DefaultContinuum.java   (with props)
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/controller/
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/controller/BuildProjectTaskExecutor.java   (with props)
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/controller/DistributedBuildController.java   (with props)
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/scm/
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/scm/queue/
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/scm/queue/PrepareBuildProjectsTaskExecutor.java   (with props)
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/taskqueue/
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/taskqueue/manager/
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/taskqueue/manager/DefaultTaskQueueManager.java   (with props)
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/taskqueue/manager/TaskQueueManager.java   (with props)
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/util/
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/util/BuildContextToProject.java   (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)
Removed:
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/queue/
Modified:
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/pom.xml
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentServiceImpl.java
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/configuration/DefaultConfigurationService.java

Modified: 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=725665&r1=725664&r2=725665&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/pom.xml (original)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/pom.xml Thu Dec 11 03:36:41 2008
@@ -29,7 +29,7 @@
   <artifactId>continuum-buildagent</artifactId>
   <packaging>jar</packaging>
   <name>Continuum :: Distributed Build :: Build Agent</name>
-  
+
   <build>
     <plugins>
       <plugin>
@@ -66,9 +66,11 @@
               <goal>xsd</goal>
             </goals>
             <configuration>
-              <outputDirectory>${project.build.outputDirectory}/META-INF/continuum/xsd</outputDirectory>
+              <outputDirectory>
+                ${project.build.outputDirectory}/META-INF/continuum/xsd
+              </outputDirectory>
             </configuration>
-          </execution>                    
+          </execution>
         </executions>
       </plugin>
     </plugins>
@@ -91,6 +93,50 @@
       <version>1.0.1</version>
     </dependency>
     <dependency>
+      <groupId>org.apache.continuum</groupId>
+      <artifactId>continuum-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.shared</groupId>
+      <artifactId>file-management</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-artifact</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.wagon</groupId>
+      <artifactId>wagon-provider-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.scm</groupId>
+      <artifactId>maven-scm-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-project</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-core</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-core</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.continuum</groupId>
+      <artifactId>continuum-scm</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.continuum</groupId>
+      <artifactId>continuum-core</artifactId>
+    </dependency>
+
+    <dependency>
       <groupId>org.codehaus.plexus</groupId>
       <artifactId>plexus-utils</artifactId>
     </dependency>
@@ -98,15 +144,26 @@
       <groupId>org.springframework</groupId>
       <artifactId>spring-core</artifactId>
       <version>${spring.version}</version>
-    </dependency> 
+    </dependency>
     <dependency>
       <groupId>org.slf4j</groupId>
       <artifactId>slf4j-api</artifactId>
-    </dependency>      
+    </dependency>
     <dependency>
       <groupId>org.slf4j</groupId>
       <artifactId>slf4j-log4j12</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.codehaus.plexus</groupId>
+      <artifactId>plexus-action</artifactId>
+      <version>1.0-alpha-6</version>
+      <exclusions>
+        <exclusion>
+          <groupId>org.codehaus.plexus</groupId>
+          <artifactId>plexus-container-default</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
   </dependencies>
 </project>

Modified: 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=725665&r1=725664&r2=725665&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentServiceImpl.java (original)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentServiceImpl.java Thu Dec 11 03:36:41 2008
@@ -1,12 +1,31 @@
 package org.apache.continuum.buildagent;
 
+/* TODO: 
+ * CHeckout the project
+ *   
+ */
+
+import java.io.File;
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 
+import org.apache.continuum.buildagent.buildcontext.manager.BuildContextManager;
 import org.apache.continuum.buildagent.configuration.ConfigurationService;
 import org.apache.continuum.buildagent.model.BuildContext;
 import org.apache.continuum.buildagent.model.Installation;
+import org.apache.continuum.buildagent.util.BuildContextToProject;
+import org.apache.continuum.dao.BuildResultDao;
+import org.apache.continuum.dao.ProjectDao;
+import org.apache.continuum.buildagent.continuum.Continuum;
+import org.apache.maven.continuum.model.project.BuildResult;
+import org.apache.maven.continuum.model.project.Project;
+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.shared.model.fileset.FileSet;
+import org.apache.maven.shared.model.fileset.util.FileSetManager;
 
 public class ContinuumBuildAgentServiceImpl
     extends AbstractContinuumBuildAgentService
@@ -16,14 +35,39 @@
      */
     private ConfigurationService configurationService;
 
+    /**
+     * @plexus.requirement 
+     */
+    private Continuum continuum;
+    
+    /**
+     * @plexus.requirement
+     */
+    private BuildContextManager buildContextManager;
+
     public void buildProjects( List<Map> projectsBuildContext )
         throws ContinuumBuildAgentException
     {
-        List<BuildContext> buildContext = initializeBuildContext( projectsBuildContext );
-
-        prepareBuildProjects( buildContext );
+        List<BuildContext> buildContextList = initializeBuildContext( projectsBuildContext );
         
+        buildContextManager.setBuildContextList( buildContextList );
+      
+        try
+        {
+
+            for ( BuildContext buildContext : buildContextList )
+            {
+                Project project = BuildContextToProject.getProject( buildContext );
+                continuum.buildProject( project.getId(), buildContext.getBuildDefinitionId(),
+                                        ContinuumProjectState.TRIGGER_FORCED );
+            }
+        }
+        catch ( Exception e )
+        {
+            throw new ContinuumBuildAgentException( e.getMessage(), e );
+        }        
     }
+    
 
     public List<Installation> getAvailableInstallations()
         throws ContinuumBuildAgentException
@@ -34,27 +78,39 @@
     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;
+        try
+        {
+            return continuum.getTaskQueueManager().buildInProgress();
+        }
+        catch ( Exception e )
+        {
+            throw new ContinuumBuildAgentException( e.getMessage(), e );
+        }
     }
 
     public int getProjectCurrentlyBuilding()
     {
-        // TODO Auto-generated method stub
-        return 0;
+     
+        try
+        {
+            return continuum.getTaskQueueManager().getCurrentProjectIdBuilding();
+        }
+        catch ( Exception e )
+        {
+            return -1;
+        }
     }
 
     private List<BuildContext> initializeBuildContext( List<Map> projectsBuildContext )
     {
         List<BuildContext> buildContext = new ArrayList<BuildContext>();
-        
+
         for ( Map map : projectsBuildContext )
         {
             BuildContext context = new BuildContext();
@@ -73,32 +129,5 @@
         }
 
         return buildContext;
-    }
-
-    private void prepareBuildProjects( List<BuildContext> context )
-    {
-        for ( BuildContext buildContext : context )
-        {
-            if ( buildContext.isBuildFresh() )
-            {
-                // clean working directory
-                cleanWorkingDirectory( buildContext );
-            }
-        }
-    }
-
-    private void cleanWorkingDirectory( BuildContext context )
-    {
-        
-    }
-
-    public ConfigurationService getConfigurationService()
-    {
-        return configurationService;
-    }
-
-    public void setConfigurationService( ConfigurationService configurationService )
-    {
-        this.configurationService = configurationService;
-    }
+    }    
 }

Added: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/action/AbstractContinuumAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/action/AbstractContinuumAction.java?rev=725665&view=auto
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/action/AbstractContinuumAction.java (added)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/action/AbstractContinuumAction.java Thu Dec 11 03:36:41 2008
@@ -0,0 +1,300 @@
+package org.apache.continuum.buildagent.action;
+
+/*
+ * 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.continuum.buildagent.model.BuildContext;
+import org.apache.continuum.model.project.ProjectScmRoot;
+import org.apache.maven.continuum.model.project.BuildDefinition;
+import org.apache.maven.continuum.model.project.BuildDefinitionTemplate;
+import org.apache.maven.continuum.model.project.Project;
+import org.apache.maven.continuum.model.project.ProjectGroup;
+import org.apache.maven.continuum.model.scm.ScmResult;
+import org.codehaus.plexus.action.AbstractAction;
+import org.codehaus.plexus.util.StringUtils;
+
+import java.io.File;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
+ * @version $Id$
+ */
+public abstract class AbstractContinuumAction
+    extends AbstractAction
+{
+    // ----------------------------------------------------------------------
+    // Keys for the values that can be in the context
+    // ----------------------------------------------------------------------
+
+    public static final String KEY_PROJECT_ID = "project-id";
+
+    public static final String KEY_PROJECT = "project";
+
+    public static final String KEY_BUILD_DEFINITION_TEMPLATE = "build-definition-template";
+
+    public static final String KEY_BUILD_DEFINITION = "build-definition";
+
+    public static final String KEY_BUILD_DEFINITION_ID = "build-definition-id";
+
+    public static final String KEY_UNVALIDATED_PROJECT = "unvalidated-project";
+
+    public static final String KEY_PROJECT_GROUP_ID = "project-group-id";
+
+    public static final String KEY_UNVALIDATED_PROJECT_GROUP = "unvalidated-project-group";
+
+    public static final String KEY_BUILD_ID = "build-id";
+
+    public static final String KEY_WORKING_DIRECTORY = "working-directory";
+
+    public static final String KEY_WORKING_DIRECTORY_EXISTS = "working-directory-exists";
+
+    public static final String KEY_CHECKOUT_SCM_RESULT = "checkout-result";
+
+    public static final String KEY_UPDATE_SCM_RESULT = "update-result";
+
+    public static final String KEY_UPDATE_DEPENDENCIES = "update-dependencies";
+
+    public static final String KEY_TRIGGER = "trigger";
+
+    public static final String KEY_FIRST_RUN = "first-run";
+
+    public static final String KEY_PROJECT_RELATIVE_PATH = "project-relative-path";
+    
+    public static final String KEY_SCM_USE_CREDENTIALS_CACHE = "useCredentialsCache";
+    
+    public static final String KEY_SCM_USERNAME = "scmUserName";
+    
+    public static final String KEY_SCM_PASSWORD = "scmUserPassword";
+
+    public static final String KEY_SCM_RESULT = "scmResult";
+
+    public static final String KEY_OLD_SCM_RESULT = "old-scmResult";
+
+    public static final String KEY_PROJECT_SCM_ROOT = "projectScmRoot";
+
+    public static final String KEY_OLD_BUILD_ID = "old-buildResult-id";
+
+    public static final String KEY_CANCELLED = "cancelled";
+    
+    
+    //---distributed build
+    public static final String KEY_BUILD_CONTEXT = "build-context";
+    //---
+
+    // ----------------------------------------------------------------------
+    // Utils
+    // ----------------------------------------------------------------------
+
+    protected String nullIfEmpty( String string )
+    {
+        if ( StringUtils.isEmpty( string ) )
+        {
+            return null;
+        }
+
+        return string;
+    }
+
+    // ----------------------------------------------------------------------
+    //
+    // ----------------------------------------------------------------------
+    public static BuildContext getBuildContext( Map t )
+    {
+        return (BuildContext) getObject( t, KEY_BUILD_CONTEXT );
+    }
+
+    public static int getProjectId( Map context )
+    {
+        return getInteger( context, KEY_PROJECT_ID );
+    }
+
+    public static Project getProject( Map context )
+    {
+        return (Project) getObject( context, KEY_PROJECT );
+    }
+
+    public static int getProjectGroupId( Map context )
+    {
+        return getInteger( context, KEY_PROJECT_GROUP_ID );
+    }
+
+    public static BuildDefinitionTemplate getBuildDefinitionTemplate( Map context )
+    {
+        return (BuildDefinitionTemplate) getObject( context, KEY_BUILD_DEFINITION_TEMPLATE, null );
+    }
+
+    public static BuildDefinition getBuildDefinition( Map context )
+    {
+        return (BuildDefinition) getObject( context, KEY_BUILD_DEFINITION, null );
+    }
+
+    public static int getBuildDefinitionId( Map context )
+    {
+        return getInteger( context, KEY_BUILD_DEFINITION_ID );
+    }
+
+    public static String getBuildId( Map context )
+    {
+        return getString( context, KEY_BUILD_ID );
+    }
+
+    public static int getTrigger( Map context )
+    {
+        return getInteger( context, KEY_TRIGGER );
+    }
+
+    public static Project getUnvalidatedProject( Map context )
+    {
+        return (Project) getObject( context, KEY_UNVALIDATED_PROJECT );
+    }
+
+    public static ProjectGroup getUnvalidatedProjectGroup( Map context )
+    {
+        return (ProjectGroup) getObject( context, KEY_UNVALIDATED_PROJECT_GROUP );
+    }
+
+    public static File getWorkingDirectory( Map context )
+    {
+        return new File( getString( context, KEY_WORKING_DIRECTORY ) );
+    }
+
+    public static ScmResult getCheckoutResult( Map context, Object defaultValue )
+    {
+        return (ScmResult) getObject( context, KEY_CHECKOUT_SCM_RESULT, defaultValue );
+    }
+
+    public static ScmResult getUpdateScmResult( Map context )
+    {
+        return (ScmResult) getObject( context, KEY_UPDATE_SCM_RESULT );
+    }
+
+    public static ScmResult getUpdateScmResult( Map context, ScmResult defaultValue )
+    {
+        return (ScmResult) getObject( context, KEY_UPDATE_SCM_RESULT, defaultValue );
+    }
+
+    public static List getUpdatedDependencies( Map context )
+    {
+        return getUpdatedDependencies( context, null );
+    }
+
+    public static List getUpdatedDependencies( Map context, List defaultValue )
+    {
+        return (List) getObject( context, KEY_UPDATE_DEPENDENCIES, defaultValue );
+    }
+
+    public static ScmResult getScmResult( Map context )
+    {
+        return (ScmResult) getObject( context, KEY_SCM_RESULT );
+    }
+
+    public static ScmResult getScmResult( Map context, ScmResult defaultValue )
+    {
+        return (ScmResult) getObject( context, KEY_SCM_RESULT, defaultValue );
+    }
+
+    public static ScmResult getOldScmResult( Map context )
+    {
+        return (ScmResult) getObject( context, KEY_OLD_SCM_RESULT );
+    }
+
+    public static ScmResult getOldScmResult( Map context, ScmResult defaultValue )
+    {
+        return (ScmResult) getObject( context, KEY_OLD_SCM_RESULT, defaultValue );
+    }
+
+    public static ProjectScmRoot getProjectScmRoot( Map context )
+    {
+        return (ProjectScmRoot) getObject( context, KEY_PROJECT_SCM_ROOT );
+    }
+
+    public static int getOldBuildId( Map context )
+    {
+        return getInteger( context, KEY_OLD_BUILD_ID ); 
+    }
+
+    // ----------------------------------------------------------------------
+    //
+    // ----------------------------------------------------------------------
+
+    protected static String getString( Map context, String key )
+    {
+        return (String) getObject( context, key );
+    }
+
+    protected static String getString( Map context, String key, String defaultValue )
+    {
+        return (String) getObject( context, key, defaultValue );
+    }
+
+    public static boolean getBoolean( Map context, String key )
+    {
+        return ( (Boolean) getObject( context, key ) ).booleanValue();
+    }
+    
+    public 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 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-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/action/AbstractContinuumAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/action/AbstractContinuumAction.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/action/AddProjectToCheckOutQueueAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/action/AddProjectToCheckOutQueueAction.java?rev=725665&view=auto
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/action/AddProjectToCheckOutQueueAction.java (added)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/action/AddProjectToCheckOutQueueAction.java Thu Dec 11 03:36:41 2008
@@ -0,0 +1,65 @@
+package org.apache.continuum.buildagent.action;
+
+/*
+ * 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.continuum.buildagent.configuration.ConfigurationService;
+import org.apache.continuum.buildagent.util.BuildContextToProject;
+import org.apache.continuum.dao.ProjectDao;
+import org.apache.continuum.taskqueue.manager.TaskQueueManager;
+import org.apache.maven.continuum.model.project.Project;
+import org.apache.maven.continuum.scm.queue.CheckOutTask;
+import org.apache.maven.continuum.utils.WorkingDirectoryService;
+
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
+ * @version $Id$
+ * @plexus.component role="org.codehaus.plexus.action.Action"
+ * role-hint="add-project-to-checkout-queue"
+ */
+public class AddProjectToCheckOutQueueAction
+    extends AbstractContinuumAction
+{
+
+    /**
+     * @plexus.requirement
+     */    
+    private ConfigurationService configurationService;
+
+    /**
+     * @plexus.requirement
+     */
+    private TaskQueueManager taskQueueManager;
+    
+    @SuppressWarnings("unchecked")
+    public void execute( Map context )
+        throws Exception
+    {
+
+        Project project = BuildContextToProject.getProject( getBuildContext( context ) );
+
+        CheckOutTask checkOutTask =
+            new CheckOutTask( project.getId(), configurationService.getWorkingDirectory( project.getId() ),
+                              project.getName(), project.getScmUsername(), project.getScmPassword() );
+
+        taskQueueManager.getCheckoutQueue().put( checkOutTask );
+    }
+}
\ No newline at end of file

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

Propchange: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/action/AddProjectToCheckOutQueueAction.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/action/CheckWorkingDirectoryAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/action/CheckWorkingDirectoryAction.java?rev=725665&view=auto
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/action/CheckWorkingDirectoryAction.java (added)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/action/CheckWorkingDirectoryAction.java Thu Dec 11 03:36:41 2008
@@ -0,0 +1,47 @@
+package org.apache.continuum.buildagent.action;
+
+import java.io.File;
+import java.util.Map;
+
+import org.apache.continuum.buildagent.buildcontext.manager.BuildContextManager;
+import org.apache.continuum.buildagent.configuration.ConfigurationService;
+import org.apache.continuum.buildagent.util.BuildContextToProject;
+import org.apache.maven.continuum.model.project.Project;
+
+/**
+ * 
+ * @plexus.component role="org.codehaus.plexus.action.Action"
+ * role-hint="check-working-directory-dist"
+ */
+public class CheckWorkingDirectoryAction
+    extends AbstractContinuumAction
+{
+    /**
+     * @plexus.requirement
+     */
+    BuildContextManager buildContextManager;
+
+    /**
+     * @plexus.requirement
+     */    
+    ConfigurationService configurationService;
+
+    public void execute( Map context )
+        throws Exception
+    {
+        Project project =  BuildContextToProject.getProject( buildContextManager.getBuildContext( getProjectId( context ) ) );
+
+        File workingDirectory = configurationService.getWorkingDirectory( project.getId() );
+
+        if ( !workingDirectory.exists() )
+        {
+            context.put( KEY_WORKING_DIRECTORY_EXISTS, Boolean.FALSE );
+
+            return;
+        }
+
+        File[] files = workingDirectory.listFiles();
+
+        context.put( KEY_WORKING_DIRECTORY_EXISTS, Boolean.valueOf( files.length > 0 ) );
+    }
+}

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

Propchange: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/action/CheckWorkingDirectoryAction.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/action/CheckoutProjectContinuumAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/action/CheckoutProjectContinuumAction.java?rev=725665&view=auto
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/action/CheckoutProjectContinuumAction.java (added)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/action/CheckoutProjectContinuumAction.java Thu Dec 11 03:36:41 2008
@@ -0,0 +1,272 @@
+package org.apache.continuum.buildagent.action;
+
+/*
+ * 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.continuum.dao.BuildDefinitionDao;
+import org.apache.continuum.dao.ProjectDao;
+import org.apache.continuum.scm.ContinuumScm;
+import org.apache.continuum.scm.ContinuumScmConfiguration;
+import org.apache.maven.continuum.model.project.BuildDefinition;
+import org.apache.maven.continuum.model.project.Project;
+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.continuum.buildagent.util.BuildContextToProject;
+//import org.apache.maven.continuum.utils.ContinuumUtils;
+import org.apache.maven.scm.ScmException;
+import org.apache.maven.scm.command.checkout.CheckOutScmResult;
+import org.apache.maven.scm.manager.NoSuchScmProviderException;
+import org.apache.maven.scm.repository.ScmRepositoryException;
+import org.codehaus.plexus.util.StringUtils;
+
+import java.io.File;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
+ * @version $Id$
+ * @plexus.component role="org.codehaus.plexus.action.Action" role-hint="checkout-project-dist"
+ */
+public class CheckoutProjectContinuumAction
+    extends AbstractContinuumAction
+{
+    /**
+     * @plexus.requirement
+     */
+    private ContinuumNotificationDispatcher notifier;
+
+    /**
+     * @plexus.requirement
+     */
+    private ContinuumScm scm;
+
+    /**
+     * @plexus.requirement
+     */
+    //private BuildDefinitionDao buildDefinitionDao;
+
+    /**
+     * @plexus.requirement
+     */
+   // private ProjectDao projectDao;
+
+    public void execute( Map context )
+        throws ContinuumObjectNotFoundException, ContinuumStoreException
+    {
+        Project project = BuildContextToProject.getProject( this.getBuildContext( context ) );
+        
+        /*
+        BuildDefinition buildDefinition = getBuildDefinition( context );
+
+        if ( buildDefinition != null )
+        {
+            buildDefinition = buildDefinitionDao.getBuildDefinition( buildDefinition.getId() );
+        }
+        */
+
+        project.setState( ContinuumProjectState.CHECKING_OUT );
+
+        //projectDao.updateProject( project );
+
+        File workingDirectory = getWorkingDirectory( context );
+
+        // ----------------------------------------------------------------------
+        // Check out the project
+        // ----------------------------------------------------------------------
+
+        ScmResult result;
+
+        try
+        {
+            String scmUserName = getString( context, KEY_SCM_USERNAME, "" );
+            String scmPassword = getString( context, KEY_SCM_PASSWORD, "" );
+            ContinuumScmConfiguration config =
+                createScmConfiguration( project, workingDirectory, scmUserName, scmPassword );
+
+            String tag = config.getTag();
+            getLogger().info( "Checking out project: '" + project.getName() + "', id: '" + project.getId() + "' " +
+                "to '" + workingDirectory + "'" + ( tag != null ? " with branch/tag " + tag + "." : "." ) );
+
+            CheckOutScmResult checkoutResult = scm.checkout( config );
+            if ( StringUtils.isNotEmpty( checkoutResult.getRelativePathProjectDirectory() ) )
+            {
+                context.put( AbstractContinuumAction.KEY_PROJECT_RELATIVE_PATH,
+                             checkoutResult.getRelativePathProjectDirectory() );
+            }
+
+            if ( !checkoutResult.isSuccess() )
+            {
+                // TODO: is it more appropriate to return this in the converted result so that it can be presented to
+                // the user?
+                String msg = "Error while checking out the code for project: '" + project.getName() + "', id: '" +
+                    project.getId() + "' to '" + workingDirectory.getAbsolutePath() + "'" +
+                    ( tag != null ? " with branch/tag " + tag + "." : "." );
+                getLogger().warn( msg );
+
+                getLogger().warn( "Command output: " + checkoutResult.getCommandOutput() );
+
+                getLogger().warn( "Provider message: " + checkoutResult.getProviderMessage() );
+            }
+            else
+            {
+                getLogger().info( "Checked out " + checkoutResult.getCheckedOutFiles().size() + " files." );
+            }
+
+            result = convertScmResult( checkoutResult );
+        }
+        catch ( ScmRepositoryException e )
+        {
+            result = new ScmResult();
+
+            result.setSuccess( false );
+
+            result.setProviderMessage( e.getMessage() + ": " + getValidationMessages( e ) );
+
+            getLogger().error( e.getMessage(), e );
+        }
+        catch ( NoSuchScmProviderException e )
+        {
+            // TODO: this is not making it back into a result of any kind - log it at least. Same is probably the case for ScmException
+            result = new ScmResult();
+
+            result.setSuccess( false );
+
+            result.setProviderMessage( e.getMessage() );
+
+            getLogger().error( e.getMessage(), e );
+        }
+        catch ( ScmException e )
+        {
+            result = new ScmResult();
+
+            result.setSuccess( false );
+
+            //result.setException( ContinuumUtils.throwableMessagesToString( e ) );
+
+            getLogger().error( e.getMessage(), e );
+        }
+        catch ( Throwable t )
+        {
+            // TODO: do we want this here, or should it be to the logs?
+            // TODO: what throwables do we really get here that we can cope with?
+            result = new ScmResult();
+
+            result.setSuccess( false );
+
+            //result.setException( ContinuumUtils.throwableMessagesToString( t ) );
+
+            getLogger().error( t.getMessage(), t );
+        }
+        finally
+        {
+            String relativePath = (String) getObject( context, KEY_PROJECT_RELATIVE_PATH, "" );
+            if ( StringUtils.isNotEmpty( relativePath ) )
+            {
+                project.setRelativePath( relativePath );
+            }
+
+            //project = projectDao.getProject( project.getId() );
+
+            project.setState( ContinuumProjectState.CHECKEDOUT );
+
+            //projectDao.updateProject( project );
+
+            //notifier.checkoutComplete( project, buildDefinition );
+        }
+
+        context.put( KEY_CHECKOUT_SCM_RESULT, result );
+        context.put( KEY_PROJECT, project );
+    }
+
+    private ContinuumScmConfiguration createScmConfiguration( Project project, File workingDirectory,
+                                                              String scmUserName, String scmPassword )
+    {
+        ContinuumScmConfiguration config = new ContinuumScmConfiguration();
+        config.setUrl( project.getScmUrl() );
+        config.setUsername( scmUserName );
+        config.setPassword( scmPassword );
+        config.setUseCredentialsCache( project.isScmUseCache() );
+        config.setWorkingDirectory( workingDirectory );
+        config.setTag( project.getScmTag() );
+        return config;
+    }
+
+    private ScmResult convertScmResult( CheckOutScmResult scmResult )
+    {
+        ScmResult result = new ScmResult();
+
+        result.setSuccess( scmResult.isSuccess() );
+
+        result.setCommandLine( maskPassword( scmResult.getCommandLine() ) );
+
+        result.setCommandOutput( scmResult.getCommandOutput() );
+
+        result.setProviderMessage( scmResult.getProviderMessage() );
+
+        return result;
+    }
+
+    // TODO: migrate to the SvnCommandLineUtils version (preferably properly encapsulated in the provider)
+    private String maskPassword( String commandLine )
+    {
+        String cmd = commandLine;
+
+        if ( cmd != null && cmd.startsWith( "svn" ) )
+        {
+            String pwdString = "--password";
+
+            if ( cmd.indexOf( pwdString ) > 0 )
+            {
+                int index = cmd.indexOf( pwdString ) + pwdString.length() + 1;
+
+                int nextSpace = cmd.indexOf( " ", index );
+
+                cmd = cmd.substring( 0, index ) + "********" + cmd.substring( nextSpace );
+            }
+        }
+
+        return cmd;
+    }
+
+    private String getValidationMessages( ScmRepositoryException ex )
+    {
+        List<String> messages = ex.getValidationMessages();
+
+        StringBuffer message = new StringBuffer();
+
+        if ( messages != null && !messages.isEmpty() )
+        {
+            for ( Iterator<String> i = messages.iterator(); i.hasNext(); )
+            {
+                message.append( (String) i.next() );
+
+                if ( i.hasNext() )
+                {
+                    message.append( System.getProperty( "line.separator" ) );
+                }
+            }
+        }
+        return message.toString();
+    }
+}

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

Propchange: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/action/CheckoutProjectContinuumAction.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/action/CleanWorkingDirectoryAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/action/CleanWorkingDirectoryAction.java?rev=725665&view=auto
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/action/CleanWorkingDirectoryAction.java (added)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/action/CleanWorkingDirectoryAction.java Thu Dec 11 03:36:41 2008
@@ -0,0 +1,51 @@
+package org.apache.continuum.buildagent.action;
+
+import java.io.File;
+import java.util.Map;
+
+import org.apache.continuum.buildagent.buildcontext.manager.BuildContextManager;
+import org.apache.continuum.buildagent.configuration.ConfigurationService;
+import org.apache.continuum.buildagent.util.BuildContextToProject;
+import org.apache.maven.continuum.core.action.AbstractContinuumAction;
+import org.apache.maven.continuum.model.project.Project;
+import org.apache.maven.shared.model.fileset.FileSet;
+import org.apache.maven.shared.model.fileset.util.FileSetManager;
+
+/**
+ * @plexus.component role="org.codehaus.plexus.action.Action" role-hint="clean-working-directory-dist" 
+ */
+public class CleanWorkingDirectoryAction
+extends AbstractContinuumAction
+{
+
+    /**
+     * @plexus.requirement
+     */
+    BuildContextManager buildContextManager;
+    
+    /**
+     * @plexus.requirement
+     */    
+    ConfigurationService configurationService;
+    
+    public void execute( Map context )
+        throws Exception
+    {
+        Project project = BuildContextToProject.getProject( buildContextManager.getBuildContext( getProjectId( context ) ) );
+
+        File workingDirectory = configurationService.getWorkingDirectory( project.getId() );
+
+        if ( workingDirectory.exists() )
+        {
+            FileSetManager fileSetManager = new FileSetManager();
+            FileSet fileSet = new FileSet();
+            fileSet.setDirectory( workingDirectory.getPath() );
+            fileSet.addInclude( "**/**" );
+            // TODO : this with a configuration option somewhere ?
+            fileSet.setFollowSymlinks( false );
+            fileSetManager.delete( fileSet );
+        }
+        
+    }
+
+}

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

Propchange: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/action/CleanWorkingDirectoryAction.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/action/CreateBuildProjectTaskAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/action/CreateBuildProjectTaskAction.java?rev=725665&view=auto
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/action/CreateBuildProjectTaskAction.java (added)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/action/CreateBuildProjectTaskAction.java Thu Dec 11 03:36:41 2008
@@ -0,0 +1,127 @@
+package org.apache.continuum.buildagent.action;
+
+import java.util.Map;
+
+import org.apache.continuum.dao.BuildDefinitionDao;
+import org.apache.continuum.dao.ProjectDao;
+import org.apache.continuum.taskqueue.manager.TaskQueueManager;
+import org.apache.maven.continuum.ContinuumException;
+import org.apache.maven.continuum.buildqueue.BuildProjectTask;
+import org.apache.maven.continuum.execution.ContinuumBuildExecutor;
+import org.apache.maven.continuum.execution.manager.BuildExecutorManager;
+import org.apache.maven.continuum.model.project.BuildDefinition;
+import org.apache.maven.continuum.model.project.Project;
+import org.apache.maven.continuum.project.ContinuumProjectState;
+import org.apache.maven.continuum.store.ContinuumStoreException;
+import org.codehaus.plexus.taskqueue.TaskQueueException;
+import org.codehaus.plexus.util.StringUtils;
+
+/**
+ * @author <a href="mailto:ctan@apache.org">Maria Catherine Tan</a>
+ * @plexus.component role="org.codehaus.plexus.action.Action" role-hint="create-build-project-task"
+ */
+public class CreateBuildProjectTaskAction
+    extends AbstractContinuumAction
+{
+    /**
+     * @plexus.requirement
+     */
+    private TaskQueueManager taskQueueManager;
+
+    /**
+     * @plexus.requirement
+     */
+    private BuildExecutorManager executorManager;
+
+    /**
+     * @plexus.requirement
+     */
+    private BuildDefinitionDao buildDefinitionDao;
+    
+    public synchronized void execute( Map context )
+        throws Exception
+    {
+        Project project = AbstractContinuumAction.getProject( context );
+        
+        int buildDefinitionId = AbstractContinuumAction.getBuildDefinitionId( context );
+        int trigger = AbstractContinuumAction.getTrigger( context );
+        
+        if ( taskQueueManager.isInBuildingQueue( project.getId(), buildDefinitionId ) )
+        {
+            return;
+        }
+
+        if ( taskQueueManager.isInCheckoutQueue( project.getId() ) )
+        {
+            taskQueueManager.removeProjectFromCheckoutQueue( project.getId() );
+        }
+        
+        try
+        {
+            /*
+            if ( project.getState() != ContinuumProjectState.NEW &&
+                project.getState() != ContinuumProjectState.CHECKEDOUT &&
+                project.getState() != ContinuumProjectState.OK && project.getState() != ContinuumProjectState.FAILED &&
+                project.getState() != ContinuumProjectState.ERROR )
+            {
+                ContinuumBuildExecutor executor = executorManager.getBuildExecutor( project.getExecutorId() );
+
+                if ( executor.isBuilding( project ) || project.getState() == ContinuumProjectState.UPDATING )
+                {
+                    // project is building
+                    getLogger().info( "Project '" + project.getName() + "' already being built." );
+
+                    return;
+                }
+                else
+                {
+                    project.setOldState( project.getState() );
+
+                    project.setState( ContinuumProjectState.ERROR );
+
+                    projectDao.updateProject( project );
+
+                    project = projectDao.getProject( project.getId() );
+                }
+            }
+            else
+            {
+                project.setOldState( project.getState() );
+
+                projectDao.updateProject( project );
+
+                project = projectDao.getProject( project.getId() );
+            }
+            */
+            
+            BuildDefinition buildDefinition = buildDefinitionDao.getBuildDefinition( buildDefinitionId );
+            String buildDefinitionLabel = buildDefinition.getDescription();
+            if ( StringUtils.isEmpty( buildDefinitionLabel ) )
+            {
+                buildDefinitionLabel = buildDefinition.getGoals();
+            }
+
+            getLogger().info( "Enqueuing '" + project.getName() + "' with build definition '" + buildDefinitionLabel +
+                "' - id=" + buildDefinitionId + ")." );
+
+            BuildProjectTask task = new BuildProjectTask( project.getId(), buildDefinitionId, trigger, project
+                .getName(), buildDefinitionLabel );
+
+            task.setMaxExecutionTime( buildDefinition.getSchedule()
+                .getMaxJobExecutionTime() * 1000 );
+
+            taskQueueManager.getBuildQueue().put( task );
+        }
+        catch ( ContinuumStoreException e )
+        {
+            getLogger().error( "Error while creating build object", e );
+            throw new ContinuumException( "Error while creating build object.", e );
+        }
+        catch ( TaskQueueException e )
+        {
+            getLogger().error( "Error while enqueuing object", e );
+            throw new ContinuumException( "Error while enqueuing object.", e );
+        }
+    }
+}
+

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

Propchange: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/action/CreateBuildProjectTaskAction.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/action/ExecuteBuilderContinuumAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/action/ExecuteBuilderContinuumAction.java?rev=725665&view=auto
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/action/ExecuteBuilderContinuumAction.java (added)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/action/ExecuteBuilderContinuumAction.java Thu Dec 11 03:36:41 2008
@@ -0,0 +1,160 @@
+package org.apache.continuum.buildagent.action;
+
+import org.apache.continuum.dao.BuildResultDao;
+import org.apache.continuum.dao.ProjectDao;
+import org.apache.maven.continuum.execution.ContinuumBuildCancelledException;
+import org.apache.maven.continuum.execution.ContinuumBuildExecutionResult;
+import org.apache.maven.continuum.execution.ContinuumBuildExecutor;
+import org.apache.maven.continuum.execution.manager.BuildExecutorManager;
+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.notification.ContinuumNotificationDispatcher;
+import org.apache.maven.continuum.project.ContinuumProjectState;
+import org.apache.maven.continuum.utils.ContinuumUtils;
+import org.apache.continuum.buildagent.configuration.ConfigurationService;
+
+import java.io.File;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @plexus.component role="org.codehaus.plexus.action.Action"
+ * role-hint="execute-builder-dist"
+ */
+public class ExecuteBuilderContinuumAction
+    extends AbstractContinuumAction
+{
+    /**
+     * @plexus.requirement
+     */
+    private ConfigurationService configurationService;
+
+    /**
+     * @plexus.requirement
+     */
+    private BuildExecutorManager buildExecutorManager;
+
+    public void execute( Map context )
+        throws Exception
+    {
+        // ----------------------------------------------------------------------
+        // Get parameters from the context
+        // ----------------------------------------------------------------------
+
+        Project project =  getProject( context ) ;
+
+        BuildDefinition buildDefinition = getBuildDefinition( context );
+
+        int trigger = getTrigger( context );
+
+        List updatedDependencies = getUpdatedDependencies( context );
+
+        ContinuumBuildExecutor buildExecutor = buildExecutorManager.getBuildExecutor( project.getExecutorId() );
+
+        // ----------------------------------------------------------------------
+        // Make the buildResult
+        // ----------------------------------------------------------------------
+
+        BuildResult buildResult = new BuildResult();
+
+        buildResult.setStartTime( new Date().getTime() );
+
+        buildResult.setState( ContinuumProjectState.BUILDING );
+
+        buildResult.setTrigger( trigger );
+
+        buildResult.setModifiedDependencies( updatedDependencies );
+
+        buildResult.setBuildDefinition( getBuildDefinition( context ) );
+
+        //buildResultDao.addBuildResult( project, buildResult );
+
+        context.put( KEY_BUILD_ID, Integer.toString( buildResult.getId() ) );
+
+        context.put( KEY_CANCELLED, new Boolean( false ) );
+
+        //buildResult = buildResultDao.getBuildResult( buildResult.getId() );
+
+        try
+        {
+            //notifier.runningGoals( project, buildDefinition, buildResult );
+
+            File buildOutputFile = configurationService.getBuildOutputFile( project.getId() );
+
+            ContinuumBuildExecutionResult result = buildExecutor.build( project, buildDefinition, buildOutputFile );
+
+            buildResult.setState( result.getExitCode() == 0 ? ContinuumProjectState.OK : ContinuumProjectState.FAILED );
+
+            buildResult.setExitCode( result.getExitCode() );
+        }
+        catch ( ContinuumBuildCancelledException e )
+        {
+            getLogger().info( "Cancelled build" );
+            
+            buildResult.setState( ContinuumProjectState.CANCELLED );
+            
+            context.put( KEY_CANCELLED, new Boolean( true ) );
+        }
+        catch ( Throwable e )
+        {
+            getLogger().error( "Error running buildResult", e );
+
+            buildResult.setState( ContinuumProjectState.ERROR );
+
+            buildResult.setError( ContinuumUtils.throwableToString( e ) );
+        }
+        finally
+        {
+            
+
+            if ( buildResult.getState() == ContinuumProjectState.CANCELLED )
+            {
+                project.setState( project.getOldState() );
+
+                project.setOldState( 0 );
+
+                int buildResultId = getOldBuildId( context ); 
+
+                project.setLatestBuildId( buildResultId );
+
+              
+            }
+            else
+            {
+                buildResult.setEndTime( new Date().getTime() );
+
+                if ( buildResult.getState() == ContinuumProjectState.OK )
+                {
+                    project.setBuildNumber( project.getBuildNumber() + 1 );
+                }
+
+                project.setLatestBuildId( buildResult.getId() );
+
+                buildResult.setBuildNumber( project.getBuildNumber() );
+
+                if ( buildResult.getState() != ContinuumProjectState.OK &&
+                    buildResult.getState() != ContinuumProjectState.FAILED &&
+                    buildResult.getState() != ContinuumProjectState.ERROR )
+                {
+                    buildResult.setState( ContinuumProjectState.ERROR );
+                }
+
+                project.setState( buildResult.getState() );              
+              
+            }
+
+            context.put( KEY_PROJECT, project );
+            
+
+            // ----------------------------------------------------------------------
+            // Backup test result files
+            // ----------------------------------------------------------------------
+            //TODO: Move as a plugin
+            buildExecutor.backupTestFiles( project, buildResult.getId() );
+        }
+    }
+}
+

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

Propchange: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/action/ExecuteBuilderContinuumAction.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/action/UpdateProjectFromWorkingDirectoryContinuumAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/action/UpdateProjectFromWorkingDirectoryContinuumAction.java?rev=725665&view=auto
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/action/UpdateProjectFromWorkingDirectoryContinuumAction.java (added)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/action/UpdateProjectFromWorkingDirectoryContinuumAction.java Thu Dec 11 03:36:41 2008
@@ -0,0 +1,59 @@
+package org.apache.continuum.buildagent.action;
+
+import org.apache.continuum.buildagent.configuration.ConfigurationService;
+import org.apache.continuum.dao.BuildDefinitionDao;
+import org.apache.continuum.dao.ProjectDao;
+import org.apache.maven.continuum.ContinuumException;
+import org.apache.maven.continuum.execution.ContinuumBuildExecutor;
+import org.apache.maven.continuum.execution.ContinuumBuildExecutorException;
+import org.apache.maven.continuum.execution.manager.BuildExecutorManager;
+import org.apache.maven.continuum.model.project.BuildDefinition;
+import org.apache.maven.continuum.model.project.Project;
+import org.apache.maven.continuum.store.ContinuumStoreException;
+import org.apache.maven.continuum.utils.WorkingDirectoryService;
+
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
+ * @version $Id$
+ * @plexus.component role="org.codehaus.plexus.action.Action"
+ * role-hint="update-project-from-working-directory-dist"
+ */
+public class UpdateProjectFromWorkingDirectoryContinuumAction
+    extends AbstractContinuumAction
+{
+    /**
+     * @plexus.requirement
+     */
+    private ConfigurationService configurationService;
+
+    /**
+     * @plexus.requirement
+     */
+    private BuildExecutorManager buildExecutorManager;
+
+    /**
+     * @plexus.requirement
+     */
+    private BuildDefinitionDao buildDefinitionDao;
+
+    public void execute( Map context )
+        throws ContinuumStoreException, ContinuumException, ContinuumBuildExecutorException
+    {
+        Project project = getProject( context );      
+
+        getLogger().info( "Updating project '" + project.getName() + "' from checkout." );
+
+        BuildDefinition buildDefinition = buildDefinitionDao.getBuildDefinition( getBuildDefinitionId( context ) );
+
+        // ----------------------------------------------------------------------
+        // Make a new descriptor
+        // ----------------------------------------------------------------------
+
+        ContinuumBuildExecutor builder = buildExecutorManager.getBuildExecutor( project.getExecutorId() );
+
+        builder.updateProjectFromCheckOut( configurationService.getWorkingDirectory( project.getId() ), project,
+                                           buildDefinition );
+    }
+}

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

Propchange: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/action/UpdateProjectFromWorkingDirectoryContinuumAction.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/action/UpdateWorkingDirectoryFromScmContinuumAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/action/UpdateWorkingDirectoryFromScmContinuumAction.java?rev=725665&view=auto
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/action/UpdateWorkingDirectoryFromScmContinuumAction.java (added)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/action/UpdateWorkingDirectoryFromScmContinuumAction.java Thu Dec 11 03:36:41 2008
@@ -0,0 +1,308 @@
+package org.apache.continuum.buildagent.action;
+
+import org.apache.continuum.buildagent.buildcontext.manager.BuildContextManager;
+import org.apache.continuum.buildagent.configuration.ConfigurationService;
+import org.apache.continuum.buildagent.util.BuildContextToProject;
+import org.apache.continuum.dao.BuildResultDao;
+import org.apache.continuum.dao.ProjectDao;
+import org.apache.continuum.scm.ContinuumScm;
+import org.apache.continuum.scm.ContinuumScmConfiguration;
+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.ChangeFile;
+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.store.ContinuumObjectNotFoundException;
+import org.apache.maven.continuum.store.ContinuumStoreException;
+import org.apache.maven.continuum.utils.ContinuumUtils;
+import org.apache.maven.continuum.utils.WorkingDirectoryService;
+import org.apache.maven.scm.ScmException;
+import org.apache.maven.scm.ScmFile;
+import org.apache.maven.scm.command.update.UpdateScmResult;
+import org.apache.maven.scm.manager.NoSuchScmProviderException;
+import org.apache.maven.scm.repository.ScmRepositoryException;
+
+import java.io.File;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
+ * @version $Id$
+ * @plexus.component role="org.codehaus.plexus.action.Action" role-hint="update-working-directory-from-scm-dist"
+ */
+public class UpdateWorkingDirectoryFromScmContinuumAction
+    extends AbstractContinuumAction
+{
+    /**
+     * @plexus.requirement
+     */
+    //private ContinuumNotificationDispatcher notifier;
+
+    /**
+     * @plexus.requirement
+     */
+    private ContinuumScm scm;
+    
+    /**
+     * @plexus.requirement
+     */
+    BuildContextManager buildContextManager;
+
+    /**
+     * @plexus.requirement
+     */    
+    ConfigurationService configurationService;
+
+    public void execute( Map context )
+        throws ScmRepositoryException, NoSuchScmProviderException, ScmException, ContinuumObjectNotFoundException,
+        ContinuumStoreException
+    {
+        Project project = BuildContextToProject.getProject( buildContextManager.getBuildContext( getProjectId( context ) ) );
+
+        BuildDefinition buildDefinition = getBuildDefinition( context );
+
+        // do not set state of project to updating
+
+        //int state = project.getState();
+
+        //project.setState( ContinuumProjectState.UPDATING );
+
+        //projectDao.updateProject( project );
+
+        UpdateScmResult scmResult;
+
+        ScmResult result;
+
+        Date latestUpdateDate = null;
+       
+        try
+        {
+            //notifier.checkoutStarted( project, buildDefinition );
+
+            // TODO: not sure why this is different to the context, but it all needs to change
+            File workingDirectory = configurationService.getWorkingDirectory( project.getId() );
+            ContinuumScmConfiguration config = createScmConfiguration( project, workingDirectory );
+            config.setLatestUpdateDate( latestUpdateDate );
+            String tag = config.getTag();
+            String msg = project.getName() + "', id: '" + project.getId() + "' to '" +
+                workingDirectory.getAbsolutePath() + "'" + ( tag != null ? " with branch/tag " + tag + "." : "." );
+            getLogger().info( "Updating project: " + msg );
+            scmResult = scm.update( config );
+
+            if ( !scmResult.isSuccess() )
+            {
+                getLogger().warn( "Error while updating the code for project: '" + msg );
+
+                getLogger().warn( "Command output: " + scmResult.getCommandOutput() );
+
+                getLogger().warn( "Provider message: " + scmResult.getProviderMessage() );
+            }
+
+            if ( scmResult.getUpdatedFiles() != null && scmResult.getUpdatedFiles().size() > 0 )
+            {
+                getLogger().info( "Updated " + scmResult.getUpdatedFiles().size() + " files." );
+            }
+
+            result = convertScmResult( scmResult );
+        }
+        catch ( ScmRepositoryException e )
+        {
+            result = new ScmResult();
+
+            result.setSuccess( false );
+
+            result.setProviderMessage( e.getMessage() + ": " + getValidationMessages( e ) );
+            
+            getLogger().error( e.getMessage(), e);
+        }
+        catch ( NoSuchScmProviderException e )
+        {
+            // TODO: this is not making it back into a result of any kind - log it at least. Same is probably the case for ScmException
+            result = new ScmResult();
+
+            result.setSuccess( false );
+
+            result.setProviderMessage( e.getMessage() );
+            
+            getLogger().error( e.getMessage(), e);
+        }
+        catch ( ScmException e )
+        {
+            result = new ScmResult();
+
+            result.setSuccess( false );
+
+            result.setException( ContinuumUtils.throwableMessagesToString( e ) );
+            
+            getLogger().error( e.getMessage(), e);
+        }
+        finally
+        {
+            // set back to the original state
+            // TODO: transient states!
+            //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 );
+            //}
+
+            //notifier.checkoutComplete( project, buildDefinition );
+        }
+        
+        context.put( KEY_UPDATE_SCM_RESULT, result );
+        context.put( KEY_PROJECT, project );
+    }
+
+    private ContinuumScmConfiguration createScmConfiguration( Project project, File workingDirectory )
+    {
+        ContinuumScmConfiguration config = new ContinuumScmConfiguration();
+        config.setUrl( project.getScmUrl() );
+        config.setUsername( project.getScmUsername() );
+        config.setPassword( project.getScmPassword() );
+        config.setUseCredentialsCache( project.isScmUseCache() );
+        config.setWorkingDirectory( workingDirectory );
+        config.setTag( project.getScmTag() );
+        return config;
+    }
+
+    private ScmResult convertScmResult( UpdateScmResult scmResult )
+    {
+        ScmResult result = new ScmResult();
+
+        result.setCommandLine( maskPassword( scmResult.getCommandLine() ) );
+
+        result.setSuccess( scmResult.isSuccess() );
+
+        result.setCommandOutput( scmResult.getCommandOutput() );
+
+        result.setProviderMessage( scmResult.getProviderMessage() );
+
+        if ( scmResult.getChanges() != null && !scmResult.getChanges().isEmpty() )
+        {
+            for ( org.apache.maven.scm.ChangeSet scmChangeSet : (List<org.apache.maven.scm.ChangeSet>) scmResult.getChanges() )
+            {
+                ChangeSet change = new ChangeSet();
+
+                change.setAuthor( scmChangeSet.getAuthor() );
+
+                change.setComment( scmChangeSet.getComment() );
+
+                if ( scmChangeSet.getDate() != null )
+                {
+                    change.setDate( scmChangeSet.getDate().getTime() );
+                }
+
+                if ( scmChangeSet.getFiles() != null )
+                {
+                    for ( org.apache.maven.scm.ChangeFile f : (List<org.apache.maven.scm.ChangeFile>) scmChangeSet.getFiles() )
+                    {
+                        ChangeFile file = new ChangeFile();
+
+                        file.setName( f.getName() );
+
+                        file.setRevision( f.getRevision() );
+
+                        change.addFile( file );
+                    }
+                }
+
+                result.addChange( change );
+            }
+        }
+        else
+        {
+            // We don't have a changes information probably because provider doesn't have a changelog command
+            // so we use the updated list that contains only the updated files list
+            ChangeSet changeSet = convertScmFileSetToChangeSet( scmResult.getUpdatedFiles() );
+
+            if ( changeSet != null )
+            {
+                result.addChange( changeSet );
+            }
+
+        }
+
+        return result;
+    }
+
+    private static ChangeSet convertScmFileSetToChangeSet( List<ScmFile> files )
+    {
+        ChangeSet changeSet = null;
+
+        if ( files != null && !files.isEmpty() )
+        {
+            changeSet = new ChangeSet();
+
+            // TODO: author, etc.
+            for ( ScmFile scmFile : files )
+            {
+                ChangeFile file = new ChangeFile();
+
+                file.setName( scmFile.getPath() );
+
+                // TODO: revision?
+
+                file.setStatus( scmFile.getStatus().toString() );
+
+                changeSet.addFile( file );
+            }
+        }
+        return changeSet;
+    }
+
+    // TODO: migrate to the SvnCommandLineUtils version (preferably properly encapsulated in the provider)
+    private String maskPassword( String commandLine )
+    {
+        String cmd = commandLine;
+
+        if ( cmd != null && cmd.startsWith( "svn" ) )
+        {
+            String pwdString = "--password";
+
+            if ( cmd.indexOf( pwdString ) > 0 )
+            {
+                int index = cmd.indexOf( pwdString ) + pwdString.length() + 1;
+
+                int nextSpace = cmd.indexOf( " ", index );
+
+                cmd = cmd.substring( 0, index ) + "********" + cmd.substring( nextSpace );
+            }
+        }
+
+        return cmd;
+    }
+    
+    private String getValidationMessages( ScmRepositoryException ex )
+    {
+        List<String> messages = ex.getValidationMessages();
+
+        StringBuffer message = new StringBuffer();
+
+        if ( messages != null && !messages.isEmpty() )
+        {
+            for ( Iterator<String> i = messages.iterator(); i.hasNext(); )
+            {
+                message.append( i.next() );
+
+                if ( i.hasNext() )
+                {
+                    message.append( System.getProperty( "line.separator" ) );
+                }
+            }
+        }
+        return message.toString();
+    }
+}
\ No newline at end of file

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

Propchange: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/action/UpdateWorkingDirectoryFromScmContinuumAction.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/buildcontext/manager/BuildContextManager.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/buildcontext/manager/BuildContextManager.java?rev=725665&view=auto
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/buildcontext/manager/BuildContextManager.java (added)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/buildcontext/manager/BuildContextManager.java Thu Dec 11 03:36:41 2008
@@ -0,0 +1,19 @@
+package org.apache.continuum.buildagent.buildcontext.manager;
+
+import java.util.List;
+
+import org.apache.continuum.buildagent.model.BuildContext;
+
+public interface BuildContextManager
+{
+    String ROLE = BuildContextManager.class.getName();
+    
+    public void setBuildContextList(List<BuildContext> buildContext);
+    
+    public List<BuildContext> getBuildContextList();
+    
+    public BuildContext getBuildContext(int projectId);
+    
+    
+
+}

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

Propchange: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/buildcontext/manager/BuildContextManager.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/buildcontext/manager/DefaultBuildContextManager.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/buildcontext/manager/DefaultBuildContextManager.java?rev=725665&view=auto
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/buildcontext/manager/DefaultBuildContextManager.java (added)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/buildcontext/manager/DefaultBuildContextManager.java Thu Dec 11 03:36:41 2008
@@ -0,0 +1,47 @@
+package org.apache.continuum.buildagent.buildcontext.manager;
+
+import java.util.List;
+
+import org.apache.continuum.buildagent.model.BuildContext;
+
+/**
+ *
+ * @plexus.component role="org.apache.continuum.buildagent.buildcontext.manager.BuildContextManager" role-hint="default"
+ */
+public class DefaultBuildContextManager
+    implements BuildContextManager
+{
+
+    public List<BuildContext> buildContexts ;
+    
+    public BuildContext getBuildContext( int projectId )
+    {
+        BuildContext context = null;
+        
+        if (buildContexts!= null)
+        {
+            for ( BuildContext item : buildContexts )
+            {
+                if (item.getProjectId() == projectId)
+                {
+                    context = item;
+                    break;
+                }
+            }
+        }
+        
+        return context;
+    }
+
+    public List<BuildContext> getBuildContextList()
+    {
+        return buildContexts;
+    }
+
+    public void setBuildContextList( List<BuildContext> buildContext )
+    {
+        buildContexts = buildContext;
+
+    }
+
+}

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

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

Modified: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/configuration/DefaultConfigurationService.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/DefaultConfigurationService.java?rev=725665&r1=725664&r2=725665&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/configuration/DefaultConfigurationService.java (original)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/configuration/DefaultConfigurationService.java Thu Dec 11 03:36:41 2008
@@ -20,6 +20,7 @@
     private ContinuumConfiguration configuration;
 
     private ContinuumBuildAgentConfiguration buildAgentConfiguration;
+    
 
     public void initialize()
         throws ContinuumConfigurationException

Added: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/continuum/Continuum.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/continuum/Continuum.java?rev=725665&view=auto
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/continuum/Continuum.java (added)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/src/main/java/org/apache/continuum/buildagent/continuum/Continuum.java Thu Dec 11 03:36:41 2008
@@ -0,0 +1,14 @@
+package org.apache.continuum.buildagent.continuum;
+
+import org.apache.continuum.buildagent.taskqueue.manager.TaskQueueManager;
+import org.apache.maven.continuum.ContinuumException;
+
+public interface Continuum
+{
+    String ROLE = Continuum.class.getName();
+
+    public void buildProject( int projectId, int buildDefinitionId, int trigger )
+    throws ContinuumException;
+    
+    public TaskQueueManager getTaskQueueManager();
+}

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

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



Mime
View raw message