continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r726727 [1/2] - in /continuum/branches/continuum-distributed-builds: continuum-builder/src/main/java/org/apache/continuum/builder/distributed/executor/ continuum-builder/src/main/java/org/apache/continuum/builder/utils/ continuum-distribute...
Date Mon, 15 Dec 2008 16:23:54 GMT
Author: ctan
Date: Mon Dec 15 08:23:53 2008
New Revision: 726727

URL: http://svn.apache.org/viewvc?rev=726727&view=rev
Log:
slave agent implementation

Added:
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/Continuum.java   (with props)
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/DefaultContinuum.java   (with props)
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/build/execution/ant/
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/build/execution/ant/AntBuildExecutor.java   (with props)
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/build/execution/maven/
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/build/execution/maven/m1/   (with props)
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/build/execution/maven/m1/MavenOneBuildExecutor.java
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/build/execution/maven/m2/
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/build/execution/maven/m2/DefaultMavenBuilderHelper.java   (with props)
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/build/execution/maven/m2/MavenBuilderHelper.java   (with props)
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/build/execution/maven/m2/MavenTwoBuildExecutor.java   (with props)
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/build/execution/maven/m2/SettingsConfigurationException.java   (with props)
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/build/execution/shell/
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/build/execution/shell/ShellBuildExecutor.java   (with props)
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/installation/
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/installation/DefaultInstallationService.java   (with props)
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/installation/InstallationService.java   (with props)
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/taskqueue/manager/DefaultTaskQueueManager.java   (with props)
Removed:
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/action/DeployArtifactAction.java
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/taskqueue/execution/PrepareBuildTaskExecutor.java
Modified:
    continuum/branches/continuum-distributed-builds/continuum-builder/src/main/java/org/apache/continuum/builder/distributed/executor/DistributedBuildProjectTaskExecutor.java
    continuum/branches/continuum-distributed-builds/continuum-builder/src/main/java/org/apache/continuum/builder/utils/ContinuumBuildConstant.java
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-api/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentService.java
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentServiceImpl.java
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/action/ExecuteBuilderAction.java
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/build/execution/AbstractBuildExecutor.java
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/buildcontext/BuildContext.java
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/taskqueue/execution/BuildProjectTaskExecutor.java
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/taskqueue/manager/TaskQueueManager.java
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/utils/BuildContextToProject.java
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/utils/ContinuumBuildAgentUtil.java
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/resources/META-INF/plexus/components.xml

Modified: continuum/branches/continuum-distributed-builds/continuum-builder/src/main/java/org/apache/continuum/builder/distributed/executor/DistributedBuildProjectTaskExecutor.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-builder/src/main/java/org/apache/continuum/builder/distributed/executor/DistributedBuildProjectTaskExecutor.java?rev=726727&r1=726726&r2=726727&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-builder/src/main/java/org/apache/continuum/builder/distributed/executor/DistributedBuildProjectTaskExecutor.java (original)
+++ continuum/branches/continuum-distributed-builds/continuum-builder/src/main/java/org/apache/continuum/builder/distributed/executor/DistributedBuildProjectTaskExecutor.java Mon Dec 15 08:23:53 2008
@@ -147,6 +147,7 @@
                 context.put( ContinuumBuildConstant.KEY_PROJECT_GROUP_ID, new Integer( project.getProjectGroup().getId() ) );
                 context.put( ContinuumBuildConstant.KEY_SCM_ROOT_ADDRESS, scmRootAddress );
                 context.put( ContinuumBuildConstant.KEY_PROJECT_ID, new Integer( project.getId() ) );
+                context.put( ContinuumBuildConstant.KEY_PROJECT_NAME, project.getName() );
                 context.put( ContinuumBuildConstant.KEY_EXECUTOR_ID, project.getExecutorId() );
                 context.put( ContinuumBuildConstant.KEY_SCM_URL, project.getScmUrl() );
 

Modified: continuum/branches/continuum-distributed-builds/continuum-builder/src/main/java/org/apache/continuum/builder/utils/ContinuumBuildConstant.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-builder/src/main/java/org/apache/continuum/builder/utils/ContinuumBuildConstant.java?rev=726727&r1=726726&r2=726727&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-builder/src/main/java/org/apache/continuum/builder/utils/ContinuumBuildConstant.java (original)
+++ continuum/branches/continuum-distributed-builds/continuum-builder/src/main/java/org/apache/continuum/builder/utils/ContinuumBuildConstant.java Mon Dec 15 08:23:53 2008
@@ -52,6 +52,8 @@
 
     public static final String KEY_SCM_ERROR = "scm-error";
 
+    public static final String KEY_PROJECT_NAME = "project-name";
+
     public static int getProjectId( Map context )
     {
         return getInteger( context, KEY_PROJECT_ID );

Modified: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-api/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentService.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-api/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentService.java?rev=726727&r1=726726&r2=726727&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-api/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentService.java (original)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-api/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentService.java Mon Dec 15 08:23:53 2008
@@ -19,7 +19,8 @@
     Map getBuildResult( int projectId )
         throws ContinuumBuildAgentException;
     
-    int getProjectCurrentlyBuilding();
+    int getProjectCurrentlyBuilding()
+        throws ContinuumBuildAgentException;
     
     void cancelBuild()
         throws ContinuumBuildAgentException;

Added: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/Continuum.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/Continuum.java?rev=726727&view=auto
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/Continuum.java (added)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/Continuum.java Mon Dec 15 08:23:53 2008
@@ -0,0 +1,14 @@
+package org.apache.continuum.buildagent;
+
+import java.util.List;
+
+import org.apache.continuum.buildagent.buildcontext.BuildContext;
+import org.apache.maven.continuum.ContinuumException;
+
+public interface Continuum
+{
+    String ROLE = Continuum.class.getName();
+
+    void prepareBuildProjects( List<BuildContext> buildContextList )
+        throws ContinuumException;
+}

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

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

Modified: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/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/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentServiceImpl.java?rev=726727&r1=726726&r2=726727&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentServiceImpl.java (original)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentServiceImpl.java Mon Dec 15 08:23:53 2008
@@ -7,7 +7,10 @@
 import org.apache.continuum.buildagent.buildcontext.BuildContext;
 import org.apache.continuum.buildagent.configuration.ConfigurationService;
 import org.apache.continuum.buildagent.model.Installation;
+import org.apache.continuum.buildagent.taskqueue.manager.TaskQueueManager;
 import org.apache.continuum.buildagent.utils.ContinuumBuildAgentUtil;
+import org.apache.continuum.taskqueue.manager.TaskQueueManagerException;
+import org.apache.maven.continuum.ContinuumException;
 
 public class ContinuumBuildAgentServiceImpl
     implements ContinuumBuildAgentService
@@ -17,17 +20,28 @@
      */
     private ConfigurationService configurationService;
 
+    /**
+     * @plexus.requirement
+     */
+    private Continuum continuum;
+
+    /**
+     * @plexus.requirement
+     */
+    private TaskQueueManager taskQueueManager;
+
     public void buildProjects( List<Map> projectsBuildContext )
         throws ContinuumBuildAgentException
     {
-        List<BuildContext> buildContext = initializeBuildContext( projectsBuildContext );
+        List<BuildContext> buildContextList = initializeBuildContext( projectsBuildContext );
 
         try
         {
-            Thread.sleep( 60000 );
+            continuum.prepareBuildProjects( buildContextList );
         }
-        catch ( InterruptedException e )
+        catch ( ContinuumException e )
         {
+            throw new ContinuumBuildAgentException( e.getMessage(), e );
         }
     }
 
@@ -45,22 +59,34 @@
     }
 
     public boolean isBusy()
