continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r988398 - in /continuum/trunk: continuum-api/src/main/java/org/apache/continuum/repository/ continuum-api/src/main/java/org/apache/maven/continuum/release/ continuum-core/src/main/java/org/apache/continuum/repository/ continuum-core/src/tes...
Date Tue, 24 Aug 2010 06:18:01 GMT
Author: ctan
Date: Tue Aug 24 06:18:00 2010
New Revision: 988398

URL: http://svn.apache.org/viewvc?rev=988398&view=rev
Log:
[CONTINUUM-2565] added ability to do release prepare, release perform, release cleanup and
release rollback from continuum xmlrpc

Added:
    continuum/trunk/continuum-model/src/main/java/org/apache/continuum/model/release/
    continuum/trunk/continuum-model/src/main/java/org/apache/continuum/model/release/ReleaseListenerSummary.java
Modified:
    continuum/trunk/continuum-api/src/main/java/org/apache/continuum/repository/RepositoryService.java
    continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/release/ContinuumReleaseManager.java
    continuum/trunk/continuum-core/src/main/java/org/apache/continuum/repository/DefaultRepositoryService.java
    continuum/trunk/continuum-core/src/test/java/org/apache/continuum/repository/DefaultRepositoryServiceTest.java
    continuum/trunk/continuum-release/src/main/java/org/apache/continuum/release/config/ContinuumPropertiesReleaseDescriptorStore.java
    continuum/trunk/continuum-release/src/main/java/org/apache/continuum/release/config/ContinuumReleaseDescriptor.java
    continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/DefaultContinuumReleaseManager.java
    continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseInProgressAction.java
    continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePrepareAction.java
    continuum/trunk/continuum-webapp/src/main/mdo/view-models.mdo
    continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-api/src/main/java/org/apache/maven/continuum/xmlrpc/ContinuumService.java
    continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-api/src/main/mdo/continuum-service.xml
    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/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java
    continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/resources/dozerBeanMapping.xml

Modified: continuum/trunk/continuum-api/src/main/java/org/apache/continuum/repository/RepositoryService.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-api/src/main/java/org/apache/continuum/repository/RepositoryService.java?rev=988398&r1=988397&r2=988398&view=diff
==============================================================================
--- continuum/trunk/continuum-api/src/main/java/org/apache/continuum/repository/RepositoryService.java
(original)
+++ continuum/trunk/continuum-api/src/main/java/org/apache/continuum/repository/RepositoryService.java
Tue Aug 24 06:18:00 2010
@@ -98,4 +98,14 @@ public interface RepositoryService
      */
     LocalRepository getLocalRepository( int repositoryId )
         throws RepositoryServiceException;
+
+    /**
+     * Retrieve local repository
+     * 
+     * @param repositoryName
+     * @return
+     * @throws RepositoryServiceException
+     */
+    LocalRepository getLocalRepositoryByName( String repositoryName )
+        throws RepositoryServiceException;
 }
\ No newline at end of file

Modified: continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/release/ContinuumReleaseManager.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/release/ContinuumReleaseManager.java?rev=988398&r1=988397&r2=988398&view=diff
==============================================================================
--- continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/release/ContinuumReleaseManager.java
(original)
+++ continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/release/ContinuumReleaseManager.java
Tue Aug 24 06:18:00 2010
@@ -19,9 +19,9 @@ package org.apache.maven.continuum.relea
  * under the License.
  */
 
+import org.apache.continuum.model.release.ReleaseListenerSummary;
 import org.apache.continuum.model.repository.LocalRepository;
 import org.apache.maven.continuum.model.project.Project;
-import org.apache.maven.continuum.model.system.Profile;
 
 import java.io.File;
 import java.util.Map;
@@ -146,4 +146,10 @@ public interface ContinuumReleaseManager
      */
     String sanitizeTagName( String scmUrl, String tagName )
         throws Exception;
+
+    /**
+     * @param releaseId
+     * @return
+     */
+    ReleaseListenerSummary getListener( String releaseId );
 }

Modified: continuum/trunk/continuum-core/src/main/java/org/apache/continuum/repository/DefaultRepositoryService.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/continuum/repository/DefaultRepositoryService.java?rev=988398&r1=988397&r2=988398&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/continuum/repository/DefaultRepositoryService.java
(original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/continuum/repository/DefaultRepositoryService.java
Tue Aug 24 06:18:00 2010
@@ -216,6 +216,23 @@ public class DefaultRepositoryService
         }
     }
 
