continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r751433 [3/4] - in /continuum/trunk: continuum-api/ continuum-api/src/main/java/org/apache/continuum/release/ continuum-api/src/main/java/org/apache/continuum/release/distributed/ continuum-api/src/main/java/org/apache/continuum/release/dis...
Date Sun, 08 Mar 2009 14:41:35 GMT
Added: continuum/trunk/continuum-core/src/main/java/org/apache/continuum/release/distributed/manager/DefaultDistributedReleaseManager.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/continuum/release/distributed/manager/DefaultDistributedReleaseManager.java?rev=751433&view=auto
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/continuum/release/distributed/manager/DefaultDistributedReleaseManager.java (added)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/continuum/release/distributed/manager/DefaultDistributedReleaseManager.java Sun Mar  8 14:41:33 2009
@@ -0,0 +1,598 @@
+package org.apache.continuum.release.distributed.manager;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.continuum.dao.BuildResultDao;
+import org.apache.continuum.distributed.transport.slave.SlaveBuildAgentTransportClient;
+import org.apache.continuum.model.repository.LocalRepository;
+import org.apache.continuum.release.distributed.DistributedReleaseUtil;
+import org.apache.continuum.release.model.PreparedRelease;
+import org.apache.continuum.release.model.PreparedReleaseModel;
+import org.apache.continuum.release.model.io.xpp3.ContinuumPrepareReleasesModelXpp3Reader;
+import org.apache.continuum.release.model.io.xpp3.ContinuumPrepareReleasesModelXpp3Writer;
+import org.apache.maven.continuum.installation.InstallationService;
+import org.apache.maven.continuum.model.project.BuildResult;
+import org.apache.maven.continuum.model.project.Project;
+import org.apache.maven.continuum.release.ContinuumReleaseException;
+import org.apache.maven.shared.release.ReleaseResult;
+import org.codehaus.plexus.util.StringUtils;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @plexus.component role="org.apache.continuum.release.distributed.manager.DistributedReleaseManager"
+ */
+public class DefaultDistributedReleaseManager
+    implements DistributedReleaseManager
+{
+    private Logger log = LoggerFactory.getLogger( this.getClass() );
+
+    public final String PREPARED_RELEASES_FILENAME = "prepared-releases.xml";
+
+    /**
+     * @plexus.requirement
+     */
+    BuildResultDao buildResultDao;
+
+    /**
+     * @plexus.requirement
+     */
+    InstallationService installationService;
+    
+    public Map getReleasePluginParameters( int projectId, String pomFilename )
+        throws ContinuumReleaseException
+    {
+        BuildResult buildResult = buildResultDao.getLatestBuildResultForProject( projectId );
+
+        String buildAgentUrl = buildResult.getBuildUrl();
+
+        try
+        {
+            SlaveBuildAgentTransportClient client = new SlaveBuildAgentTransportClient( new URL( buildAgentUrl ) );
+            return client.getReleasePluginParameters( projectId, pomFilename );
+        }
+        catch ( MalformedURLException e )
+        {
+           log.error( "Invalid build agent url " + buildAgentUrl ); 
+           throw new ContinuumReleaseException( "Invalid build agent url " + buildAgentUrl );
+        }
+        catch ( Exception e )
+        {
+            log.error( "Failed to retrieve release plugin parameters", e );
+            throw new ContinuumReleaseException( "Failed to retrieve release plugin parameters", e );
+        }
+    }
+
+    public List<Map<String, String>> processProject( int projectId, String pomFilename, boolean autoVersionSubmodules )
+        throws ContinuumReleaseException
+    {
+        BuildResult buildResult = buildResultDao.getLatestBuildResultForProject( projectId );
+
+        String buildAgentUrl = buildResult.getBuildUrl();
+
+        try
+        {
+            SlaveBuildAgentTransportClient client = new SlaveBuildAgentTransportClient( new URL( buildAgentUrl ) );
+            return client.processProject( projectId, pomFilename, autoVersionSubmodules );
+        }
+        catch ( MalformedURLException e )
+        {
+            log.error( "Invalid build agent url " + buildAgentUrl );
+            throw new ContinuumReleaseException( "Invalid build agent url " + buildAgentUrl );
+        }
+        catch ( Exception e )
+        {
+            log.error( "Failed to process project for releasing", e );
+            throw new ContinuumReleaseException( "Failed to process project for releasing", e );
+        }
+    }
+
+    public String releasePrepare( Project project, Properties releaseProperties, Map<String, String> releaseVersion, 
+                                  Map<String, String> developmentVersion, Map<String, String> environments )
+        throws ContinuumReleaseException
+    {
+        BuildResult buildResult = buildResultDao.getLatestBuildResultForProject( project.getId() );
+
+        String buildAgentUrl = buildResult.getBuildUrl();
+
+        if ( StringUtils.isBlank( buildAgentUrl ) )
+        {
+            return null;
+        }
+
+        try
+        {
+            SlaveBuildAgentTransportClient client = new SlaveBuildAgentTransportClient( new URL( buildAgentUrl ) );
+            String releaseId = client.releasePrepare( createProjectMap( project ), createPropertiesMap( releaseProperties ),
+                                                      releaseVersion, developmentVersion, environments );
+
+            addReleasePrepare( releaseId, buildAgentUrl );
+
+            return releaseId;
+        }
+        catch ( MalformedURLException e )
+        {
+            log.error( "Invalid build agent url " + buildAgentUrl );
+            throw new ContinuumReleaseException( "Invalid build agent url " + buildAgentUrl );
+        }
+        catch ( Exception e )
+        {
+            log.error( "Failed to prepare release project " + project.getName(), e );
+            throw new ContinuumReleaseException( "Failed to prepare release project " + project.getName(), e );
+        }
+    }
+
+    public ReleaseResult getReleaseResult( String releaseId )
+        throws ContinuumReleaseException
+    {
+        String buildAgentUrl = getBuildAgentUrl( releaseId );
+
+        if ( StringUtils.isBlank( buildAgentUrl ) )
+        {
+            return null;
+        }
+
+        try
+        {
+            SlaveBuildAgentTransportClient client = new SlaveBuildAgentTransportClient( new URL( buildAgentUrl ) );
+            Map result = client.getReleaseResult( releaseId );
+
+            ReleaseResult releaseResult = new ReleaseResult();
+            releaseResult.setStartTime( DistributedReleaseUtil.getStartTime( result ) );
+            releaseResult.setEndTime( DistributedReleaseUtil.getEndTime( result ) );
+            releaseResult.setResultCode( DistributedReleaseUtil.getReleaseResultCode( result ) );
+            releaseResult.getOutputBuffer().append( DistributedReleaseUtil.getReleaseOutput( result ) );
+
+            return releaseResult;
+        }
+        catch ( MalformedURLException e )
+        {
+            log.error( "Invalid build agent url " + buildAgentUrl );
+            throw new ContinuumReleaseException( "Invalid build agent url " + buildAgentUrl );
+        }
+        catch ( Exception e )
+        {
+            log.error( "Failed to get release result of " + releaseId, e );
+            throw new ContinuumReleaseException( "Failed to get release result of " + releaseId, e );
+        }
+    }
+
+    public Map getListener( String releaseId )
+        throws ContinuumReleaseException
+    {
+        String buildAgentUrl = getBuildAgentUrl( releaseId );
+
+        if ( StringUtils.isBlank( buildAgentUrl ) )
+        {
+            return null;
+        }
+
+        try
+        {
+            SlaveBuildAgentTransportClient client = new SlaveBuildAgentTransportClient( new URL( buildAgentUrl ) );
+            return client.getListener( releaseId );
+        }
+        catch ( MalformedURLException e )
+        {
+            log.error( "Invalid build agent url " + buildAgentUrl );
+            throw new ContinuumReleaseException( "Invalid build agent url " + buildAgentUrl );
+        }
+        catch ( Exception e )
+        {
+            log.error( "Failed to get listener for " + releaseId, e );
+            throw new ContinuumReleaseException( "Failed to get listener for " + releaseId, e );
+        }
+    }
+
+    public void removeListener( String releaseId )
+        throws ContinuumReleaseException
+    {
+        String buildAgentUrl = getBuildAgentUrl( releaseId );
+
+        if ( StringUtils.isBlank( buildAgentUrl ) )
+        {
+            return;
+        }
+
+        try
+        {
+            SlaveBuildAgentTransportClient client = new SlaveBuildAgentTransportClient( new URL( buildAgentUrl ) );
+            client.removeListener( releaseId );
+        }
+        catch ( MalformedURLException e )
+        {
+            log.error( "Invalid build agent url " + buildAgentUrl );
+            throw new ContinuumReleaseException( "Invalid build agent url " + buildAgentUrl );
+        }
+        catch ( Exception e )
+        {
+            log.error( "Failed to remove listener of " + releaseId, e );
+            throw new ContinuumReleaseException( "Failed to remove listener of " + releaseId, e );
+        }
+    }
+
+    public String getPreparedReleaseName( String releaseId )
+        throws ContinuumReleaseException
+    {
+        String buildAgentUrl = getBuildAgentUrl( releaseId );
+
+        if ( StringUtils.isBlank( buildAgentUrl ) )
+        {
+            log.info( "Unable to get prepared release name because no build agent found for " + releaseId );
+            return null;
+        }
+
+        try
+        {
+            SlaveBuildAgentTransportClient client = new SlaveBuildAgentTransportClient( new URL( buildAgentUrl ) );
+            return client.getPreparedReleaseName( releaseId );
+        }
+        catch ( MalformedURLException e )
+        {
+            log.error( "Invalid build agent url " + buildAgentUrl );
+            throw new ContinuumReleaseException( "Invalid build agent url " + buildAgentUrl );
+        }
+        catch ( Exception e )
+        {
+            log.error( "Failed to get prepared release name of " + releaseId, e );
+            throw new ContinuumReleaseException( "Failed to get prepared release name of " + releaseId, e );
+        }
+    }
+
+    public void releasePerform( String releaseId, String goals, String arguments, boolean useReleaseProfile, LocalRepository repository )
+        throws ContinuumReleaseException
+    {
+        String buildAgentUrl = getBuildAgentUrl( releaseId );
+
+        if ( StringUtils.isBlank( buildAgentUrl ) )
+        {
+            log.error( "Unable to perform release because no build agent found for " + releaseId );
+            return;
+        }
+
+        if ( goals == null )
+        {
+            goals = "";
+        }
+
+        if ( arguments == null )
+        {
+            arguments = "";
+        }
+
+        Map map = new HashMap();
+
+        if ( repository != null )
+        {
+            map.put( DistributedReleaseUtil.KEY_LOCAL_REPOSITORY, repository.getLocation() );
+            map.put( DistributedReleaseUtil.KEY_LOCAL_REPOSITORY_NAME, repository.getName() );
+            map.put( DistributedReleaseUtil.KEY_LOCAL_REPOSITORY_LAYOUT, repository.getLayout() );
+        }
+        
+        try
+        {
+            SlaveBuildAgentTransportClient client = new SlaveBuildAgentTransportClient( new URL( buildAgentUrl ) );
+            client.releasePerform( releaseId, goals, arguments, useReleaseProfile, map );
+        }
+        catch ( MalformedURLException e )
+        {
+            log.error( "Invalid build agent url " + buildAgentUrl );
+            throw new ContinuumReleaseException( "Invalid build agent url " + buildAgentUrl );
+        }
+        catch ( Exception e )
+        {
+            log.error( "Failed to perform release of " + releaseId, e );
+            throw new ContinuumReleaseException( "Failed to perform release of " + releaseId, e );
+        }
+    }
+
+    public void releasePerformFromScm( int projectId, String goals, String arguments, boolean useReleaseProfile, LocalRepository repository, 
+                                       String scmUrl, String scmUsername, String scmPassword, String scmTag, String scmTagBase, Map environments )
+        throws ContinuumReleaseException
+    {
+        BuildResult buildResult = buildResultDao.getLatestBuildResultForProject( projectId );
+
+        String buildAgentUrl = buildResult.getBuildUrl();
+
+        if ( StringUtils.isBlank( buildAgentUrl ) )
+        {
+            log.error( "Unable to perform release because no build agent found" );
+            return;
+        }
+        
+        if ( goals == null )
+        {
+            goals = "";
+        }
+
+        if ( arguments == null )
+        {
+            arguments = "";
+        }
+
+        Map map = new HashMap();
+
+        if ( repository != null )
+        {
+            map.put( DistributedReleaseUtil.KEY_LOCAL_REPOSITORY, repository.getLocation() );
+            map.put( DistributedReleaseUtil.KEY_LOCAL_REPOSITORY_NAME, repository.getName() );
+            map.put( DistributedReleaseUtil.KEY_LOCAL_REPOSITORY_LAYOUT, repository.getLayout() );
+        }
+
+        try
+        {
+            SlaveBuildAgentTransportClient client = new SlaveBuildAgentTransportClient( new URL( buildAgentUrl ) );
+            client.releasePerformFromScm( goals, arguments, useReleaseProfile, map, scmUrl, scmUsername, scmPassword,
+                                          scmTag, scmTagBase, environments );
+        }
+        catch ( MalformedURLException e )
+        {
+            log.error( "Invalid build agent url " + buildAgentUrl );
+            throw new ContinuumReleaseException( "Invalid build agent url " + buildAgentUrl );
+        }
+        catch ( Exception e )
+        {
+            log.error( "Failed to perform release", e );
+            throw new ContinuumReleaseException( "Failed to perform release", e );
+        }
+    }
+
+    public void releaseRollback( String releaseId, int projectId )
+        throws ContinuumReleaseException
+    {
+        //TODO
+    }
+
+    public String releaseCleanup( String releaseId )
+        throws ContinuumReleaseException
+    {
+        String buildAgentUrl = getBuildAgentUrl( releaseId );
+
+        if ( StringUtils.isBlank( buildAgentUrl ) )
+        {
+            log.info( "Unable to cleanup release for " + releaseId );
+            return null;
+        }
+
+        try
+        {
+            SlaveBuildAgentTransportClient client = new SlaveBuildAgentTransportClient( new URL( buildAgentUrl ) );
+            return client.releaseCleanup( releaseId );
+        }
+        catch ( MalformedURLException e )
+        {
+            log.error( "Invalid build agent url " + buildAgentUrl );
+            throw new ContinuumReleaseException( "Invalid build agent url " + buildAgentUrl );
+        }
+        catch ( Exception e )
+        {
+            log.error( "Failed to get prepared release name of " + releaseId, e );
+            throw new ContinuumReleaseException( "Failed to get prepared release name of " + releaseId, e );
+        }
+    }
+
+    private Map createProjectMap( Project project )
+    {
+        Map map = new HashMap();
+
+        map.put( DistributedReleaseUtil.KEY_PROJECT_ID, new Integer( project.getId() ) );
+        map.put( DistributedReleaseUtil.KEY_GROUP_ID, project.getGroupId() );
+        map.put( DistributedReleaseUtil.KEY_ARTIFACT_ID, project.getArtifactId() );
+        map.put( DistributedReleaseUtil.KEY_SCM_URL, project.getScmUrl() );
+        if ( project.getProjectGroup().getLocalRepository() != null )
+        {
+            map.put( DistributedReleaseUtil.KEY_LOCAL_REPOSITORY, project.getProjectGroup().getLocalRepository().getLocation() );
+        }
+
+        return map;
+    }
+
+    private Map createPropertiesMap( Properties properties )
+    {
+        Map map = new HashMap();
+
+        String prop = properties.getProperty( "username" );
+        if ( prop != null )
+        {
+            map.put( DistributedReleaseUtil.KEY_SCM_USERNAME, prop );
+        }
+
+        prop = properties.getProperty( "password" );
+        if ( prop != null )
+        {
+            map.put( DistributedReleaseUtil.KEY_SCM_PASSWORD, prop );
+        }
+
+        prop = properties.getProperty( "tagBase" );
+        if ( prop != null )
+        {
+            map.put( DistributedReleaseUtil.KEY_SCM_TAGBASE, prop );
+        }
+
+        prop = properties.getProperty( "commentPrefix" );
+        if ( prop != null )
+        {
+            map.put( DistributedReleaseUtil.KEY_SCM_COMMENT_PREFIX, prop );
+        }
+
+        prop = properties.getProperty( "tag" );
+        if ( prop != null )
+        {
+            map.put( DistributedReleaseUtil.KEY_SCM_TAG, prop );
+        }
+
+        prop = properties.getProperty( "prepareGoals" );
+        if ( prop != null )
+        {
+            map.put( DistributedReleaseUtil.KEY_PREPARE_GOALS, prop );
+        }
+
+        prop = properties.getProperty( "arguments" );
+        if ( prop != null )
+        {
+            map.put( DistributedReleaseUtil.KEY_ARGUMENTS, prop );
+        }
+
+        prop = properties.getProperty( "useEditMode" );
+        if ( prop != null )
+        {
+            map.put( DistributedReleaseUtil.KEY_USE_EDIT_MODE, prop );
+        }
+
+        prop = properties.getProperty( "addSchema" );
+        if ( prop != null )
+        {
+            map.put( DistributedReleaseUtil.KEY_ADD_SCHEMA, prop );
+        }
+
+        prop = properties.getProperty( "autoVersionSubmodules" );
+        if ( prop != null )
+        {
+            map.put( DistributedReleaseUtil.KEY_AUTO_VERSION_SUBMODULES, prop );
+        }
+
+        return map;
+    }
+
+    private List<PreparedRelease> getPreparedReleases()
+        throws ContinuumReleaseException
+    {
+        File file = getPreparedReleasesFile();
+
+        if ( file.exists() )
+        {
+            try
+            {
+                ContinuumPrepareReleasesModelXpp3Reader reader = new ContinuumPrepareReleasesModelXpp3Reader();
+                PreparedReleaseModel model = reader.read( new InputStreamReader( new FileInputStream( file ) ) );
+    
+                return model.getPreparedReleases();
+            }
+            catch ( IOException e )
+            {
+                log.error( e.getMessage(), e );
+                throw new ContinuumReleaseException( "Unable to get prepared releases", e );
+            }
+            catch ( XmlPullParserException e )
+            {
+                log.error( e.getMessage(), e );
+                throw new ContinuumReleaseException( e.getMessage(), e );
+            }
+        }
+
+        return null;
+    }
+
+    private void addReleasePrepare( String releaseId, String buildAgentUrl )
+        throws ContinuumReleaseException
+    {
+        File file = getPreparedReleasesFile();
+
+        if ( !file.exists() )
+        {
+            file.getParentFile().mkdirs();
+        }
+
+        PreparedRelease release = new PreparedRelease();
+        release.setReleaseId( releaseId );
+        release.setBuildAgentUrl( buildAgentUrl );
+
+        List<PreparedRelease> preparedReleases = getPreparedReleases();
+
+        if ( preparedReleases == null )
+        {
+            preparedReleases = new ArrayList<PreparedRelease>();
+        }
+        else 
+        {
+            boolean found = false;
+
+            for ( PreparedRelease preparedRelease : preparedReleases )
+            {
+                if ( preparedRelease.getReleaseId().equals( release.getReleaseId() ) )
+                {
+                    preparedRelease.setBuildAgentUrl( release.getBuildAgentUrl() );
+                    found = true;
+                }
+            }
+            
+            if ( !found )
+            {
+                preparedReleases.add( release );
+            }
+        }
+
+        PreparedReleaseModel model = new PreparedReleaseModel();
+        model.setPreparedReleases( preparedReleases );
+
+        try
+        {
+            ContinuumPrepareReleasesModelXpp3Writer writer = new ContinuumPrepareReleasesModelXpp3Writer();
+            FileWriter fileWriter = new FileWriter( file );
+            writer.write( fileWriter, model );
+        }
+        catch ( IOException e )
+        {
+            throw new ContinuumReleaseException( "Failed to write prepared releases in file", e );
+        }
+    }
+
+    private void removePrepareRelease( String releaseId )
+        throws ContinuumReleaseException
+    {
+        List<PreparedRelease> preparedReleases = getPreparedReleases();
+    }
+
+    private String getBuildAgentUrl( String releaseId )
+        throws ContinuumReleaseException
+    {
+        List<PreparedRelease> preparedReleases = getPreparedReleases();
+        
+        for ( PreparedRelease preparedRelease : preparedReleases )
+        {
+            if ( preparedRelease.getReleaseId().equals( releaseId ) )
+            {
+                return preparedRelease.getBuildAgentUrl();
+            }
+        }
+
+        return null;
+    }
+
+    private File getPreparedReleasesFile()
+    {
+        return new File( System.getProperty( "appserver.base" ) + File.separator + "conf" + File.separator
+                         + PREPARED_RELEASES_FILENAME );
+    }
+}
\ No newline at end of file

