continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r988458 - in /continuum/trunk: continuum-api/src/main/java/org/apache/maven/continuum/release/ continuum-release/src/main/java/org/apache/maven/continuum/release/ continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ continu...
Date Tue, 24 Aug 2010 10:01:44 GMT
Author: ctan
Date: Tue Aug 24 10:01:43 2010
New Revision: 988458

URL: http://svn.apache.org/viewvc?rev=988458&view=rev
Log:
[CONTINUUM-2565] forgot to include getting of release plugin parameters using continuum xmlrpc

Modified:
    continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/release/ContinuumReleaseManager.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/ReleasePrepareAction.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/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java

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=988458&r1=988457&r2=988458&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 10:01:43 2010
@@ -152,4 +152,15 @@ public interface ContinuumReleaseManager
      * @return
      */
     ReleaseListenerSummary getListener( String releaseId );
+
+    /**
+     * Get the release plugin parameters
+     * 
+     * @param workingDirectory
+     * @param pomFilename
+     * @return
+     * @throws ContinuumReleaseException
+     */
+    Map<String, Object> getReleasePluginParameters( String workingDirectory, String
pomFilename )
+        throws ContinuumReleaseException;
 }

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=988458&r1=988457&r2=988458&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 10:01:43 2010
@@ -20,7 +20,10 @@ package org.apache.maven.continuum.relea
  */
 
 import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
 import java.util.Hashtable;
+import java.util.List;
 import java.util.Map;
 import java.util.Properties;
 
@@ -32,6 +35,9 @@ import org.apache.maven.continuum.model.
 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.model.Model;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
 import org.apache.maven.scm.manager.ScmManager;
 import org.apache.maven.scm.provider.ScmProvider;
 import org.apache.maven.scm.repository.ScmRepository;
@@ -42,7 +48,10 @@ import org.apache.maven.shared.release.c
 import org.codehaus.plexus.taskqueue.Task;
 import org.codehaus.plexus.taskqueue.TaskQueue;
 import org.codehaus.plexus.taskqueue.TaskQueueException;