+    public LocalRepository getLocalRepositoryByName( String repositoryName )
+        throws RepositoryServiceException
+    {
+        try
+        {
+            return localRepositoryDao.getLocalRepositoryByName( repositoryName );
+        }
+        catch ( ContinuumObjectNotFoundException e )
+        {
+            throw new RepositoryServiceException( "No repository found with name: " + repositoryName,
e );
+        }
+        catch ( ContinuumStoreException e )
+        {
+            throw new RepositoryServiceException( "Unable to retrieve local repository: "
+ repositoryName, e );
+        }
+    }
+
     private void removePurgeConfigurationsOfRepository( int repositoryId )
         throws RepositoryServiceException
     {

Modified: continuum/trunk/continuum-core/src/test/java/org/apache/continuum/repository/DefaultRepositoryServiceTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/test/java/org/apache/continuum/repository/DefaultRepositoryServiceTest.java?rev=988398&r1=988397&r2=988398&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/test/java/org/apache/continuum/repository/DefaultRepositoryServiceTest.java
(original)
+++ continuum/trunk/continuum-core/src/test/java/org/apache/continuum/repository/DefaultRepositoryServiceTest.java
Tue Aug 24 06:18:00 2010
@@ -91,6 +91,14 @@ public class DefaultRepositoryServiceTes
         assertEquals( "check # repositories", 1, repositories.size() );
         assertTrue( "check if repository was added", repositories.contains( repository )
);
 
+        LocalRepository repo = repositoryService.getLocalRepositoryByName( "DefaultRepo"
);
+        assertNotNull( repo );
+        assertEquals( "check if repository name is the same", repository.getName(), repo.getName()
);
+
+        repo = repositoryService.getLocalRepositoryByLocation( repository.getLocation() );
+        assertNotNull( repo );
+        assertEquals( "check if repository location is the same", repository.getLocation(),
repo.getLocation() );
+
         ProjectGroup retrievedGroup = getDefaultProjectGroup();
         assertNotNull( retrievedGroup.getLocalRepository() );
         assertEquals( "check if repository is the same", repository, retrievedGroup.getLocalRepository()
);

Added: continuum/trunk/continuum-model/src/main/java/org/apache/continuum/model/release/ReleaseListenerSummary.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-model/src/main/java/org/apache/continuum/model/release/ReleaseListenerSummary.java?rev=988398&view=auto
==============================================================================
--- continuum/trunk/continuum-model/src/main/java/org/apache/continuum/model/release/ReleaseListenerSummary.java
(added)
+++ continuum/trunk/continuum-model/src/main/java/org/apache/continuum/model/release/ReleaseListenerSummary.java
Tue Aug 24 06:18:00 2010
@@ -0,0 +1,90 @@
+package org.apache.continuum.model.release;
+
+import java.util.List;
+
+public class ReleaseListenerSummary
+{
+    private String goalName;
+
+    private String error;
+
+    private String username;
+
+    private String inProgress;
+
+    private int state;
+
+    private List<String> phases;
+
+    public String getGoalName()
+    {
+        return goalName;
+    }
+
+    public void setGoalName( String goalName )
+    {
+        this.goalName = goalName;
+    }
+
+    public String getError()
+    {
+        return error;
+    }
+
+    public void setError( String error )
+    {
+        this.error = error;
+    }
+
+    public String getUsername()
+    {
+        return username;
+    }
+
+    public void setUsername( String username )
+    {
+        this.username = username;
+    }
+
+    public String getInProgress()
+    {
+        return inProgress;
+    }
+
+    public void setInProgress( String inProgress )
+    {
+        this.inProgress = inProgress;
+    }
+
+    public int getState()
+    {
+        return state;
+    }
+
+    public void setState( int state )
+    {
+        this.state = state;
+    }
+
+    public List<String> getPhases()
+    {
+        return phases;
+    }
+
+    public void setPhases( List<String> phases )
+    {
+        this.phases = phases;
+    }
+
+    public List<String> getCompletedPhases()
+    {
+        return completedPhases;
+    }
+
+    public void setCompletedPhases( List<String> completedPhases )
+    {
+        this.completedPhases = completedPhases;
+    }
+
+    private List<String> completedPhases;
+}

Modified: continuum/trunk/continuum-release/src/main/java/org/apache/continuum/release/config/ContinuumPropertiesReleaseDescriptorStore.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-release/src/main/java/org/apache/continuum/release/config/ContinuumPropertiesReleaseDescriptorStore.java?rev=988398&r1=988397&r2=988398&view=diff
==============================================================================
--- continuum/trunk/continuum-release/src/main/java/org/apache/continuum/release/config/ContinuumPropertiesReleaseDescriptorStore.java
(original)
+++ continuum/trunk/continuum-release/src/main/java/org/apache/continuum/release/config/ContinuumPropertiesReleaseDescriptorStore.java
Tue Aug 24 06:18:00 2010
@@ -83,6 +83,7 @@ public class ContinuumPropertiesReleaseD
         releaseDescriptor.setPomFileName( properties.getProperty( "exec.pomFileName" ) );
         releaseDescriptor.setPreparationGoals( properties.getProperty( "preparationGoals"
) );
         releaseDescriptor.setExecutable( properties.getProperty( "build.executable" ) );
+        releaseDescriptor.setReleaseBy( properties.getProperty( "release.by" ) );
 
         loadResolvedDependencies( properties, releaseDescriptor );
 
@@ -254,6 +255,12 @@ public class ContinuumPropertiesReleaseD
             properties.setProperty( "build.executable", config.getExecutable() );
         }
 
