continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r993609 - in /continuum/trunk: continuum-api/src/main/java/org/apache/continuum/release/distributed/manager/ continuum-api/src/main/java/org/apache/maven/continuum/ continuum-core/src/main/java/org/apache/continuum/release/distributed/manag...
Date Wed, 08 Sep 2010 05:53:28 GMT
Author: ctan
Date: Wed Sep  8 05:53:27 2010
New Revision: 993609

URL: http://svn.apache.org/viewvc?rev=993609&view=rev
Log:
[CONTINUUM-2569] added a call to create a continuumreleaseresult in the releaseCleanup()

Added:
    continuum/trunk/continuum-model/src/main/mdo/prepared-releases.mdo
Removed:
    continuum/trunk/continuum-release/src/main/mdo/
Modified:
    continuum/trunk/continuum-api/src/main/java/org/apache/continuum/release/distributed/manager/DistributedReleaseManager.java
    continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
    continuum/trunk/continuum-core/src/main/java/org/apache/continuum/release/distributed/manager/DefaultDistributedReleaseManager.java
    continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
    continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java
    continuum/trunk/continuum-model/pom.xml
    continuum/trunk/continuum-release/pom.xml
    continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseInProgressAction.java
    continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-api/src/main/java/org/apache/maven/continuum/xmlrpc/ContinuumService.java
    continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-client/src/main/java/org/apache/maven/continuum/xmlrpc/client/ContinuumXmlRpcClient.java
    continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/pom.xml
    continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java

Modified: continuum/trunk/continuum-api/src/main/java/org/apache/continuum/release/distributed/manager/DistributedReleaseManager.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-api/src/main/java/org/apache/continuum/release/distributed/manager/DistributedReleaseManager.java?rev=993609&r1=993608&r2=993609&view=diff
==============================================================================
--- continuum/trunk/continuum-api/src/main/java/org/apache/continuum/release/distributed/manager/DistributedReleaseManager.java
(original)
+++ continuum/trunk/continuum-api/src/main/java/org/apache/continuum/release/distributed/manager/DistributedReleaseManager.java
Wed Sep  8 05:53:27 2010
@@ -25,10 +25,12 @@ import java.util.Properties;
 
 import org.apache.continuum.configuration.BuildAgentConfigurationException;
 import org.apache.continuum.model.repository.LocalRepository;
+import org.apache.continuum.release.model.PreparedRelease;
 import org.apache.maven.continuum.model.project.Project;
 import org.apache.maven.continuum.release.ContinuumReleaseException;
 import org.apache.maven.shared.release.ReleaseResult;
 
+
 public interface DistributedReleaseManager
 {
     Map getReleasePluginParameters( int projectId, String pomFilename )
@@ -70,4 +72,7 @@ public interface DistributedReleaseManag
         throws ContinuumReleaseException, BuildAgentConfigurationException;
     
     String getDefaultBuildagent( int projectId );
+
+    PreparedRelease getPreparedRelease( String releaseId, String releaseType )
+        throws ContinuumReleaseException;
 }
\ No newline at end of file

Modified: continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java?rev=993609&r1=993608&r2=993609&view=diff
==============================================================================
--- continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
(original)
+++ continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
Wed Sep  8 05:53:27 2010
@@ -620,6 +620,9 @@ public interface Continuum
     public void startup()
         throws ContinuumException;
 
+    ContinuumReleaseResult addContinuumReleaseResult( int projectId, String releaseId, String
releaseType )
+        throws ContinuumException;
+
     ContinuumReleaseResult addContinuumReleaseResult( ContinuumReleaseResult releaseResult
)
         throws ContinuumException;
 

