You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@continuum.apache.org by ev...@apache.org on 2007/05/16 16:12:44 UTC

svn commit: r538608 - in /maven/continuum/trunk: continuum-xmlrpc/continuum-xmlrpc-api/src/main/java/org/apache/maven/continuum/xmlrpc/ continuum-xmlrpc/continuum-xmlrpc-client/src/main/java/org/apache/maven/continuum/xmlrpc/client/ continuum-xmlrpc/co...

Author: evenisse
Date: Wed May 16 07:12:43 2007
New Revision: 538608

URL: http://svn.apache.org/viewvc?view=rev&rev=538608
Log:
Add more goals

Added:
    maven/continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/continuum/plugin/AbstractAddProject.java   (with props)
    maven/continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/continuum/plugin/AddAntProject.java   (with props)
    maven/continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/continuum/plugin/AddMavenOneProject.java   (with props)
    maven/continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/continuum/plugin/AddShellProject.java   (with props)
Modified:
    maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-api/src/main/java/org/apache/maven/continuum/xmlrpc/ContinuumService.java
    maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-client/src/main/java/org/apache/maven/continuum/xmlrpc/client/ContinuumXmlRpcClient.java
    maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java
    maven/continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/continuum/plugin/AbstractContinuumMojo.java
    maven/continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/continuum/plugin/AddMavenTwoProject.java

Modified: maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-api/src/main/java/org/apache/maven/continuum/xmlrpc/ContinuumService.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-api/src/main/java/org/apache/maven/continuum/xmlrpc/ContinuumService.java?view=diff&rev=538608&r1=538607&r2=538608
==============================================================================
--- maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-api/src/main/java/org/apache/maven/continuum/xmlrpc/ContinuumService.java (original)
+++ maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-api/src/main/java/org/apache/maven/continuum/xmlrpc/ContinuumService.java Wed May 16 07:12:43 2007
@@ -276,7 +276,7 @@
     /**
      * Add an ANT project.
      *
-     * @param project The project to add. groupId, artifactId, version and scm informations are required
+     * @param project The project to add. name, version and scm informations are required
      * @return The project populated with the id.
      * @throws ContinuumException
      * @throws XmlRpcException
@@ -284,6 +284,18 @@
     ProjectSummary addAntProject( ProjectSummary project )
         throws ContinuumException, XmlRpcException;
 
+    /**
+     * Add an ANT project in the specified group.
+     *
+     * @param project        The project to add. name, version and scm informations are required
+     * @param projectGroupId The id of the group where projects will be stored
+     * @return The project populated with the id.
+     * @throws ContinuumException
+     * @throws XmlRpcException
+     */
+    ProjectSummary addAntProject( ProjectSummary project, int projectGroupId )
+        throws ContinuumException, XmlRpcException;
+
     // ----------------------------------------------------------------------
     // Maven Shell projects
     // ----------------------------------------------------------------------
@@ -291,12 +303,24 @@
     /**
      * Add an shell project.
      *
-     * @param project The project to add. groupId, artifactId, version and scm informations are required
+     * @param project The project to add. name, version and scm informations are required
      * @return The project populated with the id.
      * @throws ContinuumException
      * @throws XmlRpcException
      */
     ProjectSummary addShellProject( ProjectSummary project )
+        throws ContinuumException, XmlRpcException;
+
+    /**
+     * Add an shell project in the specified group.
+     *
+     * @param project        The project to add. name, version and scm informations are required
+     * @param projectGroupId The id of the group where projects will be stored
+     * @return The project populated with the id.
+     * @throws ContinuumException
+     * @throws XmlRpcException
+     */
+    ProjectSummary addShellProject( ProjectSummary project, int projectGroupId )
         throws ContinuumException, XmlRpcException;
 
     // ----------------------------------------------------------------------

Modified: maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-client/src/main/java/org/apache/maven/continuum/xmlrpc/client/ContinuumXmlRpcClient.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-client/src/main/java/org/apache/maven/continuum/xmlrpc/client/ContinuumXmlRpcClient.java?view=diff&rev=538608&r1=538607&r2=538608
==============================================================================
--- maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-client/src/main/java/org/apache/maven/continuum/xmlrpc/client/ContinuumXmlRpcClient.java (original)
+++ maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-client/src/main/java/org/apache/maven/continuum/xmlrpc/client/ContinuumXmlRpcClient.java Wed May 16 07:12:43 2007
@@ -432,6 +432,19 @@
         }
     }
 
+    public ProjectSummary addAntProject( ProjectSummary project, int projectGroupId )
+        throws ContinuumException
+    {
+        try
+        {
+            return continuum.addAntProject( project, projectGroupId );
+        }
+        catch ( Exception e )
+        {
+            throw new ContinuumException( "The remote method failed.", e );
+        }
+    }
+
     // ----------------------------------------------------------------------
     // Maven Shell projects
     // ----------------------------------------------------------------------