+        // release by
+        if ( config.getReleaseBy() != null )
+        {
+            properties.setProperty( "release.by", config.getReleaseBy() );
+        }
+
         OutputStream outStream = null;
         //noinspection OverlyBroadCatchBlock
         try

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=988398&r1=988397&r2=988398&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
Tue Aug 24 06:18:00 2010
@@ -34,6 +34,8 @@ public class ContinuumReleaseDescriptor
 
     private String executable;
 
+    private String releaseBy;
+
     public void addEnvironment( String name, String value )
     {
         getEnvironments().put( name, value );
@@ -77,4 +79,14 @@ public class ContinuumReleaseDescriptor
     {
         this.executable = executable;
     }
+
+    public String getReleaseBy()
+    {
+        return releaseBy;
+    }
+
+    public void setReleaseBy( String releaseBy )
+    {
+        this.releaseBy = releaseBy;
+    }
 }

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=988398&r1=988397&r2=988398&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
Tue Aug 24 06:18:00 2010
@@ -25,6 +25,7 @@ import java.util.Map;
 import java.util.Properties;
 
 import org.apache.commons.lang.BooleanUtils;
+import org.apache.continuum.model.release.ReleaseListenerSummary;
 import org.apache.continuum.model.repository.LocalRepository;
 import org.apache.continuum.release.config.ContinuumReleaseDescriptor;
 import org.apache.maven.continuum.model.project.Project;
@@ -111,6 +112,12 @@ public class DefaultContinuumReleaseMana
             getReleaseDescriptor( project, releaseProperties, relVersions, devVersions, environments,
workingDirectory,
                                   executable );
 
+        if ( listener == null )
+        {
+            listener = new DefaultReleaseManagerListener();
+            listener.setUsername( releaseProperties.getProperty( "releaseBy" ) );
+        }
+
         getListeners().put( releaseId, listener );
 
         try
@@ -150,7 +157,6 @@ public class DefaultContinuumReleaseMana
         throws ContinuumReleaseException
     {
         ReleaseDescriptor descriptor = readReleaseDescriptor( workingDirectory );
-
         perform( releaseId, descriptor, buildDirectory, goals, arguments, useReleaseProfile,
listener, null );
     }
 
@@ -164,6 +170,15 @@ public class DefaultContinuumReleaseMana
             descriptor.setAdditionalArguments( arguments );
         }
 
+        if ( listener == null )
+        {
+            listener = new DefaultReleaseManagerListener();
+            if ( descriptor instanceof ContinuumReleaseDescriptor )
+            {
+                listener.setUsername( ( (ContinuumReleaseDescriptor) descriptor ).getReleaseBy()
);
+            }
+        }
+
         try
         {
             getListeners().put( releaseId, listener );
@@ -183,6 +198,15 @@ public class DefaultContinuumReleaseMana
     {
         ReleaseDescriptor descriptor = readReleaseDescriptor( workingDirectory );
 
+        if ( listener == null )
+        {
+            listener = new DefaultReleaseManagerListener();
+            if ( descriptor instanceof ContinuumReleaseDescriptor )
+            {
+                listener.setUsername( ( (ContinuumReleaseDescriptor) descriptor ).getReleaseBy()
);
+            }
+        }
+
         rollback( releaseId, descriptor, listener );
     }
 
@@ -291,6 +315,9 @@ public class DefaultContinuumReleaseMana
         descriptor.setEnvironments( environments );
         descriptor.setExecutable( executable );
 
+        //release by
+        descriptor.setReleaseBy( releaseProperties.getProperty( "releaseBy" ) );
+
         return descriptor;
     }
 
@@ -329,4 +356,25 @@ public class DefaultContinuumReleaseMana
         ScmProvider scmProvider = scmManager.getProviderByRepository( scmRepo );
         return scmProvider.sanitizeTagName( tagName );
     }