-        throws ContinuumBuildAgentException
     {
-        // TODO Auto-generated method stub
         return false;
     }
 
     public int getProjectCurrentlyBuilding()
+        throws ContinuumBuildAgentException
     {
-        // TODO Auto-generated method stub
-        return 0;
+        try
+        {
+            return taskQueueManager.getCurrentProjectInBuilding();
+        }
+        catch ( TaskQueueManagerException e )
+        {
+            throw new ContinuumBuildAgentException( e.getMessage(), e );
+        }
     }
 
     public void cancelBuild()
         throws ContinuumBuildAgentException
     {
-        
+        try
+        {
+            taskQueueManager.cancelBuild();
+        }
+        catch ( TaskQueueManagerException e )
+        {
+            throw new ContinuumBuildAgentException( e.getMessage(), e );
+        }
     }
 
     private List<BuildContext> initializeBuildContext( List<Map> projectsBuildContext )
@@ -82,6 +108,7 @@
             context.setBuildFresh( ContinuumBuildAgentUtil.isBuildFresh( map ) );
             context.setProjectGroupId( ContinuumBuildAgentUtil.getProjectGroupId( map ) );
             context.setScmRootAddress( ContinuumBuildAgentUtil.getScmRootAddress( map ) );
+            context.setProjectName( ContinuumBuildAgentUtil.getProjectName( map ) );
             
             buildContext.add( context );
         }
@@ -98,4 +125,24 @@
     {
         this.configurationService = configurationService;
     }
+    
+    public Continuum getContinuum()
+    {
+        return continuum;
+    }
+
+    public void setContinuum( Continuum continuum )
+    {
+        this.continuum = continuum;
+    }
+
+    public TaskQueueManager getTaskQueueManager()
+    {
+        return taskQueueManager;
+    }
+
+    public void setTaskQueueManager( TaskQueueManager taskQueueManager )
+    {
+        this.taskQueueManager = taskQueueManager;
+    }
 }

Added: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/DefaultContinuum.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/DefaultContinuum.java?rev=726727&view=auto
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/DefaultContinuum.java (added)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/DefaultContinuum.java Mon Dec 15 08:23:53 2008
@@ -0,0 +1,338 @@
+package org.apache.continuum.buildagent;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.continuum.buildagent.buildcontext.BuildContext;
+import org.apache.continuum.buildagent.buildcontext.manager.BuildContextManager;
+import org.apache.continuum.buildagent.configuration.ConfigurationService;
+import org.apache.continuum.buildagent.taskqueue.manager.TaskQueueManager;
+import org.apache.continuum.buildagent.utils.BuildContextToBuildDefinition;
+import org.apache.continuum.buildagent.utils.BuildContextToProject;
+import org.apache.continuum.buildagent.utils.ContinuumBuildAgentUtil;
+import org.apache.continuum.taskqueue.BuildProjectTask;
+import org.apache.continuum.utils.ContinuumUtils;
+import org.apache.maven.continuum.ContinuumException;
+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.project.ContinuumProjectState;
+import org.codehaus.plexus.action.ActionManager;
+import org.codehaus.plexus.action.ActionNotFoundException;
+import org.codehaus.plexus.taskqueue.TaskQueueException;
+import org.codehaus.plexus.util.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @plexus.component role="org.apache.continuum.buildagent.Continuum" role-hint="default"
+ */
+public class DefaultContinuum
+    implements Continuum
+{
+    private Logger log = LoggerFactory.getLogger( this.getClass() );
+
+    /**
+     * @plexus.requirement
+     */
+    private ActionManager actionManager;
+
+    /**
+     * @plexus.requirement
+     */
+    private ConfigurationService configurationService;
+
+    /**
+     * @plexus.requirement
+     */
+    private TaskQueueManager taskQueueManager;
+
+    public void prepareBuildProjects( List<BuildContext> buildContexts)
+        throws ContinuumException
+    {
+        Map<String, Object> context = null;
+
+        try
+        {
+            for ( BuildContext buildContext : buildContexts )
+            {
+                context = buildContext.getActionContext();
+
+                BuildDefinition buildDef = BuildContextToBuildDefinition.getBuildDefinition( buildContext );
+    
+                log.info( "Check scm root state" );
+                if ( !checkProjectScmRoot( context ) )
+                {
+                    break;
+                }
+                
+                log.info( "Initializing prepare build" );
+                initializeActionContext( buildContext );
+                
+                log.info( "Starting prepare build" );
+
+                try
+                {
+                    if ( buildDef.isBuildFresh() )
+                    {
+                        log.info( "Clean up working directory" );
+                        cleanWorkingDirectory( buildContext );
+                    }
+        
+                    log.info( "Updating working directory" );
+                    updateWorkingDirectory( buildContext );
+                }
+                finally
+                {
+                    endProjectPrepareBuild( buildContext );
+                }
+            }
+        }
+        finally
+        {
+            endPrepareBuild( context );
+        }
+
+        if ( !checkProjectScmRoot( context ) )
+        {
+            buildProjects( buildContexts );
+        }
+    }
+
+    private void initializeActionContext( BuildContext buildContext )
+    {
+        Map<String, Object> actionContext = new HashMap<String, Object>();
+
+        actionContext.put( ContinuumBuildAgentUtil.KEY_PROJECT_ID, buildContext.getProjectId() );
+        actionContext.put( ContinuumBuildAgentUtil.KEY_PROJECT, BuildContextToProject.getProject( buildContext ) );
+        actionContext.put( ContinuumBuildAgentUtil.KEY_BUILD_DEFINITION, BuildContextToBuildDefinition.getBuildDefinition( buildContext ) );
+        actionContext.put( ContinuumBuildAgentUtil.KEY_SCM_ROOT_STATE, ContinuumProjectState.UPDATING );
+        actionContext.put( ContinuumBuildAgentUtil.KEY_PROJECT_GROUP_ID, buildContext.getProjectGroupId() );
+        actionContext.put( ContinuumBuildAgentUtil.KEY_SCM_ROOT_ADDRESS, buildContext.getScmRootAddress() );
+        
+        buildContext.setActionContext( actionContext );
+    }
+
+    private boolean checkProjectScmRoot( Map context )
+    {
+        if ( context != null && ContinuumBuildAgentUtil.getScmRootState( context ) == ContinuumProjectState.ERROR )
+        {
+            return false;
+        }
+
+        return true;
+    }
+
+    private void cleanWorkingDirectory( BuildContext buildContext )
+        throws ContinuumException
+    {
+        performAction( "clean-agent-work-directory", buildContext );
+    }
+
+    private void updateWorkingDirectory( BuildContext buildContext )
+        throws ContinuumException
+    {
+        Map<String, Object> actionContext = buildContext.getActionContext();
+
+        performAction( "check-agent-working-directory", buildContext );
+        
+        boolean workingDirectoryExists =
+            ContinuumBuildAgentUtil.getBoolean( actionContext, ContinuumBuildAgentUtil.KEY_WORKING_DIRECTORY_EXISTS );
+    
+        ScmResult scmResult;
+    
+        if ( workingDirectoryExists )
+        {
+            performAction( "update-agent-working-directory", buildContext );
+    
+            scmResult = ContinuumBuildAgentUtil.getUpdateScmResult( actionContext, null );
+        }
+        else
+        {
+            Project project = ContinuumBuildAgentUtil.getProject( actionContext );
+    
+            actionContext.put( ContinuumBuildAgentUtil.KEY_WORKING_DIRECTORY,
+                               configurationService.getWorkingDirectory( project.getId() ).getAbsolutePath() );
+    
+            performAction( "checkout-project", buildContext );
+    
+            scmResult = ContinuumBuildAgentUtil.getCheckoutScmResult( actionContext, null );
+        }
+    
+        buildContext.setScmResult( scmResult );
+        actionContext.put( ContinuumBuildAgentUtil.KEY_SCM_RESULT, scmResult );
+    }
+
+    private void endProjectPrepareBuild( BuildContext buildContext )
+        throws ContinuumException
+    {
+        Map<String, Object> context = buildContext.getActionContext();
+
+        ScmResult scmResult = ContinuumBuildAgentUtil.getScmResult( context, null );
+        Project project = ContinuumBuildAgentUtil.getProject( context );
+
+        if ( scmResult == null || !scmResult.isSuccess() )
+        {
+            context.put( ContinuumBuildAgentUtil.KEY_SCM_ROOT_STATE, ContinuumProjectState.ERROR );
+        }
+    }
+
+    private void endPrepareBuild( Map context )
+        throws ContinuumException
+    {
+        Map<String, Object> result = new HashMap<String, Object>();
+        result.put( ContinuumBuildAgentUtil.KEY_PROJECT_GROUP_ID, new Integer( ContinuumBuildAgentUtil.getProjectGroupId( context ) ) );
+        result.put( ContinuumBuildAgentUtil.KEY_SCM_ROOT_ADDRESS, ContinuumBuildAgentUtil.getScmRootAddress( context ) );
+        
+        String error = convertScmResultToError( ContinuumBuildAgentUtil.getScmResult( context, null ) );
+        if ( StringUtils.isEmpty( error ) )
+        {
+            result.put( ContinuumBuildAgentUtil.KEY_SCM_ERROR, "" );
+        }
+        else
+        {
+            result.put( ContinuumBuildAgentUtil.KEY_SCM_ERROR, error );
+        }
+    }
+
+    private Map<String, Object> createScmResult( BuildContext buildContext )
+    {
+        Map<String, Object> result = new HashMap<String, Object>();
+        ScmResult scmResult = buildContext.getScmResult();
+
+        result.put( ContinuumBuildAgentUtil.KEY_PROJECT_ID, new Integer( buildContext.getProjectId() ) );
+        if ( StringUtils.isEmpty( scmResult.getCommandLine() ) )
+        {
+            result.put( ContinuumBuildAgentUtil.KEY_SCM_COMMAND_LINE, "" );
+        }
+        else
+        {
+            result.put( ContinuumBuildAgentUtil.KEY_SCM_COMMAND_LINE, scmResult.getCommandLine() );
+        }
+        if ( StringUtils.isEmpty( scmResult.getCommandOutput() ) )
+        {
+            result.put( ContinuumBuildAgentUtil.KEY_SCM_COMMAND_OUTPUT, "" );
+        }
+        else
+        {
+            result.put( ContinuumBuildAgentUtil.KEY_SCM_COMMAND_OUTPUT, scmResult.getCommandOutput() );
+        }
+        if ( StringUtils.isEmpty( scmResult.getProviderMessage() ) )
+        {
+            result.put( ContinuumBuildAgentUtil.KEY_SCM_PROVIDER_MESSAGE, "" );
+        }
+        else
+        {
+            result.put( ContinuumBuildAgentUtil.KEY_SCM_PROVIDER_MESSAGE, scmResult.getProviderMessage() );
+        }
+        if ( StringUtils.isEmpty( scmResult.getException() ) )
+        {
+            result.put( ContinuumBuildAgentUtil.KEY_SCM_EXCEPTION, "" );
+        }
+        else
+        {
+            result.put( ContinuumBuildAgentUtil.KEY_SCM_EXCEPTION, scmResult.getException() );
+        }
+        result.put( ContinuumBuildAgentUtil.KEY_SCM_SUCCESS, new Boolean( scmResult.isSuccess() ) );
+        
+        return result;
+    }
+
+    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 performAction( String actionName, BuildContext buildContext )
+        throws ContinuumException
+    {
+        ContinuumException exception = null;
+    
+        try
+        {
+            log.info( "Performing action " + actionName );
+            actionManager.lookup( actionName ).execute( buildContext.getActionContext() );
+            return;
+        }
+        catch ( ActionNotFoundException e )
+        {
+            exception = new ContinuumException( "Error looking up action '" + actionName + "'", e );
+        }
+        catch ( Exception e )
+        {
+            exception = new ContinuumException( "Error executing action '" + actionName + "'", e );
+        }
+        
+        ScmResult result = new ScmResult();
+        
+        result.setSuccess( false );
+        
+        result.setException( ContinuumUtils.throwableToString( exception ) );
+
+        buildContext.setScmResult( result );
+        buildContext.getActionContext().put( ContinuumBuildAgentUtil.KEY_UPDATE_SCM_RESULT, result );
+        
+        throw exception;
+    }
+    
+    private void buildProjects( List<BuildContext> buildContexts )
+        throws ContinuumException
+    {
+        for ( BuildContext buildContext : buildContexts )
+        {
+            BuildProjectTask buildProjectTask = new BuildProjectTask( buildContext.getProjectId(),
+                                                                      buildContext.getBuildDefinitionId(),
+                                                                      buildContext.getTrigger(),
+                                                                      buildContext.getProjectName(),
+                                                                      "" );
+            try
+            {
+                taskQueueManager.getBuildQueue().put( buildProjectTask );
+            }
+            catch ( TaskQueueException e )
+            {
+                log.error( "Error while enqueing build task for project " + buildContext.getProjectId(), e );
+                throw new ContinuumException( "Error while enqueuing build task for project " + buildContext.getProjectId(), e );
+            }
+        }
+    }
+
+}

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

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