@@ -442,6 +455,19 @@
         try
         {
             return continuum.addShellProject( project );
+        }
+        catch ( Exception e )
+        {
+            throw new ContinuumException( "The remote method failed.", e );
+        }
+    }
+
+    public ProjectSummary addShellProject( ProjectSummary project, int projectGroupId )
+        throws ContinuumException
+    {
+        try
+        {
+            return continuum.addShellProject( project, projectGroupId );
         }
         catch ( Exception e )
         {

Modified: maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java?view=diff&rev=538608&r1=538607&r2=538608
==============================================================================
--- maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java (original)
+++ maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java Wed May 16 07:12:43 2007
@@ -329,6 +329,15 @@
         return getProjectSummary( projectId );
     }
 
+    public ProjectSummary addAntProject( ProjectSummary project, int projectGroupId )
+        throws ContinuumException
+    {
+        checkAddProjectGroupAuthorization();
+
+        int projectId = continuum.addProject( populateProject( project ), "ant", projectGroupId );
+        return getProjectSummary( projectId );
+    }
+
     // ----------------------------------------------------------------------
     // Maven Shell projects
     // ----------------------------------------------------------------------
@@ -339,6 +348,15 @@
         checkAddProjectGroupAuthorization();
 
         int projectId = continuum.addProject( populateProject( project ), "shell" );
+        return getProjectSummary( projectId );
+    }
+
+    public ProjectSummary addShellProject( ProjectSummary project, int projectGroupId )
+        throws ContinuumException
+    {
+        checkAddProjectGroupAuthorization();
+
+        int projectId = continuum.addProject( populateProject( project ), "shell", projectGroupId );
         return getProjectSummary( projectId );
     }
 

Added: maven/continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/continuum/plugin/AbstractAddProject.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/continuum/plugin/AbstractAddProject.java?view=auto&rev=538608
==============================================================================
--- maven/continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/continuum/plugin/AbstractAddProject.java (added)
+++ maven/continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/continuum/plugin/AbstractAddProject.java Wed May 16 07:12:43 2007
@@ -0,0 +1,143 @@
+package org.apache.maven.continuum.plugin;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.continuum.ContinuumException;
+import org.apache.maven.continuum.xmlrpc.project.ProjectSummary;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+
+/**
+ * Base class to add ANT/Shell projects.
+ *
+ * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
+ * @version $Id$
+ */
+public abstract class AbstractAddProject
+    extends AbstractContinuumMojo
+{
+    public static final String ANT = "ant";
+
+    public static final String SHELL = "shell";
+
+    /**
+     * The project name.
+     *
+     * @parameter expression="${projectName}"
+     * @required
+     */
+    private String projectName;
+
+    /**
+     * The project verion.
+     *
+     * @parameter expression="${projectVersion}"
+     * @required
+     */
+    private String projectVersion;
+
+    /**
+     * The SCM Url. Must be a Maven-SCM url.
+     *
+     * @parameter expression="${scmUrl}"
+     * @required
+     */
+    private String scmUrl;
+
+    /**
+     * The SCM username.
+     *
+     * @parameter expression="${scm.username}"
+     */
+    private String scmUsernme;
+
+    /**
+     * The SCM password.
+     *
+     * @parameter expression="${scm.password}"
+     */
+    private String scmPassword;
+
+    /**
+     * The SCM branch/tag name.
+     *
+     * @parameter expression="${scm.tag}"
+     */
+    private String scmTag;
+
+    /**
+     * Use SCM credentials Cache, if available.
+     *
+     * @parameter expression="${scm.useCredentialsCache}" default-value="false"
+     */
+    private boolean scmUseCredentialsCache;
+
+    /**
+     * The project Group Id.
+     *
+     * @parameter expression="${projectGroupId}"
+     */
+    private String projectGroupId;
+
+    public void execute()
+        throws MojoExecutionException, MojoFailureException
+    {
+        ProjectSummary project = new ProjectSummary();
+        project.setName( projectName );
+        project.setVersion( projectVersion );
+        project.setScmUrl( scmUrl );
+        project.setScmUsername( scmUsernme );
+        project.setScmPassword( scmPassword );
+        project.setScmTag( scmTag );
+        project.setScmUseCache( scmUseCredentialsCache );
+
+        try
+        {
+            if ( projectGroupId != null && projectGroupId.length() > 0 )
+            {
+                if ( ANT.equals( getProjectType() ) )
+                {
+                    getClient().addAntProject( project, Integer.parseInt( projectGroupId ) );
+                }
+                else
+                {
+                    getClient().addShellProject( project, Integer.parseInt( projectGroupId ) );
+                }
+            }
+            else
+            {
+                if ( ANT.equals( getProjectType() ) )
+                {
+                    getClient().addAntProject( project );
+                }
+                else
+                {
+                    getClient().addShellProject( project );
+                }
+            }
+        }
+        catch ( ContinuumException e )
+        {
+            throw new MojoExecutionException( "Can't add the " + getProjectType() + " project.", e );
+        }
+    }
+
+    protected abstract String getProjectType();
+}