Modified: 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=993609&r1=993608&r2=993609&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/continuum/release/distributed/manager/DefaultDistributedReleaseManager.java
(original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/continuum/release/distributed/manager/DefaultDistributedReleaseManager.java
Wed Sep  8 05:53:27 2010
@@ -32,6 +32,8 @@ import java.util.List;
 import java.util.Map;
 import java.util.Properties;
 
+import javax.xml.stream.XMLStreamException;
+
 import org.apache.continuum.builder.distributed.manager.DistributedBuildManager;
 import org.apache.continuum.configuration.BuildAgentConfiguration;
 import org.apache.continuum.configuration.BuildAgentConfigurationException;
@@ -41,8 +43,8 @@ import org.apache.continuum.model.reposi
 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.continuum.release.model.io.stax.ContinuumPrepareReleasesModelStaxReader;
+import org.apache.continuum.release.model.io.stax.ContinuumPrepareReleasesModelStaxWriter;
 import org.apache.maven.continuum.configuration.ConfigurationService;
 import org.apache.maven.continuum.installation.InstallationService;
 import org.apache.maven.continuum.model.project.BuildResult;
@@ -180,7 +182,7 @@ public class DefaultDistributedReleaseMa
                     client.releasePrepare( createProjectMap( project ), releaseProperties,
                                            releaseVersion, developmentVersion, environments,
username );
     
-                addReleasePrepare( releaseId, buildAgentUrl, releaseVersion.get( releaseId
), "prepare" );
+                addReleasePrepare( releaseId, buildAgentUrl, releaseVersion.get( releaseId
), "prepare", releaseProperties.getProperty( "preparation-goals" ), username );
     
                 addReleaseInProgress( releaseId, "prepare", project.getId(), username );
     
@@ -465,7 +467,7 @@ public class DefaultDistributedReleaseMa
                     client.releasePerformFromScm( goals, arguments, useReleaseProfile, map,
scmUrl, scmUsername,
                                                   scmPassword, scmTag, scmTagBase, environments,
username );
     
-                addReleasePrepare( releaseId, buildAgentUrl, scmTag, "perform" );
+                addReleasePrepare( releaseId, buildAgentUrl, scmTag, "perform", goals, username
);
                 addReleaseInProgress( releaseId, "perform", projectId, username );
     
                 return releaseId;
@@ -640,6 +642,23 @@ public class DefaultDistributedReleaseMa
         return buildResult != null ? buildResult.getBuildUrl() : null;
     }
 