+
+    public ReleaseListenerSummary getListener( String releaseId )
+    {
+        ContinuumReleaseManagerListener listener = (ContinuumReleaseManagerListener) getListeners().get(
releaseId );
+
+        if ( listener != null )
+        {
+            ReleaseListenerSummary listenerSummary = new ReleaseListenerSummary();
+            listenerSummary.setGoalName( listener.getGoalName() );
+            listenerSummary.setError( listener.getError() );
+            listenerSummary.setInProgress( listener.getInProgress() );
+            listenerSummary.setState( listener.getState() );
+            listenerSummary.setPhases( listener.getPhases() );
+            listenerSummary.setCompletedPhases( listener.getCompletedPhases() );
+            listenerSummary.setUsername( listener.getUsername() );
+    
+            return listenerSummary;
+        }
+
+        return null;
+    }
 }

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=988398&r1=988397&r2=988398&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
Tue Aug 24 06:18:00 2010
@@ -29,6 +29,7 @@ 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;
@@ -38,7 +39,6 @@ import org.apache.maven.continuum.model.
 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;
 
 /**
@@ -144,17 +144,17 @@ public class ReleaseInProgressAction
         {
             ContinuumReleaseManager releaseManager = getContinuum().getReleaseManager();
     
-            listener = (ContinuumReleaseManagerListener) releaseManager.getListeners().get(
releaseId );
-    
-            if ( listener != null )
+            listenerSummary = releaseManager.getListener( releaseId );
+
+            if ( listenerSummary != null )
             {
-            	username = listener.getUsername();
+            	username = listenerSummary.getUsername();
             	
-                if ( listener.getState() == ContinuumReleaseManagerListener.LISTENING )
+                if ( listenerSummary.getState() == ContinuumReleaseManagerListener.LISTENING
)
                 {
                     status = "inProgress";
                 }
-                else if ( listener.getState() == ContinuumReleaseManagerListener.FINISHED
)
+                else if ( listenerSummary.getState() == ContinuumReleaseManagerListener.FINISHED
)
                 {
                     status = SUCCESS;
                 }
@@ -162,11 +162,6 @@ public class ReleaseInProgressAction
                 {
                     status = "initialized";
                 }
-
-                listenerSummary.setPhases( listener.getPhases() );
-                listenerSummary.setCompletedPhases( listener.getCompletedPhases() );
-                listenerSummary.setInProgress( listener.getInProgress() );
-                listenerSummary.setError( listener.getError() );
             }
             else
             {
@@ -250,18 +245,13 @@ public class ReleaseInProgressAction
         {
             ContinuumReleaseManager releaseManager = getContinuum().getReleaseManager();
     
-            listener = (ContinuumReleaseManagerListener) releaseManager.getListeners().get(
releaseId );
+            listenerSummary = releaseManager.getListener( releaseId );
     
-            if ( listener != null )
-            {
-                listenerSummary.setPhases( listener.getPhases() );
-                listenerSummary.setCompletedPhases( listener.getCompletedPhases() );
-                listenerSummary.setInProgress( listener.getInProgress() );
-                listenerSummary.setError( listener.getError() );
-                
-                username = listener.getUsername();
+            if ( listenerSummary != null )
+            {                
+                username = listenerSummary.getUsername();
 
-                if ( listener.getState() == ContinuumReleaseManagerListener.FINISHED )
+                if ( listenerSummary.getState() == ContinuumReleaseManagerListener.FINISHED
)
                 {
                     result = (ReleaseResult) releaseManager.getReleaseResults().get( releaseId
);
     

Modified: continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePrepareAction.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePrepareAction.java?rev=988398&r1=988397&r2=988398&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePrepareAction.java
(original)
+++ continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePrepareAction.java
Tue Aug 24 06:18:00 2010
@@ -20,6 +20,7 @@ package org.apache.maven.continuum.web.a
  */
 
 import org.apache.continuum.configuration.BuildAgentConfigurationException;
+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.continuum.web.action.AbstractReleaseAction;
@@ -33,7 +34,6 @@ import org.apache.maven.continuum.releas
 import org.apache.maven.continuum.release.ContinuumReleaseManagerListener;
 import org.apache.maven.continuum.release.DefaultReleaseManagerListener;
 import org.apache.maven.continuum.web.exception.AuthorizationRequiredException;
-import org.apache.maven.continuum.web.model.ReleaseListenerSummary;
 import org.apache.maven.model.Model;
 import org.apache.maven.model.Plugin;
 import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
