continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r483910 - /maven/continuum/trunk/continuum-rpc-client/src/main/java/org/apache/maven/continuum/rpc/ProjectsReader.java
Date Fri, 08 Dec 2006 10:29:59 GMT
Author: evenisse
Date: Fri Dec  8 02:29:58 2006
New Revision: 483910

URL: http://svn.apache.org/viewvc?view=rev&rev=483910
Log:
[CONTINUUM-1036] Allow to add maven projects by url
Submitted by: Valerie Lavilla

Modified:
    maven/continuum/trunk/continuum-rpc-client/src/main/java/org/apache/maven/continuum/rpc/ProjectsReader.java

Modified: maven/continuum/trunk/continuum-rpc-client/src/main/java/org/apache/maven/continuum/rpc/ProjectsReader.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-rpc-client/src/main/java/org/apache/maven/continuum/rpc/ProjectsReader.java?view=diff&rev=483910&r1=483909&r2=483910
==============================================================================
--- maven/continuum/trunk/continuum-rpc-client/src/main/java/org/apache/maven/continuum/rpc/ProjectsReader.java
(original)
+++ maven/continuum/trunk/continuum-rpc-client/src/main/java/org/apache/maven/continuum/rpc/ProjectsReader.java
Fri Dec  8 02:29:58 2006
@@ -151,7 +151,42 @@
             Hashtable table = (Hashtable) obj;
             if ( !table.get( "result" ).equals( "ok" ) )
             {
-                throw new RuntimeException( "Edit failed" );
+                throw new RuntimeException( "Add failed" );
+            }
+        }
+        else if ( obj instanceof XmlRpcException )
+        {
+            throw (XmlRpcException) obj;
+        }
+    }
+
+    public void addMavenOneProject( String url )
+        throws XmlRpcException, IOException
+    {
+        addProjectByUrl( url, "maven-1" );
+    }
+
+    public void addMavenTwoProject( String url )
+        throws XmlRpcException, IOException
+    {
+        addProjectByUrl( url, "maven2" );
+    }
+
+    private void addProjectByUrl( String url, String execId )
+        throws XmlRpcException, IOException
+    {
+        XmlRpcClient client = new XmlRpcClient( server );
+
+        Vector vect = new Vector();
+        vect.add( url );
+
+        Object obj = client.execute( "continuum.add" + executorMap.get( execId ) + "Project",
vect );
+        if ( obj instanceof Hashtable )
+        {
+            Hashtable table = (Hashtable) obj;
+            if ( !table.get( "result" ).equals( "ok" ) )
+            {
+                throw new RuntimeException( "Add failed" );
             }
         }
         else if ( obj instanceof XmlRpcException )



Mime
View raw message