continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r726638 [2/2] - in /continuum/branches/continuum-distributed-builds: ./ continuum-builder/src/test/java/org/apache/continuum/builder/distributed/manager/ continuum-distributed-build/continuum-buildagent/ continuum-distributed-build/continuu...
Date Mon, 15 Dec 2008 07:48:40 GMT
Added: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/configuration/ContinuumConfigurationException.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/configuration/ContinuumConfigurationException.java?rev=726638&view=auto
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/configuration/ContinuumConfigurationException.java (added)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/configuration/ContinuumConfigurationException.java Sun Dec 14 23:48:38 2008
@@ -0,0 +1,20 @@
+package org.apache.continuum.buildagent.configuration;
+
+public class ContinuumConfigurationException
+    extends Exception
+{
+    public ContinuumConfigurationException( String message )
+    {
+        super( message );
+    }
+
+    public ContinuumConfigurationException( Throwable cause )
+    {
+        super( cause );
+    }
+
+    public ContinuumConfigurationException( String message, Throwable cause )
+    {
+        super( message, cause );
+    }
+}

Added: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/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/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/configuration/DefaultConfigurationService.java?rev=726638&view=auto
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/configuration/DefaultConfigurationService.java (added)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/configuration/DefaultConfigurationService.java Sun Dec 14 23:48:38 2008
@@ -0,0 +1,123 @@
+package org.apache.continuum.buildagent.configuration;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+
+import org.apache.continuum.buildagent.model.Installation;
+import org.codehaus.plexus.util.FileUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DefaultConfigurationService
+    implements ConfigurationService
+{
+    private Logger log = LoggerFactory.getLogger( this.getClass() );
+
+    /**
+     * @plexus.requirement
+     */
+    private ContinuumConfiguration configuration;
+
+    private ContinuumBuildAgentConfiguration buildAgentConfiguration;
+
+    public void initialize()
+        throws ContinuumConfigurationException
+    {
+        loadData();
+    }
+
+    public ContinuumConfiguration getConfiguration()
+    {
+        return configuration;
+    }
+
+    public void setConfiguration( ContinuumConfiguration configuration )
+    {
+        this.configuration = configuration;
+    }
+
+    public File getBuildOutputDirectory()
+    {
+        return buildAgentConfiguration.getBuildOutputDirectory();
+    }
+
+    public File getBuildOutputDirectory( int projectId )
+    {
+        File dir = new File( getBuildOutputDirectory(), Integer.toString( projectId ) );
+
+        try
+        {
+            dir = dir.getCanonicalFile();
+        }
+        catch ( IOException e )
+        {
+        }
+
+        return dir;
+    }
+
+    public File getWorkingDirectory()
+    {
+        return buildAgentConfiguration.getWorkingDirectory();
+    }
+
+    public File getWorkingDirectory( int projectId )
+    {
+        return new File( buildAgentConfiguration.getWorkingDirectory(), Integer.toString( projectId ) );
+    }
+
+    public String getBuildOutput( int projectId )
+        throws ContinuumConfigurationException
+    {
+        File file = getBuildOutputFile( projectId );
+    
+        try
+        {
+            if ( file.exists() )
+            {
+                return FileUtils.fileRead( file.getAbsolutePath() );
+            }
+            else
+            {
+                return "There are no output for this build.";
+            }
+        }
+        catch ( IOException e )
+        {
+            log.warn( "Error reading build output for project '" + projectId + "'.", e );
+    
+            return null;
+        }
+    }
+
+    public File getBuildOutputFile( int projectId )
+        throws ContinuumConfigurationException
+    {
+        File dir = getBuildOutputDirectory( projectId );
+
+        if ( !dir.exists() && !dir.mkdirs() )
+        {
+            throw new ContinuumConfigurationException( 
+                      "Could not make the build output directory: " + "'" + dir.getAbsolutePath() + "'." );
+        }
+
+        return new File( dir, "build.log.txt" );
+    }
+
+    public String getContinuumServerUrl()
+    {
+        return buildAgentConfiguration.getContinuumServerUrl();
+    }
+
+    public List<Installation> getAvailableInstallations()
+    {
+        return buildAgentConfiguration.getInstallations();
+    }
+
+    private void loadData()
+        throws ContinuumConfigurationException
+    {
+        buildAgentConfiguration = configuration.getContinuumBuildAgentConfiguration();
+    }
+}
\ No newline at end of file

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