+    public PreparedRelease getPreparedRelease( String releaseId, String releaseType )
+        throws ContinuumReleaseException
+    {
+        List<PreparedRelease> releases = getPreparedReleases();
+
+        for ( PreparedRelease release : releases )
+        {
+            if ( release.getReleaseId().equals( releaseId ) &&
+                            release.getReleaseType().equals( releaseType ) )
+            {
+                return release;
+            }
+        }
+
+        return null;
+    }
+
     private Map createProjectMap( Project project )
     {
         Map<String, Object> map = new HashMap<String, Object>();
@@ -668,7 +687,7 @@ public class DefaultDistributedReleaseMa
             try
             {
                 fis = new FileInputStream( file );
-                ContinuumPrepareReleasesModelXpp3Reader reader = new ContinuumPrepareReleasesModelXpp3Reader();
+                ContinuumPrepareReleasesModelStaxReader reader = new ContinuumPrepareReleasesModelStaxReader();
                 PreparedReleaseModel model = reader.read( new InputStreamReader( fis ) );
 
                 return model.getPreparedReleases();
@@ -678,7 +697,7 @@ public class DefaultDistributedReleaseMa
                 log.error( e.getMessage(), e );
                 throw new ContinuumReleaseException( "Unable to get prepared releases", e
);
             }
-            catch ( XmlPullParserException e )
+            catch ( XMLStreamException e )
             {
                 log.error( e.getMessage(), e );
                 throw new ContinuumReleaseException( e.getMessage(), e );
@@ -695,7 +714,8 @@ public class DefaultDistributedReleaseMa
         return null;
     }
 
-    private void addReleasePrepare( String releaseId, String buildAgentUrl, String releaseName,
String releaseType )
+    private void addReleasePrepare( String releaseId, String buildAgentUrl, String releaseName,
String releaseType, 
+                                    String releaseGoals, String username )
         throws ContinuumReleaseException
     {
         PreparedRelease release = new PreparedRelease();
@@ -703,6 +723,8 @@ public class DefaultDistributedReleaseMa
         release.setBuildAgentUrl( buildAgentUrl );
         release.setReleaseName( releaseName );
         release.setReleaseType( releaseType );
+        release.setReleaseGoals( releaseGoals );
+        release.setReleaseBy( username );
 
         List<PreparedRelease> preparedReleases = getPreparedReleases();
 
@@ -826,7 +848,7 @@ public class DefaultDistributedReleaseMa
 
         try
         {
-            ContinuumPrepareReleasesModelXpp3Writer writer = new ContinuumPrepareReleasesModelXpp3Writer();
+            ContinuumPrepareReleasesModelStaxWriter writer = new ContinuumPrepareReleasesModelStaxWriter();
             FileWriter fileWriter = new FileWriter( file );
             writer.write( fileWriter, model );
             fileWriter.flush();
@@ -836,6 +858,10 @@ public class DefaultDistributedReleaseMa
         {
             throw new ContinuumReleaseException( "Failed to write prepared releases in file",
e );
         }
+        catch ( XMLStreamException e )
+        {
+            throw new ContinuumReleaseException( "Failed to write prepared releases in file",
e );
+        }
     }
     
     // for unit test

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=993609&r1=993608&r2=993609&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
Wed Sep  8 05:53:27 2010
@@ -26,6 +26,7 @@ import org.apache.continuum.buildmanager
 import org.apache.continuum.buildmanager.BuildsManager;
 import org.apache.continuum.buildqueue.BuildQueueService;
 import org.apache.continuum.buildqueue.BuildQueueServiceException;
+import org.apache.continuum.configuration.BuildAgentConfigurationException;
 import org.apache.continuum.configuration.ContinuumConfigurationException;
 import org.apache.continuum.dao.BuildDefinitionDao;
 import org.apache.continuum.dao.BuildResultDao;
@@ -41,7 +42,9 @@ import org.apache.continuum.model.projec
 import org.apache.continuum.model.release.ContinuumReleaseResult;
 import org.apache.continuum.purge.ContinuumPurgeManager;
 import org.apache.continuum.purge.PurgeConfigurationService;
+import org.apache.continuum.release.config.ContinuumReleaseDescriptor;
 import org.apache.continuum.release.distributed.manager.DistributedReleaseManager;
+import org.apache.continuum.release.model.PreparedRelease;
 import org.apache.continuum.repository.RepositoryService;
 import org.apache.continuum.taskqueue.manager.TaskQueueManager;
 import org.apache.continuum.taskqueue.manager.TaskQueueManagerException;
@@ -78,11 +81,13 @@ import org.apache.maven.continuum.projec
 import org.apache.maven.continuum.project.builder.ContinuumProjectBuildingResult;
 import org.apache.maven.continuum.project.builder.maven.MavenOneContinuumProjectBuilder;
 import org.apache.maven.continuum.project.builder.maven.MavenTwoContinuumProjectBuilder;
+import org.apache.maven.continuum.release.ContinuumReleaseException;
 import org.apache.maven.continuum.release.ContinuumReleaseManager;
 import org.apache.maven.continuum.store.ContinuumObjectNotFoundException;
 import org.apache.maven.continuum.store.ContinuumStoreException;
 import org.apache.maven.continuum.utils.ContinuumUrlValidator;
 import org.apache.maven.continuum.utils.WorkingDirectoryService;
+import org.apache.maven.shared.release.ReleaseResult;
 import org.codehaus.plexus.action.Action;
 import org.codehaus.plexus.action.ActionManager;
 import org.codehaus.plexus.action.ActionNotFoundException;
@@ -99,8 +104,10 @@ import org.slf4j.LoggerFactory;
 import org.springframework.beans.BeanUtils;
 
 import java.io.File;
+import java.io.FileWriter;
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.PrintWriter;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
@@ -3182,6 +3189,88 @@ public class DefaultContinuum
         return buildDefinitionService;
     }
 
+    public ContinuumReleaseResult addContinuumReleaseResult( int projectId, String releaseId,
String releaseType )
+        throws ContinuumException
+    {
+        ReleaseResult result;
+        String releaseBy = "";
+
+        if ( getConfiguration().isDistributedBuildEnabled() )
+        {
+            try
+            {
+                result = (ReleaseResult) distributedReleaseManager.getReleaseResult( releaseId
);
+                PreparedRelease preparedRelease = distributedReleaseManager.getPreparedRelease(
releaseId, releaseType );
+                if ( preparedRelease != null )
+                {
+                    releaseBy = preparedRelease.getReleaseBy();
+                }
+            }
+            catch ( ContinuumReleaseException e )
+            {
+                throw new ContinuumException( "Failed to release project: " + projectId,
e );
+            }
+            catch ( BuildAgentConfigurationException e )
+            {
+                throw new ContinuumException( "Failed to release project: " + projectId,
e );
+            }
+        }
+        else
+        {
+            result = (ReleaseResult) releaseManager.getReleaseResults().get( releaseId );
+            ContinuumReleaseDescriptor descriptor = (ContinuumReleaseDescriptor) releaseManager.getPreparedReleases().get(
releaseId );
+            if ( descriptor != null )
+            {
+                releaseBy = descriptor.getReleaseBy();
+            }
+        }
+
+        if ( result != null && getContinuumReleaseResult( projectId, releaseType,
result.getStartTime(), result.getEndTime() ) == null )
+        {
+            ContinuumReleaseResult releaseResult = createContinuumReleaseResult( projectId,
releaseType, result, releaseBy );
+            return addContinuumReleaseResult( releaseResult );
+        }
+
+        return null;
+    }
+
+    private ContinuumReleaseResult createContinuumReleaseResult( int projectId, String releaseGoals,
ReleaseResult result, String releaseBy )
+        throws ContinuumException
+    {
+        ContinuumReleaseResult releaseResult = new ContinuumReleaseResult();
+        releaseResult.setStartTime( result.getStartTime() );
+        releaseResult.setEndTime( result.getEndTime() );
+        releaseResult.setResultCode( result.getResultCode() );
+    
+        Project project = getProject( projectId );
+        ProjectGroup projectGroup = project.getProjectGroup();
+        releaseResult.setProjectGroup( projectGroup );
+        releaseResult.setProject( project );
+        releaseResult.setReleaseGoal( releaseGoals );
+        releaseResult.setUsername( releaseBy );
+    
+        String releaseName = "releases-" + result.getStartTime();
+    
+        try
+        {
+            File logFile = getConfiguration().getReleaseOutputFile( projectGroup.getId(),
releaseName );
+    
+            PrintWriter writer = new PrintWriter( new FileWriter( logFile ) );
+            writer.write( result.getOutput() );
+            writer.close();
+        }
+        catch ( ConfigurationException e )
+        {
+            throw new ContinuumException( e.getMessage(), e );
+        }
+        catch ( IOException e )
+        {
+            throw new ContinuumException( "Unable to write output to file", e );
+        }
+    
+        return releaseResult;
+    }
+
     public ContinuumReleaseResult addContinuumReleaseResult( ContinuumReleaseResult releaseResult
)
         throws ContinuumException
     {

Modified: continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java?rev=993609&r1=993608&r2=993609&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java
(original)
+++ continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java
Wed Sep  8 05:53:27 2010
@@ -32,6 +32,7 @@ import org.apache.continuum.dao.ProjectD
 import org.apache.continuum.model.project.ProjectScmRoot;
 import org.apache.continuum.model.release.ContinuumReleaseResult;
 import org.apache.continuum.model.repository.LocalRepository;
+import org.apache.continuum.release.config.ContinuumReleaseDescriptor;
 import org.apache.continuum.repository.RepositoryService;
 import org.apache.continuum.taskqueue.manager.TaskQueueManager;
 import org.apache.continuum.utils.build.BuildTrigger;
@@ -45,6 +46,7 @@ import org.apache.maven.continuum.model.
 import org.apache.maven.continuum.model.project.ProjectGroup;
 import org.apache.maven.continuum.model.project.ProjectNotifier;
 import org.apache.maven.continuum.project.builder.ContinuumProjectBuildingResult;
+import org.apache.maven.shared.release.ReleaseResult;
 import org.jmock.Expectations;
 import org.jmock.Mockery;
 import org.jmock.integration.junit3.JUnit3Mockery;
@@ -641,37 +643,40 @@ public class DefaultContinuumTest
     {
         Continuum continuum = getContinuum();
 
-        ProjectGroup defaultProjectGroup =
-            continuum.getProjectGroupByGroupId( ContinuumInitializer.DEFAULT_PROJECT_GROUP_GROUP_ID
);
-
+        Project project = makeStubProject( "test-project" );
+        ProjectGroup defaultGroup = getDefaultProjectGroup();
+        defaultGroup.addProject( project );
+        getProjectGroupDao().updateProjectGroup( defaultGroup );
+        project = getProjectDao().getProjectByName( "test-project" );
+        assertNotNull ( project );
         assertEquals( 0, continuum.getAllContinuumReleaseResults().size() );
 
-        ContinuumReleaseResult releaseResult = new ContinuumReleaseResult();
-        releaseResult.setStartTime( System.currentTimeMillis() );
+        ReleaseResult result = new ReleaseResult();
+        result.setStartTime( System.currentTimeMillis() );
+        result.setEndTime( System.currentTimeMillis() );
+        result.setResultCode( 200 );
+        result.appendOutput( "Error in release" );
+
+        ContinuumReleaseDescriptor descriptor = new ContinuumReleaseDescriptor();
+        descriptor.setPreparationGoals( "clean" );
+        descriptor.setReleaseBy( "admin" );
 
-        File logFile = continuum.getConfiguration().getReleaseOutputFile( defaultProjectGroup.getId(),
-                                                                          "releases-" + releaseResult.getStartTime()
);
-        logFile.mkdirs();
-
-        assertTrue( logFile.exists() );
-
-        releaseResult.setResultCode( 0 );
-        releaseResult.setEndTime( System.currentTimeMillis() );
-        releaseResult.setProjectGroup( defaultProjectGroup );
+        continuum.getReleaseManager().getReleaseResults().put( "test-release-id", result
);
+        continuum.getReleaseManager().getPreparedReleases().put( "test-release-id", descriptor
);
+
+        ContinuumReleaseResult releaseResult = continuum.addContinuumReleaseResult( project.getId(),
"test-release-id", "prepare" );
 
         releaseResult = continuum.addContinuumReleaseResult( releaseResult );
 
         List<ContinuumReleaseResult> releaseResults =
-            continuum.getContinuumReleaseResultsByProjectGroup( defaultProjectGroup.getId()
);
+            continuum.getContinuumReleaseResultsByProjectGroup( defaultGroup.getId() );
         assertEquals( 1, releaseResults.size() );
         assertEquals( releaseResult, releaseResults.get( 0 ) );
 
         continuum.removeContinuumReleaseResult( releaseResult.getId() );
         assertEquals( 0, continuum.getAllContinuumReleaseResults().size() );
-        assertFalse( logFile.exists() );
-        assertEquals( defaultProjectGroup,
+        assertEquals( defaultGroup,
                       continuum.getProjectGroupByGroupId( ContinuumInitializer.DEFAULT_PROJECT_GROUP_GROUP_ID
) );
-
     }
 
     public void testBuildProjectWhileProjectIsInReleaseStage()

Modified: continuum/trunk/continuum-model/pom.xml
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-model/pom.xml?rev=993609&r1=993608&r2=993609&view=diff
==============================================================================
--- continuum/trunk/continuum-model/pom.xml (original)
+++ continuum/trunk/continuum-model/pom.xml Wed Sep  8 05:53:27 2010
@@ -47,6 +47,7 @@ under the License.
           <packageWithVersion>false</packageWithVersion>
           <models>
             <model>src/main/mdo/continuum.xml</model>
+            <model>src/main/mdo/prepared-releases.mdo</model>
           </models>
           <useJava5>true</useJava5>
         </configuration>

Added: continuum/trunk/continuum-model/src/main/mdo/prepared-releases.mdo
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-model/src/main/mdo/prepared-releases.mdo?rev=993609&view=auto
==============================================================================
--- continuum/trunk/continuum-model/src/main/mdo/prepared-releases.mdo (added)
+++ continuum/trunk/continuum-model/src/main/mdo/prepared-releases.mdo Wed Sep  8 05:53:27
2010
@@ -0,0 +1,95 @@
+<?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 id</description>
+          <type>String</type>
+        </field>
+        <field>
+          <name>releaseName</name>
+          <version>1.0.0+</version>
+          <required>true</required>
+          <description>prepared release name</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>
+        <field>
+          <name>releaseType</name>
+          <version>1.4.0+</version>
+          <required>true</required>
+          <description>type of release. possible values are "prepare" or "perform"</description>
+          <type>String</type>
+        </field>
+        <field>
+          <name>releaseGoals</name>
+          <version>1.4.1+</version>
+          <required>true</required>
+          <description>release goals</description>
+          <type>String</type>
+        </field>
+        <field>
+          <name>releaseBy</name>
+          <version>1.4.1+</version>
+          <required>true</required>
+          <description>release by</description>
+          <type>String</type>
+        </field>
+      </fields>
+    </class>
+  </classes>
+</model>
\ No newline at end of file

Modified: continuum/trunk/continuum-release/pom.xml
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-release/pom.xml?rev=993609&r1=993608&r2=993609&view=diff
==============================================================================
--- continuum/trunk/continuum-release/pom.xml (original)
+++ continuum/trunk/continuum-release/pom.xml Wed Sep  8 05:53:27 2010
@@ -113,30 +113,6 @@ under the License.
     </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.4.0</version>
-          <useJava5>true</useJava5>
-        </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-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=993609&r1=993608&r2=993609&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
Wed Sep  8 05:53:27 2010
@@ -19,23 +19,15 @@ package org.apache.maven.continuum.web.a
  * under the License.
  */
 
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.PrintWriter;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 
 import org.apache.continuum.configuration.BuildAgentConfigurationException;
-import org.apache.continuum.model.release.ContinuumReleaseResult;
 import org.apache.continuum.model.release.ReleaseListenerSummary;
 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;
-import org.apache.maven.continuum.model.project.ProjectGroup;
 import org.apache.maven.continuum.release.ContinuumReleaseManager;
 import org.apache.maven.continuum.release.ContinuumReleaseManagerListener;
 import org.apache.maven.continuum.web.exception.AuthorizationRequiredException;
@@ -121,13 +113,7 @@ public class ReleaseInProgressAction
     
                 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 );
-                    }
+                    getContinuum().addContinuumReleaseResult( projectId, releaseId, releaseGoal
);
                 }
 
                 listenerSummary.setPhases( DistributedReleaseUtil.getReleasePhases( map )
);
@@ -170,13 +156,7 @@ public class ReleaseInProgressAction
 
             if ( status.equals( SUCCESS ) )
             {
-                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 );
-                }
+                getContinuum().addContinuumReleaseResult( projectId, releaseId, releaseGoal
);
             }
         }
 