@@ -467,11 +467,11 @@ public class ReleasePrepareAction
         {
             ContinuumReleaseManager releaseManager = getContinuum().getReleaseManager();
     
-            listener = (ContinuumReleaseManagerListener) releaseManager.getListeners().get(
releaseId );
+            listenerSummary = releaseManager.getListener( releaseId );
     
-            if ( listener != null )
+            if ( listenerSummary != null )
             {
-                if ( listener.getState() == ContinuumReleaseManagerListener.FINISHED )
+                if ( listenerSummary.getState() == ContinuumReleaseManagerListener.FINISHED
)
                 {
                     releaseManager.getListeners().remove( releaseId );
     
@@ -483,11 +483,6 @@ public class ReleasePrepareAction
                 {
                     status = "inProgress";
                 }
-
-                listenerSummary.setPhases( listener.getPhases() );
-                listenerSummary.setCompletedPhases( listener.getCompletedPhases() );
-                listenerSummary.setInProgress( listener.getInProgress() );
-                listenerSummary.setError( listener.getError() );
             }
             else
             {

Modified: continuum/trunk/continuum-webapp/src/main/mdo/view-models.mdo
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/mdo/view-models.mdo?rev=988398&r1=988397&r2=988398&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/mdo/view-models.mdo (original)
+++ continuum/trunk/continuum-webapp/src/main/mdo/view-models.mdo Tue Aug 24 06:18:00 2010
@@ -542,42 +542,6 @@
       </fields>
     </class>
     <class>
-      <name>ReleaseListenerSummary</name>
-      <version>1.0.0+</version>
-      <fields>
-        <field>
-          <name>phases</name>
-          <version>1.0.0+</version>
-          <required>true</required>
-          <description>Release Phases</description>
-          <association>
-            <type>String</type>
-            <multiplicity>*</multiplicity>
-          </association>
-        </field>
-        <field>
-          <name>completedPhases</name>
-          <version>1.0.0+</version>
-          <description>Completed release phases</description>
-          <association>
-            <type>String</type>
-            <multiplicity>*</multiplicity>
-          </association>
-        </field>
-        <field>
-          <name>inProgress</name>
-          <version>1.0.0+</version>
-          <description>Release phase in progress</description> 
-          <type>String</type>
-        </field>
-        <field>
-          <name>error</name>
-          <version>1.0.0+</version>
-          <type>String</type>
-        </field>
-      </fields>
-    </class>
-    <class>
       <name>DistributedReleaseSummary</name>
       <version>1.0.0+</version>
       <fields>

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=988398&r1=988397&r2=988398&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
Tue Aug 24 06:18:00 2010
@@ -21,6 +21,7 @@ package org.apache.maven.continuum.xmlrp
 
 import java.util.List;
 import java.util.Map;
+import java.util.Properties;
 
 import org.apache.continuum.xmlrpc.release.ContinuumReleaseResult;
 import org.apache.continuum.xmlrpc.repository.DirectoryPurgeConfiguration;
@@ -38,6 +39,7 @@ import org.apache.maven.continuum.xmlrpc
 import org.apache.maven.continuum.xmlrpc.project.ProjectGroupSummary;
 import org.apache.maven.continuum.xmlrpc.project.ProjectNotifier;
 import org.apache.maven.continuum.xmlrpc.project.ProjectSummary;
+import org.apache.maven.continuum.xmlrpc.project.ReleaseListenerSummary;
 import org.apache.maven.continuum.xmlrpc.project.Schedule;
 import org.apache.maven.continuum.xmlrpc.system.Installation;
 import org.apache.maven.continuum.xmlrpc.system.Profile;
@@ -1464,4 +1466,70 @@ public interface ContinuumService
      */
     String getReleaseOutput( int releaseId )
         throws Exception;
+
+    /**
+     * Release prepare a project
+     * 
+     * @param projectId
+     * @param releaseProperties
+     * @param releaseVersions
+     * @param developmentVersions
+     * @param environments
+     * @param username
+     * @return The release id
+     * @throws Exception
+     */
+    String releasePrepare( int projectId, Properties releaseProperties, Map<String, String>
releaseVersions,
+                         Map<String, String> developmentVersions, Map<String, String>
environments, String username )
+        throws Exception;
+
+    /**
+     * Release perform a project
+     * 
+     * @param projectId
+     * @param releaseId
+     * @param goals
+     * @param arguments
+     * @param useReleaseProfile
+     * @param repositoryName
+     * @param username
+     * @return
+     * @throws Exception
+     */
+    int releasePerform( int projectId, String releaseId, String goals, String arguments,
boolean useReleaseProfile, 
+                         String repositoryName, String username )
+        throws Exception;
+
+    /**
+     * Get release listener
+     * 
+     * @param projectId
+     * @param releaseId
+     * @return
+     * @throws Exception
+     */
+    ReleaseListenerSummary getListener( int projectId, String releaseId )
+        throws Exception;
+
+    /**
+     * Cleanup the release
+     * 
+     * @param projectId
+     * @param releaseId
+     * @return
+     * @throws Exception
+     */
+    int releaseCleanup( int projectId, String releaseId )
+        throws Exception;
+
+    /**
+     * Rollback a release
+     * 
+     * @param projectId
+     * @param releaseId
+     * @return
+     * @throws Exception
+     */
+    int releaseRollback( int projectId, String releaseId )
+        throws Exception;
 }

Modified: continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-api/src/main/mdo/continuum-service.xml
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-api/src/main/mdo/continuum-service.xml?rev=988398&r1=988397&r2=988398&view=diff
==============================================================================
--- continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-api/src/main/mdo/continuum-service.xml
(original)
+++ continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-api/src/main/mdo/continuum-service.xml
Tue Aug 24 06:18:00 2010
@@ -1424,5 +1424,47 @@
         </field>
       </fields>
     </class>
+    <class>
+      <name>ReleaseListenerSummary</name>
+      <version>1.4.1+</version>
+      <fields>
+        <field>
+          <name>phases</name>
+          <version>1.4.1+</version>
+          <association>
+            <type>String</type>
+            <multiplicity>*</multiplicity>
+          </association>
+        </field>
+        <field>
+          <name>completedPhases</name>
+          <version>1.4.1+</version>
+          <association>
+            <type>String</type>
+            <multiplicity>*</multiplicity>
+          </association>
+        </field>
+        <field>
+          <name>inProgress</name>
+          <version>1.4.1+</version>
+          <type>String</type>
+        </field>
+        <field>
+          <name>state</name>
+          <version>1.4.1+</version>
+          <type>int</type>
+        </field>
+        <field>
+          <name>error</name>
+          <version>1.4.1+</version>
+          <type>String</type>
+        </field>
+        <field>
+          <name>username</name>
+          <version>1.4.1+</version>
+          <type>String</type>
+        </field>
+      </fields>
+    </class>
   </classes>
 </model>

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=988398&r1=988397&r2=988398&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
Tue Aug 24 06:18:00 2010
@@ -23,6 +23,7 @@ import java.net.URL;
 import java.util.Hashtable;
 import java.util.List;
 import java.util.Map;
+import java.util.Properties;
 
 import org.apache.continuum.xmlrpc.release.ContinuumReleaseResult;
 import org.apache.continuum.xmlrpc.repository.DirectoryPurgeConfiguration;
@@ -42,6 +43,7 @@ import org.apache.maven.continuum.xmlrpc
 import org.apache.maven.continuum.xmlrpc.project.ProjectGroupSummary;
 import org.apache.maven.continuum.xmlrpc.project.ProjectNotifier;
 import org.apache.maven.continuum.xmlrpc.project.ProjectSummary;
+import org.apache.maven.continuum.xmlrpc.project.ReleaseListenerSummary;
 import org.apache.maven.continuum.xmlrpc.project.Schedule;
 import org.apache.maven.continuum.xmlrpc.system.Installation;
 import org.apache.maven.continuum.xmlrpc.system.Profile;
@@ -1152,4 +1154,37 @@ public class ContinuumXmlRpcClient
     {
         return continuum.getAllLocalRepositoriesRPC();
     }
+
+    public int releasePerform( int projectId, String releaseId, String goals, String arguments,
+                                boolean useReleaseProfile, String repositoryName, String
username )
+        throws Exception
+    {
+        return continuum.releasePerform( projectId, releaseId, goals, arguments, useReleaseProfile,
repositoryName, username );
+    }
+
+    public String releasePrepare( int projectId, Properties releaseProperties, Map<String,
String> releaseVersions,
+                                Map<String, String> developmentVersions, Map<String,
String> environments,
+                                String username )
+        throws Exception
+    {
+        return continuum.releasePrepare( projectId, releaseProperties, releaseVersions, developmentVersions,
environments, username );
+    }
+
+    public ReleaseListenerSummary getListener( int projectId, String releaseId )
+        throws Exception
+    {
+        return continuum.getListener( projectId, releaseId );
+    }
+
+    public int releaseCleanup( int projectId, String releaseId )
+        throws Exception
+    {
+        return continuum.releaseCleanup( projectId, releaseId );
+    }
+
+    public int releaseRollback( int projectId, String releaseId )
+        throws Exception
+    {
+        return continuum.releaseRollback( projectId, releaseId );
+    }
 }

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=988398&r1=988397&r2=988398&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
Tue Aug 24 06:18:00 2010
@@ -19,6 +19,7 @@ package org.apache.maven.continuum.xmlrp
  * under the License.
  */
 
+import java.io.File;
 import java.lang.reflect.Field;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -27,6 +28,7 @@ import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.Properties;
 import java.util.Set;
 
 import org.apache.continuum.buildagent.NoBuildAgentException;
@@ -47,6 +49,7 @@ import org.apache.maven.continuum.Contin
 import org.apache.maven.continuum.builddefinition.BuildDefinitionServiceException;
 import org.apache.maven.continuum.execution.ContinuumBuildExecutorConstants;
 import org.apache.maven.continuum.installation.InstallationException;
+import org.apache.maven.continuum.installation.InstallationService;
 import org.apache.maven.continuum.profile.ProfileException;
 import org.apache.maven.continuum.project.ContinuumProjectState;
 import org.apache.maven.continuum.project.builder.ContinuumProjectBuildingResult;
@@ -63,6 +66,7 @@ import org.apache.maven.continuum.xmlrpc
 import org.apache.maven.continuum.xmlrpc.project.ProjectGroupSummary;
 import org.apache.maven.continuum.xmlrpc.project.ProjectNotifier;
 import org.apache.maven.continuum.xmlrpc.project.ProjectSummary;
+import org.apache.maven.continuum.xmlrpc.project.ReleaseListenerSummary;
 import org.apache.maven.continuum.xmlrpc.project.Schedule;
 import org.apache.maven.continuum.xmlrpc.system.Installation;
 import org.apache.maven.continuum.xmlrpc.system.Profile;
@@ -2760,4 +2764,198 @@ public class ContinuumServiceImpl
     {
         return serializeObject( this.getAllLocalRepositories() );
     }
+
+    public String releasePrepare( int projectId, Properties releaseProperties, Map<String,
String> releaseVersions,
+                                Map<String, String> developmentVersions, Map<String,
String> environments, String username )
+        throws Exception
+    {
+        org.apache.maven.continuum.model.project.Project project = continuum.getProject(
projectId );
+
+        if ( project != null )
+        {
+            checkBuildProjectInGroupAuthorization( project.getProjectGroup().getName() );
+
+            if ( continuum.getConfiguration().isDistributedBuildEnabled() )
+            {
+                return continuum.getDistributedReleaseManager().releasePrepare( project,
releaseProperties, releaseVersions, 
+                                                                                developmentVersions,
environments, username );
+            }
+            else
+            {
+                String executable = null;
+
+                if ( environments != null )
+                {
+                    String m2Home = environments.get( continuum.getInstallationService().getEnvVar(
InstallationService.MAVEN2_TYPE ) );
+                    if ( StringUtils.isNotEmpty( m2Home ) )
+                    {
+                        executable = m2Home + File.separator + "bin" + File.separator + executable;
+                    }
+                }
+
+                releaseProperties.setProperty( "releaseBy", username );
+                return continuum.getReleaseManager().prepare( project, releaseProperties,
releaseVersions, developmentVersions, null, 
+                                                              continuum.getWorkingDirectory(
projectId ).getPath(), environments, executable );
+            }
+        }
+        else
+        {
+            throw new Exception( "Unable to prepare release project with id : " + projectId
+ " because it doesn't exist" );
+        }
+    }
+
+    public int releasePerform( int projectId, String releaseId, String goals, String arguments,
+                               boolean useReleaseProfile, String repositoryName, String username
)
+        throws Exception
+    {
+        org.apache.maven.continuum.model.project.Project project = continuum.getProject(
projectId );
+
+        if ( project != null )
+        {
+            checkBuildProjectInGroupAuthorization( project.getProjectGroup().getName() );
+
+            org.apache.continuum.model.repository.LocalRepository repository = continuum.getRepositoryService().getLocalRepositoryByName(
repositoryName );
+
+            if ( continuum.getConfiguration().isDistributedBuildEnabled() )
+            {
+                continuum.getDistributedReleaseManager().releasePerform( projectId, releaseId,
goals, arguments, useReleaseProfile, repository, username );
+            }
+            else
+            {
+                File performDirectory = new File( continuum.getConfiguration().getWorkingDirectory(),
+                                                  "releases-" + System.currentTimeMillis()
);
+                performDirectory.mkdirs();
+
+                continuum.getReleaseManager().perform( releaseId, performDirectory, goals,
arguments, useReleaseProfile, null, repository );
+            }
+
+            return 0;
+        }
+        else
+        {
+            throw new Exception( "Unable to perform release project with id : " + projectId
+ " because it doesn't exist" );
+        }
+    }
+
+    public ReleaseListenerSummary getListener( int projectId, String releaseId )
+        throws Exception
+    {
+        org.apache.maven.continuum.model.project.Project project = continuum.getProject(
projectId );
+
+        if ( project != null )
+        {
+            checkBuildProjectInGroupAuthorization( project.getProjectGroup().getName() );
+
+            if ( continuum.getConfiguration().isDistributedBuildEnabled() )
+            {
+                Map map = continuum.getDistributedReleaseManager().getListener( releaseId
);
+                return processListenerMap( map );
+            }
+            else
+            {
+                return populateReleaseListenerSummary( continuum.getReleaseManager().getListener(
releaseId ) );
+            }
+        }
+        else
+        {
+            throw new Exception( "Unable to get release listener for '" + releaseId + "'"
);
+        }
+    }
+
+    public int releaseCleanup( int projectId, String releaseId )
+        throws Exception
+    {
+        org.apache.maven.continuum.model.project.Project project = continuum.getProject(
projectId );
+
+        if ( project != null )
+        {
+            checkBuildProjectInGroupAuthorization( project.getProjectGroup().getName() );
+            if ( continuum.getConfiguration().isDistributedBuildEnabled() )
+            {
+                continuum.getDistributedReleaseManager().releaseCleanup( releaseId );
+            }
+            else
+            {
+                continuum.getReleaseManager().getReleaseResults().remove( releaseId );
+                continuum.getReleaseManager().getListeners().remove( releaseId );
+            }
+    
+            return 0;
+        }
+        else
+        {
+            throw new Exception( "Unable to do release cleanup for release '" + releaseId
+ "'" );
+        }
+    }
+
+    public int releaseRollback( int projectId, String releaseId )
+        throws Exception
+    {
+        org.apache.maven.continuum.model.project.Project project = continuum.getProject(
projectId );
+
+        if ( project != null )
+        {
+            checkBuildProjectInGroupAuthorization( project.getProjectGroup().getName() );
+            if ( continuum.getConfiguration().isDistributedBuildEnabled() )
+            {
+                continuum.getDistributedReleaseManager().releaseRollback( releaseId, projectId
);
+            }
+            else
+            {
+                continuum.getReleaseManager().rollback( releaseId, continuum.getWorkingDirectory(
projectId ).getPath(), null );
+            }
+            return 0;
+        }
+        else
+        {
+            throw new Exception( "Unable to rollback the release for '" + releaseId + "'"
);
+        }
+    }
+    private ReleaseListenerSummary processListenerMap( Map context )
+    {
+        ReleaseListenerSummary listenerSummary = new ReleaseListenerSummary();
+        Object value = context.get( "release-in-progress" );
+        if ( value != null )
+        {
+            listenerSummary.setInProgress( (String) value );
+        }
+
+        value = context.get( "release-error" );
+        if ( value != null )
+        {
+            listenerSummary.setError( (String) value );
+        }
+
+        value = context.get( "username" );
+        if ( value != null )
+        {
+            listenerSummary.setUsername( (String) value );
+        }
+
+        value = context.get( "state" );
+        if ( value != null )
+        {
+            listenerSummary.setState( (Integer) value );
+        }
+
+        value = context.get( "release-phases" );
+        if ( value != null )
+        {
+            listenerSummary.setPhases( (List<String>) value );
+        }
+
+        value = context.get( "completed-release-phases" );
+        if ( value != null )
+        {
+            listenerSummary.setPhases( (List<String>) value );
+        }
+
+        return listenerSummary;
+    }
+
+    private ReleaseListenerSummary populateReleaseListenerSummary( org.apache.continuum.model.release.ReleaseListenerSummary

+                                                                   listener )
+    {
+        return (ReleaseListenerSummary) mapper.map( listener, ReleaseListenerSummary.class
);
+    }
 }

Modified: continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/resources/dozerBeanMapping.xml
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/resources/dozerBeanMapping.xml?rev=988398&r1=988397&r2=988398&view=diff
==============================================================================
--- continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/resources/dozerBeanMapping.xml
(original)
+++ continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/resources/dozerBeanMapping.xml
Tue Aug 24 06:18:00 2010
@@ -261,4 +261,9 @@
     <class-a>org.apache.continuum.xmlrpc.utils.BuildTrigger</class-a>
     <class-b>org.apache.continuum.utils.build.BuildTrigger</class-b>
   </mapping>
+
+  <mapping>
+    <class-a>org.apache.maven.continuum.xmlrpc.project.ReleaseListenerSummary</class-a>
+    <class-b>org.apache.continuum.model.release.ReleaseListenerSummary</class-b>
+  </mapping>
 </mappings>



Mime
View raw message