+import org.codehaus.plexus.util.ReaderFactory;
 import org.codehaus.plexus.util.StringUtils;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
 
 /**
  * @author Jason van Zyl
@@ -377,4 +386,91 @@ public class DefaultContinuumReleaseMana
 
         return null;
     }
+
+    public Map<String, Object> getReleasePluginParameters( String workingDirectory,
String pomFilename )
+        throws ContinuumReleaseException
+    {
+        Map<String, Object> params = new HashMap<String, Object>();
+
+        // TODO: Use the model reader so we'll can get the plugin configuration from parent
too
+        MavenXpp3Reader pomReader = new MavenXpp3Reader();
+        Model model;
+        try
+        {
+            model = pomReader.read( ReaderFactory.newXmlReader( new File( workingDirectory,
pomFilename ) ) );
+        }
+        catch ( IOException e )
+        {
+            throw new ContinuumReleaseException( "Failed to read pom file to get the release
plugin parameters: " + pomFilename );
+        }
+        catch ( XmlPullParserException e )
+        {
+            throw new ContinuumReleaseException( "Failed to parse pom file to get the release
plugin parameters: " + pomFilename );
+        }
+
+        if ( model.getBuild() != null && model.getBuild().getPlugins() != null )
+        {
+            for ( Plugin plugin : (List<Plugin>) model.getBuild().getPlugins() )
+            {
+                if ( plugin.getGroupId() != null && plugin.getGroupId().equals( "org.apache.maven.plugins"
) &&
+                    plugin.getArtifactId() != null && plugin.getArtifactId().equals(
"maven-release-plugin" ) )
+                {
+                    Xpp3Dom dom = (Xpp3Dom) plugin.getConfiguration();
+
+                    // TODO: use constants
+                    if ( dom != null )
+                    {
+                        Xpp3Dom configuration = dom.getChild( "releaseLabel" );
+                        if ( configuration != null )
+                        {
+                            params.put( "scm-tag", configuration.getValue() );
+                        }
+
+                        configuration = dom.getChild( "tag" );
+                        if ( configuration != null )
+                        {
+                            params.put( "scm-tag", configuration.getValue() );
+                        }
+
+                        configuration = dom.getChild( "tagBase" );
+                        if ( configuration != null )
+                        {
+                            params.put( "scm-tagbase", configuration.getValue() );
+                        }
+
+                        configuration = dom.getChild( "preparationGoals" );
+                        if ( configuration != null )
+                        {
+                            params.put( "preparation-goals", configuration.getValue() );
+                        }
+
+                        configuration = dom.getChild( "arguments" );
+                        if ( configuration != null )
+                        {
+                            params.put( "arguments", configuration.getValue() );
+                        }
+
+                        configuration = dom.getChild( "scmCommentPrefix" );
+                        if ( configuration != null )
+                        {
+                            params.put( "scm-comment-prefix", configuration.getValue() );
+                        }
+
+                        configuration = dom.getChild( "autoVersionSubmodules" );
+                        if ( configuration != null )
+                        {
+                            params.put( "auto-version-submodules", Boolean.valueOf( configuration.getValue()
) );
+                        }
+
+                        configuration = dom.getChild( "addSchema" );
+                        if ( configuration != null )
+                        {
+                            params.put( "add-schema", Boolean.valueOf( configuration.getValue()
) );
+                        }
+                    }
+                }
+            }
+        }
+        return params;
+    }
 }

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=988458&r1=988457&r2=988458&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 10:01:43 2010
@@ -210,71 +210,42 @@ public class ReleasePrepareAction
     private void getReleasePluginParameters( String workingDirectory, String pomFilename
)
         throws Exception
     {
-        //TODO: Use the model reader so we'll can get the plugin configuration from parent
too
-        MavenXpp3Reader pomReader = new MavenXpp3Reader();
-        Model model = pomReader.read( ReaderFactory.newXmlReader( new File( workingDirectory,
pomFilename ) ) );
+        Map<String, Object> params = getContinuum().getReleaseManager().getReleasePluginParameters(
workingDirectory, pomFilename );
 
-        if ( model.getBuild() != null && model.getBuild().getPlugins() != null )
+        // TODO: use constants for this
+        if ( params.get( "scm-tag" ) != null )
         {
-            for ( Plugin plugin : (List<Plugin>) model.getBuild().getPlugins() )
-            {
-                if ( plugin.getGroupId() != null && plugin.getGroupId().equals( "org.apache.maven.plugins"
) &&
-                    plugin.getArtifactId() != null && plugin.getArtifactId().equals(
"maven-release-plugin" ) )
-                {
-                    Xpp3Dom dom = (Xpp3Dom) plugin.getConfiguration();
+            scmTag = (String) params.get( "scm-tag" );
+        }
 
-                    if ( dom != null )
-                    {
-                        Xpp3Dom configuration = dom.getChild( "releaseLabel" );
-                        if ( configuration != null )
-                        {
-                            scmTag = configuration.getValue();
-                        }
-
-                        configuration = dom.getChild( "tag" );
-                        if ( configuration != null )
-                        {
-                            scmTag = configuration.getValue();
-                        }
-
-                        configuration = dom.getChild( "tagBase" );
-                        if ( configuration != null )
-                        {
-                            scmTagBase = configuration.getValue();
-                        }
-
-                        configuration = dom.getChild( "preparationGoals" );
-                        if ( configuration != null )
-                        {
-                            prepareGoals = configuration.getValue();
-                        }
-
-                        configuration = dom.getChild( "arguments" );
-                        if ( configuration != null )
-                        {
-                            arguments = configuration.getValue();
-                        }
-
-                        configuration = dom.getChild( "scmCommentPrefix" );
-                        if ( configuration != null )
-                        {
-                            scmCommentPrefix = configuration.getValue();
-                        }
-
-                        configuration = dom.getChild( "autoVersionSubmodules" );
-                        if ( configuration != null )
-                        {
-                            autoVersionSubmodules = Boolean.valueOf( configuration.getValue()
);
-                        }
-
-                        configuration = dom.getChild( "addSchema" );
-                        if ( configuration != null )
-                        {
-                            addSchema = Boolean.valueOf( configuration.getValue() );
-                        }
-                    }
-                }
-            }
+        if ( params.get( "scm-tagbase" ) != null )
+        {
+            scmTagBase = (String) params.get( "scm-tagbase" );
+        }
+
+        if ( params.get( "preparation-goals" ) != null )
+        {
+            prepareGoals = (String) params.get( "preparation-goals" );
+        }
+
+        if ( params.get( "arguments" ) != null )
+        {
+            arguments = (String) params.get( "arguments" );
+        }
+
+        if ( params.get( "scm-comment-prefix" ) != null )
+        {
+            scmCommentPrefix = (String) params.get( "scm-comment-prefix" );
+        }
+
+        if ( params.get( "auto-version-submodules" ) != null )
+        {
+            autoVersionSubmodules = (Boolean) params.get( "auto-version-submodules" );
+        }
+
+        if ( params.get( "add-schema" ) != null )
+        {
+            addSchema = (Boolean) params.get( "add-schema" );
         }
     }
 

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=988458&r1=988457&r2=988458&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 10:01:43 2010
@@ -1532,4 +1532,13 @@ public interface ContinuumService
      */
     int releaseRollback( int projectId, String releaseId )
         throws Exception;
+
+    /**
+     * Get release plugin parameters
+     * 
+     * @param projectId
+     * @return
+     */
+    Map<String, Object> getReleasePluginParameters( int projectId )
+        throws Exception;
 }

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=988458&r1=988457&r2=988458&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 10:01:43 2010
@@ -1187,4 +1187,10 @@ public class ContinuumXmlRpcClient
     {
         return continuum.releaseRollback( projectId, releaseId );
     }
+
+    public Map<String, Object> getReleasePluginParameters( int projectId )
+        throws Exception
+    {
+        return continuum.getReleasePluginParameters( projectId );
+    }
 }

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=988458&r1=988457&r2=988458&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 10:01:43 2010
@@ -2911,6 +2911,30 @@ public class ContinuumServiceImpl
             throw new Exception( "Unable to rollback the release for '" + releaseId + "'"
);
         }
     }
+
+    public Map<String, Object> getReleasePluginParameters( int projectId )
+        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().getReleasePluginParameters(
projectId, "pom.xml" );
+            }
+            else
+            {
+                return continuum.getReleaseManager().getReleasePluginParameters( continuum.getWorkingDirectory(
projectId ).getPath(), "pom.xml" );
+            }
+        }
+        else
+        {
+            throw new Exception( "Unable to get release plugin parameters for project with
id " + projectId );
+        }
+    }
+
     private ReleaseListenerSummary processListenerMap( Map context )
     {
         ReleaseListenerSummary listenerSummary = new ReleaseListenerSummary();



Mime
View raw message