Propchange: continuum/trunk/continuum-core/src/main/java/org/apache/continuum/release/distributed/manager/DefaultDistributedReleaseManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/trunk/continuum-core/src/main/java/org/apache/continuum/release/distributed/manager/DefaultDistributedReleaseManager.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java?rev=751433&r1=751432&r2=751433&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java (original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java Sun Mar  8 14:41:33 2009
@@ -52,6 +52,7 @@
 import org.apache.continuum.model.release.ContinuumReleaseResult;
 import org.apache.continuum.purge.ContinuumPurgeManager;
 import org.apache.continuum.purge.PurgeConfigurationService;
+import org.apache.continuum.release.distributed.manager.DistributedReleaseManager;
 import org.apache.continuum.repository.RepositoryService;
 import org.apache.continuum.taskqueue.PrepareBuildProjectsTask;
 import org.apache.continuum.taskqueue.manager.TaskQueueManager;
@@ -270,6 +271,11 @@
      */
     private DistributedBuildManager distributedBuildManager;
 
+    /**
+     * @plexus.requirement
+     */
+    private DistributedReleaseManager distributedReleaseManager;
+
     public DefaultContinuum()
     {
         Runtime.getRuntime().addShutdownHook( new Thread()
@@ -328,6 +334,11 @@
         return parallelBuildsManager;
     }
 
+    public DistributedReleaseManager getDistributedReleaseManager()
+    {
+        return distributedReleaseManager;
+    }
+
     // ----------------------------------------------------------------------
     // Project Groups
     // ----------------------------------------------------------------------
@@ -1476,7 +1487,10 @@
 
         executeAction( "store-project", context );
 
-        executeAction( "add-project-to-checkout-queue", context );
+        if ( !configurationService.isDistributedBuildEnabled() )
+        {
+            executeAction( "add-project-to-checkout-queue", context );
+        }
 
         executeAction( "add-assignable-roles", context );
 
@@ -1727,7 +1741,10 @@
                 // used by BuildManager to determine on which build queue will the project be put
                 context.put( AbstractContinuumAction.KEY_BUILD_DEFINITION, defaultBuildDefinition );
 
-                executeAction( "add-project-to-checkout-queue", context );
+                if ( !configurationService.isDistributedBuildEnabled() )
+                {
+                    executeAction( "add-project-to-checkout-queue", context );
+                }
 
             }
         }