Modified: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/action/ExecuteBuilderAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/action/ExecuteBuilderAction.java?rev=726727&r1=726726&r2=726727&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/action/ExecuteBuilderAction.java (original)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/action/ExecuteBuilderAction.java Mon Dec 15 08:23:53 2008
@@ -17,6 +17,9 @@
 import org.apache.maven.continuum.project.ContinuumProjectState;
 import org.codehaus.plexus.action.AbstractAction;
 
+/**
+ * @plexus.component role="org.codehaus.plexus.action.Action" role-hint="execute-agent-builder"
+ */
 public class ExecuteBuilderAction
     extends AbstractAction
 {
@@ -76,8 +79,6 @@
             getLogger().info( "Cancelled build" );
             
             buildResult.setState( ContinuumProjectState.CANCELLED );
-            
-            context.put( ContinuumBuildAgentUtil.KEY_CANCELLED, new Boolean( true ) );
         }
         catch ( Throwable e )
         {
@@ -97,6 +98,8 @@
             {
                 buildResult.setState( ContinuumProjectState.ERROR );
             }
+
+            context.put( ContinuumBuildAgentUtil.KEY_BUILD_RESULT, buildResult );
         }
     }
 }
\ No newline at end of file

Modified: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/build/execution/AbstractBuildExecutor.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/build/execution/AbstractBuildExecutor.java?rev=726727&r1=726726&r2=726727&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/build/execution/AbstractBuildExecutor.java (original)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/build/execution/AbstractBuildExecutor.java Mon Dec 15 08:23:53 2008
@@ -8,6 +8,7 @@
 import java.util.Properties;
 
 import org.apache.continuum.buildagent.configuration.ConfigurationService;
+import org.apache.continuum.buildagent.installation.InstallationService;
 import org.apache.continuum.utils.shell.ExecutionResult;
 import org.apache.continuum.utils.shell.ShellCommandHelper;
 import org.apache.maven.artifact.Artifact;