@@ -340,43 +320,6 @@ public class ReleaseInProgressAction
         this.listenerSummary = listenerSummary;
     }
 
-    private ContinuumReleaseResult createContinuumReleaseResult( ReleaseResult result )
-        throws ContinuumException
-    {
-        ContinuumReleaseResult releaseResult = new ContinuumReleaseResult();
-        releaseResult.setStartTime( result.getStartTime() );
-        releaseResult.setEndTime( result.getEndTime() );
-        releaseResult.setResultCode( result.getResultCode() );
-
-        Project project = getContinuum().getProject( projectId );
-        ProjectGroup projectGroup = project.getProjectGroup();
-        releaseResult.setProjectGroup( projectGroup );
-        releaseResult.setProject( project );
-        releaseResult.setReleaseGoal( releaseGoal );
-        releaseResult.setUsername( username );
-
-        String releaseName = "releases-" + result.getStartTime();
-
-        try
-        {
-            File logFile = getContinuum().getConfiguration().getReleaseOutputFile( projectGroup.getId(),
releaseName );
-
-            PrintWriter writer = new PrintWriter( new FileWriter( logFile ) );
-            writer.write( result.getOutput() );
-            writer.close();
-        }
-        catch ( ConfigurationException e )
-        {
-            throw new ContinuumException( e.getMessage(), e );
-        }
-        catch ( IOException e )
-        {
-            throw new ContinuumException( "Unable to write output to file", e );
-        }
-
-        return releaseResult;
-    }
-    
     public String getProjectName()
         throws ContinuumException
     {

Modified: continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-api/src/main/java/org/apache/maven/continuum/xmlrpc/ContinuumService.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-api/src/main/java/org/apache/maven/continuum/xmlrpc/ContinuumService.java?rev=993609&r1=993608&r2=993609&view=diff
==============================================================================
--- continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-api/src/main/java/org/apache/maven/continuum/xmlrpc/ContinuumService.java
(original)
+++ continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-api/src/main/java/org/apache/maven/continuum/xmlrpc/ContinuumService.java
Wed Sep  8 05:53:27 2010
@@ -1523,6 +1523,18 @@ public interface ContinuumService
         throws Exception;
 
     /**
+     * Cleanup the release
+     * 
+     * @param projectId
+     * @param releaseId
+     * @param releaseType
+     * @return
+     * @throws Exception
+     */
+    int releaseCleanup( int projectId, String releaseId, String releaseType )
+        throws Exception;
+
+    /**
      * Rollback a release
      * 
      * @param projectId

Modified: continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-client/src/main/java/org/apache/maven/continuum/xmlrpc/client/ContinuumXmlRpcClient.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-client/src/main/java/org/apache/maven/continuum/xmlrpc/client/ContinuumXmlRpcClient.java?rev=993609&r1=993608&r2=993609&view=diff
==============================================================================
--- continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-client/src/main/java/org/apache/maven/continuum/xmlrpc/client/ContinuumXmlRpcClient.java
(original)
+++ continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-client/src/main/java/org/apache/maven/continuum/xmlrpc/client/ContinuumXmlRpcClient.java
Wed Sep  8 05:53:27 2010
@@ -1182,6 +1182,12 @@ public class ContinuumXmlRpcClient
         return continuum.releaseCleanup( projectId, releaseId );
     }
 
+    public int releaseCleanup( int projectId, String releaseId, String releaseType )
+        throws Exception
+    {
+        return continuum.releaseCleanup( projectId, releaseId, releaseType );
+    }
+
     public int releaseRollback( int projectId, String releaseId )
         throws Exception
     {

Modified: continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/pom.xml
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/pom.xml?rev=993609&r1=993608&r2=993609&view=diff
==============================================================================
--- continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/pom.xml (original)
+++ continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/pom.xml Wed Sep  8 05:53:27 2010
@@ -53,6 +53,10 @@ under the License.
       <artifactId>continuum-buildagent-api</artifactId>
     </dependency>
     <dependency>
+      <groupId>org.apache.continuum</groupId>
+      <artifactId>continuum-release</artifactId>
+    </dependency>
+    <dependency>
       <groupId>org.codehaus.redback</groupId>
       <artifactId>redback-rbac-role-manager</artifactId>
     </dependency>

Modified: continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java?rev=993609&r1=993608&r2=993609&view=diff
==============================================================================
--- continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java
(original)
+++ continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java
Wed Sep  8 05:53:27 2010
@@ -38,6 +38,7 @@ import org.apache.continuum.buildmanager
 import org.apache.continuum.dao.SystemConfigurationDao;
 import org.apache.continuum.purge.ContinuumPurgeManagerException;
 import org.apache.continuum.purge.PurgeConfigurationServiceException;
+import org.apache.continuum.release.config.ContinuumReleaseDescriptor;
 import org.apache.continuum.repository.RepositoryServiceException;
 import org.apache.continuum.xmlrpc.release.ContinuumReleaseResult;
 import org.apache.continuum.xmlrpc.repository.DirectoryPurgeConfiguration;
@@ -72,6 +73,7 @@ import org.apache.maven.continuum.xmlrpc
 import org.apache.maven.continuum.xmlrpc.system.Profile;
 import org.apache.maven.continuum.xmlrpc.system.SystemConfiguration;
 import org.apache.maven.scm.provider.svn.repository.SvnScmProviderRepository;
+import org.apache.maven.shared.release.ReleaseResult;
 import org.codehaus.plexus.redback.authorization.AuthorizationException;
 import org.codehaus.plexus.redback.role.RoleManager;
 import org.codehaus.plexus.redback.role.RoleManagerException;
@@ -2866,11 +2868,19 @@ public class ContinuumServiceImpl
     public int releaseCleanup( int projectId, String releaseId )
         throws Exception
     {
+        return releaseCleanup( projectId, releaseId, null );
+    }
+
+    public int releaseCleanup( int projectId, String releaseId, String releaseType )
+        throws Exception
+    {
         org.apache.maven.continuum.model.project.Project project = continuum.getProject(
projectId );
 
         if ( project != null )
         {
             checkBuildProjectInGroupAuthorization( project.getProjectGroup().getName() );
+            continuum.addContinuumReleaseResult( projectId, releaseId, releaseType );
+
             if ( continuum.getConfiguration().isDistributedBuildEnabled() )
             {
                 continuum.getDistributedReleaseManager().releaseCleanup( releaseId );



Mime
View raw message