Modified: continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutor.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutor.java?rev=751433&r1=751432&r2=751433&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutor.java (original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutor.java Sun Mar  8 14:41:33 2009
@@ -120,14 +120,14 @@
                 log.info( "Initializing prepare build" );
                 context = initializeContext( projectId, buildDefinitionId );
 
+                log.info( "Starting prepare build of project: " + AbstractContinuumAction.getProject( context ).getName() );
+                startPrepareBuild( context );
+
                 if ( !checkProjectScmRoot( context ) )
                 {
                     break;
                 }
 
-                log.info( "Starting prepare build of project: " + AbstractContinuumAction.getProject( context ).getName() );
-                startPrepareBuild( context );
-
                 try
                 {
                     if ( AbstractContinuumAction.getBuildDefinition( context ).isBuildFresh() )

Modified: continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-api/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportService.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-api/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportService.java?rev=751433&r1=751432&r2=751433&view=diff
==============================================================================
--- continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-api/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportService.java (original)
+++ continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-api/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportService.java Sun Mar  8 14:41:33 2009
@@ -47,4 +47,35 @@
 
     public String getProjectFileContent( int projectId, String directory, String filename )
         throws Exception;
+
+    public Map getReleasePluginParameters( int projectId, String pomFilename )
+        throws Exception;
+
+    public List<Map<String, String>> processProject( int projectId, String pomFilename, boolean autoVersionSubmodules )
+        throws Exception;
+
+    public String releasePrepare( Map project, Map properties, Map releaseVersion, Map developmentVersion, Map environments )
+        throws Exception;
+
+    public Map getReleaseResult( String releaseId )
+        throws Exception;
+
+    public Map getListener( String releaseId )
+        throws Exception;
+
+    public Boolean removeListener( String releaseId )
+        throws Exception;
+
+    public String getPreparedReleaseName( String releaseId )
+        throws Exception;
+
+    public Boolean releasePerform( String releaseId, String goals, String arguments, boolean useReleaseProfile, Map repository )
+        throws Exception;
+
+    public Boolean releasePerformFromScm( String goals, String arguments, boolean useReleaseProfile, Map repository, String scmUrl, 
+                                          String scmUsername, String scmPassword, String scmTag, String scmTagBase, Map environments )
+        throws Exception;
+
+    public String releaseCleanup( String releaseId )
+        throws Exception;
 }

Modified: continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-client/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportClient.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-client/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportClient.java?rev=751433&r1=751432&r2=751433&view=diff
==============================================================================
--- continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-client/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportClient.java (original)
+++ continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-client/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportClient.java Sun Mar  8 14:41:33 2009
@@ -215,4 +215,199 @@
 
         return result;
     }