@@ -46,6 +47,11 @@
     private ConfigurationService configurationService;
 
     /**
+     * @plexus.requirement
+     */
+    private InstallationService installationService;
+
+    /**
      * @plexus.configuration
      */
     private String defaultExecutable;
@@ -94,6 +100,16 @@
         this.configurationService = configurationService;
     }
 
+    public InstallationService getInstallationService()
+    {
+        return installationService;
+    }
+
+    public void setInstallationService( InstallationService installationService )
+    {
+        this.installationService = installationService;
+    }
+
     // ----------------------------------------------------------------------
     // Component Lifecycle
     // ----------------------------------------------------------------------
@@ -241,73 +257,6 @@
         }
     }
 
-    private String getRelativePath( File chrootDir, File workingDirectory, String groupId )
-    {
-        String path = workingDirectory.getPath();
-        String chrootBase = new File( chrootDir, groupId ).getPath();
-        if ( path.startsWith( chrootBase ) )
-        {
-            return path.substring( chrootBase.length(), path.length() );
-        }
-        else
-        {
-            throw new IllegalArgumentException(
-                "Working directory is not inside the chroot jail " + chrootBase + " , " + path );
-        }
-    }
-
-    protected abstract Map<String, String> getEnvironments( BuildDefinition buildDefinition );
-
-    protected String getJavaHomeValue( BuildDefinition buildDefinition )
-    {
-        Profile profile = buildDefinition.getProfile();
-        if ( profile == null )
-        {
-            return null;
-        }
-        Installation jdk = profile.getJdk();
-        if ( jdk == null )
-        {
-            return null;
-        }
-        return jdk.getVarValue();
-    }
-
-    public void backupTestFiles( Project project, int buildId )
-    {
-        //Nothing to do, by default
-    }
-
-    /**
-     * By default, we return true because with a change, the project must be rebuilt.
-     */
-    public boolean shouldBuild( List<ChangeSet> changes, Project continuumProject, File workingDirectory,
-                                BuildDefinition buildDefinition )
-        throws ContinuumBuildExecutorException
-    {
-        return true;
-    }
-
-    protected Map<String, String> getEnvironmentVariables( BuildDefinition buildDefinition )
-    {
-        Profile profile = buildDefinition.getProfile();
-        Map<String, String> envVars = new HashMap<String, String>();
-        if ( profile == null )
-        {
-            return envVars;
-        }
-        List<Installation> environmentVariables = profile.getEnvironmentVariables();
-        if ( environmentVariables.isEmpty() )
-        {
-            return envVars;
-        }
-        for ( Installation installation : environmentVariables )
-        {
-            envVars.put( installation.getVarName(), installation.getVarValue() );
-        }
-        return envVars;
-    }
-
     protected Properties getContinuumSystemProperties( Project project )
     {
         Properties properties = new Properties();
@@ -324,14 +273,8 @@
     protected String getBuildFileForProject( Project project, BuildDefinition buildDefinition )
     {
         String buildFile = StringUtils.clean( buildDefinition.getBuildFile() );
-        String relPath = StringUtils.clean( project.getRelativePath() );
-
-        if ( StringUtils.isEmpty( relPath ) )
-        {
-            return buildFile;
-        }
-
-        return relPath + File.separator + buildFile;
+        
+        return buildFile;
     }
 
     public boolean isBuilding( Project project )
@@ -357,7 +300,6 @@
         return getConfigurationService().getWorkingDirectory( projectId );
     }
 
-
     public boolean isResolveExecutable()
     {
         return resolveExecutable;

Added: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/build/execution/ant/AntBuildExecutor.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/build/execution/ant/AntBuildExecutor.java?rev=726727&view=auto
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/build/execution/ant/AntBuildExecutor.java (added)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/build/execution/ant/AntBuildExecutor.java Mon Dec 15 08:23:53 2008
@@ -0,0 +1,62 @@
+package org.apache.continuum.buildagent.build.execution.ant;
+
+import java.io.File;
+import java.util.Enumeration;
+import java.util.Properties;
+
+import org.apache.continuum.buildagent.build.execution.AbstractBuildExecutor;
+import org.apache.continuum.buildagent.build.execution.ContinuumBuildCancelledException;
+import org.apache.continuum.buildagent.build.execution.ContinuumBuildExecutionResult;
+import org.apache.continuum.buildagent.build.execution.ContinuumBuildExecutor;
+import org.apache.continuum.buildagent.build.execution.ContinuumBuildExecutorException;
+import org.apache.continuum.buildagent.installation.InstallationService;
+import org.apache.maven.continuum.execution.ContinuumBuildExecutorConstants;
+import org.apache.maven.continuum.model.project.BuildDefinition;
+import org.apache.maven.continuum.model.project.Project;
+import org.codehaus.plexus.util.StringUtils;
+
+public class AntBuildExecutor
+    extends AbstractBuildExecutor   
+    implements ContinuumBuildExecutor
+{
+    public static final String CONFIGURATION_EXECUTABLE = "executable";
+
+    public static final String CONFIGURATION_TARGETS = "targets";
+
+    public static final String ID = ContinuumBuildExecutorConstants.ANT_BUILD_EXECUTOR;
+
+    protected AntBuildExecutor()
+    {
+        super( ID, true );
+    }
+
+    public ContinuumBuildExecutionResult build( Project project, BuildDefinition buildDefinition, File buildOutput )
+        throws ContinuumBuildExecutorException, ContinuumBuildCancelledException
+    {
+        String executable = getInstallationService().getExecutorConfigurator( InstallationService.ANT_TYPE )
+            .getExecutable();
+
+        StringBuffer arguments = new StringBuffer();
+    
+        String buildFile = getBuildFileForProject( project, buildDefinition );
+    
+        if ( !StringUtils.isEmpty( buildFile ) )
+        {
+            arguments.append( "-f " ).append( buildFile ).append( " " );
+        }
+    
+        arguments.append( StringUtils.clean( buildDefinition.getArguments() ) ).append( " " );
+    
+        Properties props = getContinuumSystemProperties( project );
+        for ( Enumeration itr = props.propertyNames(); itr.hasMoreElements(); )
+        {
+            String name = (String) itr.nextElement();
+            String value = props.getProperty( name );
+            arguments.append( "\"-D" ).append( name ).append( "=" ).append( value ).append( "\" " );
+        }
+    
+        arguments.append( StringUtils.clean( buildDefinition.getGoals() ) );
+
+        return executeShellCommand( project, executable, arguments.toString(), buildOutput, null );
+    }
+}

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

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

Propchange: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/build/execution/maven/m1/
------------------------------------------------------------------------------
    svn:mergeinfo = 

Added: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/build/execution/maven/m1/MavenOneBuildExecutor.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/build/execution/maven/m1/MavenOneBuildExecutor.java?rev=726727&view=auto
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/build/execution/maven/m1/MavenOneBuildExecutor.java (added)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/build/execution/maven/m1/MavenOneBuildExecutor.java Mon Dec 15 08:23:53 2008
@@ -0,0 +1,61 @@
+package org.apache.continuum.buildagent.build.execution.maven.m1;
+
+import java.io.File;
+import java.util.Enumeration;
+import java.util.Properties;
+
+import org.apache.continuum.buildagent.build.execution.AbstractBuildExecutor;
+import org.apache.continuum.buildagent.build.execution.ContinuumBuildCancelledException;
+import org.apache.continuum.buildagent.build.execution.ContinuumBuildExecutionResult;
+import org.apache.continuum.buildagent.build.execution.ContinuumBuildExecutor;
+import org.apache.continuum.buildagent.build.execution.ContinuumBuildExecutorException;
+import org.apache.continuum.buildagent.installation.InstallationService;
+import org.apache.maven.continuum.execution.ContinuumBuildExecutorConstants;
+import org.apache.maven.continuum.model.project.BuildDefinition;
+import org.apache.maven.continuum.model.project.Project;
+import org.codehaus.plexus.util.StringUtils;
+
+public class MavenOneBuildExecutor
+    extends AbstractBuildExecutor
+    implements ContinuumBuildExecutor
+{
+    public final static String CONFIGURATION_GOALS = "goals";
+
+    public final static String ID = ContinuumBuildExecutorConstants.MAVEN_ONE_BUILD_EXECUTOR;
+
+    public MavenOneBuildExecutor()
+    {
+        super( ID, true );
+    }
+
+    public ContinuumBuildExecutionResult build( Project project, BuildDefinition buildDefinition, File buildOutput )
+        throws ContinuumBuildExecutorException, ContinuumBuildCancelledException
+    {
+        String executable = getInstallationService().getExecutorConfigurator( InstallationService.MAVEN1_TYPE )
+        .getExecutable();
+    
+        StringBuffer arguments = new StringBuffer();
+    
+        String buildFile = getBuildFileForProject( project, buildDefinition );
+    
+        if ( !StringUtils.isEmpty( buildFile ) && !"project.xml".equals( buildFile ) )
+        {
+            arguments.append( "-p " ).append( buildFile ).append( " " );
+        }
+    
+        arguments.append( StringUtils.clean( buildDefinition.getArguments() ) ).append( " " );
+    
+        Properties props = getContinuumSystemProperties( project );
+        for ( Enumeration itr = props.propertyNames(); itr.hasMoreElements(); )
+        {
+            String name = (String) itr.nextElement();
+            String value = props.getProperty( name );
+            arguments.append( "\"-D" ).append( name ).append( "=" ).append( value ).append( "\" " );
+        }
+        
+        arguments.append( StringUtils.clean( buildDefinition.getGoals() ) );
+    
+        return executeShellCommand( project, executable, arguments.toString(), buildOutput, null );
+    }
+
+}

Added: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/build/execution/maven/m2/DefaultMavenBuilderHelper.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/build/execution/maven/m2/DefaultMavenBuilderHelper.java?rev=726727&view=auto
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/build/execution/maven/m2/DefaultMavenBuilderHelper.java (added)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/build/execution/maven/m2/DefaultMavenBuilderHelper.java Mon Dec 15 08:23:53 2008
@@ -0,0 +1,402 @@
+package org.apache.continuum.buildagent.build.execution.maven.m2;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.StringWriter;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.maven.artifact.manager.WagonManager;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
+import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
+import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
+import org.apache.maven.continuum.project.builder.ContinuumProjectBuildingResult;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.Profile;
+import org.apache.maven.model.Scm;
+import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
+import org.apache.maven.profiles.DefaultProfileManager;
+import org.apache.maven.profiles.ProfileManager;
+import org.apache.maven.project.InvalidProjectModelException;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.MavenProjectBuilder;
+import org.apache.maven.project.ProjectBuildingException;
+import org.apache.maven.project.validation.ModelValidationResult;
+import org.apache.maven.settings.MavenSettingsBuilder;
+import org.apache.maven.settings.Mirror;
+import org.apache.maven.settings.Proxy;
+import org.apache.maven.settings.Server;
+import org.apache.maven.settings.Settings;
+import org.apache.maven.settings.io.xpp3.SettingsXpp3Writer;
+import org.codehaus.plexus.PlexusConstants;
+import org.codehaus.plexus.PlexusContainer;
+import org.codehaus.plexus.component.repository.exception.ComponentLifecycleException;
+import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
+import org.codehaus.plexus.context.Context;
+import org.codehaus.plexus.context.ContextException;
+import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable;
+import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
+import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
+import org.codehaus.plexus.util.StringUtils;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @plexus.component role="org.apache.continuum.buildagent.build.execution.maven.m2.MavenBuilderHelper" role-hint="default"
+ */
+public class DefaultMavenBuilderHelper
+    implements MavenBuilderHelper, Contextualizable, Initializable
+{
+    private Logger log = LoggerFactory.getLogger( this.getClass() );
+
+    /**
+     * @plexus.requirement
+     */
+    private MavenProjectBuilder projectBuilder;
+
+    /**
+     * @plexus.requirement
+     */
+    private MavenSettingsBuilder mavenSettingsBuilder;
+
+    /**
+     * @plexus.requirement
+     */
+    private ArtifactRepositoryFactory artifactRepositoryFactory;
+
+    /**
+     * @plexus.requirement
+     */
+    private ArtifactRepositoryLayout repositoryLayout;
+
+    private PlexusContainer container;
+    
+    public MavenProject getMavenProject( ContinuumProjectBuildingResult result, File file )
+    {
+        MavenProject project;
+
+        try
+        {
+            //   TODO: This seems like code that is shared with DefaultMaven, so it should be moved to the project
+            //   builder perhaps
+
+            Settings settings = getSettings();
+
+            if ( log.isDebugEnabled() )
+            {
+                writeSettings( settings );
+            }
+
+            ProfileManager profileManager = new DefaultProfileManager( container, settings );
+
+            project = projectBuilder.build( file, getRepository( settings ), profileManager, false );
+
+            if ( log.isDebugEnabled() )
+            {
+                writePom( project );
+                writeActiveProfileStatement( project );
+            }
+
+        }
+        catch ( ProjectBuildingException e )
+        {
+            StringBuffer messages = new StringBuffer();
+
+            Throwable cause = e.getCause();
+
+            if ( cause != null )
+            {
+                while ( ( cause.getCause() != null ) && ( cause instanceof ProjectBuildingException ) )
+                {
+                    cause = cause.getCause();
+                }
+            }
+
+            if ( e instanceof InvalidProjectModelException )
+            {
+                InvalidProjectModelException ex = (InvalidProjectModelException) e;
+
+                ModelValidationResult validationResult = ex.getValidationResult();
+
+                if ( validationResult != null && validationResult.getMessageCount() > 0 )
+                {
+                    for ( Iterator<String> i = validationResult.getMessages().iterator(); i.hasNext(); )
+                    {
+                        String valmsg = i.next();
+                        result.addError( ContinuumProjectBuildingResult.ERROR_VALIDATION, valmsg );
+                        messages.append( valmsg );
+                        messages.append( "\n" );
+                    }
+                }
+            }
+
+            if ( cause instanceof ArtifactNotFoundException )
+            {
+                result.addError( ContinuumProjectBuildingResult.ERROR_ARTIFACT_NOT_FOUND,
+                                 ( (ArtifactNotFoundException) cause ).toString() );
+                return null;
+            }
+
+            result.addError( ContinuumProjectBuildingResult.ERROR_PROJECT_BUILDING, e.getMessage() );
+
+            String msg = "Cannot build maven project from " + file + " (" + e.getMessage() + ").\n" + messages;
+
+            file.delete();
+
+            log.error( msg );
+
+            return null;
+        }
+        // TODO catch all exceptions is bad
+        catch ( Exception e )
+        {
+            result.addError( ContinuumProjectBuildingResult.ERROR_PROJECT_BUILDING, e.getMessage() );
+
+            String msg = "Cannot build maven project from " + file + " (" + e.getMessage() + ").";
+
+            file.delete();
+
+            log.error( msg );
+
+            return null;
+        }
+
+        // ----------------------------------------------------------------------
+        // Validate the MavenProject using some Continuum rules
+        // ----------------------------------------------------------------------
+
+        // SCM connection
+        Scm scm = project.getScm();
+
+        if ( scm == null )
+        {
+            result.addError( ContinuumProjectBuildingResult.ERROR_MISSING_SCM, getProjectName( project ) );
+
+            log.error( "Missing 'scm' element in the " + getProjectName( project ) + " POM." );
+
+            return null;
+        }
+
+        String url = scm.getConnection();
+
+        if ( StringUtils.isEmpty( url ) )
+        {
+            result.addError( ContinuumProjectBuildingResult.ERROR_MISSING_SCM_CONNECTION, getProjectName( project ) );
+
+            log.error(
+                "Missing 'connection' element in the 'scm' element in the " + getProjectName( project ) + " POM." );
+
+            return null;
+        }
+
+        return project;
+    }
+
+    private Settings getSettings()
+        throws SettingsConfigurationException
+    {
+        try
+        {
+            return mavenSettingsBuilder.buildSettings( false );
+        }
+        catch ( IOException e )
+        {
+            throw new SettingsConfigurationException( "Error reading settings file", e );
+        }
+        catch ( XmlPullParserException e )
+        {
+            throw new SettingsConfigurationException( e.getMessage(), e.getDetail(), e.getLineNumber(),
+                                                      e.getColumnNumber() );
+        }
+    }
+
+    private ArtifactRepository getRepository( Settings settings )
+    {
+        return artifactRepositoryFactory.createArtifactRepository( "local", "file://" + settings.getLocalRepository(), 
+                                                                   repositoryLayout, null, null );
+    }
+    
+    public String getProjectName( MavenProject project )
+    {
+        String name = project.getName();
+
+        if ( StringUtils.isEmpty( name ) )
+        {
+            return project.getId();
+        }
+
+        return name;
+    }
+    
+    private void writeSettings( Settings settings )
+    {
+        StringWriter sWriter = new StringWriter();
+
+        SettingsXpp3Writer settingsWriter = new SettingsXpp3Writer();
+
+        try
+        {
+            settingsWriter.write( sWriter, settings );
+
+            StringBuffer message = new StringBuffer();
+
+            message.append( "\n************************************************************************************" );
+            message.append( "\nEffective Settings" );
+            message.append( "\n************************************************************************************" );
+            message.append( "\n" );
+            message.append( sWriter.toString() );
+            message.append( "\n************************************************************************************" );
+            message.append( "\n\n" );
+
+            log.debug( message.toString() );
+        }
+        catch ( IOException e )
+        {
+            log.warn( "Cannot serialize Settings to XML.", e );
+        }
+    }
+
+    private void writePom( MavenProject project )
+    {
+        StringBuffer message = new StringBuffer();
+
+        Model pom = project.getModel();
+
+        StringWriter sWriter = new StringWriter();
+
+        MavenXpp3Writer pomWriter = new MavenXpp3Writer();
+
+        try
+        {
+            pomWriter.write( sWriter, pom );
+
+            message.append( "\n************************************************************************************" );
+            message.append( "\nEffective POM for project \'" ).append( project.getId() ).append( "\'" );
+            message.append( "\n************************************************************************************" );
+            message.append( "\n" );
+            message.append( sWriter.toString() );
+            message.append( "\n************************************************************************************" );
+            message.append( "\n\n" );
+
+            log.debug( message.toString() );
+        }
+        catch ( IOException e )
+        {
+            log.warn( "Cannot serialize POM to XML.", e );
+        }
+    }
+    
+    private void writeActiveProfileStatement( MavenProject project )
+    {
+        List<Profile> profiles = project.getActiveProfiles();
+
+        StringBuffer message = new StringBuffer();
+
+        message.append( "\n" );
+
+        message.append( "\n************************************************************************************" );
+        message.append( "\nActive Profiles for Project \'" ).append( project.getId() ).append( "\'" );
+        message.append( "\n************************************************************************************" );
+        message.append( "\n" );
+
+        if ( profiles == null || profiles.isEmpty() )
+        {
+            message.append( "There are no active profiles." );
+        }
+        else
+        {
+            message.append( "The following profiles are active:\n" );
+
+            for ( Profile profile : profiles )
+            {
+                message.append( "\n - " ).append( profile.getId() ).append( " (source: " )
+                    .append( profile.getSource() ).append( ")" );
+            }
+
+        }
+
+        message.append( "\n************************************************************************************" );
+        message.append( "\n\n" );
+
+        log.debug( message.toString() );
+    }
+
+    public void contextualize( Context context )
+        throws ContextException
+    {
+        container = (PlexusContainer) context.get( PlexusConstants.PLEXUS_KEY );
+    }
+
+    public void initialize()
+        throws InitializationException
+    {
+        try
+        {
+            Settings settings = getSettings();
+
+            resolveParameters( settings );
+        }
+        catch ( Exception e )
+        {
+            throw new InitializationException( "Can't initialize '" + getClass().getName() + "'", e );
+        }
+    }
+    
+    /**
+     * @todo [BP] this might not be required if there is a better way to pass
+     * them in. It doesn't feel quite right.
+     * @todo [JC] we should at least provide a mapping of protocol-to-proxy for
+     * the wagons, shouldn't we?
+     */
+    private void resolveParameters( Settings settings )
+        throws ComponentLookupException, ComponentLifecycleException, SettingsConfigurationException
+    {
+        WagonManager wagonManager = (WagonManager) container.lookup( WagonManager.ROLE );
+
+        try
+        {
+            Proxy proxy = settings.getActiveProxy();
+
+            if ( proxy != null )
+            {
+                if ( proxy.getHost() == null )
+                {
+                    throw new SettingsConfigurationException( "Proxy in settings.xml has no host" );
+                }
+
+                wagonManager.addProxy( proxy.getProtocol(), proxy.getHost(), proxy.getPort(), proxy.getUsername(),
+                                       proxy.getPassword(), proxy.getNonProxyHosts() );
+            }
+
+            for ( Iterator<Server> i = settings.getServers().iterator(); i.hasNext(); )
+            {
+                Server server = i.next();
+
+                wagonManager.addAuthenticationInfo( server.getId(), server.getUsername(), server.getPassword(),
+                                                    server.getPrivateKey(), server.getPassphrase() );
+
+                wagonManager.addPermissionInfo( server.getId(), server.getFilePermissions(),
+                                                server.getDirectoryPermissions() );
+
+                if ( server.getConfiguration() != null )
+                {
+                    wagonManager.addConfiguration( server.getId(), (Xpp3Dom) server.getConfiguration() );
+                }
+            }
+
+            for ( Iterator<Mirror> i = settings.getMirrors().iterator(); i.hasNext(); )
+            {
+                Mirror mirror = i.next();
+
+                wagonManager.addMirror( mirror.getId(), mirror.getMirrorOf(), mirror.getUrl() );
+            }
+        }
+        finally
+        {
+            container.release( wagonManager );
+        }
+    }
+}

Propchange: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/build/execution/maven/m2/DefaultMavenBuilderHelper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/build/execution/maven/m2/DefaultMavenBuilderHelper.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/build/execution/maven/m2/MavenBuilderHelper.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/build/execution/maven/m2/MavenBuilderHelper.java?rev=726727&view=auto
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/build/execution/maven/m2/MavenBuilderHelper.java (added)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/build/execution/maven/m2/MavenBuilderHelper.java Mon Dec 15 08:23:53 2008
@@ -0,0 +1,13 @@
+package org.apache.continuum.buildagent.build.execution.maven.m2;
+
+import java.io.File;
+
+import org.apache.maven.continuum.project.builder.ContinuumProjectBuildingResult;
+import org.apache.maven.project.MavenProject;
+
+public interface MavenBuilderHelper
+{
+    String ROLE = MavenBuilderHelper.class.getName();
+
+    MavenProject getMavenProject( ContinuumProjectBuildingResult result, File file );
+}

Propchange: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/build/execution/maven/m2/MavenBuilderHelper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/build/execution/maven/m2/MavenBuilderHelper.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/build/execution/maven/m2/MavenTwoBuildExecutor.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/build/execution/maven/m2/MavenTwoBuildExecutor.java?rev=726727&view=auto
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/build/execution/maven/m2/MavenTwoBuildExecutor.java (added)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/build/execution/maven/m2/MavenTwoBuildExecutor.java Mon Dec 15 08:23:53 2008
@@ -0,0 +1,227 @@
+package org.apache.continuum.buildagent.build.execution.maven.m2;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.continuum.buildagent.build.execution.AbstractBuildExecutor;
+import org.apache.continuum.buildagent.build.execution.ContinuumBuildCancelledException;
+import org.apache.continuum.buildagent.build.execution.ContinuumBuildExecutionResult;
+import org.apache.continuum.buildagent.build.execution.ContinuumBuildExecutor;
+import org.apache.continuum.buildagent.build.execution.ContinuumBuildExecutorException;
+import org.apache.continuum.buildagent.installation.InstallationService;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.metadata.ArtifactMetadata;
+import org.apache.maven.continuum.execution.ContinuumBuildExecutorConstants;
+import org.apache.maven.continuum.model.project.BuildDefinition;
+import org.apache.maven.continuum.model.project.Project;
+import org.apache.maven.continuum.project.builder.ContinuumProjectBuildingResult;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.MavenProjectHelper;
+import org.apache.maven.project.artifact.ProjectArtifactMetadata;
+import org.codehaus.plexus.util.StringUtils;
+
+public class MavenTwoBuildExecutor
+    extends AbstractBuildExecutor
+    implements ContinuumBuildExecutor
+{
+    public static final String CONFIGURATION_GOALS = "goals";
+
+    public static final String ID = ContinuumBuildExecutorConstants.MAVEN_TWO_BUILD_EXECUTOR;
+
+    /**
+     * @plexus.requirement
+     */
+    private MavenProjectHelper projectHelper;
+
+    /**
+     * @plexus.requirement
+     */
+    private MavenBuilderHelper builderHelper;
+
+    public MavenTwoBuildExecutor()
+    {
+        super( ID, true );
+    }
+
+    public MavenProjectHelper getProjectHelper()
+    {
+        return projectHelper;
+    }
+
+    public void setProjectHelper( MavenProjectHelper projectHelper )
+    {
+        this.projectHelper = projectHelper;
+    }
+
+    public ContinuumBuildExecutionResult build( Project project, BuildDefinition buildDefinition, File buildOutput )
+        throws ContinuumBuildExecutorException, ContinuumBuildCancelledException
+    {
+        String executable = getInstallationService().getExecutorConfigurator( InstallationService.MAVEN2_TYPE )
+        .getExecutable();
+
+        StringBuffer arguments = new StringBuffer();
+    
+        String buildFile = getBuildFileForProject( project, buildDefinition );
+    
+        if ( !StringUtils.isEmpty( buildFile ) && !"pom.xml".equals( buildFile ) )
+        {
+            arguments.append( "-f " ).append( buildFile ).append( " " );
+        }
+    
+        arguments.append( StringUtils.clean( buildDefinition.getArguments() ) ).append( " " );
+    
+        Properties props = getContinuumSystemProperties( project );
+        for ( Enumeration itr = props.propertyNames(); itr.hasMoreElements(); )
+        {
+            String name = (String) itr.nextElement();
+            String value = props.getProperty( name );
+            arguments.append( "\"-D" ).append( name ).append( "=" ).append( value ).append( "\" " );
+        }
+    
+        arguments.append( StringUtils.clean( buildDefinition.getGoals() ) );
+
+        return executeShellCommand( project, executable, arguments.toString(), buildOutput, null );
+    }
+
+    @Override
+    public List<Artifact> getDeployableArtifacts( Project continuumProject, File workingDirectory,
+                                        BuildDefinition buildDefinition )
+        throws ContinuumBuildExecutorException
+    {
+        MavenProject project = getMavenProject( continuumProject, workingDirectory, buildDefinition );
+
+        // Maven could help us out a lot more here by knowing how to get the deployment artifacts from a project.
+        // TODO: this is currently quite lame
+
+        Artifact artifact = project.getArtifact();
+
+        String projectPackaging = project.getPackaging();
+
+        boolean isPomArtifact = "pom".equals( projectPackaging );
+
+        if ( isPomArtifact )
+        {
+            artifact.setFile( project.getFile() );
+        }
+        else
+        {
+            // Attach pom
+            ArtifactMetadata metadata = new ProjectArtifactMetadata( artifact, project.getFile() );
+
+            artifact.addMetadata( metadata );
+
+            String finalName = project.getBuild().getFinalName();
+
+            String filename = finalName + "." + artifact.getArtifactHandler().getExtension();
+
+            String buildDirectory = project.getBuild().getDirectory();
+
+            File artifactFile = new File( buildDirectory, filename );
+
+            artifact.setFile( artifactFile );
+
+            // sources jar
+            File sourcesFile = new File( buildDirectory, finalName + "-sources.jar" );
+
+            if ( sourcesFile.exists() )
+            {
+                projectHelper.attachArtifact( project, "java-source", "sources", sourcesFile );
+            }
+
+            // tests sources jar
+            File testsSourcesFile = new File( buildDirectory, finalName + "-test-sources.jar" );
+
+            if ( testsSourcesFile.exists() )
+            {
+                projectHelper.attachArtifact( project, "java-source", "test-sources", testsSourcesFile );
+            }
+
+            // javadoc jar
+            File javadocFile = new File( buildDirectory, finalName + "-javadoc.jar" );
+
+            if ( javadocFile.exists() )
+            {
+                projectHelper.attachArtifact( project, "javadoc", "javadoc", javadocFile );
+            }
+
+            // client jar
+            File clientFile = new File( buildDirectory, finalName + "-client.jar" );
+
+            if ( clientFile.exists() )
+            {
+                projectHelper.attachArtifact( project, projectPackaging + "-client", "client", clientFile );
+            }
+
+            // Tests jar
+            File testsFile = new File( buildDirectory, finalName + "-tests.jar" );
+
+            if ( testsFile.exists() )
+            {
+                projectHelper.attachArtifact( project, "jar", "tests", testsFile );
+            }
+        }
+
+        List<Artifact> attachedArtifacts = project.getAttachedArtifacts();
+
+        List<Artifact> artifacts = new ArrayList<Artifact>( attachedArtifacts.size() + 1 );
+
+        if ( artifact.getFile().exists() )
+        {
+            artifacts.add( artifact );
+        }
+
+        for ( Artifact attachedArtifact : attachedArtifacts )
+        {
+            artifacts.add( attachedArtifact );
+        }
+
+        return artifacts;
+    }
+
+    private MavenProject getMavenProject( Project continuumProject, File workingDirectory,
+                                          BuildDefinition buildDefinition )
+        throws ContinuumBuildExecutorException
+    {
+        ContinuumProjectBuildingResult result = new ContinuumProjectBuildingResult();
+
+        File f = getPomFile( getBuildFileForProject( continuumProject, buildDefinition ), workingDirectory );
+
+        if ( !f.exists() )
+        {
+            throw new ContinuumBuildExecutorException( "Could not find Maven project descriptor '" + f + "'." );
+        }
+
+        MavenProject project = builderHelper.getMavenProject( result, f );
+
+        if ( result.hasErrors() )
+        {
+            throw new ContinuumBuildExecutorException(
+                "Unable to read the Maven project descriptor '" + f + "': " + result.getErrorsAsString() );
+        }
+        return project;
+    }
+
+    private static File getPomFile( String projectBuildFile, File workingDirectory )
+    {
+        File f = null;
+
+        String buildFile = StringUtils.clean( projectBuildFile );
+
+        if ( !StringUtils.isEmpty( buildFile ) )
+        {
+            f = new File( workingDirectory, buildFile );
+        }
+
+        if ( f == null )
+        {
+            f = new File( workingDirectory, "pom.xml" );
+        }
+
+        return f;
+    }
+
+}

Propchange: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/build/execution/maven/m2/MavenTwoBuildExecutor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/build/execution/maven/m2/MavenTwoBuildExecutor.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/build/execution/maven/m2/SettingsConfigurationException.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/build/execution/maven/m2/SettingsConfigurationException.java?rev=726727&view=auto
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/build/execution/maven/m2/SettingsConfigurationException.java (added)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/build/execution/maven/m2/SettingsConfigurationException.java Mon Dec 15 08:23:53 2008
@@ -0,0 +1,37 @@
+package org.apache.continuum.buildagent.build.execution.maven.m2;
+
+public class SettingsConfigurationException
+    extends Exception
+    {
+    private int lineNumber;
+    
+    private int columnNumber;
+    
+    public SettingsConfigurationException( String message )
+    {
+        super( message );
+    }
+    
+    public SettingsConfigurationException( String message, Throwable cause )
+    {
+        super( message, cause );
+    }
+    
+    public SettingsConfigurationException( String message, Throwable cause, int lineNumber, int columnNumber )
+    {
+        super( message + ( lineNumber > 0 ? "\n  Line:   " + lineNumber : "" ) +
+            ( columnNumber > 0 ? "\n  Column: " + columnNumber : "" ), cause );
+        this.lineNumber = lineNumber;
+        this.columnNumber = columnNumber;
+    }
+    
+    public int getColumnNumber()
+    {
+        return columnNumber;
+    }
+    
+    public int getLineNumber()
+    {
+        return lineNumber;
+    }
+}
\ No newline at end of file

Propchange: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/build/execution/maven/m2/SettingsConfigurationException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/build/execution/maven/m2/SettingsConfigurationException.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/build/execution/shell/ShellBuildExecutor.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/build/execution/shell/ShellBuildExecutor.java?rev=726727&view=auto
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/build/execution/shell/ShellBuildExecutor.java (added)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/build/execution/shell/ShellBuildExecutor.java Mon Dec 15 08:23:53 2008
@@ -0,0 +1,34 @@
+package org.apache.continuum.buildagent.build.execution.shell;
+
+import java.io.File;
+
+import org.apache.continuum.buildagent.build.execution.AbstractBuildExecutor;
+import org.apache.continuum.buildagent.build.execution.ContinuumBuildCancelledException;
+import org.apache.continuum.buildagent.build.execution.ContinuumBuildExecutionResult;
+import org.apache.continuum.buildagent.build.execution.ContinuumBuildExecutor;
+import org.apache.continuum.buildagent.build.execution.ContinuumBuildExecutorException;
+import org.apache.maven.continuum.execution.ContinuumBuildExecutorConstants;
+import org.apache.maven.continuum.model.project.BuildDefinition;
+import org.apache.maven.continuum.model.project.Project;
+
+public class ShellBuildExecutor
+    extends AbstractBuildExecutor
+    implements ContinuumBuildExecutor
+{
+    public static final String CONFIGURATION_EXECUTABLE = "executable";
+
+    public static final String ID = ContinuumBuildExecutorConstants.SHELL_BUILD_EXECUTOR;
+
+    public ShellBuildExecutor()
+    {
+        super( ID, false );
+    }
+
+    public ContinuumBuildExecutionResult build( Project project, BuildDefinition buildDefinition, File buildOutput )
+        throws ContinuumBuildExecutorException, ContinuumBuildCancelledException
+    {
+        String executable = getBuildFileForProject( project, buildDefinition );
+
+        return executeShellCommand( project, executable, buildDefinition.getArguments(), buildOutput, null );
+    }
+}

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

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

Modified: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/buildcontext/BuildContext.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/buildcontext/BuildContext.java?rev=726727&r1=726726&r2=726727&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/buildcontext/BuildContext.java (original)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/buildcontext/BuildContext.java Mon Dec 15 08:23:53 2008
@@ -9,6 +9,8 @@
 {
     private int projectId;
 
+    private String projectName;
+
     private int buildDefinitionId;
 
     private String buildFile;
@@ -71,6 +73,16 @@
         this.projectId = projectId;
     }
 
+    public String getProjectName()
+    {
+        return projectName;
+    }
+
+    public void setProjectName( String projectName )
+    {
+        this.projectName = projectName;
+    }
+
     public int getBuildDefinitionId()
     {
         return buildDefinitionId;

Added: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/installation/DefaultInstallationService.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/installation/DefaultInstallationService.java?rev=726727&view=auto
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/installation/DefaultInstallationService.java (added)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/installation/DefaultInstallationService.java Mon Dec 15 08:23:53 2008
@@ -0,0 +1,39 @@
+package org.apache.continuum.buildagent.installation;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.maven.continuum.execution.ExecutorConfigurator;
+import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
+import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
+
+/**
+ * @plexus.component role="org.apache.continuum.buildagent.installation.InstallationService"
+ */
+public class DefaultInstallationService
+    implements InstallationService, Initializable
+{
+    private Map<String, ExecutorConfigurator> typesValues;
+
+    public ExecutorConfigurator getExecutorConfigurator( String type )
+    {
+        return this.typesValues.get( type );
+    }
+
+    public void initialize()
+        throws InitializationException
+    {
+        this.typesValues = new HashMap<String, ExecutorConfigurator>();
+        this.typesValues.put( InstallationService.ANT_TYPE,
+                              new ExecutorConfigurator( "ant", "bin", "ANT_HOME", "-version" ) );
+
+        this.typesValues.put( InstallationService.ENVVAR_TYPE, null );
+        this.typesValues.put( InstallationService.JDK_TYPE,
+                              new ExecutorConfigurator( "java", "bin", "JAVA_HOME", "-version" ) );
+        this.typesValues.put( InstallationService.MAVEN1_TYPE,
+                              new ExecutorConfigurator( "maven", "bin", "MAVEN_HOME", "-v" ) );
+        this.typesValues
+            .put( InstallationService.MAVEN2_TYPE, new ExecutorConfigurator( "mvn", "bin", "M2_HOME", "-v" ) );
+    }
+
+}

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

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

Added: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/installation/InstallationService.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/installation/InstallationService.java?rev=726727&view=auto
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/installation/InstallationService.java (added)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/installation/InstallationService.java Mon Dec 15 08:23:53 2008
@@ -0,0 +1,24 @@
+package org.apache.continuum.buildagent.installation;
+
+import org.apache.maven.continuum.execution.ExecutorConfigurator;
+
+public interface InstallationService
+{
+    String ROLE = InstallationService.class.getName();
+
+    String JDK_TYPE = "jdk";
+
+    String MAVEN2_TYPE = "maven2";
+
+    String MAVEN1_TYPE = "maven1";
+
+    String ANT_TYPE = "ant";
+
+    String ENVVAR_TYPE = "envvar";
+
+    /**
+     * @param type
+     * @return ExecutorConfigurator or null if unknown type
+     */
+    public ExecutorConfigurator getExecutorConfigurator( String type );
+}

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

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



Mime
View raw message