Added: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/taskqueue/execution/BuildProjectTaskExecutor.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/taskqueue/execution/BuildProjectTaskExecutor.java?rev=726638&view=auto
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/taskqueue/execution/BuildProjectTaskExecutor.java (added)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/taskqueue/execution/BuildProjectTaskExecutor.java Sun Dec 14 23:48:38 2008
@@ -0,0 +1,192 @@
+package org.apache.continuum.buildagent.taskqueue.execution;
+
+import java.util.Iterator;
+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.taskqueue.BuildProjectTask;
+import org.apache.continuum.utils.ContinuumUtils;
+import org.apache.maven.scm.ScmException;
+import org.apache.maven.scm.repository.ScmRepositoryException;
+import org.codehaus.plexus.action.ActionManager;
+import org.codehaus.plexus.action.ActionNotFoundException;
+import org.codehaus.plexus.taskqueue.Task;
+import org.codehaus.plexus.taskqueue.execution.TaskExecutionException;
+import org.codehaus.plexus.taskqueue.execution.TaskExecutor;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class BuildProjectTaskExecutor
+    implements TaskExecutor
+{
+    private Logger log = LoggerFactory.getLogger( this.getClass() );
+
+    /**
+     * @plexus.requirement
+     */
+    private BuildContextManager buildContextManager;
+
+    /**
+     * @plexus.requirement
+     */
+    private ActionManager actionManager;
+
+    public void executeTask( Task task )
+        throws TaskExecutionException
+    {
+        BuildProjectTask buildProjectTask = (BuildProjectTask) task;
+
+        int projectId = buildProjectTask.getProjectId();
+        int buildDefinitionId = buildProjectTask.getBuildDefinitionId();
+        int trigger = buildProjectTask.getTrigger();
+
+        log.info( "Initializing build" );
+        BuildContext context = buildContextManager.getBuildContext( projectId );
+        initializeBuildContext( context );
+
+        if ( !checkScmResult( context ) )
+        {
+            log.info( "Error updating from SCM, not building" );
+            return;
+        }
+        
+        log.info( "Starting build of " + context.getProjectId() );
+        startBuild( context );
+
+        try
+        {
+            Map actionContext = context.getActionContext();
+
+            performAction( "execute-builder", context );
+
+            performAction( "deploy-artifact", context );
+
+            /*
+            context.setCancelled( (Boolean) actionContext.get( AbstractContinuumAction.KEY_CANCELLED ) );
+
+            String s = (String) actionContext.get( AbstractContinuumAction.KEY_BUILD_ID );
+
+            if ( s != null && !context.isCancelled() )
+            {
+                try
+                {
+                    context.setBuildResult( buildResultDao.getBuildResult( Integer.valueOf( s ) ) );
+                }
+                catch ( NumberFormatException e )
+                {
+                    throw new TaskExecutionException( "Internal error: build id not an integer", e );
+                }
+                catch ( ContinuumObjectNotFoundException e )
+                {
+                    throw new TaskExecutionException( "Internal error: Cannot find build result", e );
+                }
+                catch ( ContinuumStoreException e )
+                {
+                    throw new TaskExecutionException( "Error loading build result", e );
+                }
+            }*/
+        }
+        finally
+        {
+            //endBuild( context );
+        }
+    }
+
+    private void initializeBuildContext( BuildContext buildContext )
+    {
+        buildContext.setBuildStartTime( System.currentTimeMillis() );
+    }
+    
+    private boolean checkScmResult( BuildContext buildContext )
+    {
+        if ( buildContext.getScmResult() == null || !buildContext.getScmResult().isSuccess() )
+        {
+            return false;
+        }
+
+        return true;
+    }
+
+    private void startBuild( BuildContext buildContext )
+    {
+        // inform master that project is building ( to set the state )
+    }
+
+    private void performAction( String actionName, BuildContext context )
+        throws TaskExecutionException
+    {
+        String error = null;
+        TaskExecutionException exception = null;
+    
+        try
+        {
+            log.info( "Performing action " + actionName );
+            actionManager.lookup( actionName ).execute( context.getActionContext() );
+            return;
+        }
+        catch ( ActionNotFoundException e )
+        {
+            error = ContinuumUtils.throwableToString( e );
+            exception = new TaskExecutionException( "Error looking up action '" + actionName + "'", e );
+        }
+        catch ( ScmRepositoryException e )
+        {
+            error = getValidationMessages( e ) + "\n" + ContinuumUtils.throwableToString( e );
+    
+            exception = new TaskExecutionException( "SCM error while executing '" + actionName + "'", e );
+        }
+        catch ( ScmException e )
+        {
+            error = ContinuumUtils.throwableToString( e );
+    
+            exception = new TaskExecutionException( "SCM error while executing '" + actionName + "'", e );
+        }
+        catch ( Exception e )
+        {
+            exception = new TaskExecutionException( "Error executing action '" + actionName + "'", e );
+            error = ContinuumUtils.throwableToString( exception );
+        }
+    
+        // TODO: clean this up. We catch the original exception from the action, and then update the buildresult
+        // for it - we need to because of the specialized error message for SCM.
+        // If updating the buildresult fails, log the previous error and throw the new one.
+        // If updating the buildresult succeeds, throw the original exception. The build result should NOT
+        // be updated again - a TaskExecutionException is final, no further action should be taken upon it.
+    
+        /*
+        try
+        {
+            updateBuildResult( context, error );
+        }
+        catch ( TaskExecutionException e )
+        {
+            log.error( "Error updating build result after receiving the following exception: ", exception );
+            throw e;
+        }*/
+    
+        throw exception;
+    }
+
+    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();
+    }
+}