+
+    public Map getReleasePluginParameters( int projectId, String pomFilename )
+        throws Exception
+    {
+        Map result = null;
+
+        try
+        {
+            result = slave.getReleasePluginParameters( projectId, pomFilename );
+            log.info(  "Retrieving release plugin parameters" );
+        }
+        catch ( Exception e )
+        {
+            log.error( "Error retrieving release plugin parameters", e );
+            throw new Exception( "Error retrieving release plugin parameters", e );
+        }
+
+        return result;
+    }
+
+    public List<Map<String, String>> processProject( int projectId, String pomFilename, boolean autoVersionSubmodules )
+        throws Exception
+    {
+        List<Map<String, String>> result = null;
+
+        try
+        {
+            result = slave.processProject( projectId, pomFilename, autoVersionSubmodules );
+            log.info( "Processing project" );
+        }
+        catch ( Exception e )
+        {
+            log.error( "Error processing project", e );
+            throw new Exception( "Error processing project", e );
+        }
+
+        return result;
+    }
+
+    public String releasePrepare( Map project, Map properties, Map releaseVersion, Map developmentVersion, Map environments )
+        throws Exception
+    {
+        String releaseId = null;
+
+        try
+        {
+            releaseId = slave.releasePrepare( project, properties, releaseVersion, developmentVersion, environments );
+            log.info( "Preparing release" );
+        }
+        catch ( Exception e )
+        {
+            log.error( "Error while preparing release", e );
+            throw new Exception( "Error while preparing release", e );
+        }
+
+        return releaseId;
+    }
+
+    public Map getReleaseResult( String releaseId )
+        throws Exception
+    {
+        Map result = null;
+
+        try
+        {
+            result = slave.getReleaseResult( releaseId );
+            log.info( "Retrieving release result for " + releaseId );
+        }
+        catch ( Exception e )
+        {
+            log.error( "Error retrieving release result for " + releaseId, e );
+            throw new Exception( "Error retrieving release result for " + releaseId, e );
+        }
+
+        return result;
+    }
+
+    public Map getListener( String releaseId )
+        throws Exception
+    {
+        Map result = null;
+
+        try
+        {
+            result = slave.getListener( releaseId );
+            log.info( "Retrieving listener for " + releaseId );
+        }
+        catch ( Exception e )
+        {
+            log.error( "Error retrieving listener for " + releaseId, e );
+            throw new Exception( "Error retrieving listener for " + releaseId, e );
+        }
+
+        return result;
+    }
+
+    public Boolean removeListener( String releaseId )
+        throws Exception
+    {
+        Boolean result = null;
+
+        try
+        {
+            slave.removeListener( releaseId );
+            result = Boolean.FALSE;
+            log.info( "Removing listener for " + releaseId );
+        }
+        catch ( Exception e )
+        {
+            log.error( "Error removing listener for " + releaseId, e );
+            throw new Exception( "Error removing listener for " + releaseId, e );
+        }
+
+        return result;
+    }
+
+    public String getPreparedReleaseName( String releaseId )
+        throws Exception
+    {
+        String result = null;
+
+        try
+        {
+            result = slave.getPreparedReleaseName( releaseId );
+            log.info( "Retrieving prepared release name for " + releaseId );
+        }
+        catch ( Exception e )
+        {
+            log.error( "Error while retrieving prepared release name for " + releaseId );
+            throw new Exception( "Error while retrieving prepared release name for " + releaseId );
+        }
+
+        return result;
+    }
+
+    public Boolean releasePerform( String releaseId, String goals, String arguments, boolean useReleaseProfile, Map repository )
+        throws Exception
+    {
+        Boolean result = null;
+
+        try
+        {
+            slave.releasePerform( releaseId, goals, arguments, useReleaseProfile, repository );
+            result = Boolean.FALSE;
+            log.info( "Performing release" );
+        }
+        catch ( Exception e )
+        {
+            log.error( "Error performing release", e );
+            throw new Exception( "Error performing release", e );
+        }
+
+        return result;
+    }
+
+    public Boolean releasePerformFromScm( String goals, String arguments, boolean useReleaseProfile, Map repository, String scmUrl,
+                                          String scmUsername, String scmPassword, String scmTag, String scmTagBase, Map environments )
+        throws Exception
+    {
+        Boolean result = null;
+
+        try
+        {
+            slave.releasePerformFromScm( goals, arguments, useReleaseProfile, repository, scmUrl, scmUsername, scmPassword, scmTag,
+                                         scmTagBase, environments);
+            result = Boolean.FALSE;
+            log.info( "Performing release" );
+        }
+        catch ( Exception e )
+        {
+            log.error( "Error performing release from scm", e );
+            throw new Exception( "Error performing release from scm", e );
+        }
+
+        return result;
+    }
+
+    public String releaseCleanup( String releaseId )
+        throws Exception
+    {
+        String result = null;
+
+        try
+        {
+            result = slave.releaseCleanup( releaseId );
+            log.info( "Cleanup release of " + releaseId );
+        }
+        catch ( Exception e )
+        {
+            log.error( "Error cleaning up release of " + releaseId, e );
+            throw new Exception( "Error cleaning up release of " + releaseId, e );
+        }
+
+        return result;
+    }
 }

Modified: continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-server/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportServer.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-server/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportServer.java?rev=751433&r1=751432&r2=751433&view=diff
==============================================================================
--- continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-server/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportServer.java (original)
+++ continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-server/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportServer.java Sun Mar  8 14:41:33 2009
@@ -167,4 +167,161 @@
             throw e;
         }
     }
+
+    public Map getReleasePluginParameters( int projectId, String pomFilename )
+        throws Exception
+    {
+        try
+        {
+            return continuumBuildAgentService.getReleasePluginParameters( projectId, pomFilename );
+        }
+        catch ( ContinuumBuildAgentException e )
+        {
+            log.error( "Failed to retrieve release plugin parameters", e );
+            throw e;
+        }
+    }
+
+    public List<Map<String, String>> processProject( int projectId, String pomFilename, boolean autoVersionSubmodules )
+        throws Exception
+    {
+        try
+        {
+            return continuumBuildAgentService.processProject( projectId, pomFilename, autoVersionSubmodules );
+        }
+        catch ( ContinuumBuildAgentException e )
+        {
+            log.error( "Failed to process project", e );
+            throw e;
+        }
+    }
+
+    public String releasePrepare( Map project, Map properties, Map releaseVersion, Map developmentVersion, Map environments )
+        throws Exception
+    {
+        try
+        {
+            return continuumBuildAgentService.releasePrepare( project, properties, releaseVersion, developmentVersion, environments );
+        }
+        catch ( ContinuumBuildAgentException e )
+        {
+            log.error( "Failed to prepare release", e );
+            throw e;
+        }
+    }
+
+    public Map getListener( String releaseId )
+        throws Exception
+    {
+        try
+        {
+            return continuumBuildAgentService.getListener( releaseId );
+        }
+        catch ( ContinuumBuildAgentException e )
+        {
+            log.error( "Failed to retrieve listener state of " + releaseId, e );
+            throw e;
+        }
+    }
+
+    public Map getReleaseResult( String releaseId )
+        throws Exception
+    {
+        try
+        {
+            return continuumBuildAgentService.getReleaseResult( releaseId );
+        }
+        catch ( ContinuumBuildAgentException e )
+        {
+            log.error( "Failed to retrieve release result of " + releaseId, e );
+            throw e;
+        }
+    }
+
+    public Boolean removeListener( String releaseId )
+        throws Exception
+    {
+        Boolean result = Boolean.FALSE;
+
+        try
+        {
+            continuumBuildAgentService.removeListener( releaseId );
+            result = Boolean.TRUE;
+        }
+        catch ( ContinuumBuildAgentException e )
+        {
+            log.error( "Failed to remove listener of " + releaseId, e );
+            throw e;
+        }
+
+        return result;
+    }
+
+    public String getPreparedReleaseName( String releaseId )
+        throws Exception
+    {
+        try
+        {
+            return continuumBuildAgentService.getPreparedReleaseName( releaseId );
+        }
+        catch ( ContinuumBuildAgentException e )
+        {
+            log.error( "Failed to retrieve prepared release name of " + releaseId );
+            throw e;
+        }
+    }
+
+    public Boolean releasePerform( String releaseId, String goals, String arguments, boolean useReleaseProfile, Map repository )
+        throws Exception
+    {
+        Boolean result = Boolean.FALSE;
+
+        try
+        {
+            continuumBuildAgentService.releasePerform( releaseId, goals, arguments, useReleaseProfile, repository );
+            result = Boolean.TRUE;
+        }
+        catch ( ContinuumBuildAgentException e )
+        {
+            log.error( "Unable to perform release", e );
+            throw e;
+        }
+
+        return result;
+    }
+
+    public Boolean releasePerformFromScm( String goals, String arguments, boolean useReleaseProfile, Map repository, String scmUrl,
+                                          String scmUsername, String scmPassword, String scmTag, String scmTagBase, Map environments )
+        throws Exception
+    {
+        Boolean result = Boolean.FALSE;
+    
+        try
+        {
+            continuumBuildAgentService.releasePerformFromScm( goals, arguments, useReleaseProfile, repository, scmUrl, scmUsername,
+                                                              scmPassword, scmTag, scmTagBase, environments );
+            result = Boolean.TRUE;
+        }
+        catch ( ContinuumBuildAgentException e )
+        {
+            log.error( "Unable to perform release", e );
+            throw e;
+        }
+    
+        return result;
+    }
+
+    public String releaseCleanup( String releaseId )
+        throws Exception
+    {
+        try
+        {
+            return continuumBuildAgentService.releaseCleanup( releaseId );
+        }
+        catch ( ContinuumBuildAgentException e )
+        {
+            log.error( "Unable to cleanup release of " + releaseId, e );
+            throw e;
+        }
+    }
 }

Modified: continuum/trunk/continuum-release/pom.xml
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-release/pom.xml?rev=751433&r1=751432&r2=751433&view=diff
==============================================================================
--- continuum/trunk/continuum-release/pom.xml (original)
+++ continuum/trunk/continuum-release/pom.xml Sun Mar  8 14:41:33 2009
@@ -36,10 +36,6 @@
       <artifactId>continuum-api</artifactId>
     </dependency>
     <dependency>
-      <groupId>org.apache.continuum</groupId>
-      <artifactId>continuum-commons</artifactId>
-    </dependency>
-    <dependency>
       <groupId>org.apache.maven</groupId>
       <artifactId>maven-settings</artifactId>
     </dependency>
@@ -111,6 +107,29 @@
     </dependency>
   </dependencies>
   <build>
+    <plugins>
+      <plugin>
+        <groupId>org.codehaus.modello</groupId>
+        <artifactId>modello-maven-plugin</artifactId>
+        <configuration>
+          <models>
+            <model>src/main/mdo/prepared-releases.mdo</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>                   
+        </executions>
+      </plugin>
+    </plugins>
     <testResources>
       <testResource>
         <directory>src/test/resources</directory>

Modified: continuum/trunk/continuum-release/src/main/java/org/apache/continuum/release/config/ContinuumReleaseDescriptor.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-release/src/main/java/org/apache/continuum/release/config/ContinuumReleaseDescriptor.java?rev=751433&r1=751432&r2=751433&view=diff
==============================================================================
--- continuum/trunk/continuum-release/src/main/java/org/apache/continuum/release/config/ContinuumReleaseDescriptor.java (original)
+++ continuum/trunk/continuum-release/src/main/java/org/apache/continuum/release/config/ContinuumReleaseDescriptor.java Sun Mar  8 14:41:33 2009
@@ -32,6 +32,8 @@
 {
     private Map<String, String> environments;
 
+    private String executable;
+
     public void addEnvironment( String name, String value )
     {
         getEnvironments().put( name, value );
@@ -65,4 +67,14 @@
     {
         this.environments = environments;
     }
+
+    public String getExecutable()
+    {
+        return executable;
+    }
+
+    public void setExecutable( String executable )
+    {
+        this.executable = executable;
+    }
 }

Modified: continuum/trunk/continuum-release/src/main/java/org/apache/continuum/release/phase/AbstractContinuumRunGoalsPhase.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-release/src/main/java/org/apache/continuum/release/phase/AbstractContinuumRunGoalsPhase.java?rev=751433&r1=751432&r2=751433&view=diff
==============================================================================
--- continuum/trunk/continuum-release/src/main/java/org/apache/continuum/release/phase/AbstractContinuumRunGoalsPhase.java (original)
+++ continuum/trunk/continuum-release/src/main/java/org/apache/continuum/release/phase/AbstractContinuumRunGoalsPhase.java Sun Mar  8 14:41:33 2009
@@ -59,21 +59,14 @@
             if ( !StringUtils.isEmpty( goals ) )
             {
                 Map<String, String> environments = null;
-                
+
+                String executable = null;
+
                 if ( releaseDescriptor instanceof ContinuumReleaseDescriptor )
                 {
                     environments = ( (ContinuumReleaseDescriptor) releaseDescriptor ).getEnvironments();
-                }
 
-                String executable = installationService.getExecutorConfigurator( InstallationService.MAVEN2_TYPE ).getExecutable();
-
-                if ( environments != null )
-                {
-                    String m2Home = environments.get( installationService.getEnvVar( InstallationService.MAVEN2_TYPE ) );
-                    if ( StringUtils.isNotEmpty( m2Home ) )
-                    {
-                        executable = m2Home + File.separator + "bin" + File.separator + executable;
-                    }
+                    executable = ( (ContinuumReleaseDescriptor) releaseDescriptor).getExecutable();
                 }
 
                 shellCommandHelper.executeGoals( determineWorkingDirectory( workingDirectory,

Modified: continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/DefaultContinuumReleaseManager.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/DefaultContinuumReleaseManager.java?rev=751433&r1=751432&r2=751433&view=diff
==============================================================================
--- continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/DefaultContinuumReleaseManager.java (original)
+++ continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/DefaultContinuumReleaseManager.java Sun Mar  8 14:41:33 2009
@@ -22,14 +22,10 @@
 import org.apache.commons.lang.BooleanUtils;
 import org.apache.continuum.model.repository.LocalRepository;
 import org.apache.continuum.release.config.ContinuumReleaseDescriptor;
-import org.apache.maven.continuum.installation.InstallationService;
 import org.apache.maven.continuum.model.project.Project;
-import org.apache.maven.continuum.model.system.Installation;
-import org.apache.maven.continuum.model.system.Profile;
 import org.apache.maven.continuum.release.tasks.PerformReleaseProjectTask;
 import org.apache.maven.continuum.release.tasks.PrepareReleaseProjectTask;
 import org.apache.maven.continuum.release.tasks.RollbackReleaseProjectTask;
-import org.apache.maven.continuum.utils.WorkingDirectoryService;
 import org.apache.maven.scm.manager.ScmManager;
 import org.apache.maven.scm.provider.ScmProvider;
 import org.apache.maven.scm.repository.ScmRepository;
@@ -40,13 +36,9 @@
 import org.codehaus.plexus.taskqueue.Task;
 import org.codehaus.plexus.taskqueue.TaskQueue;
 import org.codehaus.plexus.taskqueue.TaskQueueException;
-import org.codehaus.plexus.util.StringUtils;
 
 import java.io.File;
-import java.util.Collections;
-import java.util.HashMap;
 import java.util.Hashtable;
-import java.util.List;
 import java.util.Map;
 import java.util.Properties;
 
@@ -81,16 +73,6 @@
     /**
      * @plexus.requirement
      */
-    private WorkingDirectoryService workingDirectoryService;
-
-    /**
-     * @plexus.requirement
-     */
-    private InstallationService installationService;
-
-    /**
-     * @plexus.requirement
-     */
     private ScmManager scmManager;
 
     private Map<String, ContinuumReleaseManagerListener> listeners;
@@ -110,28 +92,29 @@
     private static Map releaseResults;
 
     public String prepare( Project project, Properties releaseProperties, Map<String, String> relVersions,
-                           Map<String, String> devVersions, ContinuumReleaseManagerListener listener )
+                           Map<String, String> devVersions, ContinuumReleaseManagerListener listener,
+                           String workingDirectory )
         throws ContinuumReleaseException
     {
-        return prepare( project, releaseProperties, relVersions, devVersions, listener, null );
+        return prepare( project, releaseProperties, relVersions, devVersions, listener, workingDirectory, null, null );
     }
 
     public String prepare( Project project, Properties releaseProperties, Map<String, String> relVersions,
-                           Map<String, String> devVersions, ContinuumReleaseManagerListener listener, Profile profile )
+                           Map<String, String> devVersions, ContinuumReleaseManagerListener listener,
+                           String workingDirectory, Map<String, String> environments, String executable )
         throws ContinuumReleaseException
     {
         String releaseId = project.getGroupId() + ":" + project.getArtifactId();
 
         ReleaseDescriptor descriptor =
-            getReleaseDescriptor( project, releaseProperties, relVersions, devVersions, profile );
+            getReleaseDescriptor( project, releaseProperties, relVersions, devVersions, environments, workingDirectory, executable );
 
         getListeners().put( releaseId, listener );
 
         try
         {
             prepareReleaseQueue.put(
-                new PrepareReleaseProjectTask( releaseId, descriptor, (ReleaseManagerListener) listener, profile ) );
-
+                new PrepareReleaseProjectTask( releaseId, descriptor, (ReleaseManagerListener) listener ) );
         }
         catch ( TaskQueueException e )
         {
@@ -236,42 +219,13 @@
         return releaseResults;
     }
 
-    public Map<String, String> getEnvironments( Profile profile )
-    {
-        if ( profile == null )
-        {
-            return Collections.EMPTY_MAP;
-        }
-
-        Map<String, String> envVars = new HashMap<String, String>();
-
-        String javaHome = getJavaHomeValue( profile );
-        if ( !StringUtils.isEmpty( javaHome ) )
-        {
-            envVars.put( installationService.getEnvVar( InstallationService.JDK_TYPE ), javaHome );
-        }
-
-        Installation builder = profile.getBuilder();
-        if ( builder != null )
-        {
-            envVars.put( installationService.getEnvVar( InstallationService.MAVEN2_TYPE ), builder.getVarValue() );
-        }
-
-        List<Installation> installations = profile.getEnvironmentVariables();
-        for ( Installation installation : installations )
-        {
-            envVars.put( installation.getVarName(), installation.getVarValue() );
-        }
-        return envVars;
-    }
-
     private ReleaseDescriptor getReleaseDescriptor( Project project, Properties releaseProperties,
                                                     Map<String, String> relVersions, Map<String, String> devVersions,
-                                                    Profile profile )
+                                                    Map<String, String> environments, String workingDirectory,
+                                                    String executable )
     {
         ContinuumReleaseDescriptor descriptor = new ContinuumReleaseDescriptor();
-        String workingDirectory = workingDirectoryService.getWorkingDirectory( project ).getPath();
-
+        
         //release properties from the project
         descriptor.setWorkingDirectory( workingDirectory );
         descriptor.setScmSourceUrl( project.getScmUrl() );
@@ -322,7 +276,8 @@
         descriptor.setInteractive( false );
 
         //set environments
-        descriptor.setEnvironments( getEnvironments( profile ) );
+        descriptor.setEnvironments( environments );
+        descriptor.setExecutable( executable );
 
         return descriptor;
     }
@@ -355,16 +310,6 @@
         return listeners;
     }
 
