maven-wagon-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mic...@apache.org
Subject cvs commit: maven-wagon/wagon-providers/wagon-http-lightweight pom.xml
Date Wed, 14 Jul 2004 21:13:03 GMT
michal      2004/07/14 14:13:03

  Added:       wagon-providers/wagon-http-lightweight/src/main/java/org/apache/maven/wagon/providers/http
                        LightweightHttpWagon.java
               wagon-providers/wagon-http-lightweight/src/main/resources/META-INF/plexus
                        components.xml
               wagon-providers/wagon-http-lightweight/src/test/java/g/apache/maven/wagon/providers/http
                        LightweightHttpWagonTest.java
                        LightweightHttpWagonTest.xml
               wagon-providers/wagon-http-lightweight pom.xml
  Log:
  cleanup of import
  
  Revision  Changes    Path
  1.1                  maven-wagon/wagon-providers/wagon-http-lightweight/src/main/java/org/apache/maven/wagon/providers/http/LightweightHttpWagon.java
  
  Index: LightweightHttpWagon.java
  ===================================================================
  package org.apache.maven.wagon.providers.http;
  
  /*
   * Copyright 2001-2004 The Apache Software Foundation.
   *
   * Licensed 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.wagon.ConnectionException;
  import org.apache.maven.wagon.ResourceDoesNotExistException;
  import org.apache.maven.wagon.StreamWagon;
  import org.apache.maven.wagon.TransferFailedException;
  import org.apache.maven.wagon.authentication.AuthenticationException;
  import org.apache.maven.wagon.repository.Repository;
  
  import java.io.FileNotFoundException;
  import java.io.IOException;
  import java.io.InputStream;
  import java.io.OutputStream;
  import java.net.MalformedURLException;
  import java.net.URL;
  
  /**
   * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
   * @version $Id: LightweightHttpWagon.java,v 1.1 2004/07/14 21:13:03 michal Exp $
   */
  public class LightweightHttpWagon extends StreamWagon
  {
  
      public InputStream getInputStream( String resource ) throws TransferFailedException,
ResourceDoesNotExistException
      {
          Repository repository = getRepository();
  
          String repositoryUrl = repository.getUrl();
  
          try
          {
              URL url;
  
              if ( repositoryUrl.endsWith( "/" ) )
              {
                  url = new URL( repositoryUrl + resource );
              }
              else
              {
                  url = new URL( repositoryUrl + "/" + resource );
              }
  
              return url.openStream();
          }
          catch ( MalformedURLException e )
          {
              throw new ResourceDoesNotExistException( e.getMessage() );
  
          }
          catch( FileNotFoundException e )
          {
             throw new ResourceDoesNotExistException( e.getMessage() );
          }
          catch ( IOException e )
          {
  
              throw new TransferFailedException( e.getMessage() );
          }
  
  
      }
  
      public OutputStream getOutputStream( String resource ) throws TransferFailedException
      {
          throw new  UnsupportedOperationException( "PUT operation is not supported by Light
Weight  HTTP wagon" );
      }
  
      public void openConnection() throws ConnectionException, AuthenticationException
      {
  
      }
  
      public void closeConnection() throws ConnectionException
      {
  
      }
  }
  
  
  
  1.1                  maven-wagon/wagon-providers/wagon-http-lightweight/src/main/resources/META-INF/plexus/components.xml
  
  Index: components.xml
  ===================================================================
  <component-set>  
    <components>
      <component>
        <role>org.apache.maven.wagon.Wagon</role>
        <role-hint>http</role-hint>
        <implementation>org.apache.maven.wagon.providers.http.LightweightHttpWagon</implementation>
        <instantiation-strategy>per-lookup</instantiation-strategy>
      </component>
    </components>
  </component-set>
  
  
  
  1.1                  maven-wagon/wagon-providers/wagon-http-lightweight/src/test/java/g/apache/maven/wagon/providers/http/LightweightHttpWagonTest.java
  
  Index: LightweightHttpWagonTest.java
  ===================================================================
  package g.apache.maven.wagon.providers.http;
  
  /*
   * Copyright 2001-2004 The Apache Software Foundation.
   *
   * Licensed 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.wagon.WagonTestCase;
  import org.apache.maven.wagon.FileTestUtils;
  import org.apache.maven.wagon.Wagon;
  import org.apache.maven.wagon.ConnectionException;
  import org.apache.maven.wagon.authentication.AuthenticationException;
  import org.apache.maven.wagon.artifact.Artifact;
  import org.apache.maven.wagon.repository.Repository;
  import org.codehaus.plexus.jetty.Httpd;
  import org.codehaus.plexus.PlexusTestCase;
  
  import java.io.File;
  
  /**
   * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
   * @version $Id: LightweightHttpWagonTest.java,v 1.1 2004/07/14 21:13:03 michal Exp $
   */
  public class LightweightHttpWagonTest
      extends PlexusTestCase
  {
      private Wagon wagon;
  
      public LightweightHttpWagonTest( String testName )
      {
          super( testName );       
      }
  
  
      protected void setUp()
          throws Exception
      {
          super.setUp();
          wagon = ( Wagon ) lookup( Wagon.ROLE, "http" );
      }
  
      public void testHttpWagon()
      {
  
          try
          {
              Repository repository = new Repository( "test", "http://www.ibiblio.org/maven"
);
  
              wagon.connect( repository );
  
              File file = File.createTempFile( "maven-http-wagon", ".test" );
  
              file.deleteOnExit();
  
              wagon.get( "maven/poms/maven-1.0.pom", file );
  
              assertTrue( file.exists()  );
  
              assertTrue( file.length() > 0  );
          }
          catch ( Exception e )
          {
  
              e.printStackTrace();
  
              fail( e.getMessage() );
          }
  
  
      }
  
  
  }
  
  
  
  1.1                  maven-wagon/wagon-providers/wagon-http-lightweight/src/test/java/g/apache/maven/wagon/providers/http/LightweightHttpWagonTest.xml
  
  Index: LightweightHttpWagonTest.xml
  ===================================================================
  <plexus>
    <components>
      <component>
        <role>org.codehaus.plexus.jetty.Httpd</role>
        <implementation>org.codehaus.plexus.jetty.DefaultHttpd</implementation>
        <configuration>
          <port>10007</port>
          <contexts>
            <context>
              <path>/</path>
              <document-root>${basedir}/target/http-repository</document-root>
            </context>
          </contexts>
        </configuration>
      </component>
    </components>
  </plexus>
  
  
  1.1                  maven-wagon/wagon-providers/wagon-http-lightweight/pom.xml
  
  Index: pom.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  
  <project>
    <parent>
      <groupId>maven</groupId>
      <artifactId>wagon</artifactId>
      <version>0.9-SNAPSHOT</version>
    </parent>
    <groupId>maven</groupId>
    <artifactId>wagon-http-lightweight</artifactId>
    <name>Lightweight Wagon HTTP provider</name>
    <version>0.9-SNAPSHOT</version>
    <shortDescription>Wagon Provider for HTTP protocol without any external dependedencies</shortDescription>
    <package>org.apache.maven.wagon.providers.http</package>
    <inceptionYear>2004</inceptionYear>
    <url>http://maven.apache.org/wagon/wagon-providers/http-ligtweight</url>
    <issueTrackingUrl>http://jira.codehaus.org/BrowseProject.jspa?id=10319</issueTrackingUrl>
    <siteDirectory>/www/maven.apache.org/wagon/wagon-providers/http-lightweight</siteDirectory>
  
    <developers>
      <developer>
        <name>Michal Maczka</name>
        <id>michal</id>
        <email>michal@codehaus.org</email>
        <organization>Codehaus</organization>
        <roles>
          <role>Creator</role>
          <role>Developer</role>
          <role>Release Manager</role>
        </roles>
      </developer>
    </developers>
  
    <dependencies>
      <dependency>
        <groupId>maven</groupId>
        <artifactId>wagon-api</artifactId>
        <version>0.9-SNAPSHOT</version>
      </dependency>
      <!-- Testing -->
      <dependency>
        <groupId>plexus</groupId>
        <artifactId>plexus-jetty-httpd</artifactId>
        <version>1.0-SNAPSHOT</version>
      </dependency>
      <dependency>
        <groupId>jetty</groupId>
        <artifactId>jetty</artifactId>
        <version>4.2.10</version>
      </dependency>
      <dependency>
        <groupId>servletapi</groupId>
        <artifactId>servletapi</artifactId>
        <version>2.3</version>
      </dependency>
    </dependencies>
  </project>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: wagon-cvs-unsubscribe@maven.apache.org
For additional commands, e-mail: wagon-cvs-help@maven.apache.org


Mime
View raw message