Added: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/taskqueue/execution/PrepareBuildTaskExecutor.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/taskqueue/execution/PrepareBuildTaskExecutor.java?rev=726638&view=auto
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/taskqueue/execution/PrepareBuildTaskExecutor.java (added)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/taskqueue/execution/PrepareBuildTaskExecutor.java Sun Dec 14 23:48:38 2008
@@ -0,0 +1,348 @@
+package org.apache.continuum.buildagent.taskqueue.execution;
+
+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.utils.BuildContextToBuildDefinition;
+import org.apache.continuum.buildagent.utils.BuildContextToProject;
+import org.apache.continuum.buildagent.utils.ContinuumBuildAgentUtil;
+import org.apache.continuum.buildagent.taskqueue.manager.TaskQueueManager;
+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.Task;
+import org.codehaus.plexus.taskqueue.TaskQueueException;
+import org.codehaus.plexus.taskqueue.execution.TaskExecutionException;
+import org.codehaus.plexus.taskqueue.execution.TaskExecutor;
+import org.codehaus.plexus.util.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @author Maria Catherine Tan
+ * @plexus.component role="org.codehaus.plexus.taskqueue.execution.TaskExecutor" role-hint="prepare-build-agent"
+ */
+public class PrepareBuildTaskExecutor
+    implements TaskExecutor
+{
+    private Logger log = LoggerFactory.getLogger( this.getClass() );
+
+    /**
+     * @plexus.requirement
+     */
+    private ActionManager actionManager;
+    
+    /**
+     * @plexus.requirement
+     */
+    private BuildContextManager buildContextManager;
+
+    /**
+     * @plexus.requirement
+     */
+    private ConfigurationService configurationService;
+
+    /**
+     * @plexus.requirement
+     */
+    private TaskQueueManager taskQueueManager;
+
+    // do we still need a queue for this?
+    public void executeTask( Task task )
+        throws TaskExecutionException
+    {
+        List<BuildContext> buildContexts = buildContextManager.getBuildContextList();
+
+        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 TaskExecutionException
+    {
+        performAction( "clean-agent-work-directory", buildContext );
+    }
+
+    private void updateWorkingDirectory( BuildContext buildContext )
+        throws TaskExecutionException
+    {
+        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 TaskExecutionException
+    {
+        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 TaskExecutionException
+    {
+        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 TaskExecutionException
+    {
+        TaskExecutionException exception = null;
+    
+        try
+        {
+            log.info( "Performing action " + actionName );
+            actionManager.lookup( actionName ).execute( buildContext.getActionContext() );
+            return;
+        }
+        catch ( ActionNotFoundException e )
+        {
+            exception = new TaskExecutionException( "Error looking up action '" + actionName + "'", e );
+        }
+        catch ( Exception e )
+        {
+            exception = new TaskExecutionException( "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 TaskExecutionException
+    {
+        for ( BuildContext buildContext : buildContexts )
+        {
+            BuildProjectTask buildProjectTask = new BuildProjectTask( buildContext.getProjectId(),
+                                                                      buildContext.getBuildDefinitionId(),
+                                                                      buildContext.getTrigger(),
+                                                                      "", "" );
+            try
+            {
+                taskQueueManager.getBuildQueue().put( buildProjectTask );
+            }
+            catch ( TaskQueueException e )
+            {
+                log.error( "Error while enqueing build task for project " + buildContext.getProjectId(), e );
+                throw new TaskExecutionException( "Error while enqueuing build task for project " + buildContext.getProjectId(), e );
+            }
+        }
+    }
+}

Added: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/taskqueue/manager/TaskQueueManager.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/taskqueue/manager/TaskQueueManager.java?rev=726638&view=auto
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/taskqueue/manager/TaskQueueManager.java (added)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/taskqueue/manager/TaskQueueManager.java Sun Dec 14 23:48:38 2008
@@ -0,0 +1,14 @@
+package org.apache.continuum.buildagent.taskqueue.manager;
+
+import org.apache.continuum.taskqueue.manager.TaskQueueManagerException;
+import org.codehaus.plexus.taskqueue.TaskQueue;
+
+public interface TaskQueueManager
+{
+    TaskQueue getBuildQueue();
+
+    TaskQueue getPrepareBuildQueue();
+
+    void cancelBuild()
+        throws TaskQueueManagerException;
+}

Added: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/utils/BuildContextToBuildDefinition.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/utils/BuildContextToBuildDefinition.java?rev=726638&view=auto
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/utils/BuildContextToBuildDefinition.java (added)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/utils/BuildContextToBuildDefinition.java Sun Dec 14 23:48:38 2008
@@ -0,0 +1,27 @@
+package org.apache.continuum.buildagent.utils;
+
+import org.apache.continuum.buildagent.buildcontext.BuildContext;
+import org.apache.maven.continuum.model.project.BuildDefinition;
+
+/**
+ * @author Maria Catherine Tan
+ */
+public class BuildContextToBuildDefinition
+{
+    public static BuildDefinition getBuildDefinition( BuildContext buildContext )
+    {
+        BuildDefinition buildDefinition = new BuildDefinition();
+
+        buildDefinition.setAlwaysBuild( true );
+
+        buildDefinition.setArguments( buildContext.getArguments() );
+
+        buildDefinition.setBuildFile( buildContext.getBuildFile() );
+
+        buildDefinition.setBuildFresh( buildContext.isBuildFresh() );
+
+        buildDefinition.setGoals( buildContext.getGoals() );
+
+        return buildDefinition;
+    }
+}

Added: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/utils/BuildContextToProject.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/utils/BuildContextToProject.java?rev=726638&view=auto
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/utils/BuildContextToProject.java (added)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/utils/BuildContextToProject.java Sun Dec 14 23:48:38 2008
@@ -0,0 +1,30 @@
+package org.apache.continuum.buildagent.utils;
+
+import org.apache.continuum.buildagent.buildcontext.BuildContext;
+import org.apache.maven.continuum.model.project.Project;
+
+/**
+ * @author Jan Stevens Ancajas
+ */
+public class BuildContextToProject
+{
+    public static Project getProject( BuildContext buildContext )
+    {
+        Project project = new Project();    
+
+        project.setId( buildContext.getProjectId() );
+
+        project.setScmUrl( buildContext.getScmUrl() );
+
+        project.setScmUsername( buildContext.getScmPassword());
+
+        project.setScmPassword( buildContext.getScmPassword() );
+
+        project.setExecutorId( buildContext.getExecutorId() );
+        
+        //rename ?
+        project.setName( "distributed-build-[projectId="+buildContext.getProjectId()+"]" );
+        
+        return project;
+    }
+}

Added: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/utils/ContinuumBuildAgentUtil.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/utils/ContinuumBuildAgentUtil.java?rev=726638&view=auto
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/utils/ContinuumBuildAgentUtil.java (added)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/utils/ContinuumBuildAgentUtil.java Sun Dec 14 23:48:38 2008
@@ -0,0 +1,253 @@
+package org.apache.continuum.buildagent.utils;
+
+import java.util.Map;
+
+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;
+
+public class ContinuumBuildAgentUtil
+{
+    public static final String KEY_PROJECT_ID = "project-id";
+
+    public static final String KEY_BUILD_DEFINITION_ID = "builddefinition-id";
+
+    public static final String KEY_TRIGGER = "trigger";
+
+    public static final String KEY_EXECUTOR_ID = "executor-id";
+
+    public static final String KEY_SCM_URL = "scm-url";
+
+    public static final String KEY_SCM_USERNAME = "scm-username";
+
+    public static final String KEY_SCM_PASSWORD = "scm-password";
+
+    public static final String KEY_BUILD_FILE = "build-file";
+
+    public static final String KEY_GOALS = "goals";
+
+    public static final String KEY_ARGUMENTS = "arguments";
+
+    public static final String KEY_BUILD_FRESH = "build-fresh";
+
+    public static final String KEY_BUILD_START = "build-start";
+
+    public static final String KEY_BUILD_END = "build-end";
+
+    public static final String KEY_BUILD_ERROR = "build-error";
+
+    public static final String KEY_BUILD_EXIT_CODE = "build-exit-code";
+
+    public static final String KEY_BUILD_STATE = "build-state";
+
+    public static final String KEY_SCM_STATE = "scm-state";
+
+    public static final String KEY_SCM_COMMAND_OUTPUT = "scm-command-output";
+
+    public static final String KEY_SCM_COMMAND_LINE = "scm-command-line";
+
+    public static final String KEY_SCM_PROVIDER_MESSAGE = "scm-provider-message";
+
+    public static final String KEY_SCM_EXCEPTION = "scm-exception";
+
+    public static final String KEY_PROJECT_GROUP_ID = "project-group-id";
+
+    public static final String KEY_SCM_ROOT_ADDRESS = "scm-root-address";
+
+    public static final String KEY_SCM_ROOT_STATE = "scm-root-state";
+
+    public static final String KEY_CHECKOUT_SCM_RESULT = "checkout-scm-result";
+
+    public static final String KEY_UPDATE_SCM_RESULT = "update-scm-result";
+
+    public static final String KEY_WORKING_DIRECTORY_EXISTS = "working-directory-exists";
+
+    public static final String KEY_PROJECT = "project";
+
+    public static final String KEY_BUILD_DEFINITION = "build-definition";
+
+    public static final String KEY_SCM_RESULT = "scm-result";
+
+    public static final String KEY_WORKING_DIRECTORY = "working-directory";
+
+    public static final String KEY_SCM_SUCCESS = "scm-success";
+
+    public static final String KEY_SCM_ERROR = "scm-error";
+
+    public static final String KEY_BUILD_RESULT = "build-result";
+
+    public static final String KEY_CANCELLED = "cancelled";
+
+    public static Integer getProjectId( Map context )
+    {
+        return getInteger( context, KEY_PROJECT_ID );
+    }
+
+    public static Integer getBuildDefinitionId( Map context )
+    {
+        return getInteger( context, KEY_BUILD_DEFINITION_ID );
+    }
+
+    public static String getBuildFile( Map context )
+    {
+        return getString( context, KEY_BUILD_FILE );
+    }
+
+    public static String getExecutorId( Map context )
+    {
+        return getString( context, KEY_EXECUTOR_ID );
+    }
+
+    public static String getGoals( Map context )
+    {
+        return getString( context, KEY_GOALS );
+    }
+
+    public static String getArguments( Map context )
+    {
+        return getString( context, KEY_ARGUMENTS );
+    }
+
+    public static String getScmUrl( Map context )
+    {
+        return getString( context, KEY_SCM_URL );
+    }
+
+    public static String getScmUsername( Map context )
+    {
+        return getString( context, KEY_SCM_USERNAME );
+    }
+
+    public static String getScmPassword( Map context )
+    {
+        return getString( context, KEY_SCM_PASSWORD );
+    }
+
+    public static boolean isBuildFresh( Map context )
+    {
+        return getBoolean( context, KEY_BUILD_FRESH );
+    }
+
+    public static int getProjectGroupId( Map context )
+    {
+        return getInteger( context, KEY_PROJECT_GROUP_ID );
+    }
+
+    public static String getScmRootAddress( Map context )
+    {
+        return getString( context, KEY_SCM_ROOT_ADDRESS );
+    }
+
+    public static int getScmRootState( Map context )
+    {
+        return getInteger( context, KEY_SCM_ROOT_STATE );
+    }
+
+    public static Project getProject( Map context )
+    {
+        return (Project) getObject( context, KEY_PROJECT );
+    }
+
+    public static BuildDefinition getBuildDefinition( Map context )
+    {
+        return (BuildDefinition) getObject( context, KEY_BUILD_DEFINITION );
+    }
+
+    public static ScmResult getCheckoutScmResult( Map context, Object defaultValue )
+    {
+        return (ScmResult) getObject( context, KEY_CHECKOUT_SCM_RESULT, defaultValue );
+    }
+
+    public static ScmResult getUpdateScmResult( Map context, Object defaultValue )
+    {
+        return (ScmResult) getObject( context, KEY_UPDATE_SCM_RESULT, defaultValue );
+    }
+
+    public static ScmResult getScmResult( Map context, Object defaultValue )
+    {
+        return (ScmResult) getObject( context, KEY_SCM_RESULT );
+    }
+
+    public static int getTrigger( Map context )
+    {
+        return (Integer) getObject( context, KEY_TRIGGER );
+    }
+
+    public static BuildResult getBuildResult( Map context, Object defaultValue )
+    {
+        return (BuildResult) getObject( context, KEY_BUILD_RESULT );
+    }
+
+    public static boolean isCancelled( Map context )
+    {
+        return (Boolean) getObject( context, KEY_CANCELLED );
+    }
+
+    // ----------------------------------------------------------------------
+    //
+    // ----------------------------------------------------------------------
+
+    public static String getString( Map context, String key )
+    {
+        return (String) getObject( context, key );
+    }
+
+    public 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();
+    }    
+
+    public 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;
+    }
+}
\ No newline at end of file

Added: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/resources/META-INF/plexus/components.xml?rev=726638&view=auto
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/resources/META-INF/plexus/components.xml (added)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/resources/META-INF/plexus/components.xml Sun Dec 14 23:48:38 2008
@@ -0,0 +1,49 @@
+<!--
+  ~ 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.
+  -->
+
+<component-set>
+  <components>
+    <component>
+      <role>org.codehaus.plexus.taskqueue.TaskQueue</role>
+      <role-hint>prepare-build-agent</role-hint>
+      <implementation>org.codehaus.plexus.taskqueue.DefaultTaskQueue</implementation>
+      <lifecycle-handler>plexus-configurable</lifecycle-handler>
+    </component>
+
+    <component>
+      <role>org.codehaus.plexus.taskqueue.execution.TaskQueueExecutor</role>
+      <role-hint>prepare-build-agent</role-hint>
+      <implementation>org.codehaus.plexus.taskqueue.execution.ThreadedTaskQueueExecutor</implementation>
+      <instantiation-strategy>singleton</instantiation-strategy>
+      <requirements>
+        <requirement>
+          <role>org.codehaus.plexus.taskqueue.execution.TaskExecutor</role>
+          <role-hint>prepare-build-agent</role-hint>
+        </requirement>
+        <requirement>
+          <role>org.codehaus.plexus.taskqueue.TaskQueue</role>
+          <role-hint>prepare-build-agent</role-hint>
+        </requirement>
+      </requirements>
+      <configuration>
+        <name>prepare-build-agent</name>
+      </configuration>
+    </component>
+  </components>
+</component-set>
\ No newline at end of file

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=726638&r1=726637&r2=726638&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 Sun Dec 14 23:48:38 2008
@@ -27,112 +27,11 @@
 
   <groupId>org.apache.continuum</groupId>
   <artifactId>continuum-buildagent</artifactId>
-  <packaging>jar</packaging>
+  <packaging>pom</packaging>
   <name>Continuum :: Distributed Build :: Build Agent</name>
   
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.codehaus.modello</groupId>
-        <artifactId>modello-maven-plugin</artifactId>
-        <configuration>
-          <models>
-            <model>src/main/mdo/continuum-buildagent.xml</model>
-          </models>
-          <version>1.0.0</version>
-        </configuration>
-        <executions>
-          <execution>
-            <id>continuum-modello</id>
-            <phase>generate-sources</phase>
-            <goals>
-              <goal>java</goal>
-              <goal>xpp3-reader</goal>
-              <goal>xpp3-writer</goal>
-            </goals>
-          </execution>
-          <execution>
-            <id>site-docs</id>
-            <phase>pre-site</phase>
-            <goals>
-              <goal>xdoc</goal>
-              <goal>xsd</goal>
-            </goals>
-          </execution>
-          <execution>
-            <id>generate-xsd</id>
-            <phase>generate-resources</phase>
-            <goals>
-              <goal>xsd</goal>
-            </goals>
-            <configuration>
-              <outputDirectory>${project.build.outputDirectory}/META-INF/continuum/xsd</outputDirectory>
-            </configuration>
-          </execution>                    
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-  <dependencies>
-    <dependency>
-      <groupId>org.apache.continuum</groupId>
-      <artifactId>continuum-api</artifactId>
-      <exclusions>
-        <exclusion>
-          <groupId>org.apache.archiva</groupId>
-          <artifactId>archiva-common</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>org.apache.archiva</groupId>
-          <artifactId>archiva-repository-layer</artifactId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.continuum</groupId>
-      <artifactId>continuum-commons</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.continuum</groupId>
-      <artifactId>continuum-scm</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>net.java.dev.stax-utils</groupId>
-      <artifactId>stax-utils</artifactId>
-      <version>20060502</version>
-      <exclusions>
-        <exclusion>
-          <groupId>com.bea.xml</groupId>
-          <artifactId>jsr173-ri</artifactId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-    <dependency>
-      <groupId>stax</groupId>
-      <artifactId>stax-api</artifactId>
-      <version>1.0.1</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.maven.shared</groupId>
-      <artifactId>file-management</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.codehaus.plexus</groupId>
-      <artifactId>plexus-utils</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.springframework</groupId>
-      <artifactId>spring-core</artifactId>
-      <version>${spring.version}</version>
-    </dependency> 
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-api</artifactId>
-    </dependency>      
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-log4j12</artifactId>
-      <scope>test</scope>
-    </dependency>
-  </dependencies>
+  <modules>
+    <module>continuum-buildagent-api</module>
+    <module>continuum-buildagent-core</module>
+  </modules>
 </project>

Modified: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-common/pom.xml
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-common/pom.xml?rev=726638&r1=726637&r2=726638&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-common/pom.xml (original)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-common/pom.xml Sun Dec 14 23:48:38 2008
@@ -39,11 +39,6 @@
       <version>0.8.2</version>
     </dependency>
     <dependency>
-      <groupId>org.apache.continuum</groupId>
-      <artifactId>continuum-buildagent</artifactId>
-      <version>1.3.1-SNAPSHOT</version>
-    </dependency>
-    <dependency>
       <groupId>org.slf4j</groupId>
       <artifactId>slf4j-api</artifactId>
     </dependency>

Modified: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-common/src/main/java/org/apache/continuum/distributed/transport/SlaveBuildAgentTransportService.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-common/src/main/java/org/apache/continuum/distributed/transport/SlaveBuildAgentTransportService.java?rev=726638&r1=726637&r2=726638&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-common/src/main/java/org/apache/continuum/distributed/transport/SlaveBuildAgentTransportService.java (original)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-common/src/main/java/org/apache/continuum/distributed/transport/SlaveBuildAgentTransportService.java Sun Dec 14 23:48:38 2008
@@ -3,8 +3,6 @@
 import java.util.List;
 import java.util.Map;
 
-import org.apache.continuum.buildagent.model.Installation;
-
 import com.atlassian.xmlrpc.ServiceObject;
 
 /*
@@ -38,7 +36,7 @@
     
     public Integer getProjectCurrentlyBuilding() throws Exception;
     
-    public List<Installation> getAvailableInstallations() throws Exception;
+    public List<Object> getAvailableInstallations() throws Exception;
     
     public Boolean isBusy() throws Exception;
     

Modified: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-master/pom.xml
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-master/pom.xml?rev=726638&r1=726637&r2=726638&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-master/pom.xml (original)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-master/pom.xml Sun Dec 14 23:48:38 2008
@@ -32,5 +32,19 @@
       <groupId>org.apache.continuum</groupId>
       <artifactId>continuum-distributed-build-transport-common</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.apache.continuum</groupId>
+      <artifactId>continuum-api</artifactId>
+      <exclusions>
+        <exclusion>
+          <groupId>org.apache.archiva</groupId>
+          <artifactId>archiva-common</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.apache.archiva</groupId>
+          <artifactId>archiva-repository-layer</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
   </dependencies>
 </project>

Modified: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-master/src/main/java/org/apache/continuum/distributed/transport/master/DefaultMasterBuildAgentTransportService.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-master/src/main/java/org/apache/continuum/distributed/transport/master/DefaultMasterBuildAgentTransportService.java?rev=726638&r1=726637&r2=726638&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-master/src/main/java/org/apache/continuum/distributed/transport/master/DefaultMasterBuildAgentTransportService.java (original)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-master/src/main/java/org/apache/continuum/distributed/transport/master/DefaultMasterBuildAgentTransportService.java Sun Dec 14 23:48:38 2008
@@ -21,6 +21,7 @@
 
 import java.util.Map;
 
+import org.apache.continuum.builder.distributed.manager.DistributedBuildManager;
 import org.apache.continuum.distributed.transport.MasterBuildAgentTransportService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -33,11 +34,16 @@
 {
     private Logger log = LoggerFactory.getLogger( this.getClass() );
 
+    /**
+     * @plexus.requirement
+     */
+    private DistributedBuildManager distributedBuildManager;
+
     public Boolean returnBuildResult( Map buildResult )
         throws Exception
     {
         log.info( "Build result returned." );
-        
+        distributedBuildManager.updateBuildResult( buildResult );
         return Boolean.TRUE;
     }
 
@@ -45,7 +51,7 @@
         throws Exception
     {
         log.info( "SCM result returned." );
-        
+        distributedBuildManager.updateScmResult( scmResult );
         return Boolean.TRUE;
     }
 
@@ -56,4 +62,6 @@
         
         return Boolean.TRUE;
     }
+    
+    // TODO: add prepareBuildFinished() method
 }

Modified: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-master/src/main/java/org/apache/continuum/distributed/transport/master/ProxySlaveAgentTransportService.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-master/src/main/java/org/apache/continuum/distributed/transport/master/ProxySlaveAgentTransportService.java?rev=726638&r1=726637&r2=726638&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-master/src/main/java/org/apache/continuum/distributed/transport/master/ProxySlaveAgentTransportService.java (original)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-master/src/main/java/org/apache/continuum/distributed/transport/master/ProxySlaveAgentTransportService.java Sun Dec 14 23:48:38 2008
@@ -23,7 +23,6 @@
 import java.util.List;
 import java.util.Map;
 
-import org.apache.continuum.buildagent.model.Installation;
 import org.apache.continuum.distributed.transport.SlaveBuildAgentTransportService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -85,10 +84,10 @@
         return result;
     }
 
-    public List<Installation> getAvailableInstallations()
+    public List<Object> getAvailableInstallations()
         throws Exception
     {
-        List<Installation> installations = null;
+        List<Object> installations = null;
         
         try
         {

Modified: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-slave/pom.xml
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-slave/pom.xml?rev=726638&r1=726637&r2=726638&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-slave/pom.xml (original)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-slave/pom.xml Sun Dec 14 23:48:38 2008
@@ -31,7 +31,10 @@
     <dependency>
       <groupId>org.apache.continuum</groupId>
       <artifactId>continuum-distributed-build-transport-common</artifactId>
-      <version>1.3.1-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.continuum</groupId>
+      <artifactId>continuum-buildagent-api</artifactId>
     </dependency>
   </dependencies>
 </project>

Modified: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-slave/src/main/java/org/apache/continuum/distributed/transport/slave/DefaultSlaveBuildAgentTransportService.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-slave/src/main/java/org/apache/continuum/distributed/transport/slave/DefaultSlaveBuildAgentTransportService.java?rev=726638&r1=726637&r2=726638&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-slave/src/main/java/org/apache/continuum/distributed/transport/slave/DefaultSlaveBuildAgentTransportService.java (original)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-slave/src/main/java/org/apache/continuum/distributed/transport/slave/DefaultSlaveBuildAgentTransportService.java Sun Dec 14 23:48:38 2008
@@ -64,9 +64,12 @@
         return result;
     }
 
-    public List<Installation> getAvailableInstallations()
+    // TODO: fix this
+    public List<Object> getAvailableInstallations()
         throws Exception
     {
+        List<Object> installationsObj = null;
+
         List<Installation> installations = null;
         
         try
@@ -78,8 +81,8 @@
         {
             log.error( "Failed to get available installations.", e );
         }
-        
-        return installations;
+
+        return installationsObj;
     }
 
     public Map getBuildResult( int projectId )

Modified: continuum/branches/continuum-distributed-builds/pom.xml
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/pom.xml?rev=726638&r1=726637&r2=726638&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/pom.xml (original)
+++ continuum/branches/continuum-distributed-builds/pom.xml Sun Dec 14 23:48:38 2008
@@ -572,6 +572,16 @@
       </dependency>
       <dependency>
         <groupId>org.apache.continuum</groupId>
+        <artifactId>continuum-buildagent-api</artifactId>
+        <version>${pom.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.continuum</groupId>
+        <artifactId>continuum-buildagent-core</artifactId>
+        <version>${pom.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.continuum</groupId>
         <artifactId>continuum-distributed-build-transport-common</artifactId>
         <version>${pom.version}</version>
       </dependency>



Mime
View raw message