-    private String getJavaHomeValue( Profile profile )
-    {
-        Installation jdk = profile.getJdk();
-        if ( jdk == null )
-        {
-            return null;
-        }
-        return jdk.getVarValue();
-    }
-
     public String sanitizeTagName( String scmUrl, String tagName )
         throws Exception
     {

Modified: continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/tasks/AbstractReleaseProjectTask.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/tasks/AbstractReleaseProjectTask.java?rev=751433&r1=751432&r2=751433&view=diff
==============================================================================
--- continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/tasks/AbstractReleaseProjectTask.java (original)
+++ continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/tasks/AbstractReleaseProjectTask.java Sun Mar  8 14:41:33 2009
@@ -39,15 +39,11 @@
 
     private long maxExecutionTime;
 
-    private Profile profile;
-
-    public AbstractReleaseProjectTask( String releaseId, ReleaseDescriptor descriptor, ReleaseManagerListener listener,
-                                       Profile profile )
+    public AbstractReleaseProjectTask( String releaseId, ReleaseDescriptor descriptor, ReleaseManagerListener listener )
     {
         this.releaseId = releaseId;
         this.descriptor = descriptor;
         this.listener = listener;
-        this.profile = profile;
     }
 
     public ReleaseDescriptor getDescriptor()
@@ -89,14 +85,4 @@
     {
         this.maxExecutionTime = maxTime;
     }
-
-    public Profile getProfile()
-    {
-        return profile;
-    }
-
-    public void setProfile( Profile profile )
-    {
-        this.profile = profile;
-    }
 }

Modified: continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/tasks/PerformReleaseProjectTask.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/tasks/PerformReleaseProjectTask.java?rev=751433&r1=751432&r2=751433&view=diff
==============================================================================
--- continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/tasks/PerformReleaseProjectTask.java (original)
+++ continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/tasks/PerformReleaseProjectTask.java Sun Mar  8 14:41:33 2009
@@ -20,7 +20,6 @@
  */
 
 import org.apache.continuum.model.repository.LocalRepository;
-import org.apache.maven.continuum.model.system.Profile;
 import org.apache.maven.shared.release.ReleaseManagerListener;
 import org.apache.maven.shared.release.config.ReleaseDescriptor;
 
@@ -44,20 +43,13 @@
     public PerformReleaseProjectTask( String releaseId, ReleaseDescriptor descriptor, File buildDirectory, String goals,
                                       boolean useReleaseProfile, ReleaseManagerListener listener )
     {
-        this( releaseId, descriptor, buildDirectory, goals, useReleaseProfile, listener, null, null );
+        this( releaseId, descriptor, buildDirectory, goals, useReleaseProfile, listener, null );
     }
 
     public PerformReleaseProjectTask( String releaseId, ReleaseDescriptor descriptor, File buildDirectory, String goals,
                                       boolean useReleaseProfile, ReleaseManagerListener listener, LocalRepository repository )
     {
-        this( releaseId, descriptor, buildDirectory, goals, useReleaseProfile, listener, repository, null );
-    }
-    
-    public PerformReleaseProjectTask( String releaseId, ReleaseDescriptor descriptor, File buildDirectory, String goals,
-                                      boolean useReleaseProfile, ReleaseManagerListener listener, LocalRepository repository,
-                                      Profile profile )
-    {
-        super( releaseId, descriptor, listener, profile );
+        super( releaseId, descriptor, listener );
         setBuildDirectory( buildDirectory );
         setGoals( goals );
         setUseReleaseProfile( useReleaseProfile );

Modified: continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/tasks/PrepareReleaseProjectTask.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/tasks/PrepareReleaseProjectTask.java?rev=751433&r1=751432&r2=751433&view=diff
==============================================================================
--- continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/tasks/PrepareReleaseProjectTask.java (original)
+++ continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/tasks/PrepareReleaseProjectTask.java Sun Mar  8 14:41:33 2009
@@ -19,7 +19,6 @@
  * under the License.
  */
 
-import org.apache.maven.continuum.model.system.Profile;
 import org.apache.maven.shared.release.ReleaseManagerListener;
 import org.apache.maven.shared.release.config.ReleaseDescriptor;
 
@@ -32,11 +31,6 @@
 {
     public PrepareReleaseProjectTask( String releaseId, ReleaseDescriptor descriptor, ReleaseManagerListener listener )
     {
-        this( releaseId, descriptor, listener, null );
-    }
-    
-    public PrepareReleaseProjectTask( String releaseId, ReleaseDescriptor descriptor, ReleaseManagerListener listener, Profile profile )
-    {
-        super( releaseId, descriptor, listener, profile );
+        super( releaseId, descriptor, listener );
     }
 }

Modified: continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/tasks/RollbackReleaseProjectTask.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/tasks/RollbackReleaseProjectTask.java?rev=751433&r1=751432&r2=751433&view=diff
==============================================================================
--- continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/tasks/RollbackReleaseProjectTask.java (original)
+++ continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/tasks/RollbackReleaseProjectTask.java Sun Mar  8 14:41:33 2009
@@ -32,11 +32,6 @@
 {
     public RollbackReleaseProjectTask( String releaseId, ReleaseDescriptor descriptor, ReleaseManagerListener listener )
     {
-        this( releaseId, descriptor, listener, null );
-    }
-    
-    public RollbackReleaseProjectTask( String releaseId, ReleaseDescriptor descriptor, ReleaseManagerListener listener, Profile profile )
-    {
-        super( releaseId, descriptor, listener, profile );
+        super( releaseId, descriptor, listener );
     }
 }

Added: continuum/trunk/continuum-release/src/main/mdo/prepared-releases.mdo
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-release/src/main/mdo/prepared-releases.mdo?rev=751433&view=auto
==============================================================================
--- continuum/trunk/continuum-release/src/main/mdo/prepared-releases.mdo (added)
+++ continuum/trunk/continuum-release/src/main/mdo/prepared-releases.mdo Sun Mar  8 14:41:33 2009
@@ -0,0 +1,67 @@
+<?xml version="1.0"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+<model>
+  <id>continuum-prepared-releases</id>
+  <name>ContinuumPrepareReleasesModel</name>
+  <defaults>
+    <default>
+      <key>package</key>
+      <value>org.apache.continuum.release.model</value>
+    </default>
+  </defaults>
+  <classes>
+    <class rootElement="true" xml.tagName="prepared-releases">
+      <name>PreparedReleaseModel</name>
+      <version>1.0.0</version>
+      <fields>
+        <field>
+          <name>preparedReleases</name>
+          <version>1.0.0</version>
+          <description></description>
+          <required>true</required>
+          <association>
+            <type>PreparedRelease</type>
+            <multiplicity>*</multiplicity>
+          </association>
+        </field>
+      </fields>
+    </class>
+    <class>
+      <name>PreparedRelease</name>
+      <version>1.0.0</version>
+      <fields>
+        <field>
+          <name>releaseId</name>
+          <version>1.0.0</version>
+          <required>true</required>
+          <description>release</description>
+          <type>String</type>
+        </field>
+        <field>
+          <name>buildAgentUrl</name>
+          <version>1.0.0</version>
+          <required>true</required>
+          <description>build agent url</description>
+          <type>String</type>
+        </field>
+      </fields>
+    </class>
+  </classes>
+</model>
\ No newline at end of file

Modified: continuum/trunk/continuum-release/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-release/src/main/resources/META-INF/plexus/components.xml?rev=751433&r1=751432&r2=751433&view=diff
==============================================================================
--- continuum/trunk/continuum-release/src/main/resources/META-INF/plexus/components.xml (original)
+++ continuum/trunk/continuum-release/src/main/resources/META-INF/plexus/components.xml Sun Mar  8 14:41:33 2009
@@ -44,12 +44,6 @@
           <field-name>rollbackReleaseQueue</field-name>
         </requirement>
         <requirement>
-          <role>org.apache.maven.continuum.utils.WorkingDirectoryService</role>
-        </requirement>
-        <requirement>
-          <role>org.apache.maven.continuum.installation.InstallationService</role>
-        </requirement>
-        <requirement>
           <role>org.apache.maven.scm.manager.ScmManager</role>
         </requirement>
       </requirements>
@@ -318,9 +312,6 @@
         <requirement>
           <role>org.apache.continuum.utils.shell.ShellCommandHelper</role>
         </requirement>
-        <requirement>
-          <role>org.apache.maven.continuum.installation.InstallationService</role>
-        </requirement>
       </requirements>
     </component>
     <component>
@@ -331,9 +322,6 @@
         <requirement>
           <role>org.apache.continuum.utils.shell.ShellCommandHelper</role>
         </requirement>
-        <requirement>
-          <role>org.apache.maven.continuum.installation.InstallationService</role>
-        </requirement>
       </requirements>
     </component>
     

Added: continuum/trunk/continuum-webapp/src/main/java/org/apache/continuum/web/action/AbstractReleaseAction.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/java/org/apache/continuum/web/action/AbstractReleaseAction.java?rev=751433&view=auto
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/java/org/apache/continuum/web/action/AbstractReleaseAction.java (added)
+++ continuum/trunk/continuum-webapp/src/main/java/org/apache/continuum/web/action/AbstractReleaseAction.java Sun Mar  8 14:41:33 2009
@@ -0,0 +1,74 @@
+package org.apache.continuum.web.action;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.maven.continuum.installation.InstallationService;
+import org.apache.maven.continuum.model.system.Installation;
+import org.apache.maven.continuum.model.system.Profile;
+import org.apache.maven.continuum.web.action.ContinuumActionSupport;
+import org.codehaus.plexus.util.StringUtils;
+
+public class AbstractReleaseAction
+    extends ContinuumActionSupport
+{
+    protected Map<String, String> getEnvironments( Profile profile )
+    {
+        if ( profile == null )
+        {
+            return Collections.EMPTY_MAP;
+        }
+
+        Map<String, String> envVars = new HashMap<String, String>();
+
+        String javaHome = getJavaHomeValue( profile );
+        if ( !StringUtils.isEmpty( javaHome ) )
+        {
+            envVars.put( getContinuum().getInstallationService().getEnvVar( InstallationService.JDK_TYPE ), javaHome );
+        }
+
+        Installation builder = profile.getBuilder();
+        if ( builder != null )
+        {
+            envVars.put( getContinuum().getInstallationService().getEnvVar( InstallationService.MAVEN2_TYPE ), builder.getVarValue() );
+        }
+
+        List<Installation> installations = profile.getEnvironmentVariables();
+        for ( Installation installation : installations )
+        {
+            envVars.put( installation.getVarName(), installation.getVarValue() );
+        }
+        return envVars;
+    }
+
+    private String getJavaHomeValue( Profile profile )
+    {
+        Installation jdk = profile.getJdk();
+        if ( jdk == null )
+        {
+            return null;
+        }
+        return jdk.getVarValue();
+    }
+}

Propchange: continuum/trunk/continuum-webapp/src/main/java/org/apache/continuum/web/action/AbstractReleaseAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/trunk/continuum-webapp/src/main/java/org/apache/continuum/web/action/AbstractReleaseAction.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseCleanupAction.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseCleanupAction.java?rev=751433&r1=751432&r2=751433&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseCleanupAction.java (original)
+++ continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseCleanupAction.java Sun Mar  8 14:41:33 2009
@@ -19,10 +19,12 @@
  * under the License.
  */
 
+import org.apache.continuum.release.distributed.manager.DistributedReleaseManager;
 import org.apache.maven.continuum.ContinuumException;
 import org.apache.maven.continuum.release.ContinuumReleaseManager;
 import org.apache.maven.continuum.release.ContinuumReleaseManagerListener;
 import org.apache.maven.continuum.web.exception.AuthorizationRequiredException;
+import org.codehaus.plexus.util.StringUtils;
 
 /**
  * @author Edwin Punzalan
@@ -51,24 +53,41 @@
             return REQUIRES_AUTHORIZATION;
         }
 
-        ContinuumReleaseManager releaseManager = getContinuum().getReleaseManager();
-
-        releaseManager.getReleaseResults().remove( releaseId );
-
-        ContinuumReleaseManagerListener listener =
-            (ContinuumReleaseManagerListener) releaseManager.getListeners().remove( releaseId );
-
-        if ( listener != null )
+        if ( getContinuum().getConfiguration().isDistributedBuildEnabled() )
         {
-            String goal = listener.getGoalName();
+            DistributedReleaseManager releaseManager = getContinuum().getDistributedReleaseManager();
 
-            return goal + "Finished";
+            String goal = releaseManager.releaseCleanup( releaseId );
+
+            if ( StringUtils.isNotBlank( goal ) )
+            {
+                return goal;
+            }
+            else
+            {
+                throw new Exception( "No listener to cleanup for id " + releaseId );
+            }
         }
         else
         {
-            throw new Exception( "No listener to cleanup for id " + releaseId );
+            ContinuumReleaseManager releaseManager = getContinuum().getReleaseManager();
+    
+            releaseManager.getReleaseResults().remove( releaseId );
+    
+            ContinuumReleaseManagerListener listener =
+                (ContinuumReleaseManagerListener) releaseManager.getListeners().remove( releaseId );
+    
+            if ( listener != null )
+            {
+                String goal = listener.getGoalName();
+    
+                return goal + "Finished";
+            }
+            else
+            {
+                throw new Exception( "No listener to cleanup for id " + releaseId );
+            }
         }
-
     }
 
     public String getReleaseId()

Modified: continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseInProgressAction.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseInProgressAction.java?rev=751433&r1=751432&r2=751433&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseInProgressAction.java (original)
+++ continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseInProgressAction.java Sun Mar  8 14:41:33 2009
@@ -23,8 +23,11 @@
 import java.io.FileWriter;
 import java.io.IOException;
 import java.io.PrintWriter;
+import java.util.Map;
 
 import org.apache.continuum.model.release.ContinuumReleaseResult;
+import org.apache.continuum.release.distributed.DistributedReleaseUtil;
+import org.apache.continuum.release.distributed.manager.DistributedReleaseManager;
 import org.apache.maven.continuum.ContinuumException;
 import org.apache.maven.continuum.configuration.ConfigurationException;
 import org.apache.maven.continuum.model.project.Project;
@@ -32,6 +35,7 @@
 import org.apache.maven.continuum.release.ContinuumReleaseManager;
 import org.apache.maven.continuum.release.ContinuumReleaseManagerListener;
 import org.apache.maven.continuum.web.exception.AuthorizationRequiredException;
+import org.apache.maven.continuum.web.model.ReleaseListenerSummary;
 import org.apache.maven.shared.release.ReleaseResult;
 
 /**
@@ -54,6 +58,8 @@
 
     private String projectGroupName = "";
 
+    private ReleaseListenerSummary listenerSummary;
+
     public String execute()
         throws Exception
     {
@@ -68,38 +74,92 @@
 
         String status = "";
 
-        ContinuumReleaseManager releaseManager = getContinuum().getReleaseManager();
-
-        listener = (ContinuumReleaseManagerListener) releaseManager.getListeners().get( releaseId );
+        listenerSummary = new ReleaseListenerSummary();
 
-        if ( listener != null )
+        if ( getContinuum().getConfiguration().isDistributedBuildEnabled() )
         {
-            if ( listener.getState() == ContinuumReleaseManagerListener.LISTENING )
-            {
-                status = "inProgress";
-            }
-            else if ( listener.getState() == ContinuumReleaseManagerListener.FINISHED )
+            DistributedReleaseManager releaseManager = getContinuum().getDistributedReleaseManager();
+
+            Map map = releaseManager.getListener( releaseId );
+
+            if ( map != null && !map.isEmpty() )
             {
-                status = SUCCESS;
+                int state = DistributedReleaseUtil.getReleaseState( map );
+
+                if ( state == ContinuumReleaseManagerListener.LISTENING )
+                {
+                    status = "inProgress";
+                }
+                else if ( state == ContinuumReleaseManagerListener.FINISHED )
+                {
+                    status = SUCCESS;
+                }
+                else
+                {
+                    status = "initialized";
+                }
+    
+                if ( status.equals( SUCCESS ) )
+                {
+                    ReleaseResult result = releaseManager.getReleaseResult( releaseId );
+    
+                    if ( result != null && getContinuum().getContinuumReleaseResult( projectId, releaseGoal, result.getStartTime(), result.getEndTime() ) == null )
+                    {
+                        ContinuumReleaseResult releaseResult = createContinuumReleaseResult( result );
+                        getContinuum().addContinuumReleaseResult( releaseResult );
+                    }
+                }
+
+                listenerSummary.setPhases( DistributedReleaseUtil.getReleasePhases( map ) );
+                listenerSummary.setCompletedPhases( DistributedReleaseUtil.getCompletedReleasePhases( map ) );
+                listenerSummary.setInProgress( DistributedReleaseUtil.getReleaseInProgress( map ) );
+                listenerSummary.setError( DistributedReleaseUtil.getReleaseError( map ) );
             }
             else
             {
-                status = "initialized";
+                throw new Exception( "There is no on-going or finished release operation with id " + releaseId );
             }
         }
         else
         {
-            throw new Exception( "There is no on-going or finished release operation with id " + releaseId );
-        }
-
-        if ( status.equals( SUCCESS ) )
-        {
-            ReleaseResult result = (ReleaseResult) releaseManager.getReleaseResults().get( releaseId );
+            ContinuumReleaseManager releaseManager = getContinuum().getReleaseManager();
+    
+            listener = (ContinuumReleaseManagerListener) releaseManager.getListeners().get( releaseId );
+    
+            if ( listener != null )
+            {
+                if ( listener.getState() == ContinuumReleaseManagerListener.LISTENING )
+                {
+                    status = "inProgress";
+                }
+                else if ( listener.getState() == ContinuumReleaseManagerListener.FINISHED )
+                {
+                    status = SUCCESS;
+                }
+                else
+                {
+                    status = "initialized";
+                }
+
+                listenerSummary.setPhases( listener.getPhases() );
+                listenerSummary.setCompletedPhases( listener.getCompletedPhases() );
+                listenerSummary.setInProgress( listener.getInProgress() );
+                listenerSummary.setError( listener.getError() );
+            }
+            else
+            {
+                throw new Exception( "There is no on-going or finished release operation with id " + releaseId );
+            }
 
-            if ( result != null && getContinuum().getContinuumReleaseResult( projectId, releaseGoal, result.getStartTime(), result.getEndTime() ) == null )
+            if ( status.equals( SUCCESS ) )
             {
-                ContinuumReleaseResult releaseResult = createContinuumReleaseResult( result );
-                getContinuum().addContinuumReleaseResult( releaseResult );
+                ReleaseResult result = (ReleaseResult) releaseManager.getReleaseResults().get( releaseId );
+
+                if ( result != null && getContinuum().getContinuumReleaseResult( projectId, releaseGoal, result.getStartTime(), result.getEndTime() ) == null )
+                {
+                    ContinuumReleaseResult releaseResult = createContinuumReleaseResult( result );
+                    getContinuum().addContinuumReleaseResult( releaseResult );
+                }
             }
         }
 
@@ -118,26 +178,67 @@
             return REQUIRES_AUTHORIZATION;
         }
 
-        ContinuumReleaseManager releaseManager = getContinuum().getReleaseManager();
-
-        listener = (ContinuumReleaseManagerListener) releaseManager.getListeners().get( releaseId );
+        listenerSummary = new ReleaseListenerSummary();
 
-        if ( listener != null )
+        if ( getContinuum().getConfiguration().isDistributedBuildEnabled() )
         {
-            if ( listener.getState() == ContinuumReleaseManagerListener.FINISHED )
+            DistributedReleaseManager releaseManager = getContinuum().getDistributedReleaseManager();
+
+            Map map = releaseManager.getListener( releaseId );
+
+            if ( map != null && !map.isEmpty() )
             {
-                result = (ReleaseResult) releaseManager.getReleaseResults().get( releaseId );
+                int state = DistributedReleaseUtil.getReleaseState( map );
 
-                return SUCCESS;
+                listenerSummary.setPhases( DistributedReleaseUtil.getReleasePhases( map ) );
+                listenerSummary.setCompletedPhases( DistributedReleaseUtil.getCompletedReleasePhases( map ) );
+                listenerSummary.setInProgress( DistributedReleaseUtil.getReleaseInProgress( map ) );
+                listenerSummary.setError( DistributedReleaseUtil.getReleaseError( map ) );
+
+                if ( state == ContinuumReleaseManagerListener.FINISHED )
+                {
+                    result = releaseManager.getReleaseResult( releaseId );
+    
+                    return SUCCESS;
+                }
+                else
+                {
+                    throw new Exception( "The release operation with id " + releaseId + "has not finished yet." );
+                }
             }
             else
             {
-                throw new Exception( "The release operation with id " + releaseId + "has not finished yet." );
+                throw new Exception( "There is no finished release operation with id " + releaseId );
             }
         }
         else
         {
-            throw new Exception( "There is no finished release operation with id " + releaseId );
+            ContinuumReleaseManager releaseManager = getContinuum().getReleaseManager();
+    
+            listener = (ContinuumReleaseManagerListener) releaseManager.getListeners().get( releaseId );
+    
+            if ( listener != null )
+            {
+                listenerSummary.setPhases( listener.getPhases() );
+                listenerSummary.setCompletedPhases( listener.getCompletedPhases() );
+                listenerSummary.setInProgress( listener.getInProgress() );
+                listenerSummary.setError( listener.getError() );
+
+                if ( listener.getState() == ContinuumReleaseManagerListener.FINISHED )
+                {
+                    result = (ReleaseResult) releaseManager.getReleaseResults().get( releaseId );
+    
+                    return SUCCESS;
+                }
+                else
+                {
+                    throw new Exception( "The release operation with id " + releaseId + "has not finished yet." );
+                }
+            }
+            else
+            {
+                throw new Exception( "There is no finished release operation with id " + releaseId );
+            }
         }
     }
 
@@ -202,6 +303,16 @@
         return projectGroupName;
     }
 
+    public ReleaseListenerSummary getListenerSummary()
+    {
+        return listenerSummary;
+    }
+
+    public void setListenerSummary( ReleaseListenerSummary listenerSummary )
+    {
+        this.listenerSummary = listenerSummary;
+    }
+
     private ContinuumReleaseResult createContinuumReleaseResult( ReleaseResult result )
         throws ContinuumException
     {



Mime
View raw message