Propchange: maven/continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/continuum/plugin/AbstractAddProject.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/continuum/plugin/AbstractAddProject.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: maven/continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/continuum/plugin/AbstractContinuumMojo.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/continuum/plugin/AbstractContinuumMojo.java?view=diff&rev=538608&r1=538607&r2=538608
==============================================================================
--- maven/continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/continuum/plugin/AbstractContinuumMojo.java (original)
+++ maven/continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/continuum/plugin/AbstractContinuumMojo.java Wed May 16 07:12:43 2007
@@ -37,6 +37,7 @@
      * The Continuum XML-RPC server URL.
      *
      * @parameter expression="${url}"
+     * @required
      */
     private String url;
 

Added: maven/continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/continuum/plugin/AddAntProject.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/continuum/plugin/AddAntProject.java?view=auto&rev=538608
==============================================================================
--- maven/continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/continuum/plugin/AddAntProject.java (added)
+++ maven/continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/continuum/plugin/AddAntProject.java Wed May 16 07:12:43 2007
@@ -0,0 +1,36 @@
+package org.apache.maven.continuum.plugin;
+
+/*
+ * 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.
+ */
+
+/**
+ * Goal which add an ANT project.
+ *
+ * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
+ * @version $Id$
+ * @goal add-ant-project
+ */
+public class AddAntProject
+    extends AbstractAddProject
+{
+    protected String getProjectType()
+    {
+        return ANT;
+    }
+}

Propchange: maven/continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/continuum/plugin/AddAntProject.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/continuum/plugin/AddAntProject.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/continuum/plugin/AddMavenOneProject.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/continuum/plugin/AddMavenOneProject.java?view=auto&rev=538608
==============================================================================
--- maven/continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/continuum/plugin/AddMavenOneProject.java (added)
+++ maven/continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/continuum/plugin/AddMavenOneProject.java Wed May 16 07:12:43 2007
@@ -0,0 +1,70 @@
+package org.apache.maven.continuum.plugin;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.continuum.ContinuumException;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+
+/**
+ * Goal which add a Maven1 project.
+ *
+ * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
+ * @version $Id$
+ * @goal add-maven-one-project
+ */
+public class AddMavenOneProject
+    extends AbstractContinuumMojo
+{
+    /**
+     * POM Url.
+     *
+     * @parameter expression="${projectUrl}" default-value="${project.scm.url}"
+     * @required
+     */
+    private String projectUrl;
+
+    /**
+     * Project Group Id.
+     *
+     * @parameter expression="${projectGroupId}"
+     */
+    private String projectGroupId;
+
+    public void execute()
+        throws MojoExecutionException, MojoFailureException
+    {
+        try
+        {
+            if ( projectGroupId != null && projectGroupId.length() > 0 )
+            {
+                getClient().addMavenOneProject( projectUrl, Integer.parseInt( projectGroupId ) );
+            }
+            else
+            {
+                getClient().addMavenOneProject( projectUrl );
+            }
+        }
+        catch ( ContinuumException e )
+        {
+            throw new MojoExecutionException( "Can't add the Maven1 project from '" + projectUrl + "'.", e );
+        }
+    }
+}

Propchange: maven/continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/continuum/plugin/AddMavenOneProject.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/continuum/plugin/AddMavenOneProject.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: maven/continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/continuum/plugin/AddMavenTwoProject.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/continuum/plugin/AddMavenTwoProject.java?view=diff&rev=538608&r1=538607&r2=538608
==============================================================================
--- maven/continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/continuum/plugin/AddMavenTwoProject.java (original)
+++ maven/continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/continuum/plugin/AddMavenTwoProject.java Wed May 16 07:12:43 2007
@@ -34,11 +34,16 @@
     extends AbstractContinuumMojo
 {
     /**
-     * @parameter expression="${projectUrl}"
+     * POM Url.
+     *
+     * @parameter expression="${projectUrl}" default-value="${project.scm.url}"
+     * @required
      */
     private String projectUrl;
 
     /**
+     * Project Group Id.
+     *
      * @parameter expression="${projectGroupId}"
      */
     private String projectGroupId;

Added: maven/continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/continuum/plugin/AddShellProject.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/continuum/plugin/AddShellProject.java?view=auto&rev=538608
==============================================================================
--- maven/continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/continuum/plugin/AddShellProject.java (added)
+++ maven/continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/continuum/plugin/AddShellProject.java Wed May 16 07:12:43 2007
@@ -0,0 +1,36 @@
+package org.apache.maven.continuum.plugin;
+
+/*
+ * 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.
+ */
+
+/**
+ * Goal which add a Shell Project.
+ *
+ * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
+ * @version $Id$
+ * @goal add-shell-project
+ */
+public class AddShellProject
+    extends AbstractAddProject
+{
+    protected String getProjectType()
+    {
+        return SHELL;
+    }
+}

Propchange: maven/continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/continuum/plugin/AddShellProject.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/continuum/trunk/maven-continuum-plugin/src/main/java/org/apache/maven/continuum/plugin/AddShellProject.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision