continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r240192 - in /maven/continuum/trunk: ./ continuum-api/ continuum-api/src/main/java/org/apache/maven/continuum/project/builder/ continuum-cc/ continuum-cc/src/main/java/org/apache/maven/continuum/project/builder/cc/ continuum-cc/src/test/jav...
Date Fri, 26 Aug 2005 08:48:05 GMT
Author: evenisse
Date: Fri Aug 26 01:47:43 2005
New Revision: 240192

URL: http://svn.apache.org/viewcvs?rev=240192&view=rev
Log:
[CONTINUUM-258] Add support for https protocol for referencing a pom
Thanks to Jesse McConnell.

Modified:
    maven/continuum/trunk/continuum-api/pom.xml
    maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/project/builder/AbstractContinuumProjectBuilder.java
    maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/project/builder/ContinuumProjectBuilder.java
    maven/continuum/trunk/continuum-cc/pom.xml
    maven/continuum/trunk/continuum-cc/src/main/java/org/apache/maven/continuum/project/builder/cc/CruiseControlProjectBuilder.java
    maven/continuum/trunk/continuum-cc/src/test/java/org/apache/maven/continuum/project/builder/cc/CruiseControlProjectBuilderTest.java
    maven/continuum/trunk/continuum-core/pom.xml
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CreateProjectsFromMetadata.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilder.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilder.java
    maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilderTest.java
    maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilderTest.java
    maven/continuum/trunk/pom.xml

Modified: maven/continuum/trunk/continuum-api/pom.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-api/pom.xml?rev=240192&r1=240191&r2=240192&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-api/pom.xml (original)
+++ maven/continuum/trunk/continuum-api/pom.xml Fri Aug 26 01:47:43 2005
@@ -13,5 +13,9 @@
       <groupId>org.apache.maven.continuum</groupId>
       <artifactId>continuum-model</artifactId>
     </dependency>
+    <dependency>
+      <groupId>plexus</groupId>
+      <artifactId>plexus-formica</artifactId>
+    </dependency>
   </dependencies>
 </project>

Modified: maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/project/builder/AbstractContinuumProjectBuilder.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/project/builder/AbstractContinuumProjectBuilder.java?rev=240192&r1=240191&r2=240192&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/project/builder/AbstractContinuumProjectBuilder.java
(original)
+++ maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/project/builder/AbstractContinuumProjectBuilder.java
Fri Aug 26 01:47:43 2005
@@ -22,6 +22,8 @@
 import java.io.InputStream;
 import java.net.URL;
 
+import org.codehaus.plexus.formica.util.MungedHttpsURL;
+
 import org.codehaus.plexus.logging.AbstractLogEnabled;
 import org.codehaus.plexus.util.IOUtil;
 
@@ -33,12 +35,21 @@
     extends AbstractLogEnabled
     implements ContinuumProjectBuilder
 {
-    protected File createMetadataFile( URL metadata )
+    protected File createMetadataFile( URL metadata, String username, String password )
         throws IOException
     {
         getLogger().info( "Downloading " + metadata.toExternalForm() );
 
-        InputStream is = metadata.openStream();
+        InputStream is = null;
+
+        if ( metadata.getProtocol().equals( "https" ) )
+        {
+            is = new MungedHttpsURL( metadata.toExternalForm(), username, password ).getURL().openStream();
+        }
+        else
+        {
+            is = metadata.openStream();
+        }
 
         File file = File.createTempFile( "continuum-", ".tmp" );
 
@@ -54,4 +65,5 @@
 
         return file;
     }
+
 }

Modified: maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/project/builder/ContinuumProjectBuilder.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/project/builder/ContinuumProjectBuilder.java?rev=240192&r1=240191&r2=240192&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/project/builder/ContinuumProjectBuilder.java
(original)
+++ maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/project/builder/ContinuumProjectBuilder.java
Fri Aug 26 01:47:43 2005
@@ -26,6 +26,6 @@
 {
     String ROLE = ContinuumProjectBuilder.class.getName();
 
-    ContinuumProjectBuildingResult buildProjectsFromMetadata( URL url )
+    ContinuumProjectBuildingResult buildProjectsFromMetadata( URL url, String username, String
password )
         throws ContinuumProjectBuilderException;
 }

Modified: maven/continuum/trunk/continuum-cc/pom.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-cc/pom.xml?rev=240192&r1=240191&r2=240192&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-cc/pom.xml (original)
+++ maven/continuum/trunk/continuum-cc/pom.xml Fri Aug 26 01:47:43 2005
@@ -13,6 +13,10 @@
       <groupId>org.apache.maven.continuum</groupId>
       <artifactId>continuum-core</artifactId>
     </dependency>
+    <dependency>
+      <groupId>plexus</groupId>
+      <artifactId>plexus-formica</artifactId>
+    </dependency>
   </dependencies>
   <build>
     <plugins>

Modified: maven/continuum/trunk/continuum-cc/src/main/java/org/apache/maven/continuum/project/builder/cc/CruiseControlProjectBuilder.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-cc/src/main/java/org/apache/maven/continuum/project/builder/cc/CruiseControlProjectBuilder.java?rev=240192&r1=240191&r2=240192&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-cc/src/main/java/org/apache/maven/continuum/project/builder/cc/CruiseControlProjectBuilder.java
(original)
+++ maven/continuum/trunk/continuum-cc/src/main/java/org/apache/maven/continuum/project/builder/cc/CruiseControlProjectBuilder.java
Fri Aug 26 01:47:43 2005
@@ -24,6 +24,7 @@
 import org.apache.maven.continuum.project.builder.AbstractContinuumProjectBuilder;
 import org.apache.maven.continuum.project.builder.ContinuumProjectBuilderException;
 import org.apache.maven.continuum.project.builder.ContinuumProjectBuildingResult;
+import org.codehaus.plexus.formica.util.MungedHttpsURL;
 import org.codehaus.plexus.util.StringUtils;
 import org.codehaus.plexus.util.xml.Xpp3Dom;
 import org.codehaus.plexus.util.xml.Xpp3DomBuilder;
@@ -56,12 +57,12 @@
     // ContinuumProjectBuilder Implementation
     // ----------------------------------------------------------------------
 
-    public ContinuumProjectBuildingResult buildProjectsFromMetadata( URL url )
+    public ContinuumProjectBuildingResult buildProjectsFromMetadata( URL url, String username,
String password )
         throws ContinuumProjectBuilderException
     {
         ContinuumProjectBuildingResult result = new ContinuumProjectBuildingResult();
 
-        Xpp3Dom dom = downloadAndBuildDom( url );
+        Xpp3Dom dom = downloadAndBuildDom( url, username, password );
 
         Xpp3Dom[] projects = dom.getChildren( "project" );
 
@@ -332,14 +333,21 @@
         return false;
     }
 
-    private Xpp3Dom downloadAndBuildDom( URL url )
+    private Xpp3Dom downloadAndBuildDom( URL url, String username, String password )
         throws ContinuumProjectBuilderException
     {
         try
         {
             getLogger().info( "Downloading " + url );
 
-            return Xpp3DomBuilder.build( new InputStreamReader( url.openStream() ) );
+            URL u = url;
+
+            if ( "https".equals( url.getProtocol() ) )
+            {
+                u = new MungedHttpsURL( url.toString() ).getURL();
+            }
+
+            return Xpp3DomBuilder.build( new InputStreamReader( u.openStream() ) );
         }
         catch ( XmlPullParserException e )
         {

Modified: maven/continuum/trunk/continuum-cc/src/test/java/org/apache/maven/continuum/project/builder/cc/CruiseControlProjectBuilderTest.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-cc/src/test/java/org/apache/maven/continuum/project/builder/cc/CruiseControlProjectBuilderTest.java?rev=240192&r1=240191&r2=240192&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-cc/src/test/java/org/apache/maven/continuum/project/builder/cc/CruiseControlProjectBuilderTest.java
(original)
+++ maven/continuum/trunk/continuum-cc/src/test/java/org/apache/maven/continuum/project/builder/cc/CruiseControlProjectBuilderTest.java
Fri Aug 26 01:47:43 2005
@@ -38,6 +38,6 @@
 
         URL url = getTestFile( "src/test/resources/config.xml" ).toURL();
 
-        ContinuumProjectBuildingResult result = projectBuilder.buildProjectsFromMetadata(
url );
+        ContinuumProjectBuildingResult result = projectBuilder.buildProjectsFromMetadata(
url, null, null );
     }
 }

Modified: maven/continuum/trunk/continuum-core/pom.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/pom.xml?rev=240192&r1=240191&r2=240192&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/pom.xml (original)
+++ maven/continuum/trunk/continuum-core/pom.xml Fri Aug 26 01:47:43 2005
@@ -90,7 +90,11 @@
       <groupId>quartz</groupId>
       <artifactId>quartz</artifactId>
       <version>1.4.5</version>
-    </dependency>
+   </dependency>
+   <dependency>
+      <groupId>plexus</groupId>
+      <artifactId>plexus-formica</artifactId>
+   </dependency>
     <!--
      |
      | Maven Dependencies

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CreateProjectsFromMetadata.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CreateProjectsFromMetadata.java?rev=240192&r1=240191&r2=240192&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CreateProjectsFromMetadata.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CreateProjectsFromMetadata.java
Fri Aug 26 01:47:43 2005
@@ -14,6 +14,8 @@
 import java.net.URL;
 import java.util.Map;
 
+import org.codehaus.plexus.formica.util.MungedHttpsURL;
+
 /**
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
  * @version $Id$
@@ -38,18 +40,36 @@
 
         URL url;
 
+        ContinuumProjectBuilder projectBuilder = projectBuilderManager.getProjectBuilder(
projectBuilderId );
+        ContinuumProjectBuildingResult result = null;
+
         try
         {
-            url = new URL( u );
+            if ( !u.startsWith( "https" ) )
+            {
+                url = new URL( u );
+                result = projectBuilder.buildProjectsFromMetadata( url, null, null );
+            }
+            else
+            {
+                MungedHttpsURL mungedURL = new MungedHttpsURL( u );
+                if ( mungedURL.isValid() )
+                {
+                    url = mungedURL.getURL();
+                    result = projectBuilder.buildProjectsFromMetadata( url, mungedURL.getUsername(),
mungedURL
+                        .getPassword() );
+                }
+                else
+                {
+                    throw new ContinuumException( "'" + u + "' is not a valid secureURL."
);
+                }
+            }
+
         }
         catch ( MalformedURLException e )
         {
             throw new ContinuumException( "'" + u + "' is not a valid URL.", e );
         }
-
-        ContinuumProjectBuilder projectBuilder = projectBuilderManager.getProjectBuilder(
projectBuilderId );
-
-        ContinuumProjectBuildingResult result = projectBuilder.buildProjectsFromMetadata(
url );
 
         context.put( KEY_PROJECT_BUILDING_RESULT, result );
     }

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilder.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilder.java?rev=240192&r1=240191&r2=240192&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilder.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilder.java
Fri Aug 26 01:47:43 2005
@@ -48,7 +48,7 @@
     // ProjectCreator Implementation
     // ----------------------------------------------------------------------
 
-    public ContinuumProjectBuildingResult buildProjectsFromMetadata( URL url )
+    public ContinuumProjectBuildingResult buildProjectsFromMetadata( URL url, String username,
String password )
     {
         ContinuumProjectBuildingResult result = new ContinuumProjectBuildingResult();
 
@@ -56,7 +56,7 @@
 
         try
         {
-            pomFile = createMetadataFile( url );
+            pomFile = createMetadataFile( url, username, password );
         }
         catch ( IOException e )
         {

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilder.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilder.java?rev=240192&r1=240191&r2=240192&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilder.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilder.java
Fri Aug 26 01:47:43 2005
@@ -62,7 +62,7 @@
     // AbstractContinuumProjectBuilder Implementation
     // ----------------------------------------------------------------------
 
-    public ContinuumProjectBuildingResult buildProjectsFromMetadata( URL url )
+    public ContinuumProjectBuildingResult buildProjectsFromMetadata( URL url, String username,
String password )
         throws ContinuumProjectBuilderException
     {
         // ----------------------------------------------------------------------
@@ -71,7 +71,7 @@
 
         ContinuumProjectBuildingResult result = new ContinuumProjectBuildingResult();
 
-        readModules( url, result, true );
+        readModules( url, result, true, username, password );
 
         return result;
     }
@@ -80,7 +80,7 @@
     //
     // ----------------------------------------------------------------------
 
-    private void readModules( URL url, ContinuumProjectBuildingResult result, boolean groupPom
)
+    private void readModules( URL url, ContinuumProjectBuildingResult result, boolean groupPom,
String username, String password )
     {
         MavenProject mavenProject;
 
@@ -88,7 +88,7 @@
         {
             // TODO: this isn't finding parents due to relocating to the URL
             // TODO: the whole modules resolution is funky
-            mavenProject = builderHelper.getMavenProject( createMetadataFile( url ) );
+            mavenProject = builderHelper.getMavenProject( createMetadataFile( url, username,
password ) );
         }
         catch ( MavenBuilderHelperException e )
         {
@@ -173,7 +173,7 @@
                 continue;
             }
 
-            readModules( moduleUrl, result, false );
+            readModules( moduleUrl, result, false, username, password );
         }
     }
 

Modified: maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilderTest.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilderTest.java?rev=240192&r1=240191&r2=240192&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilderTest.java
(original)
+++ maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilderTest.java
Fri Aug 26 01:47:43 2005
@@ -38,7 +38,7 @@
                                                                                    MavenOneContinuumProjectBuilder.ID
);
 
         ContinuumProjectBuildingResult result = projectBuilder.buildProjectsFromMetadata(
-            getTestFile( "src/test/resources/projects/maven-1.pom.xml" ).toURL() );
+            getTestFile( "src/test/resources/projects/maven-1.pom.xml" ).toURL(), null, null
);
 
         assertNotNull( result.getWarnings() );
 

Modified: maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilderTest.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilderTest.java?rev=240192&r1=240191&r2=240192&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilderTest.java
(original)
+++ maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilderTest.java
Fri Aug 26 01:47:43 2005
@@ -46,7 +46,7 @@
 
         File pom = getTestFile( "src/test/repository/maven-builder-helper-1.xml" );
 
-        ContinuumProjectBuildingResult result = projectBuilder.buildProjectsFromMetadata(
pom.toURL() );
+        ContinuumProjectBuildingResult result = projectBuilder.buildProjectsFromMetadata(
pom.toURL(), null, null );
 
         assertNotNull( result.getWarnings() );
 
@@ -77,7 +77,7 @@
 
         File pom = getTestFile( "src/test/repository/maven-builder-helper-2.xml" );
 
-        ContinuumProjectBuildingResult result = projectBuilder.buildProjectsFromMetadata(
pom.toURL() );
+        ContinuumProjectBuildingResult result = projectBuilder.buildProjectsFromMetadata(
pom.toURL(), null, null );
 
         assertNotNull( result.getWarnings() );
 
@@ -113,7 +113,7 @@
 
         System.setOut( new PrintStream( new ByteArrayOutputStream() ) );
 
-        ContinuumProjectBuildingResult result = projectBuilder.buildProjectsFromMetadata(
new URL( url ) );
+        ContinuumProjectBuildingResult result = projectBuilder.buildProjectsFromMetadata(
new URL( url ), null, null );
 
         System.setOut( ps );
 

Modified: maven/continuum/trunk/pom.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/pom.xml?rev=240192&r1=240191&r2=240192&view=diff
==============================================================================
--- maven/continuum/trunk/pom.xml (original)
+++ maven/continuum/trunk/pom.xml Fri Aug 26 01:47:43 2005
@@ -170,6 +170,11 @@
         <artifactId>plexus-jdo2</artifactId>
         <version>1.0-alpha-2-SNAPSHOT</version>
       </dependency>       
+       <dependency>
+          <groupId>plexus</groupId>
+          <artifactId>plexus-formica</artifactId>
+          <version>1.0-beta-5-SNAPSHOT</version>
+       </dependency>
     </dependencies>    
   </dependencyManagement>
   



Mime
View raw message