This commit was manufactured by cvs2svn to create branch 'ASF'.
git-svn-id: https://svn.apache.org/repos/asf/maven/wagon/branches/ASF@162434 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/.cvsignore b/.cvsignore
deleted file mode 100644
index db40082..0000000
--- a/.cvsignore
+++ /dev/null
@@ -1,10 +0,0 @@
-*.log
-target
-.classpath
-.project
-default.lst
-test.out
-default.ajsym
-*.iml
-*.ipr
-*.iws
diff --git a/pom.xml b/pom.xml
deleted file mode 100644
index 90eeece..0000000
--- a/pom.xml
+++ /dev/null
@@ -1,91 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<project>
- <modelVersion>4.0.0</modelVersion>
- <groupId>maven</groupId>
- <artifactId>wagon</artifactId>
- <version>1.0-alpha-2-SNAPSHOT</version>
- <type>pom</type>
- <name>Wagon</name>
- <description>Tools to manage artifacts and deployment</description>
- <shortDescription>Tools to manage artifacts and deployment</shortDescription>
- <package>org.apache.maven.wagon</package>
- <inceptionYear>2003</inceptionYear>
-
- <organization>
- <name>Apache Software Foundation</name>
- <url>http://www.apache.org/</url>
- <logo>http://maven.apache.org/images/apache-maven-project.png</logo>
- </organization>
-
- <distributionManagement>
- <repository>
- <id>central</id>
- <name>Maven Central Repository at Ibiblio</name>
- <url>scp://login.ibiblio.org//public/html/maven</url>
- </repository>
- </distributionManagement>
-
- <scm>
- <connection>scm:cvs:pserver:anoncvs@cvs.apache.org:/home/cvspublic:maven-wagon</connection>
- <developerConnection>scm:cvs:ext:${maven.username}@cvs.apache.org:/home/cvs:maven-wagon</developerConnection>
- <url>http://cvs.apache.org/viewcvs.cgi/maven-wagon</url>
- </scm>
-
- <ciManagement>
- <nagEmailAddress>wagon-dev@maven.apache.org</nagEmailAddress>
- </ciManagement>
-
- <mailingLists>
- <mailingList>
- <name>Wagon User List</name>
- <subscribe>wagon-users-subscribe@maven.apache.org</subscribe>
- <unsubscribe>wagon-users-unsubscribe@maven.apache.org</unsubscribe>
- <archive>http://nagoya.apache.org/eyebrowse/SummarizeList?listName=wagon-users@maven.apache.org</archive>
- </mailingList>
- <mailingList>
- <name>Wagon Developer List</name>
- <subscribe>wagon-dev-subscribe@maven.apache.org</subscribe>
- <unsubscribe>wagon-dev-unsubscribe@maven.apache.org</unsubscribe>
- <archive>http://nagoya.apache.org/eyebrowse/SummarizeList?listName=wagon-dev@maven.apache.org</archive>
- </mailingList>
- </mailingLists>
-
- <developers>
- <developer>
- <name>Michal Maczka</name>
- <id>michal</id>
- <email>michal@codehaus.com</email>
- <organization>Codehaus</organization>
- <roles>
- <role>Architect</role>
- </roles>
- </developer>
- <developer>
- <name>Brett Porter</name>
- <id>brett</id>
- <email>brett@apache.org</email>
- <timezone>+10</timezone>
- <roles>
- <role>Java Developer</role>
- </roles>
- </developer>
- </developers>
-
- <licenses>
- <license>
- <name>The Apache Software License, Version 2.0</name>
- <url>http://cvs.apache.org/viewcvs.cgi/*checkout*/maven/LICENSE.txt</url>
- <distribution>repo</distribution>
- </license>
- </licenses>
-
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>3.8.1</version>
- </dependency>
- </dependencies>
-
-</project>
diff --git a/wagon-provider-api/.cvsignore b/wagon-provider-api/.cvsignore
deleted file mode 100644
index 442a240..0000000
--- a/wagon-provider-api/.cvsignore
+++ /dev/null
@@ -1,11 +0,0 @@
-*.log
-target
-.classpath
-.project
-default.lst
-test.out
-default.ajsym
-*.iml
-*.ipr
-*.iws
-destination
diff --git a/wagon-provider-api/LICENSE.txt b/wagon-provider-api/LICENSE.txt
deleted file mode 100644
index d645695..0000000
--- a/wagon-provider-api/LICENSE.txt
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- 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.
diff --git a/wagon-provider-api/pom.xml b/wagon-provider-api/pom.xml
deleted file mode 100644
index 55cf292..0000000
--- a/wagon-provider-api/pom.xml
+++ /dev/null
@@ -1,46 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<project>
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>maven</groupId>
- <artifactId>wagon</artifactId>
- <version>1.0-alpha-2-SNAPSHOT</version>
- </parent>
- <groupId>maven</groupId>
- <artifactId>wagon-provider-api</artifactId>
- <name>Wagon API</name>
- <version>1.0-alpha-2-SNAPSHOT</version>
- <description></description>
- <shortDescription>Tools to manage artifacts and deployment</shortDescription>
- <description>
- Wagon in general utility resource transport framework.
- The Wagon API defines
- the interfaces, clasess and their respective roles.
- </description>
-
-
- <package>org.apache.maven.wagon</package>
- <inceptionYear>2003</inceptionYear>
- <url>http://maven.apache.org/wagon/wagon-api</url>
- <issueTrackingUrl>http://jira.codehaus.org/browse/WAGON</issueTrackingUrl>
- <developers>
- <developer>
- <name>Michal Maczka</name>
- <id>michal</id>
- <email>michal@codehaus.org</email>
- <organization>Codehaus</organization>
- <roles>
- <role>Architect</role>
- </roles>
- </developer>
- <developer>
- <name>Jason van Zyl</name>
- <id>jvanzyl</id>
- <email>jason@maven.org</email>
- <roles>
- <role>Developer</role>
- </roles>
- </developer>
- </developers>
-</project>
diff --git a/wagon-provider-api/src/main/java/org/apache/maven/wagon/AbstractWagon.java b/wagon-provider-api/src/main/java/org/apache/maven/wagon/AbstractWagon.java
deleted file mode 100644
index e7e28fc..0000000
--- a/wagon-provider-api/src/main/java/org/apache/maven/wagon/AbstractWagon.java
+++ /dev/null
@@ -1,481 +0,0 @@
-package org.apache.maven.wagon;
-
-/* ====================================================================
- * 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.authentication.AuthenticationException;
-import org.apache.maven.wagon.events.SessionEvent;
-import org.apache.maven.wagon.events.SessionEventSupport;
-import org.apache.maven.wagon.events.SessionListener;
-import org.apache.maven.wagon.events.TransferEvent;
-import org.apache.maven.wagon.events.TransferEventSupport;
-import org.apache.maven.wagon.events.TransferListener;
-import org.apache.maven.wagon.proxy.ProxyInfo;
-import org.apache.maven.wagon.repository.Repository;
-import org.apache.maven.wagon.resource.Resource;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-
-/**
- * Implementation of common facilties for Wagon providers.
- *
- * @todo [BP] The proxy information should probably be validated to match the wagon type
- *
- * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
- * @version $Id$
- */
-public abstract class AbstractWagon
- implements Wagon
-{
- private static final int DEFAULT_BUFFER_SIZE = 1024 * 4;
-
- protected Repository repository;
-
- protected SessionEventSupport sessionEventSupport = new SessionEventSupport();
-
- protected TransferEventSupport transferEventSupport = new TransferEventSupport();
-
- protected ProxyInfo proxyInfo = null;
-
- // ----------------------------------------------------------------------
- // Repository
- // ----------------------------------------------------------------------
-
- public Repository getRepository()
- {
- return repository;
- }
-
- // ----------------------------------------------------------------------
- // Connection
- // ----------------------------------------------------------------------
-
- public void connect( Repository repository )
- throws ConnectionException, AuthenticationException
- {
- connect( repository, null );
- }
-
- public void connect( Repository repository, ProxyInfo proxyInfo )
- throws ConnectionException, AuthenticationException
- {
- if ( repository == null )
- {
- throw new IllegalStateException( "The repository specified cannot be null." );
- }
-
- this.repository = repository;
- this.proxyInfo = proxyInfo;
-
- fireSessionOpening();
-
- openConnection();
-
- fireSessionOpened();
- }
-
- public void disconnect()
- throws ConnectionException
- {
- fireSessionDisconnecting();
-
- closeConnection();
-
- fireSessionDisconnected();
- }
-
- protected abstract void closeConnection() throws ConnectionException;
-
- protected void createParentDirectories( File destination )
- throws ResourceDoesNotExistException, TransferFailedException
- {
- if ( destination == null )
- {
- throw new ResourceDoesNotExistException( "get: Destination cannot be null" );
- }
-
- File destinationDirectory = destination.getParentFile();
- if ( destinationDirectory != null && !destinationDirectory.exists() )
- {
- if ( !destinationDirectory.mkdirs() )
- {
- throw new TransferFailedException( "Specified destination directory cannot be created: " + destinationDirectory );
- }
- }
- }
-
- // ----------------------------------------------------------------------
- // Stream i/o
- // ----------------------------------------------------------------------
-
- protected void getTransfer( Resource resource, File destination, InputStream input )
- throws TransferFailedException
- {
- fireGetStarted( resource, destination );
-
- OutputStream output = new LazyFileOutputStream( destination );
-
- try
- {
- transfer( resource, input, output, TransferEvent.REQUEST_GET );
- }
- catch ( IOException e )
- {
- fireTransferError( resource, e );
-
- if ( destination.exists() )
- {
- boolean deleted = destination.delete();
-
- if ( ! deleted )
- {
- destination.deleteOnExit();
- }
- }
-
- String msg = "GET request of: " + resource.getName() + " from " + repository.getName() + " failed";
-
- throw new TransferFailedException( msg, e );
-
- }
- finally
- {
- shutdownStream( input );
-
- shutdownStream( output );
-
- }
-
- fireGetCompleted( resource, destination );
- }
-
- protected void putTransfer( Resource resource, File source, OutputStream output, boolean closeOutput )
- throws TransferFailedException
- {
- firePutStarted( resource, source );
-
- if ( !source.exists() )
- {
- throw new TransferFailedException( "Specified source file does not exist: " + source );
- }
-
- InputStream input = null;
-
- try
- {
- input = new FileInputStream( source );
-
- transfer( resource, input, output, TransferEvent.REQUEST_PUT );
- }
- catch ( IOException e )
- {
- fireTransferError( resource, e );
-
- String msg = "PUT request for: " + resource + " to " + source.getName() + "failed";
-
- throw new TransferFailedException( msg, e );
- }
- finally
- {
- shutdownStream( input );
-
- if ( closeOutput )
- {
- shutdownStream( output );
- }
- }
- firePutCompleted( resource, source );
- }
-
- protected void transfer( Resource resource, InputStream input, OutputStream output, int requestType )
- throws IOException
- {
- byte[] buffer = new byte[ DEFAULT_BUFFER_SIZE ];
-
- TransferEvent transferEvent = new TransferEvent( this, resource , TransferEvent.TRANSFER_PROGRESS, requestType );
-
- while ( true )
- {
- int n = input.read( buffer ) ;
-
- if ( n == -1 )
- {
- break;
- }
-
- fireTransferProgress( transferEvent, buffer, n );
-
- output.write( buffer, 0, n );
- }
- }
-
- protected void shutdownStream( InputStream inputStream )
- {
- if ( inputStream != null )
- {
- try
- {
- inputStream.close();
- }
- catch ( Exception e )
- {
- }
- }
- }
-
- protected void shutdownStream( OutputStream outputStream )
- {
- if ( outputStream != null )
- {
- try
- {
- outputStream.close();
- }
- catch ( Exception e )
- {
- }
- }
- }
-
- // ----------------------------------------------------------------------
- //
- // ----------------------------------------------------------------------
-
- protected void fireTransferProgress( TransferEvent transferEvent, byte[] buffer, int n )
- {
- transferEventSupport.fireTransferProgress( transferEvent, buffer, n );
- }
-
- protected void fireGetCompleted( Resource resource, File localFile )
- {
- long timestamp = System.currentTimeMillis();
-
- TransferEvent transferEvent =
- new TransferEvent( this, resource, TransferEvent.TRANSFER_COMPLETED, TransferEvent.REQUEST_GET );
-
- transferEvent.setTimestamp( timestamp );
-
- transferEvent.setLocalFile( localFile );
-
- transferEventSupport.fireTransferCompleted( transferEvent );
- }
-
- protected void fireGetStarted( Resource resource, File localFile )
- {
- long timestamp = System.currentTimeMillis();
-
- TransferEvent transferEvent =
- new TransferEvent( this, resource, TransferEvent.TRANSFER_STARTED, TransferEvent.REQUEST_GET );
-
- transferEvent.setTimestamp( timestamp );
-
- transferEvent.setLocalFile( localFile );
-
- transferEventSupport.fireTransferStarted( transferEvent );
- }
-
- protected void firePutCompleted( Resource resource, File localFile )
- {
- long timestamp = System.currentTimeMillis();
-
- TransferEvent transferEvent =
- new TransferEvent( this, resource, TransferEvent.TRANSFER_COMPLETED, TransferEvent.REQUEST_PUT );
-
- transferEvent.setTimestamp( timestamp );
-
- transferEvent.setLocalFile( localFile );
-
- transferEventSupport.fireTransferCompleted( transferEvent );
- }
-
- protected void firePutStarted( Resource resource, File localFile )
- {
- long timestamp = System.currentTimeMillis();
-
- TransferEvent transferEvent =
- new TransferEvent( this, resource, TransferEvent.TRANSFER_STARTED, TransferEvent.REQUEST_PUT );
-
- transferEvent.setTimestamp( timestamp );
-
- transferEvent.setLocalFile( localFile );
-
- transferEventSupport.fireTransferStarted( transferEvent );
- }
-
- protected void fireSessionDisconnected()
- {
- long timestamp = System.currentTimeMillis();
-
- SessionEvent sessionEvent = new SessionEvent( this, SessionEvent.SESSION_DISCONNECTED );
-
- sessionEvent.setTimestamp( timestamp );
-
- sessionEventSupport.fireSessionDisconnected( sessionEvent );
- }
-
- protected void fireSessionDisconnecting()
- {
- long timestamp = System.currentTimeMillis();
-
- SessionEvent sessionEvent = new SessionEvent( this, SessionEvent.SESSION_DISCONNECTING );
-
- sessionEvent.setTimestamp( timestamp );
-
- sessionEventSupport.fireSessionDisconnecting( sessionEvent );
- }
-
- protected void fireSessionLoggedIn()
- {
- long timestamp = System.currentTimeMillis();
-
- SessionEvent sessionEvent = new SessionEvent( this, SessionEvent.SESSION_LOGGED_IN );
-
- sessionEvent.setTimestamp( timestamp );
-
- sessionEventSupport.fireSessionLoggedIn( sessionEvent );
- }
-
- protected void fireSessionLoggedOff()
- {
- long timestamp = System.currentTimeMillis();
-
- SessionEvent sessionEvent = new SessionEvent( this, SessionEvent.SESSION_LOGGED_OFF );
-
- sessionEvent.setTimestamp( timestamp );
-
- sessionEventSupport.fireSessionLoggedOff( sessionEvent );
- }
-
- protected void fireSessionOpened()
- {
- long timestamp = System.currentTimeMillis();
-
- SessionEvent sessionEvent = new SessionEvent( this, SessionEvent.SESSION_OPENED );
-
- sessionEvent.setTimestamp( timestamp );
-
- sessionEventSupport.fireSessionOpened( sessionEvent );
- }
-
- protected void fireSessionOpening()
- {
- long timestamp = System.currentTimeMillis();
-
- SessionEvent sessionEvent = new SessionEvent( this, SessionEvent.SESSION_OPENING );
-
- sessionEvent.setTimestamp( timestamp );
-
- sessionEventSupport.fireSessionOpening( sessionEvent );
- }
-
- protected void fireSessionConnectionRefused()
- {
-
- long timestamp = System.currentTimeMillis();
-
- SessionEvent sessionEvent = new SessionEvent( this, SessionEvent.SESSION_CONNECTION_REFUSED );
-
- sessionEvent.setTimestamp( timestamp );
-
- sessionEventSupport.fireSessionConnectionRefused( sessionEvent );
- }
-
- protected void fireSessionError( Exception exception )
- {
- long timestamp = System.currentTimeMillis();
-
- SessionEvent sessionEvent = new SessionEvent( this, exception );
-
- sessionEvent.setTimestamp( timestamp );
-
- sessionEventSupport.fireSessionError( sessionEvent );
-
- }
-
- protected void fireTransferDebug( String message )
- {
- transferEventSupport.fireDebug( message );
- }
-
- protected void fireSessionDebug( String message )
- {
- sessionEventSupport.fireDebug( message );
- }
-
- public boolean hasTransferListener( TransferListener listener )
- {
- return transferEventSupport.hasTransferListener( listener );
- }
-
- public void addTransferListener( TransferListener listener )
- {
- transferEventSupport.addTransferListener( listener );
- }
-
- public void removeTransferListener( TransferListener listener )
- {
- transferEventSupport.removeTransferListener( listener );
- }
-
- public void addSessionListener( SessionListener listener )
- {
- sessionEventSupport.addSessionListener( listener );
- }
-
- public boolean hasSessionListener( SessionListener listener )
- {
- return sessionEventSupport.hasSessionListener( listener );
- }
-
- public void removeSessionListener( SessionListener listener )
- {
- sessionEventSupport.removeSessionListener( listener );
- }
-
- protected void fireTransferError( Resource resource, Exception e )
- {
- TransferEvent transferEvent = new TransferEvent( this, resource, e );
-
- transferEventSupport.fireTransferError( transferEvent );
- }
-
-
- public SessionEventSupport getSessionEventSupport()
- {
- return sessionEventSupport;
- }
-
- public void setSessionEventSupport( SessionEventSupport sessionEventSupport )
- {
- this.sessionEventSupport = sessionEventSupport;
- }
-
- public TransferEventSupport getTransferEventSupport()
- {
- return transferEventSupport;
- }
-
- public void setTransferEventSupport( TransferEventSupport transferEventSupport )
- {
- this.transferEventSupport = transferEventSupport;
- }
-}
diff --git a/wagon-provider-api/src/main/java/org/apache/maven/wagon/ConnectionException.java b/wagon-provider-api/src/main/java/org/apache/maven/wagon/ConnectionException.java
deleted file mode 100644
index 618ac21..0000000
--- a/wagon-provider-api/src/main/java/org/apache/maven/wagon/ConnectionException.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package org.apache.maven.wagon;
-
-/* ====================================================================
- * 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.
- * ====================================================================
- */
-
-/**
- * The exception is thrown when a connection
- * to repository cannot be estblished or open connection cannot be closed.
- *
- * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
- * @version $Id$
- */
-public class ConnectionException extends WagonException
-{
-
-
- /**
- * @see org.apache.maven.wagon.WagonException
- */
- public ConnectionException( final String message )
- {
- super( message );
- }
-
- /**
- * @see org.apache.maven.wagon.WagonException
- */
- public ConnectionException( final String message, final Throwable cause )
- {
- super( message, cause );
- }
-
-}
diff --git a/wagon-provider-api/src/main/java/org/apache/maven/wagon/FileTestUtils.java b/wagon-provider-api/src/main/java/org/apache/maven/wagon/FileTestUtils.java
deleted file mode 100644
index 622c60b..0000000
--- a/wagon-provider-api/src/main/java/org/apache/maven/wagon/FileTestUtils.java
+++ /dev/null
@@ -1,138 +0,0 @@
-package org.apache.maven.wagon;
-
-/* ====================================================================
- * 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 junit.framework.TestCase;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.Writer;
-
-/**
- * @author <a href="michal@apache.org>Michal Maczka</a>
- * @version $Id$
- */
-public class FileTestUtils
-{
-
- public static final File createUniqueFile( final String dirname, final String name ) throws IOException
- {
-
- final File dir = createDir( dirname );
-
- final File retValue = new File( dir, name );
-
- return retValue;
-
-
- }
-
- public static final File createUniqueFile( final String name ) throws IOException
- {
- return createUniqueFile( name, name );
- }
-
-
- public static final File createUniqueFile( final TestCase testCase ) throws IOException
- {
-
- return createUniqueFile( testCase.getName() );
-
- }
-
- public static final File createUniqueDir( final String name ) throws IOException
- {
-
- String filename = name + System.currentTimeMillis();
-
- return createDir( filename );
-
- }
-
-
- public static final File createUniqueDir( final TestCase testCase ) throws IOException
- {
-
- return createUniqueDir( testCase.getName() );
-
- }
-
-
- public static final File createDir( final String name ) throws IOException
- {
-
- final File baseDirectory = getTestOutputDir();
-
- final File retValue = new File ( baseDirectory, name );
-
- retValue.delete();
-
- retValue.mkdirs();
-
- if ( !retValue.exists() )
- {
- throw new IOException( "Unable to create the directory for testdata" );
- }
-
- System.out.println( "Creating directory: " + retValue );
-
- return retValue;
- }
-
- public static final File createDir( final TestCase testCase ) throws IOException
- {
- return createDir( testCase.getName() );
- }
-
-
-
- public static final File getTestOutputDir()
- {
- final String tempDir = System.getProperty( "java.io.tmpdir" );
-
- final String baseDir = System.getProperty( "basedir", tempDir );
-
- final File base = new File( baseDir ).getAbsoluteFile();
-
- final String pathname =
- base + File.separator + "target" + File.separator + "test-output";
-
- final File retValue = new File( pathname );
-
- retValue.mkdirs();
-
- return retValue;
- }
-
- public static File generateFile( String file, String content )
- throws IOException
- {
- File f = new File( file );
-
- f.getParentFile().mkdirs();
-
- Writer writer = new FileWriter( f );
-
- writer.write( content );
-
- writer.close();
-
- return f;
- }
-}
diff --git a/wagon-provider-api/src/main/java/org/apache/maven/wagon/InputData.java b/wagon-provider-api/src/main/java/org/apache/maven/wagon/InputData.java
deleted file mode 100644
index 68463d4..0000000
--- a/wagon-provider-api/src/main/java/org/apache/maven/wagon/InputData.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package org.apache.maven.wagon;
-
-import org.apache.maven.wagon.resource.Resource;
-
-import java.io.InputStream;
-
-/**
- * @author <a href="mailto:michal@codehaus.org">Michal Maczka</a>
- * @version $Id$
- */
-public class InputData
-{
- private InputStream inputStream;
-
- private Resource resource;
-
- public InputStream getInputStream()
- {
- return inputStream;
- }
-
- public void setInputStream( InputStream inputStream )
- {
- this.inputStream = inputStream;
- }
-
- public Resource getResource() {
- return resource;
- }
-
- public void setResource( Resource resource )
- {
- this.resource = resource;
- }
-
-}
diff --git a/wagon-provider-api/src/main/java/org/apache/maven/wagon/LazyFileOutputStream.java b/wagon-provider-api/src/main/java/org/apache/maven/wagon/LazyFileOutputStream.java
deleted file mode 100644
index 81bfeb3..0000000
--- a/wagon-provider-api/src/main/java/org/apache/maven/wagon/LazyFileOutputStream.java
+++ /dev/null
@@ -1,136 +0,0 @@
-package org.apache.maven.wagon;
-
-/* ====================================================================
- * 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 java.io.*;
-import java.nio.channels.FileChannel;
-
-
-/**
- * Variant of FileOutputStream which creates the file only when first portion
- * of data is written.
- *
- * @author <a href="mailto:mmaczka@interia.pl">Michal Maczka</a>
- * @version $Id$
- */
-public class LazyFileOutputStream extends OutputStream
-{
-
- private File file;
-
- private FileOutputStream delegee;
-
-
- public LazyFileOutputStream( String filename )
- {
- this.file = new File( filename );
- }
-
- public LazyFileOutputStream( File file )
- {
- this.file = file;
- }
-
-
- public void close() throws IOException
- {
- if ( delegee != null)
- {
- delegee.close();
- }
- }
-
-
- public boolean equals( Object obj )
- {
- return delegee.equals( obj );
- }
-
-
- public void flush() throws IOException
- {
- delegee.flush();
- }
-
-
- public FileChannel getChannel()
- {
- return delegee.getChannel();
- }
-
-
- public FileDescriptor getFD() throws IOException
- {
- return delegee.getFD();
- }
-
- public int hashCode()
- {
- return delegee.hashCode();
- }
-
-
- public String toString()
- {
- return delegee.toString();
- }
-
- public void write( byte[] b ) throws IOException
- {
- if ( delegee == null)
- {
- initialize();
- }
-
- delegee.write( b );
- }
- /**
- * @see java.io.OutputStream#write(byte[], int, int)
- */
- public void write( byte[] b, int off, int len ) throws IOException
- {
- if ( delegee == null)
- {
- initialize();
- }
-
- delegee.write( b, off, len );
- }
- /**
- * @param b
- * @throws java.io.IOException
- */
- public void write( int b ) throws IOException
- {
- if ( delegee == null)
- {
- initialize();
- }
-
- delegee.write( b );
- }
-
-
- /**
- *
- */
- private void initialize() throws FileNotFoundException
- {
- delegee = new FileOutputStream( file );
- }
-}
diff --git a/wagon-provider-api/src/main/java/org/apache/maven/wagon/OutputData.java b/wagon-provider-api/src/main/java/org/apache/maven/wagon/OutputData.java
deleted file mode 100644
index b4bc0f9..0000000
--- a/wagon-provider-api/src/main/java/org/apache/maven/wagon/OutputData.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package org.apache.maven.wagon;
-
-import org.apache.maven.wagon.resource.Resource;
-
-import java.io.InputStream;
-import java.io.OutputStream;
-
-/**
- * @author <a href="mailto:michal@codehaus.org">Michal Maczka</a>
- * @version $Id$
- */
-public class OutputData
-{
- private OutputStream outputStream;
-
- private Resource resource;
-
- public OutputStream getOutputStream()
- {
- return outputStream;
- }
-
- public void setOutputStream( OutputStream outputStream )
- {
- this.outputStream = outputStream;
- }
-
- public Resource getResource()
- {
- return resource;
- }
-
- public void setResource( Resource resource )
- {
- this.resource = resource;
- }
-}
diff --git a/wagon-provider-api/src/main/java/org/apache/maven/wagon/PathUtils.java b/wagon-provider-api/src/main/java/org/apache/maven/wagon/PathUtils.java
deleted file mode 100644
index 8ac61ee..0000000
--- a/wagon-provider-api/src/main/java/org/apache/maven/wagon/PathUtils.java
+++ /dev/null
@@ -1,366 +0,0 @@
-package org.apache.maven.wagon;
-
-/* ====================================================================
- * 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 java.util.StringTokenizer;
-
-/**
- * Various path (URL) manipulation routines
- *
- * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
- * @version $Id$
- */
-public class PathUtils
-{
- /**
- * Returns the directory path portion of a file specification string.
- * Matches the equally named unix command.
- *
- * @return The directory portion excluding the ending file separator.
- */
- public static String dirname( final String path )
- {
- final int i = path.lastIndexOf( "/" );
-
- return ( ( i >= 0 ) ? path.substring( 0, i ) : "" );
- }
-
- /**
- * Returns the filename portion of a file specification string.
- *
- * @return The filename string with extension.
- */
- public static String filename( final String path )
- {
- final int i = path.lastIndexOf( "/" );
- return ( ( i >= 0 ) ? path.substring( i + 1 ) : path );
- }
-
- public static String[] dirnames( final String path )
- {
- final String dirname = PathUtils.dirname( path );
- return split( dirname, "/", -1 );
-
- }
-
- private static String[] split(
- final String str,
- final String separator,
- final int max )
- {
- final StringTokenizer tok;
-
- if ( separator == null )
- {
- // Null separator means we're using StringTokenizer's default
- // delimiter, which comprises all whitespace characters.
- tok = new StringTokenizer( str );
- }
- else
- {
- tok = new StringTokenizer( str, separator );
- }
-
- int listSize = tok.countTokens();
-
- if ( max > 0 && listSize > max )
- {
- listSize = max;
- }
-
- final String[] list = new String[listSize];
-
- int i = 0;
-
- int lastTokenBegin;
- int lastTokenEnd = 0;
-
- while ( tok.hasMoreTokens() )
- {
- if ( max > 0 && i == listSize - 1 )
- {
- // In the situation where we hit the max yet have
- // tokens left over in our input, the last list
- // element gets all remaining text.
- final String endToken = tok.nextToken();
-
- lastTokenBegin = str.indexOf( endToken, lastTokenEnd );
-
- list[i] = str.substring( lastTokenBegin );
-
- break;
-
- }
- else
- {
- list[i] = tok.nextToken();
-
- lastTokenBegin = str.indexOf( list[i], lastTokenEnd );
-
- lastTokenEnd = lastTokenBegin + list[i].length();
- }
-
- i++;
- }
- return list;
- }
-
- /**
- * Return the host name (Removes protocol and path from the URL) E.g: for input
- * <code>http://www.codehause.org</code> this method will return <code>www.apache.org</code>
- *
- * @param url the url
- *
- * @return the host name
- */
- public static String host( final String url )
- {
- String authorization = authorization( url );
- int index = authorization.indexOf( '@' );
- if ( index >= 0 )
- {
- return authorization.substring( index + 1 );
- }
- else
- {
- return authorization;
- }
- }
-
- private static String authorization( final String url )
- {
- if ( url == null )
- {
- return "localhost";
- }
-
- final String protocol = PathUtils.protocol( url );
-
- if ( protocol == null || protocol.equals( "file" ) )
- {
- return "localhost";
- }
-
- String host = url.substring( url.indexOf( "://" ) + 3 ).trim();
-
- int pos = host.indexOf( "/" );
-
- if ( pos > 0 )
- {
- host = host.substring( 0, pos );
- }
-
- pos = host.indexOf( '@' );
-
- if ( pos > 0 )
- {
- pos = host.indexOf( ':', pos );
- }
- else
- {
- pos = host.indexOf( ":" );
- }
-
- if ( pos > 0 )
- {
- host = host.substring( 0, pos );
- }
- return host;
- }
-
- /**
- * /**
- * Return the protocol name.
- * <br/>
- * E.g: for input
- * <code>http://www.codehause.org</code> this method will return <code>http</code>
- *
- * @param url the url
- *
- * @return the host name
- */
- public static String protocol( final String url )
- {
- final int pos = url.indexOf( ":" );
-
- if ( pos == -1 )
- {
- return "";
- }
- return url.substring( 0, pos ).trim();
- }
-
- /**
- * @param url
- *
- * @return
- */
- public static int port( final String url )
- {
-
- final String protocol = PathUtils.protocol( url );
-
- if ( protocol == null || protocol.equals( "file" ) )
- {
- return WagonConstants.UNKNOWN_PORT;
- }
- final String host = PathUtils.host( url );
-
- if ( host == null )
- {
- return WagonConstants.UNKNOWN_PORT;
- }
-
- final String prefix = protocol + "://" + host;
-
- final int start = prefix.length();
-
- if ( url.length() > start && url.charAt( start ) == ':' )
- {
- int end = url.indexOf( '/', start );
-
- if ( end == -1 )
- {
- end = url.length();
- }
-
- return Integer.parseInt( url.substring( start + 1, end ) );
- }
- else
- {
- return WagonConstants.UNKNOWN_PORT;
- }
-
- }
-
- /**
- * @param url
- * @todo need to URL decode for spaces?
- * @return
- */
- public static String basedir( final String url )
- {
- final String protocol = PathUtils.protocol( url );
-
- String retValue = null;
-
- if ( protocol.equals( "file" ) )
- {
- retValue = url.substring( protocol.length() + 1 );
- // special case: if omitted // on protocol, keep path as is
- if ( retValue.startsWith( "//" ) )
- {
- retValue = retValue.substring( 2 );
-
- if ( retValue.length() >= 2 && ( retValue.charAt( 1 ) == '|' || retValue.charAt( 1 ) == ':' ) )
- {
- // special case: if there is a windows drive letter, then keep the original return value
- retValue = retValue.charAt( 0 ) + ":" + retValue.substring( 2 );
- }
- else
- {
- // Now we expect the host
- int index = retValue.indexOf( "/" );
- if ( index >= 0 )
- {
- retValue = retValue.substring( index + 1 );
- }
-
- // special case: if there is a windows drive letter, then keep the original return value
- if ( retValue.length() >= 2 && ( retValue.charAt( 1 ) == '|' || retValue.charAt( 1 ) == ':' ) )
- {
- retValue = retValue.charAt( 0 ) + ":" + retValue.substring( 2 );
- }
- else if ( index >= 0 )
- {
- // leading / was previously stripped
- retValue = "/" + retValue;
- }
- }
- }
-
- // special case: if there is a windows drive letter using |, switch to :
- if ( retValue.length() >= 2 && retValue.charAt( 1 ) == '|' )
- {
- retValue = retValue.charAt( 0 ) + ":" + retValue.substring( 2 );
- }
- }
- else
- {
- final String host = PathUtils.authorization( url );
-
- final int port = PathUtils.port( url );
-
- final int pos;
-
- if ( port != WagonConstants.UNKNOWN_PORT )
- {
- pos = ( protocol + "://" + host + ":" + port ).length();
-
- }
- else
- {
- pos = ( protocol + "://" + host ).length();
- }
- if ( url.length() > pos )
- {
- retValue = url.substring( pos );
-
- }
-
- }
-
- if ( retValue == null )
- {
- retValue = "/";
- }
- return retValue.trim();
- }
-
- public static String user( String url )
- {
- String host = authorization( url );
- int index = host.indexOf( '@' );
- if ( index > 0 ) {
- String userInfo = host.substring( 0, index );
- index = userInfo.indexOf( ':' );
- if ( index > 0 ) {
- return userInfo.substring( 0, index );
- }
- else if ( index < 0 )
- {
- return userInfo;
- }
- }
- return null;
- }
-
- public static String password( String url )
- {
- String host = authorization( url );
- int index = host.indexOf( '@' );
- if ( index > 0 ) {
- String userInfo = host.substring( 0, index );
- index = userInfo.indexOf( ':' );
- if ( index >= 0 ) {
- return userInfo.substring( index + 1 );
- }
- }
- return null;
- }
-}
diff --git a/wagon-provider-api/src/main/java/org/apache/maven/wagon/ResourceDoesNotExistException.java b/wagon-provider-api/src/main/java/org/apache/maven/wagon/ResourceDoesNotExistException.java
deleted file mode 100644
index 25f5059..0000000
--- a/wagon-provider-api/src/main/java/org/apache/maven/wagon/ResourceDoesNotExistException.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package org.apache.maven.wagon;
-
-/* ====================================================================
- * 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.
- * ====================================================================
- */
-
-/**
- * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
- * @version $Id$
- */
-public class ResourceDoesNotExistException extends WagonException
-{
-
- /**
- * @param message
- */
- public ResourceDoesNotExistException( final String message )
- {
- super( message );
- }
-
- /**
- * @param message
- * @param cause
- */
- public ResourceDoesNotExistException( final String message, final Throwable cause )
- {
- super( message, cause );
- }
-
-}
diff --git a/wagon-provider-api/src/main/java/org/apache/maven/wagon/StreamWagon.java b/wagon-provider-api/src/main/java/org/apache/maven/wagon/StreamWagon.java
deleted file mode 100644
index ef5344c..0000000
--- a/wagon-provider-api/src/main/java/org/apache/maven/wagon/StreamWagon.java
+++ /dev/null
@@ -1,138 +0,0 @@
-package org.apache.maven.wagon;
-
-/* ====================================================================
- * 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.authentication.AuthenticationException;
-import org.apache.maven.wagon.authorization.AuthorizationException;
-import org.apache.maven.wagon.resource.Resource;
-
-import java.io.*;
-
-
-/**
- * Base class for wagon which provide stream based API.
- *
- * @author <a href="mailto:michal@codehaus.org">Michal Maczka</a>
- * @version $Id$
- */
-public abstract class StreamWagon
- extends AbstractWagon
-{
-
- // ----------------------------------------------------------------------
- //
- // ----------------------------------------------------------------------
-
- public abstract void fillInputData( InputData inputData )
- throws TransferFailedException, ResourceDoesNotExistException;
-
- public abstract void fillOutputData( OutputData outputData )
- throws TransferFailedException;
-
- public abstract void openConnection()
- throws ConnectionException, AuthenticationException;
-
- public abstract void closeConnection()
- throws ConnectionException;
-
- // ----------------------------------------------------------------------
- //
- // ----------------------------------------------------------------------
-
- public void get( String resourceName, File destination )
- throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException
- {
- InputData inputData = new InputData( );
-
- Resource resource = new Resource( resourceName );
-
- inputData.setResource( resource );
-
- fillInputData( inputData );
-
- InputStream is = inputData.getInputStream();
-
- if ( is == null )
- {
- throw new TransferFailedException( getRepository().getUrl() + " - Could not open input stream for resource: '" + resource+ "'" );
- }
-
- createParentDirectories( destination );
-
- getTransfer( inputData.getResource(), destination, is );
- }
-
- public boolean getIfNewer( String resourceName, File destination, long timestamp)
- throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException
- {
- boolean retValue = false;
-
- InputData inputData = new InputData( );
-
- Resource resource = new Resource( resourceName );
-
- inputData.setResource( resource );
-
- fillInputData( inputData );
-
- InputStream is = inputData.getInputStream();
-
- if ( resource.getLastModified() > timestamp )
- {
- retValue = true;
-
- if ( is == null )
- {
- throw new TransferFailedException( getRepository().getUrl() + " - Could not open input stream for resource: '" + resource+ "'" );
- }
-
- createParentDirectories( destination );
-
- getTransfer( inputData.getResource(), destination, is );
- }
- else
- {
- shutdownStream( is );
- }
-
- return retValue;
- }
-
-
- // source doesn't exist exception
- public void put( File source, String resourceName )
- throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException
- {
- OutputData outputData = new OutputData( );
-
- Resource resource = new Resource( resourceName );
-
- outputData.setResource( resource );
-
- fillOutputData( outputData );
-
- OutputStream os = outputData.getOutputStream( );
-
- if ( os == null )
- {
- throw new TransferFailedException( getRepository().getUrl() + " - Could not open output stream for resource: '" + resource+ "'" );
- }
-
- putTransfer( outputData.getResource(), source, os, true );
- }
-}
diff --git a/wagon-provider-api/src/main/java/org/apache/maven/wagon/TransferFailedException.java b/wagon-provider-api/src/main/java/org/apache/maven/wagon/TransferFailedException.java
deleted file mode 100644
index 170379c..0000000
--- a/wagon-provider-api/src/main/java/org/apache/maven/wagon/TransferFailedException.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package org.apache.maven.wagon;
-
-/* ====================================================================
- * 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.
- * ====================================================================
- */
-
-/**
- * Exception which should be thrown when IO error occures during
- * a transfer from repository
- *
- * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
- * @version $Id$
- */
-public class TransferFailedException extends WagonException
-{
-
- /**
- * @see org.apache.maven.wagon.WagonException
- */
- public TransferFailedException( final String message )
- {
- super( message );
- }
-
- /**
- * @see org.apache.maven.wagon.WagonException
- */
- public TransferFailedException( final String message, final Throwable cause )
- {
- super( message, cause );
- }
-
-}
diff --git a/wagon-provider-api/src/main/java/org/apache/maven/wagon/UnsupportedProtocolException.java b/wagon-provider-api/src/main/java/org/apache/maven/wagon/UnsupportedProtocolException.java
deleted file mode 100644
index e412e37..0000000
--- a/wagon-provider-api/src/main/java/org/apache/maven/wagon/UnsupportedProtocolException.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package org.apache.maven.wagon;
-
-/* ====================================================================
- * 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.
- * ====================================================================
- */
-
-/**
- * This exception is thrown when no Wagon provider is supporting protocol required by some repository
- *
- * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
- * @version $Id$
- */
-public class UnsupportedProtocolException extends WagonException
-{
-
-
- /**
- * @see WagonException
- */
- public UnsupportedProtocolException( final String message )
- {
- super( message );
- }
-
- /**
- * @see WagonException
- */
- public UnsupportedProtocolException( final String message, final Throwable cause )
- {
- super( message, cause );
- }
-
-
-}
diff --git a/wagon-provider-api/src/main/java/org/apache/maven/wagon/Wagon.java b/wagon-provider-api/src/main/java/org/apache/maven/wagon/Wagon.java
deleted file mode 100644
index 84aeecc..0000000
--- a/wagon-provider-api/src/main/java/org/apache/maven/wagon/Wagon.java
+++ /dev/null
@@ -1,116 +0,0 @@
-package org.apache.maven.wagon;
-
-/* ====================================================================
- * 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.authentication.AuthenticationException;
-import org.apache.maven.wagon.authorization.AuthorizationException;
-import org.apache.maven.wagon.events.SessionListener;
-import org.apache.maven.wagon.events.TransferListener;
-import org.apache.maven.wagon.proxy.ProxyInfo;
-import org.apache.maven.wagon.repository.Repository;
-
-import java.io.File;
-
-public interface Wagon
-{
- String ROLE = Wagon.class.getName();
-
- // ----------------------------------------------------------------------
- // File/File handling
- // ----------------------------------------------------------------------
-
-
- /**
- * Downloads specified resource from the repository to given file.
- *
- * @param resourceName
- * @param destination
- * @throws TransferFailedException
- * @throws ResourceDoesNotExistException
- * @throws AuthorizationException
- */
- void get( String resourceName, File destination )
- throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException;
-
- /**
- * Downloads specified resource from the repository
- * if it was modfified since specified date.
- * The date is measured in milliseconds, between the current time and midnight, January 1, 1970 UTC
- * and aliged to GMT timezone.
- *
- *
- * @param resourceName
- * @param destination
- * @param timestamp
- * @return
- * @throws TransferFailedException
- * @throws ResourceDoesNotExistException
- * @throws AuthorizationException
- *
- * @return <code>true</code> if newer resource has been downloaded, <code>false</code> if resource
- * in the repository is older or has the same age.
- *
- * @todo michal: I have to learn more about timezones!
- * Specifically how to convert time for UTC to time for GMT and if such conversioin is needed.
- */
- boolean getIfNewer( String resourceName, File destination, long timestamp )
- throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException;
-
- void put( File source, String destination )
- throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException;
-
- Repository getRepository();
-
- // ----------------------------------------------------------------------
- // Connection/Disconnection
- // ----------------------------------------------------------------------
-
- void connect( Repository source )
- throws ConnectionException, AuthenticationException;
-
- void connect( Repository source, ProxyInfo proxyInfo )
- throws ConnectionException, AuthenticationException;
-
- void openConnection()
- throws ConnectionException, AuthenticationException;
-
- void disconnect()
- throws ConnectionException;
-
-
-
- // ----------------------------------------------------------------------
- // Session listener
- // ----------------------------------------------------------------------
-
- void addSessionListener( SessionListener listener );
-
- void removeSessionListener( SessionListener listener );
-
- boolean hasSessionListener( SessionListener listener );
-
- // ----------------------------------------------------------------------
- // Transfer listener
- // ----------------------------------------------------------------------
-
- void addTransferListener( TransferListener listener );
-
- void removeTransferListener( TransferListener listener );
-
- boolean hasTransferListener( TransferListener listener );
-}
diff --git a/wagon-provider-api/src/main/java/org/apache/maven/wagon/WagonConstants.java b/wagon-provider-api/src/main/java/org/apache/maven/wagon/WagonConstants.java
deleted file mode 100644
index 07f8b93..0000000
--- a/wagon-provider-api/src/main/java/org/apache/maven/wagon/WagonConstants.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package org.apache.maven.wagon;
-
-/* ====================================================================
- * 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.
- * ====================================================================
- */
-
-/**
- * This class contains constants used in Wagon API.
- *
- * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
- * @version $Id$
- */
-public final class WagonConstants
-{
- /** Indicates that port has not been set. */
- public final static int UNKNOWN_PORT = -1;
-
- /** Indicates that length has not been set. */
- public final static int UNKNOWN_LENGTH = -1;
-}
diff --git a/wagon-provider-api/src/main/java/org/apache/maven/wagon/WagonException.java b/wagon-provider-api/src/main/java/org/apache/maven/wagon/WagonException.java
deleted file mode 100644
index 8709353..0000000
--- a/wagon-provider-api/src/main/java/org/apache/maven/wagon/WagonException.java
+++ /dev/null
@@ -1,111 +0,0 @@
-package org.apache.maven.wagon;
-
-/* ====================================================================
- * 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.
- * ====================================================================
- */
-
-/**
- * Root class for all exception in Wagon API
- *
- * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
- * @version $Id$
- */
-public abstract class WagonException extends Exception
-{
- /** the throwable that caused this throwable to get thrown */
- private Throwable cause;
-
-
- /**
- * Constructs a new WagonException with the specified detail message.
- * The cause is not initialized, and may subsequently be initialized by a call to initCause
- *
- * @param message - the detail message (which is saved for later retrieval by the getMessage() method).
- * @param cause - the cause (which is saved for later retrieval by the getCause() method).
- * (A null value is permitted, and indicates that the cause is nonexistent or unknown.)
- */
- public WagonException( final String message, final Throwable cause )
- {
- super( message );
- initCause( cause );
- }
-
- /**
- * Constructs a new WagonException with the specified detail message and cause.
- *
- * @param message - the detail message (which is saved for later retrieval by the getMessage() method).
- */
- public WagonException( final String message )
- {
- super( message );
- }
-
- /**
- * Returns the cause of this throwable or null if the cause is nonexistent or unknown.
- * (The cause is the throwable that caused this throwable to get thrown.)
- *
- * @return the cause of this throwable or null if the cause is nonexistent or unknown.
- */
- public Throwable getCause()
- {
-// try
-// {
-// Class clazz = getClass().getSuperclass();
-//
-// Method method = clazz.getMethod( "gatCause" , null );
-//
-// Throwable retValue = (Throwable) method.invoke( this, null );
-// return retValue;
-// }
-// catch( Exception e)
-// {
-//
-// }
-
- return cause;
- }
-
-
- /**
- * Initializes the cause of this throwable to the specified value.
- * (The cause is the throwable that caused this throwable to get thrown.)
- * This method can be called at most once.
- * It is generally called from within the constructor, or immediately after creating the throwable.
- * If this throwable was created with WagonException(Throwable) or WagonException(String,Throwable),
- * this method cannot be called even once.
- *
- * @return a reference to this Throwable instance.
- */
- public Throwable initCause( final Throwable cause )
- {
-// try
-// {
-// Class clazz = getClass().getSuperclass();
-// Class[] parameterTypes = new Class[1];
-// parameterTypes[0] = Throwable.class;
-// Method method = clazz.getMethod( "initCause" , parameterTypes);
-// Object[] params = { cause };
-// method.invoke( this, params );
-// }
-// catch( Exception e)
-// {
-//
-// }
- this.cause = cause;
- return this;
- }
-
-}
diff --git a/wagon-provider-api/src/main/java/org/apache/maven/wagon/WagonUtils.java b/wagon-provider-api/src/main/java/org/apache/maven/wagon/WagonUtils.java
deleted file mode 100644
index 3333349..0000000
--- a/wagon-provider-api/src/main/java/org/apache/maven/wagon/WagonUtils.java
+++ /dev/null
@@ -1,198 +0,0 @@
-package org.apache.maven.wagon;
-
-/* ====================================================================
- * 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.authentication.AuthenticationInfo;
-import org.apache.maven.wagon.authorization.AuthorizationException;
-import org.apache.maven.wagon.util.FileUtils;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.LinkedList;
-
-
-/**
- * @author <a href="mailto:mmaczka@interia.pl">Michal Maczka</a>
- * @version $Id$
- */
-public class WagonUtils
-{
-
-
- public static String toString( String resource, Wagon wagon ) throws IOException, TransferFailedException, ResourceDoesNotExistException, AuthorizationException
- {
-
- File file = null;
-
- try
- {
- file = File.createTempFile( "wagon", "tmp" );
-
- wagon.get( resource, file );
-
- String retValue = FileUtils.fileRead( file );
-
- return retValue;
- }
- finally
- {
- if ( file != null )
- {
- boolean deleted = file.delete();
-
- if ( ! deleted )
- {
- file.deleteOnExit();
- }
- }
- }
-
-
- }
-
- public static void fromString( String resource, Wagon wagon, String content ) throws Exception
- {
- File file = null;
-
- try
- {
- file = File.createTempFile( "wagon", "tmp" );
-
- //@todo this method should trow something more specific then java.lang.Exception
- FileUtils.fileWrite( file.getPath(), content );
-
- wagon.put( file, resource );
-
- }
- finally
- {
- if ( file != null )
- {
- boolean deleted = file.delete();
-
- if ( ! deleted )
- {
- file.deleteOnExit();
- }
-
- }
- }
-
-
- }
-
-
- public static void putDirectory( File dir, Wagon wagon, boolean includeBasdir )
- throws ResourceDoesNotExistException, TransferFailedException, AuthorizationException
- {
-
- LinkedList queue = new LinkedList();
-
- if ( includeBasdir )
- {
- queue.add( dir.getName() );
- }
- else
- {
- queue.add( "" );
- }
-
- while ( !queue.isEmpty() )
- {
- String path = ( String ) queue.removeFirst();
-
- File currentDir = new File ( dir, path );
-
- File[] files = currentDir.listFiles();
-
- for (int i = 0; i < files.length; i++)
- {
- File file = files[i];
-
- String resource;
-
- if ( path.length() > 0 )
- {
- resource = path + "/" + file.getName();
- }
- else
- {
- resource = file.getName();
- }
-
- if ( file.isDirectory() )
- {
- queue.add( resource );
- }
- else
- {
- wagon.put( file, resource );
- }
-
- }
-
- }
-
- }
-
- public static AuthenticationInfo getAuthInfo()
- {
- // TODO: not used presently?
-
- AuthenticationInfo authInfo = new AuthenticationInfo();
-
- String userName = getUserName();
-
- authInfo.setUserName( userName );
-
- File privateKey = new File( System.getProperty( "user.home" ), "/.ssh/id_dsa" );
-
- if ( privateKey.exists() )
- {
- authInfo.setPrivateKey( privateKey.getAbsolutePath() );
-
- authInfo.setPassphrase( "" );
- }
-
- // TODO: what about modes?
-
-// authInfo.setGroup( getUserGroup() );
-
- return authInfo;
- }
-
- private static String getUserGroup()
- {
- // TODO: this isn't a normal system property
- String retValue = System.getProperty( "user.group" );
-
- return retValue;
- }
-
-
-
- public static String getUserName()
- {
- String retValue = System.getProperty( "user.name" );
-
- return retValue;
- }
-
-
-
-}
diff --git a/wagon-provider-api/src/main/java/org/apache/maven/wagon/authentication/AuthenticationException.java b/wagon-provider-api/src/main/java/org/apache/maven/wagon/authentication/AuthenticationException.java
deleted file mode 100644
index 81eb6a3..0000000
--- a/wagon-provider-api/src/main/java/org/apache/maven/wagon/authentication/AuthenticationException.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package org.apache.maven.wagon.authentication;
-
-/* ====================================================================
- * 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.WagonException;
-
-/**
- * This exception is thrown when an authentication
- * error occurs while accessing the remote repository.
- * An authentication error can happen, for example,
- * when the credentials supplied by the user are invalid
- *
- * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
- * @version $Id$
- */
-public class AuthenticationException extends WagonException
-{
-
- /**
- * @see org.apache.maven.wagon.WagonException
- */
- public AuthenticationException( final String message )
- {
- super( message );
- }
-
- /**
- * @see org.apache.maven.wagon.WagonException
- */
- public AuthenticationException( final String message, final Throwable cause )
- {
- super( message, cause );
- }
-
-}
diff --git a/wagon-provider-api/src/main/java/org/apache/maven/wagon/authentication/AuthenticationInfo.java b/wagon-provider-api/src/main/java/org/apache/maven/wagon/authentication/AuthenticationInfo.java
deleted file mode 100644
index 9d111b2..0000000
--- a/wagon-provider-api/src/main/java/org/apache/maven/wagon/authentication/AuthenticationInfo.java
+++ /dev/null
@@ -1,125 +0,0 @@
-package org.apache.maven.wagon.authentication;
-
-/* ====================================================================
- * 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 java.io.Serializable;
-
-/**
- * This class holds the set of properties used when instance of the <code>Wagon</code>
- * will use during login opreration.
- *
- * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
- * @version $Id$
- */
-public class AuthenticationInfo implements Serializable
-{
-
- /** Username used to login to the host */
- private String userName;
-
- /** Password associated with the login */
- private String password;
-
- /** Passphrase of the user's private key file */
- private String passphrase;
-
- /** The absolute path to private key file */
- private String privateKey;
-
- /**
- * Get the passphrase of the private key file. The passphrase is used only
- * when host/protocol supports authentication via exchange of
- * private/public keys and private key was used for authentication.
- *
- * @return passphrase of the private key file
- */
- public String getPassphrase()
- {
- return passphrase;
- }
-
- /**
- * Set the passphrase of the private key file.
- *
- * @param passphrase passphrase of the private key file
- */
- public void setPassphrase( final String passphrase )
- {
- this.passphrase = passphrase;
- }
-
- /**
- * Get the absolute path to the private key file.
- *
- * @return absolute path to private key
- */
- public String getPrivateKey()
- {
- return privateKey;
- }
-
- /**
- * Set the absolute path to private key file.
- *
- * @param privateKey path to private key in local file system
- */
- public void setPrivateKey( final String privateKey )
- {
- this.privateKey = privateKey;
- }
-
- /**
- * Get the user's password which is used when connecting to the repository.
- *
- * @return password of user
- */
- public String getPassword()
- {
- return password;
- }
-
- /**
- * Set the user's password which is used when connecting to the repository.
- *
- * @param password password of the user
- */
- public void setPassword( final String password )
- {
- this.password = password;
- }
-
- /**
- * Get the username used to access the repository.
- *
- * @return username at repository
- */
- public String getUserName()
- {
- return userName;
- }
-
- /**
- * Set username used to access the repository.
- *
- * @param userName the username used to access repository
- */
- public void setUserName( final String userName )
- {
- this.userName = userName;
- }
-}
diff --git a/wagon-provider-api/src/main/java/org/apache/maven/wagon/authorization/AuthorizationException.java b/wagon-provider-api/src/main/java/org/apache/maven/wagon/authorization/AuthorizationException.java
deleted file mode 100644
index 2d79425..0000000
--- a/wagon-provider-api/src/main/java/org/apache/maven/wagon/authorization/AuthorizationException.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package org.apache.maven.wagon.authorization;
-
-/* ====================================================================
- * 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.WagonException;
-
-/**
- * This exception is thrown when the user is not entitled to fetch from or deploy to
- * prticular place in the repository.
- *
- * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
- * @version $Id$
- */
-public class AuthorizationException extends WagonException
-{
-
-
- /**
- * @see org.apache.maven.wagon.WagonException
- */
- public AuthorizationException( final String message )
- {
- super( message );
- }
-
- /**
- * @see org.apache.maven.wagon.WagonException
- */
- public AuthorizationException( final String message, final Throwable cause )
- {
- super( message, cause );
- }
-
-
-}
diff --git a/wagon-provider-api/src/main/java/org/apache/maven/wagon/events/SessionEvent.java b/wagon-provider-api/src/main/java/org/apache/maven/wagon/events/SessionEvent.java
deleted file mode 100644
index 6b3cf0f..0000000
--- a/wagon-provider-api/src/main/java/org/apache/maven/wagon/events/SessionEvent.java
+++ /dev/null
@@ -1,162 +0,0 @@
-package org.apache.maven.wagon.events;
-
-/* ====================================================================
- * 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.Wagon;
-
-/**
- *
- * SessionEvent is used for notifing SessionListeners about
- * occurences of various sistutation releated.
- *
- * The session event is emitted by <code>Wagon</code> objects when
- *
- * <ul>
- * <li>Before connection to the repository will be opened</li>
- * <li>After connection to the repository was opened</li>
- * <li>After wagon has logged-in to the repository</li>
- * <li>After wagon has logged-off from the repository</li>
- * <li>Before connection to the repository will be closed</li>
- * <li>After connection to the repository was closed</li>
- * </ul>
- *
- * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
- * @version $Id$
- */
-public class SessionEvent extends WagonEvent
-{
-
- /** A SESSION was closed. */
- public final static int SESSION_CLOSED = 1;
-
- /** A SESSION is about to be disconnected. */
- public final static int SESSION_DISCONNECTING = 2;
-
- /** A SESSION was disconnected (not currently used). */
- public final static int SESSION_DISCONNECTED = 3;
-
- /** A SESSION was refused. */
- public final static int SESSION_CONNECTION_REFUSED = 4;
-
- /** A SESSION is about to be opened. */
- public final static int SESSION_OPENING = 5;
-
- /** A SESSION was opened. */
- public final static int SESSION_OPENED = 6;
-
- /** A SESSION was opened. */
- public final static int SESSION_LOGGED_IN = 7;
-
- /** A SESSION was opened. */
- public final static int SESSION_LOGGED_OFF = 8;
-
- /** A SESSION was opened. */
- public final static int SESSION_ERROR_OCCURRED = 9;
-
- /** The type of the event. One of the SESSSION_XXX constans*/
- private int eventType;
-
- private Exception exception;
-
- /**
- * Creates new instance of SessionEvent
- * @param wagon <code>Wagon<code> object which created this event
- * @param eventType the type of the event
- */
- public SessionEvent(
- final Wagon wagon,
- final int eventType )
- {
- super( wagon );
- this.eventType = eventType;
-
- }
-
- /**
- * Creates new instance of SessionEvent. Sets event type to <code>SESSION_ERROR_OCCURRED</code>
- * @param wagon <code>Wagon<code> object which created this event
- * @param exception the exception
- */
- public SessionEvent(
- final Wagon wagon,
- final Exception exception )
- {
- super( wagon );
- this.exception = exception;
- this.eventType = SESSION_ERROR_OCCURRED;
-
- }
-
- /**
- * @return Returns the type.
- */
- public int getEventType()
- {
- return eventType;
- }
-
- /**
- * @return Returns the exception.
- */
- public Exception getException()
- {
- return exception;
- }
-
- /**
- * @param eventType The eventType to set.
- */
- public void setEventType( final int eventType )
- {
- switch ( eventType )
- {
-
- case SessionEvent.SESSION_CLOSED:
- break;
- case SessionEvent.SESSION_DISCONNECTED:
- break;
- case SessionEvent.SESSION_DISCONNECTING:
- break;
- case SessionEvent.SESSION_ERROR_OCCURRED:
- break;
- case SessionEvent.SESSION_LOGGED_IN:
- break;
- case SessionEvent.SESSION_LOGGED_OFF:
- break;
- case SessionEvent.SESSION_OPENED:
- break;
- case SessionEvent.SESSION_OPENING:
- break;
- case SessionEvent.SESSION_CONNECTION_REFUSED:
- break;
- default :
- throw new IllegalArgumentException(
- "Illegal event type: " + eventType );
- }
- this.eventType = eventType;
- }
-
- /**
- * @param exception The exception to set.
- */
- public void setException( final Exception exception )
- {
- this.exception = exception;
- }
-
-}
diff --git a/wagon-provider-api/src/main/java/org/apache/maven/wagon/events/SessionEventSupport.java b/wagon-provider-api/src/main/java/org/apache/maven/wagon/events/SessionEventSupport.java
deleted file mode 100644
index 1116331..0000000
--- a/wagon-provider-api/src/main/java/org/apache/maven/wagon/events/SessionEventSupport.java
+++ /dev/null
@@ -1,233 +0,0 @@
-package org.apache.maven.wagon.events;
-
-/* ====================================================================
- * 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 java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * The class allows registration and deregistration of session listeners
- *
- * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
- * @version $Id$
- */
-public final class SessionEventSupport
-{
- /** registred listeners */
- private final List listeners = new ArrayList();
-
- /**
- * Adds the listener to the collection of listeners
- * who will be notifed when any session event occurs
- * in this <code>Wagon</code> object.
- * <br/>
- * If listener is <code>null</code>, no exception is thrown and no action is performed
- *
- * @param listener the transfer listener
- *
- * @see #removeSessionListener(SessionListener)
- * @see TransferListener
- */
- public void addSessionListener( final SessionListener listener )
- {
- listeners.add( listener );
- }
-
- /**
- * Removes the session listener from the collection of listeners so
- * it no longer receives session events.
- * <br/>
- * If listener is <code>null</code> or specified listener was not added
- * to this <code>SessionEventSupport</code> object
- * no exception is thrown and no action is performed
- *
- * @param listener the session listener
- *
- * @see #addSessionListener(org.apache.maven.wagon.events.SessionListener)
- */
- public void removeSessionListener( final SessionListener listener )
- {
- listeners.remove( listener );
- }
-
- /**
- * Returns whether the specified instance of session
- * listener was added to the collection of listeners
- * who will be notifed when an seesion event occurs
- *
- * @param listener the session listener
- *
- * @return <code>true<code>
- * if given listner was added to the collection of listeners
- * <code>false</code> otherwise
- *
- * @see org.apache.maven.wagon.events.SessionListener
- * @see #addSessionListener(org.apache.maven.wagon.events.SessionListener)
- */
- public boolean hasSessionListener( final SessionListener listener )
- {
- return listeners.contains( listener );
- }
-
- /**
- * Dispatches the given <code>SessionEvent</code>
- * to all registred listeners (calls method {@link SessionListener#sessionDisconnected(SessionEvent)} on all of them}.
- * The Event should be of type {@link SessionEvent#SESSION_DISCONNECTED}
- *
- * @param sessionEvent the SessionEvent which will be dispached to listeners
- */
- public void fireSessionDisconnected( final SessionEvent sessionEvent )
- {
- for ( Iterator iter = listeners.iterator(); iter.hasNext(); )
- {
- final SessionListener listener = ( SessionListener ) iter.next();
- listener.sessionDisconnected( sessionEvent );
- }
- }
-
- /**
- * Dispatches the given <code>SessionEvent</code>
- * to all registred listeners (calls method {@link SessionListener#sessionDisconnecting(SessionEvent)} } on all of them}.
- * The Event should be of type {@link SessionEvent#SESSION_DISCONNECTING}
- *
- * @param sessionEvent the SessionEvent which will be dispached to listeners
- */
- public void fireSessionDisconnecting( final SessionEvent sessionEvent )
- {
- for ( Iterator iter = listeners.iterator(); iter.hasNext(); )
- {
- final SessionListener listener = ( SessionListener ) iter.next();
- listener.sessionDisconnecting( sessionEvent );
- }
- }
-
- /**
- * Dispatches the given <code>SessionEvent</code>
- * to all registred listeners (calls method {@link SessionListener#sessionLoggedIn(SessionEvent)} on all of them}.
- * The Event should be of type {@link SessionEvent#SESSION_LOGGED_IN}
- *
- * @param sessionEvent the SessionEvent which will be dispached to listeners
- */
- public void fireSessionLoggedIn( final SessionEvent sessionEvent )
- {
- for ( Iterator iter = listeners.iterator(); iter.hasNext(); )
- {
- final SessionListener listener = ( SessionListener ) iter.next();
- listener.sessionLoggedIn( sessionEvent );
- }
- }
-
- /**
- * Dispatches the given <code>SessionEvent</code>
- * to all registred listeners (calls method {@link SessionListener#sessionLoggedOff(SessionEvent)} on all of them}.
- * The Event should be of type {@link SessionEvent#SESSION_LOGGED_OFF}
- *
- * @param sessionEvent the SessionEvent which will be dispached to listeners
- */
- public void fireSessionLoggedOff( final SessionEvent sessionEvent )
- {
- for ( Iterator iter = listeners.iterator(); iter.hasNext(); )
- {
- final SessionListener listener = ( SessionListener ) iter.next();
- listener.sessionLoggedOff( sessionEvent );
- }
- }
-
- /**
- * Dispatches the given <code>SessionEvent</code>
- * to all registred listeners (calls method {@link SessionListener#sessionOpened(SessionEvent)} on all of them}.
- * The Event should be of type {@link SessionEvent#SESSION_OPENED}
- *
- * @param sessionEvent the SessionEvent which will be dispached to listeners
- */
- public void fireSessionOpened( final SessionEvent sessionEvent )
- {
- for ( Iterator iter = listeners.iterator(); iter.hasNext(); )
- {
- final SessionListener listener = ( SessionListener ) iter.next();
- listener.sessionOpened( sessionEvent );
- }
- }
-
- /**
- * Dispatches the given <code>SessionEvent</code>
- * to all registred listeners (calls method {@link SessionListener#sessionOpening(SessionEvent)} on all of them}.
- * The Event should be of type {@link SessionEvent#SESSION_OPENING}
- *
- * @param sessionEvent the SessionEvent which will be dispached to listeners
- */
- public void fireSessionOpening( final SessionEvent sessionEvent )
- {
- for ( Iterator iter = listeners.iterator(); iter.hasNext(); )
- {
- final SessionListener listener = ( SessionListener ) iter.next();
- listener.sessionOpening( sessionEvent );
- }
- }
-
- /**
- * Dispatches the given <code>SessionEvent</code>
- * to all registred listeners (calls method {@link SessionListener#sessionConnectionRefused(SessionEvent)} on all of them}.
- * The Event should be of type {@link SessionEvent#SESSION_CONNECTION_REFUSED}
- *
- * @param sessionEvent the SessionEvent which will be dispached to listeners
- */
- public void fireSessionConnectionRefused( final SessionEvent sessionEvent )
- {
- for ( Iterator iter = listeners.iterator(); iter.hasNext(); )
- {
- final SessionListener listener = ( SessionListener ) iter.next();
- listener.sessionConnectionRefused( sessionEvent );
- }
- }
-
- /**
- * Dispatches the given debug message
- * to all registred listeners (calls method {@link SessionListener#debug(String)} on all of them}.
- *
- * @param message the debug message which will be dispached to listeners
- */
- public void fireDebug( final String message )
- {
- for ( Iterator iter = listeners.iterator(); iter.hasNext(); )
- {
- final SessionListener listener =
- ( SessionListener ) iter.next();
- listener.debug( message );
- }
- }
-
- /**
- * Dispatches the given <code>SessionEvent</code>
- * to all registred listeners (calls method {@link SessionListener#sessionConnectionRefused(SessionEvent)} on all of them.
- * The Event should be of type {@link SessionEvent#SESSION_ERROR_OCCURRED} and it is expected that
- * {@link SessionEvent#getException()} method will return not null value
- *
- * @param sessionEvent the SessionEvent which will be dispached to listeners
- */
- public void fireSessionError( final SessionEvent sessionEvent )
- {
- for ( Iterator iter = listeners.iterator(); iter.hasNext(); )
- {
- final SessionListener listener =
- ( SessionListener ) iter.next();
- listener.sessionError( sessionEvent );
- }
- }
-}
diff --git a/wagon-provider-api/src/main/java/org/apache/maven/wagon/events/SessionListener.java b/wagon-provider-api/src/main/java/org/apache/maven/wagon/events/SessionListener.java
deleted file mode 100644
index b283945..0000000
--- a/wagon-provider-api/src/main/java/org/apache/maven/wagon/events/SessionListener.java
+++ /dev/null
@@ -1,116 +0,0 @@
-package org.apache.maven.wagon.events;
-
-/* ====================================================================
- * 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.
- * ====================================================================
- */
-
-/**
- * Interface for classes which wants to receive and respond to any session update events.
- *
- * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
- * @version $Id$
- */
-public interface SessionListener
-{
-
- /**
- * This method will be called when Wagon is about to open
- * connection to the repository.
- * The type of the event should
- * be set to {@link SessionEvent.SESSION_OPENING}
- *
- * @param sessionEvent the session event
- */
- void sessionOpening( SessionEvent sessionEvent );
-
- /**
- * This method will be called when Wagon has sucessfully connected to
- * to the repository.
- * The type of the event should
- * be set to {@link SessionEvent.SESSION_OPENED}
- *
- * @param sessionEvent the session event
- */
- void sessionOpened( SessionEvent sessionEvent );
-
- /**
- * This method will be called when Wagon has closed connection to
- * to the repository.
- * The type of the event should
- * be set to {@link SessionEvent.SESSION_DISCONNECTING}
- *
- * @param sessionEvent the session event
- */
- void sessionDisconnecting( SessionEvent sessionEvent );
-
- /**
- * This method will be called when Wagon has closed connection to
- * the repository.
- * The type of the event should
- * be set to {@link SessionEvent.SESSION_DISCONNECTED}
- *
- * @param sessionEvent the session event
- */
- void sessionDisconnected( SessionEvent sessionEvent );
-
- /**
- * This method will be called when Wagon when connection to
- * the repository was refused.
- *
- * The type of the event should
- * be set to {@link SessionEvent.SESSION_CONNECTION_REFUSED}
- *
- * @param sessionEvent the session event
- */
- void sessionConnectionRefused( SessionEvent sessionEvent );
-
- /**
- * This method will be called by Wagon when Wagon manged
- * to login to the repository.
- *
- * @param sessionEvent the session event
- */
- void sessionLoggedIn( SessionEvent sessionEvent );
-
- /**
- * This method will be called by Wagon has logged off
- * from the repository.
- *
- * The type of the event should
- * be set to {@link SessionEvent.SESSION_LOGGED_OFF}
- *
- * @param sessionEvent the session event
- */
- void sessionLoggedOff( SessionEvent sessionEvent );
-
- /**
- * This method will be called by Wagon when an error occured.
- *
- * The type of the event should
- * be set to {@link SessionEvent.SESSION_ERROR_OCCURRED}
- *
- * @param sessionEvent the session event
- */
- void sessionError( SessionEvent sessionEvent );
-
- /**
- * This methid allows to send arbitrary debug messages.
- *
- * @param message the debug messgae
- */
- void debug( String message );
-
-}
\ No newline at end of file
diff --git a/wagon-provider-api/src/main/java/org/apache/maven/wagon/events/TransferEvent.java b/wagon-provider-api/src/main/java/org/apache/maven/wagon/events/TransferEvent.java
deleted file mode 100644
index fcb0d45..0000000
--- a/wagon-provider-api/src/main/java/org/apache/maven/wagon/events/TransferEvent.java
+++ /dev/null
@@ -1,212 +0,0 @@
-package org.apache.maven.wagon.events;
-
-/* ====================================================================
- * 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.Wagon;
-import org.apache.maven.wagon.resource.Resource;
-
-import java.io.File;
-
-/***
- * TransferEvent is used to notify TransferListeners about progress
- * in transfer of resources form/to the respository
- *
- * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
- * @version $Id$
- */
-public class TransferEvent extends WagonEvent
-{
-
- /** A transfer was started. */
- public final static int TRANSFER_STARTED = 1;
-
- /** A transfer is completed. */
- public final static int TRANSFER_COMPLETED = 2;
-
- /** A transfer is in progress. */
- public final static int TRANSFER_PROGRESS = 3;
-
- /** An error occured during transfer */
- public final static int TRANSFER_ERROR = 4;
-
- /** Indicates GET transfer (from the repository) */
- public final static int REQUEST_GET = 5;
-
- /** Indicates PUT transfer (to the repository)*/
- public final static int REQUEST_PUT = 6;
-
- private Resource resource;
-
- private int eventType;
-
- private int requestType;
-
- private Exception exception;
-
- private File localFile;
-
-
- public TransferEvent(
- final Wagon wagon,
- final Resource resource,
- final int eventType,
- final int requestType )
- {
- super( wagon );
-
- this.resource = resource;
-
- setEventType( eventType );
-
- setRequestType( requestType );
-
- }
-
- public TransferEvent(
- final Wagon wagon,
- final Resource resource,
- final Exception exception )
- {
- super( wagon );
-
- this.resource = resource;
-
- setEventType( TRANSFER_ERROR );
-
- this.exception = exception;
-
- }
-
-
-
- /**
- * @return Returns the resource.
- */
- public Resource getResource()
- {
- return resource;
- }
-
- /**
- * @return Returns the exception.
- */
- public Exception getException()
- {
- return exception;
- }
-
- /**
- * Returns the request type.
- * @return Returns the request type. The Request type is one of
- * <code>TransferEvent.REQUEST_GET<code> or <code>TransferEvent.REQUEST_PUT<code>
- */
- public int getRequestType()
- {
- return requestType;
- }
-
- /**
- * Sets the request type
- * @param requestType The requestType to set.
- * The Request type value should be either
- * <code>TransferEvent.REQUEST_GET<code> or <code>TransferEvent.REQUEST_PUT<code>.
- * @throws IllegalArgumentException when
- */
- public void setRequestType( final int requestType )
- {
- switch ( requestType )
- {
-
- case REQUEST_PUT:
- break;
- case REQUEST_GET:
- break;
-
- default :
- throw new IllegalArgumentException(
- "Illegal request type: " + requestType );
- }
-
- this.requestType = requestType;
- }
-
- /**
- * @return Returns the eventType.
- */
- public int getEventType()
- {
- return eventType;
- }
-
- /**
- * @param eventType The eventType to set.
- */
- public void setEventType( final int eventType )
- {
- switch ( eventType )
- {
-
- case TRANSFER_STARTED:
- break;
- case TRANSFER_COMPLETED:
- break;
- case TRANSFER_PROGRESS:
- break;
- case TRANSFER_ERROR:
- break;
- default :
- throw new IllegalArgumentException(
- "Illegal event type: " + eventType );
- }
-
- this.eventType = eventType;
- }
-
- /**
- * The
- * @param exception The exception to set.
- */
- public void setException( final Exception exception )
- {
- this.exception = exception;
- }
-
-
- /**
- * @param resource The resource to set.
- */
- public void setResource( final Resource resource )
- {
- this.resource = resource;
- }
-
- /**
- * @return Returns the local file.
- */
- public File getLocalFile()
- {
- return localFile;
- }
- /**
- * @param localFile The local file to set.
- */
- public void setLocalFile( File localFile )
- {
- this.localFile = localFile;
- }
-}
diff --git a/wagon-provider-api/src/main/java/org/apache/maven/wagon/events/TransferEventSupport.java b/wagon-provider-api/src/main/java/org/apache/maven/wagon/events/TransferEventSupport.java
deleted file mode 100644
index 59cf103..0000000
--- a/wagon-provider-api/src/main/java/org/apache/maven/wagon/events/TransferEventSupport.java
+++ /dev/null
@@ -1,178 +0,0 @@
-package org.apache.maven.wagon.events;
-
-/* ====================================================================
- * 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 java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * The class allows registration and removal of event listners of type
- * TransferListener and dispatch of those events to those listeners
- *
- * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
- * @version $Id$
- */
-public final class TransferEventSupport
-{
-
- /** registred listeners */
- private final List listeners = new ArrayList();
-
- /**
- * Adds the listener to the collection of listeners
- * who will be notifed when any transfer event occurs
- * in this <code>Wagon</code> object.
- * <br/>
- * If listener is <code>null</code>, no exception is thrown and no action is performed
- *
- * @param listener the transfer listener
- *
- * @see #removeTransferListener(org.apache.maven.wagon.events.TransferListener)
- * @see TransferListener
- */
- public void addTransferListener( final TransferListener listener )
- {
- listeners.add( listener );
- }
-
- /**
- * Removes the transfer listener from the collection of listeners so
- * it no longer receives transfer events.
- * <br/>
- * If listener is <code>null</code> or specified listener was not added
- * to this <code>TransferEventSupport</code> object
- * no exception is thrown and no action is performed
- *
- * @param listener the transfer listener
- *
- * @see #addTransferListener(TransferListener)
- */
- public void removeTransferListener( final TransferListener listener )
- {
- listeners.remove( listener );
- }
-
- /**
- * Returns whether the specified instance of transfer
- * listener was added to the collection of listeners
- * who will be notifed when an transfer event occurs
- *
- * @param listener the transfer listener
- *
- * @return <code>true<code>
- * if given listner was added to the collection of listeners
- * <code>false</code> otherwise
- *
- * @see org.apache.maven.wagon.events.TransferEvent
- * @see #addTransferListener(TransferListener)
- */
- public boolean hasTransferListener( final TransferListener listener )
- {
- return listeners.contains( listener );
- }
-
-
- /**
- * Dispatches the given <code>TransferEvent</code>
- * to all registred listeners (calls method {@link TransferListener#transferStarted(TransferEvent)} on all of them}.
- * The Event should be of type {@link TransferEvent#TRANSFER_COMPLETED}
- *
- * @param transferEvent the TransferEvent which will be dispached to listeners
- */
- public void fireTransferStarted( final TransferEvent transferEvent )
- {
- for ( Iterator iter = listeners.iterator(); iter.hasNext(); )
- {
- final TransferListener listener = ( TransferListener ) iter.next();
- listener.transferStarted( transferEvent );
- }
- }
-
- /**
- * Dispatches the given <code>TransferEvent</code>
- * to all registred listeners (calls method {@link TransferListener#transferProgress(TransferEvent)} on all of them}.
- * The Event should be of type {@link TransferEvent#TRANSFER_PROGRESS}.
- *
- * @param transferEvent the TransferEvent which will be dispached to listeners
- * @param buffer the buffer containing the additional content
- * @param length the length of the content in the buffer
- */
- public void fireTransferProgress( final TransferEvent transferEvent, byte[] buffer, int length )
- {
- for ( Iterator iter = listeners.iterator(); iter.hasNext(); )
- {
- final TransferListener listener = ( TransferListener ) iter.next();
- listener.transferProgress( transferEvent, buffer, length );
-
- }
- }
-
- /**
- * Dispatches the given <code>TransferEvent</code>
- * to all registred listeners (calls method {@link TransferListener#transferCompleted(TransferEvent)} on all of them}.
- * The Event should be of type {@link TransferEvent#TRANSFER_COMPLETED}
- *
- * @param transferEvent the TransferEvent which will be dispached to listeners
- */
- public void fireTransferCompleted( final TransferEvent transferEvent )
- {
- for ( Iterator iter = listeners.iterator(); iter.hasNext(); )
- {
- final TransferListener listener = ( TransferListener ) iter.next();
- listener.transferCompleted( transferEvent );
-
- }
- }
-
- /**
- * Dispatches the given <code>TransferEvent</code>
- * to all registred listeners (calls method {@link TransferListener#transferError(TransferEvent)} on all of them.
- * The Event should be of type {@link TransferEvent#TRANSFER_ERROR} and it is expected that
- * {@link TransferEvent#getException()} } method will return not null value
- *
- * @param transferEvent the TransferEvent which will be dispached to listeners
- */
- public void fireTransferError( final TransferEvent transferEvent )
- {
- for ( Iterator iter = listeners.iterator(); iter.hasNext(); )
- {
- final TransferListener listener = ( TransferListener ) iter.next();
- listener.transferError( transferEvent );
-
- }
- }
-
- /**
- * Dispatches the given debug message
- * to all registred listeners (calls method {@link TransferListener#debug(String)} on all of them.
- *
- * @param message the debug message which will be dispached to listeners
- */
- public void fireDebug( final String message )
- {
-
- for ( Iterator iter = listeners.iterator(); iter.hasNext(); )
- {
- final TransferListener listener = ( TransferListener ) iter.next();
- listener.debug( message );
-
- }
- }
-
-}
diff --git a/wagon-provider-api/src/main/java/org/apache/maven/wagon/events/TransferListener.java b/wagon-provider-api/src/main/java/org/apache/maven/wagon/events/TransferListener.java
deleted file mode 100644
index aa3db0e..0000000
--- a/wagon-provider-api/src/main/java/org/apache/maven/wagon/events/TransferListener.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package org.apache.maven.wagon.events;
-
-/* ====================================================================
- * 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.
- * ====================================================================
- */
-
-/**
- * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
- * @version $Id$
- */
-public interface TransferListener
-{
-
- /**
- * @param transferEvent
- */
- void transferStarted( TransferEvent transferEvent );
-
- /**
- * @param transferEvent
- */
- void transferProgress( TransferEvent transferEvent, byte[] buffer, int length );
-
- /**
- * @param transferEvent
- */
- void transferCompleted( TransferEvent transferEvent );
-
- /**
- * @param transferEvent
- */
- void transferError( TransferEvent transferEvent );
-
- /**
- * @param message
- */
- void debug( String message );
-
-}
diff --git a/wagon-provider-api/src/main/java/org/apache/maven/wagon/events/WagonEvent.java b/wagon-provider-api/src/main/java/org/apache/maven/wagon/events/WagonEvent.java
deleted file mode 100644
index 96e6fdc..0000000
--- a/wagon-provider-api/src/main/java/org/apache/maven/wagon/events/WagonEvent.java
+++ /dev/null
@@ -1,77 +0,0 @@
-package org.apache.maven.wagon.events;
-
-/* ====================================================================
- * 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.Wagon;
-import org.apache.maven.wagon.repository.Repository;
-
-import java.util.EventObject;
-
-/**
- * Base class for all events emitted by <code>Wagon</code> objects.
- *
- * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
- * @version $Id$
- */
-public class WagonEvent extends EventObject
-{
- /**
- * Repository to which the Wagon
- * object which emitted this event is connected
- */
- protected Repository repository;
-
- /** The time when event occured*/
- protected long timestamp;
-
- /**
- * @param source The Wagon object on which the WagonEvent initially occurred
- */
- public WagonEvent( final Wagon source )
- {
- super( source );
- }
-
- /**
- * Returns The Wagon object on which the WagonEvent initially occurred
- * @return The Wagon object on which the WagonEvent initially occurred
- */
- public Wagon getWagon()
- {
- return ( Wagon ) getSource();
- }
-
- /**
- * Returns the timestamp which indicated the time when this event has occured
- * @return Returns the timestamp.
- */
- public long getTimestamp()
- {
- return timestamp;
- }
-
- /**
- * Sets the timestamp which indicated the time when this event has occured
- * @param timestamp The timestamp to set.
- */
- public void setTimestamp( final long timestamp )
- {
- this.timestamp = timestamp;
- }
-
-}
diff --git a/wagon-provider-api/src/main/java/org/apache/maven/wagon/observers/ChecksumObserver.java b/wagon-provider-api/src/main/java/org/apache/maven/wagon/observers/ChecksumObserver.java
deleted file mode 100644
index 7706046..0000000
--- a/wagon-provider-api/src/main/java/org/apache/maven/wagon/observers/ChecksumObserver.java
+++ /dev/null
@@ -1,275 +0,0 @@
-package org.apache.maven.wagon.observers;
-
-/* ====================================================================
- * 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.Wagon;
-import org.apache.maven.wagon.WagonUtils;
-import org.apache.maven.wagon.util.FileUtils;
-import org.apache.maven.wagon.util.IoUtils;
-import org.apache.maven.wagon.events.TransferEvent;
-import org.apache.maven.wagon.events.TransferListener;
-
-import java.io.File;
-import java.io.InputStream;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-import java.util.HashMap;
-import java.util.Map;
-
-
-/**
- *
- * TransferListeners which computes MD5 checksum on the fly when files are transfered.
- *
- * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
- * @version $Id$
- */
-public class ChecksumObserver implements TransferListener
-{
-
- private String algorithm;
-
- private MessageDigest digester;
-
- private String expectedChecksum;
-
- private String actualChecksum;
-
- private boolean transferingMd5 = false;
-
-
- private static Map algorithmExtensionMap = new HashMap();
-
- static
- {
- algorithmExtensionMap.put( "MD5", ".md5" );
-
- algorithmExtensionMap.put( "MD2", ".md2" );
-
- algorithmExtensionMap.put( "SHA-1", ".sha1" );
-
- }
-
-
- public ChecksumObserver()
- {
- this( "MD5" );
- }
-
- /**
- *
- * @param algorithm One of the algorithms supported by JDK: MD5, MD2 or SHA-1
- */
- public ChecksumObserver( String algorithm )
- {
- this.algorithm = algorithm;
- }
-
- /**
- * @see org.apache.maven.wagon.events.TransferListener#transferStarted(org.apache.maven.wagon.events.TransferEvent)
- */
- public void transferStarted( TransferEvent transferEvent )
- {
-
- if ( transferingMd5 )
- {
- return;
- }
-
- expectedChecksum = null;
-
- actualChecksum = null;
-
-
- try
- {
- digester = MessageDigest.getInstance( algorithm );
- }
- catch ( NoSuchAlgorithmException e)
- {
-
- }
-
- }
-
- /**
- * @see org.apache.maven.wagon.events.TransferListener#transferProgress(org.apache.maven.wagon.events.TransferEvent,byte[],int)
- */
- public void transferProgress( TransferEvent transferEvent, byte[] buffer, int length )
- {
- if ( digester != null )
- {
- digester.update( buffer, 0, length );
- }
-
- }
-
- public void transferCompleted( TransferEvent transferEvent )
- {
-
- if ( digester == null )
- {
- return;
- }
-
- Wagon wagon = transferEvent.getWagon();
-
- actualChecksum = encode ( digester.digest() );
-
- digester = null;
-
- InputStream inputStream = null;
-
- transferingMd5 = true;
-
- try
- {
- int type = transferEvent.getRequestType();
-
- String resource = transferEvent.getResource().getName();
-
- String extension = ( String ) algorithmExtensionMap.get( algorithm );
-
- if ( type == TransferEvent.REQUEST_GET )
- {
-
- //we will fetch md5 cheksum from server and
- // read its content into memory
- File artifactFile = transferEvent.getLocalFile();
-
- File md5File = new File( artifactFile.getPath() + extension );
-
- String md5Resource = resource + extension;
-
- wagon.get( md5Resource, md5File );
-
- expectedChecksum = FileUtils.fileRead( md5File ).trim();
- }
- else
- {
- //It's PUT put request we will also put md5 checksum
- // which was computed on the fly
- WagonUtils.fromString( resource + extension , wagon, actualChecksum );
-
- }
-
- }
- catch ( Exception e )
- {
- // TODO: handle differently! No Exception catching....
- e.printStackTrace();
- }
- finally
- {
- if ( inputStream != null )
- {
- IoUtils.close( inputStream );
- }
-
- transferingMd5 = false;
- }
-
-
- }
-
- public void transferError( TransferEvent transferEvent )
- {
- digester = null;
- }
-
- public void debug( String message )
- {
-
-
- }
-
-
-
- /**
- * Returns the md5 checksum downloaded from the server
- *
- * @return
- */
- public String getExpectedChecksum()
- {
- return expectedChecksum;
- }
-
-
- /**
- * Returns md5 checksum which was computed during transfer
- * @return
- */
- public String getActualChecksum()
- {
- return actualChecksum;
- }
-
-
- /**
- * Encodes a 128 bit (16 bytes) byte array into a 32 character String.
- * XXX I think it should at least throw an IllegalArgumentException rather than return null
- *
- * @param binaryData Array containing the digest
- * @return Encoded hex string, or null if encoding failed
- */
- protected String encode( byte[] binaryData )
- {
- if ( binaryData.length != 16 )
- {
- return null;
- }
-
- String retValue = "";
-
- for ( int i = 0; i < 16; i++ )
- {
- String t = Integer.toHexString( binaryData[i] & 0xff );
-
- if ( t.length() == 1 )
- {
- retValue += ( "0" + t );
- }
- else
- {
- retValue += t;
- }
- }
-
- return retValue.trim();
- }
-
-
- public boolean cheksumIsValid()
- {
- boolean retValue = false;
-
- if ( actualChecksum != null && expectedChecksum !=null )
- {
- retValue = actualChecksum.equals( expectedChecksum );
- }
-
- return retValue;
- }
-
-
-
-
-
-
-}
diff --git a/wagon-provider-api/src/main/java/org/apache/maven/wagon/observers/Debug.java b/wagon-provider-api/src/main/java/org/apache/maven/wagon/observers/Debug.java
deleted file mode 100644
index bfeda7f..0000000
--- a/wagon-provider-api/src/main/java/org/apache/maven/wagon/observers/Debug.java
+++ /dev/null
@@ -1,216 +0,0 @@
-package org.apache.maven.wagon.observers;
-
-/* ====================================================================
- * 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.events.SessionEvent;
-import org.apache.maven.wagon.events.SessionListener;
-import org.apache.maven.wagon.events.TransferEvent;
-import org.apache.maven.wagon.events.TransferListener;
-
-import java.io.PrintStream;
-
-/**
- * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
- * @version $Id$
- */
-public class Debug
- implements SessionListener, TransferListener
-{
- private PrintStream out;
-
- long timestamp;
-
- long transfer;
-
-
- public Debug()
- {
- this( System.out );
- }
-
- public Debug( PrintStream out )
- {
- this.out = out;
- }
-
- /**
- * @see SessionListener#sessionOpening(SessionEvent)
- */
- public void sessionOpening( final SessionEvent sessionEvent )
- {
- //out.println( .getUrl() + " - Session: Opening ");
- }
-
- /**
- * @see SessionListener#sessionOpened(SessionEvent)
- */
- public void sessionOpened( final SessionEvent sessionEvent )
- {
- out.println(
- sessionEvent.getWagon().getRepository().getUrl() +
- " - Session: Opened " );
- }
-
- /**
- * @see SessionListener#sessionDisconnecting(SessionEvent)
- */
- public void sessionDisconnecting( final SessionEvent sessionEvent )
- {
- out.println(
- sessionEvent.getWagon().getRepository().getUrl() +
- " - Session: Disconnecting " );
-
- }
-
- /**
- * @see SessionListener#sessionDisconnected(SessionEvent)
- */
- public void sessionDisconnected( final SessionEvent sessionEvent )
- {
- out.println(
- sessionEvent.getWagon().getRepository().getUrl() +
- " - Session: Disconnected" );
- }
-
- /**
- * @see SessionListener#sessionConnectionRefused(SessionEvent)
- */
- public void sessionConnectionRefused( final SessionEvent sessionEvent )
- {
- out.println(
- sessionEvent.getWagon().getRepository().getUrl() +
- " - Session: Connection refused" );
-
- }
-
- /**
- * @see SessionListener#sessionLoggedIn(SessionEvent)
- */
- public void sessionLoggedIn( final SessionEvent sessionEvent )
- {
- out.println(
- sessionEvent.getWagon().getRepository().getUrl() +
- " - Session: Logged in" );
-
- }
-
- /**
- * @see SessionListener#sessionLoggedOff(SessionEvent)
- */
- public void sessionLoggedOff( final SessionEvent sessionEvent )
- {
- out.println(
- sessionEvent.getWagon().getRepository().getUrl() +
- " - Session: Logged off" );
-
- }
-
- /**
- * @see TransferListener#debug(String)
- */
- public void debug( final String message )
- {
- out.println( message );
-
- }
-
- /**
- * @see TransferListener#transferStarted(TransferEvent)
- */
- public void transferStarted( final TransferEvent transferEvent )
- {
- timestamp = transferEvent.getTimestamp();
-
- transfer = 0;
-
- if( transferEvent.getRequestType() == TransferEvent.REQUEST_GET )
- {
- final String message = "Downloading: " +
- transferEvent.getResource() +
- " from " +
- transferEvent.getWagon().getRepository().getUrl();
-
- out.println( message );
-
- out.println( "" );
- }
- else
- {
- final String message = "Uploading: " +
- transferEvent.getResource() +
- " to " +
- transferEvent.getWagon().getRepository().getUrl();
-
- out.println( message );
-
- out.println( "" );
-
- }
- }
-
- /**
- * @see TransferListener#transferProgress(TransferEvent,byte[],int)
- */
- public void transferProgress( final TransferEvent transferEvent, byte[] buffer, int length )
- {
-
- out.print( "#" );
- //String data = new String( transferEvent.getData(),0, transferEvent.getDataLength());
- //out.println(data);
- transfer += length;
- }
-
- /**
- * @see TransferListener#transferCompleted(TransferEvent)
- */
- public void transferCompleted( final TransferEvent transferEvent )
- {
- final double duration =
- (double)( transferEvent.getTimestamp() - timestamp ) / 1000;
-
- out.println();
-
- final String message = "Transfer finished. " +
- transfer +
- " bytes copied in " +
- duration +
- " seconds";
-
- out.println( message );
-
- }
-
- /**
- * @see TransferListener#transferError(TransferEvent)
- */
- public void transferError( final TransferEvent transferEvent )
- {
- out.println( " Transfer error: " + transferEvent.getException() );
-
- }
-
- /**
- * @see SessionListener#sessionError(SessionEvent)
- */
- public void sessionError( final SessionEvent sessionEvent )
- {
- out.println( " Session error: " + sessionEvent.getException() );
-
- }
-
-}
diff --git a/wagon-provider-api/src/main/java/org/apache/maven/wagon/proxy/ProxyInfo.java b/wagon-provider-api/src/main/java/org/apache/maven/wagon/proxy/ProxyInfo.java
deleted file mode 100644
index d94cce7..0000000
--- a/wagon-provider-api/src/main/java/org/apache/maven/wagon/proxy/ProxyInfo.java
+++ /dev/null
@@ -1,207 +0,0 @@
-package org.apache.maven.wagon.proxy;
-
-/* ====================================================================
- * 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.WagonConstants;
-
-import java.io.Serializable;
-
-/**
- * Conatins set of properties used by <code>Wagon</code> objects
- * while connection to the repository must go thru a proxy server.
- *
- * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
- * @version $Id$
- * @todo Propose standard types of proxy servers (e.g. <i>SOCKSv4</i>),
- * which can be shared between wagon api and providers
- */
-public class ProxyInfo
- implements Serializable
-{
- public final static String PROXY_SOCKS5 = "SOCKS_5";
- public final static String PROXY_SOCKS4 = "SOCKS4";
- public final static String PROXY_HTTP = "HTTP";
-
- /**
- * Proxy server host
- */
- private String host = null;
-
- /**
- * Username used to access the proxy server
- */
- private String userName = null;
-
- /**
- * Password associated with the proxy server
- */
- private String password = null;
-
- /**
- * Proxy server port
- */
- private int port = WagonConstants.UNKNOWN_PORT;
-
- /**
- * Type of the proxy
- */
- private String type = null;
-
- /**
- * The non-proxy hosts. Follows Java system property format: <code>*.foo.com|localhost</code>.
- */
- private String nonProxyHosts;
-
- /**
- * For NTLM proxies, specifies the NTLM host.
- */
- private String ntlmHost;
-
- /**
- * For NTLM proxies, specifies the NTLM domain.
- */
- private String ntlmDomain;
-
- /**
- * Return proxy server host name.
- *
- * @return proxy server host name
- */
- public String getHost()
- {
- return host;
- }
-
- /**
- * Set proxy host name.
- *
- * @param host proxy server host name
- */
- public void setHost( final String host )
- {
- this.host = host;
- }
-
- /**
- * Get user's password used to login to proxy server.
- *
- * @return user's password at proxy host
- */
- public String getPassword()
- {
- return password;
- }
-
- /**
- * Set the user's password for the proxy server.
- *
- * @param password password to use to login to a proxy server
- */
- public void setPassword( final String password )
- {
- this.password = password;
- }
-
- /**
- * Get the proxy port.
- *
- * @return proxy server port
- */
- public int getPort()
- {
- return port;
- }
-
- /**
- * Set the proxy port.
- *
- * @param port proxy server port
- */
- public void setPort( final int port )
- {
- this.port = port;
- }
-
- /**
- * Get the proxy username.
- *
- * @return username for the proxy server
- */
- public String getUserName()
- {
- return userName;
- }
-
- /**
- * Set the proxy username.
- *
- * @param userName username for the proxy server
- */
- public void setUserName( final String userName )
- {
- this.userName = userName;
- }
-
- /**
- * Get the type of the proxy server.
- *
- * @return the type of the proxy server
- */
- public String getType()
- {
- return type;
- }
-
- /**
- * @param type the type of the proxy server like <i>SOCKSv4</i>
- */
- public void setType( final String type )
- {
- this.type = type;
- }
-
- public String getNonProxyHosts()
- {
- return nonProxyHosts;
- }
-
- public void setNonProxyHosts( String nonProxyHosts )
- {
- this.nonProxyHosts = nonProxyHosts;
- }
-
- public String getNtlmHost()
- {
- return ntlmHost;
- }
-
- public void setNtlmHost( String ntlmHost )
- {
- this.ntlmHost = ntlmHost;
- }
-
- public void setNtlmDomain( String ntlmDomain )
- {
- this.ntlmDomain = ntlmDomain;
- }
-
- public String getNtlmDomain()
- {
- return ntlmDomain;
- }
-}
diff --git a/wagon-provider-api/src/main/java/org/apache/maven/wagon/repository/Repository.java b/wagon-provider-api/src/main/java/org/apache/maven/wagon/repository/Repository.java
deleted file mode 100644
index ea91a91..0000000
--- a/wagon-provider-api/src/main/java/org/apache/maven/wagon/repository/Repository.java
+++ /dev/null
@@ -1,230 +0,0 @@
-package org.apache.maven.wagon.repository;
-
-/* ====================================================================
- * 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.PathUtils;
-import org.apache.maven.wagon.WagonConstants;
-import org.apache.maven.wagon.authentication.AuthenticationInfo;
-
-import java.io.Serializable;
-
-
-/**
- * This class is an abstraction of the location from/to resources
- * can be transfered.
- *
- * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
- * @version $Id$
- * @todo [BP] some things are specific to certain wagons (eg key stuff in authInfo, permissions)
- */
-public class Repository
- implements Serializable
-{
- private String id;
-
- private String name;
-
- private String host;
-
- private int port = WagonConstants.UNKNOWN_PORT;
-
- private String basedir;
-
- private String protocol;
-
- private String url;
-
- private RepositoryPermissions permissions;
-
- private AuthenticationInfo authenticationInfo;
-
-
- public Repository()
- {
-
- }
-
-
- public Repository( String id, String url )
- {
- setId( id );
-
- setUrl( url );
- }
-
-
- public String getId()
- {
- return id;
- }
-
- public void setId( String id )
- {
- this.id = id;
- }
-
-
- public AuthenticationInfo getAuthenticationInfo()
- {
- return authenticationInfo;
- }
-
- public void setAuthenticationInfo( AuthenticationInfo authenticationInfo )
- {
- this.authenticationInfo = authenticationInfo;
- }
-
- public String getBasedir()
- {
- return basedir;
- }
-
- public void setBasedir( String basedir )
- {
- this.basedir = basedir;
- }
-
- public void setName( String name )
- {
- this.name = name;
- }
-
- public int getPort()
- {
- return port;
- }
-
- public void setPort( int port )
- {
- this.port = port;
- }
-
- public void setUrl( String url )
- {
- this.url = url;
-
- // TODO [BP]: refactor out the PathUtils URL stuff into a class like java.net.URL, so you only parse once
- // can't use URL class as is because it won't recognise our protocols, though perhaps we could attempt to
- // register handlers for scp, etc?
-
- this.host = PathUtils.host( url );
-
- this.protocol = PathUtils.protocol( url );
-
- this.port = PathUtils.port( url );
-
- this.basedir = PathUtils.basedir( url );
-
- String username = PathUtils.user( url );
-
- if ( username != null )
- {
- if ( authenticationInfo == null )
- {
- authenticationInfo = new AuthenticationInfo();
- }
- authenticationInfo.setUserName( username );
-
- String password = PathUtils.password( url );
-
- String userInfo = username;
-
- if ( password != null )
- {
- authenticationInfo.setPassword( password );
-
- userInfo += ":" + password;
- }
-
- userInfo += "@";
-
- int index = url.indexOf( userInfo );
- this.url = url.substring( 0, index ) + url.substring( index + userInfo.length() );
- }
- }
-
- public String getUrl()
- {
- if ( url != null )
- {
- return url;
- }
-
- StringBuffer sb = new StringBuffer();
-
- sb.append( protocol );
-
- sb.append( "://" );
-
- sb.append( host );
-
- if ( port != WagonConstants.UNKNOWN_PORT )
- {
- sb.append( ":" );
-
- sb.append( port );
- }
-
- sb.append( basedir );
-
- return sb.toString();
- }
-
- public String getHost()
- {
- if ( host == null )
- {
- return "localhost";
- }
- return host;
- }
-
- public String getName()
- {
- if ( name == null )
- {
- return getId();
- }
- return name;
- }
-
- public String toString()
- {
- if ( getName() != null )
- {
- return "[" + getName() + "] -> " + getUrl();
- }
-
- return getUrl();
- }
-
- public String getProtocol()
- {
- return protocol;
- }
-
- public RepositoryPermissions getPermissions()
- {
- return permissions;
- }
-
- public void setPermissions( RepositoryPermissions permissions )
- {
- this.permissions = permissions;
- }
-}
diff --git a/wagon-provider-api/src/main/java/org/apache/maven/wagon/repository/RepositoryPermissions.java b/wagon-provider-api/src/main/java/org/apache/maven/wagon/repository/RepositoryPermissions.java
deleted file mode 100644
index 50489b5..0000000
--- a/wagon-provider-api/src/main/java/org/apache/maven/wagon/repository/RepositoryPermissions.java
+++ /dev/null
@@ -1,107 +0,0 @@
-package org.apache.maven.wagon.repository;
-
-/* ====================================================================
- * Copyright 2001-2005 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.
- * ====================================================================
- */
-
-/**
- * Describes the permissions to set on files uploaded to the repository.
- *
- * @author Brett Porter
- * @version $Id$
- */
-public class RepositoryPermissions
-{
- /**
- * Repository group name.
- */
- private String group;
-
- /**
- * Repository directory mode. Modes can be in either textual (ugo+rx) or octal (755) form.
- */
- private String directoryMode;
-
- /**
- * Repository file mode. Modes can be in either textual (ugo+rx) or octal (644) form.
- */
- private String fileMode;
-
- /**
- * Get the repository directory mode to which an artifact will belong to after
- * deployment. Not all protolcols permit the changing of the mode.
- *
- * @return mode
- */
- public String getDirectoryMode()
- {
- return directoryMode;
- }
-
- /**
- * Set the repository directory mode for the deployed artifact.
- *
- * @param directoryMode repository directory mode for deployed artifacts
- */
- public void setDirectoryMode( final String directoryMode )
- {
- this.directoryMode = directoryMode;
- }
-
- /**
- * Get the repository file mode to which an artifact will belong to after
- * deployment. Not all protolcols permit the changing of the artifact mode.
- *
- * @return repository group name
- */
- public String getFileMode()
- {
- return fileMode;
- }
-
- /**
- * Set the repository file mode for the deployed artifact.
- *
- * @param fileMode repository file mode for deployed artifacts
- */
- public void setFileMode( final String fileMode )
- {
- this.fileMode = fileMode;
- }
-
- /**
- * Get the repository group name to which an artifact will belong to after
- * deployemnt. Not all protolcols permit the changing of the artifact
- * group.
- *
- * @return repository group name
- */
- public String getGroup()
- {
- return group;
- }
-
- /**
- * Set the repository group name for the deployed artifact.
- *
- * @param group repository group for deployed artifacts
- */
- public void setGroup( final String group )
- {
- this.group = group;
- }
-
-}
diff --git a/wagon-provider-api/src/main/java/org/apache/maven/wagon/resource/Resource.java b/wagon-provider-api/src/main/java/org/apache/maven/wagon/resource/Resource.java
deleted file mode 100644
index 8182e71..0000000
--- a/wagon-provider-api/src/main/java/org/apache/maven/wagon/resource/Resource.java
+++ /dev/null
@@ -1,88 +0,0 @@
-package org.apache.maven.wagon.resource;
-
-import org.apache.maven.wagon.WagonConstants;
-
-/* ====================================================================
- * 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.
- * ====================================================================
- */
-
-
-/**
- * Describes resources which can be downloaded from the repository
- * or uploaded to repository.
- * <p/>
- * This class contains minimal set of informations, which
- * are needed to reuse wagon in maven 1.
- *
- * @author <a href="michal@codehaus.org">Michal Maczka</a>
- * @version $Id$
- */
-
-public class Resource
- {
- private String name;
-
- private long lastModified;
-
- private long contentLength = WagonConstants.UNKNOWN_LENGTH;
-
- public Resource()
- {
-
- }
-
- public Resource( String name )
- {
- this.name = name;
- }
-
- public String getName()
- {
- return name;
- }
-
- public void setName( String name )
- {
- this.name = name;
- }
-
- /**
- * Returns the value of the last-modified header field.
- * The result is the number of milliseconds since January 1, 1970 GMT.
- *
- * @return the date the resource was last modified, or WagonConstants.UNKNOWN_LENGTH
- * if not known.
- */
- public long getLastModified()
- {
- return lastModified;
- }
-
- public void setLastModified( long lastModified )
- {
- this.lastModified = lastModified;
- }
-
- public long getContentLength()
- {
- return contentLength;
- }
-
- public void setContentLength( long contentLength )
- {
- this.contentLength = contentLength;
- }
-}
diff --git a/wagon-provider-api/src/main/java/org/apache/maven/wagon/util/FileUtils.java b/wagon-provider-api/src/main/java/org/apache/maven/wagon/util/FileUtils.java
deleted file mode 100644
index 16a0fec..0000000
--- a/wagon-provider-api/src/main/java/org/apache/maven/wagon/util/FileUtils.java
+++ /dev/null
@@ -1,1307 +0,0 @@
-package org.apache.maven.wagon.util;
-
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2001 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.codehaus.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Turbine" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
- * written permission, please contact codehaus@codehaus.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * "Apache Turbine", nor may "Apache" appear in their name, without
- * prior written permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.codehaus.org/>.
- *
- */
-
-import java.io.*;
-import java.net.URL;
-import java.text.DecimalFormat;
-import java.util.Random;
-import java.util.Vector;
-
-/**
- * This class provides basic facilities for manipulating files and file paths.
- *
- * <h3>Path-related methods</h3>
- *
- * <p>Methods exist to retrieve the components of a typical file path. For example
- * <code>/www/hosted/mysite/index.html</code>, can be broken into:
- * <ul>
- * <li><code>/www/hosted/mysite/</code> -- retrievable through {@link #getPath}</li>
- * <li><code>index.html</code> -- retrievable through {@link #removePath}</li>
- * <li><code>/www/hosted/mysite/index</code> -- retrievable through {@link #removeExtension}</li>
- * <li><code>html</code> -- retrievable through {@link #getExtension}</li>
- * </ul>
- * There are also methods to {@link #catPath concatenate two paths}, {@link #resolveFile resolve a
- * path relative to a File} and {@link #normalize} a path.
- * </p>
- *
- * <h3>File-related methods</h3>
- * <p>
- * There are methods to create a {@link #toFile File from a URL}, copy a
- * {@link #copyFileToDirectory File to a directory},
- * copy a {@link #copyFile File to another File},
- * copy a {@link #copyURLToFile URL's contents to a File},
- * as well as methods to {@link #deleteDirectory(File) delete} and {@link #cleanDirectory(File)
- * clean} a directory.
- * </p>
- *
- * Common {@link java.io.File} manipulation routines.
- *
- * Taken from the commons-util repo.
- * Also code from Alexandria's FileUtils.
- * And from Avalon Excalibur's IO.
- * And from Ant.
- *
- * @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</A>
- * @author <a href="mailto:sanders@codehaus.org">Scott Sanders</a>
- * @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a>
- * @author <a href="mailto:Christoph.Reck@dlr.de">Christoph.Reck</a>
- * @author <a href="mailto:peter@codehaus.org">Peter Donald</a>
- * @author <a href="mailto:jefft@codehaus.org">Jeff Turner</a>
- * @version $Id$
- */
-public class FileUtils
-{
- /**
- * The number of bytes in a kilobyte.
- */
- public static final int ONE_KB = 1024;
-
- /**
- * The number of bytes in a megabyte.
- */
- public static final int ONE_MB = ONE_KB * ONE_KB;
-
- /**
- * The number of bytes in a gigabyte.
- */
- public static final int ONE_GB = ONE_KB * ONE_MB;
-
- /**
- * Returns a human-readable version of the file size (original is in
- * bytes).
- *
- * @param size The number of bytes.
- * @return A human-readable display value (includes units).
- */
- public static String byteCountToDisplaySize( int size )
- {
- String displaySize;
-
- if ( size / ONE_GB > 0 )
- {
- displaySize = String.valueOf( size / ONE_GB ) + " GB";
- }
- else if ( size / ONE_MB > 0 )
- {
- displaySize = String.valueOf( size / ONE_MB ) + " MB";
- }
- else if ( size / ONE_KB > 0 )
- {
- displaySize = String.valueOf( size / ONE_KB ) + " KB";
- }
- else
- {
- displaySize = String.valueOf( size ) + " bytes";
- }
-
- return displaySize;
- }
-
- /**
- * Returns the directory path portion of a file specification string.
- * Matches the equally named unix command.
- * @return The directory portion excluding the ending file separator.
- */
- public static String dirname( String filename )
- {
- int i = filename.lastIndexOf( File.separator );
- return ( i >= 0 ? filename.substring( 0, i ) : "" );
- }
-
- /**
- * Returns the filename portion of a file specification string.
- * @return The filename string with extension.
- */
- public static String filename( String filename )
- {
- int i = filename.lastIndexOf( File.separator );
- return ( i >= 0 ? filename.substring( i + 1 ) : filename );
- }
-
- /**
- * Returns the filename portion of a file specification string.
- * Matches the equally named unix command.
- * @return The filename string without extension.
- */
- public static String basename( String filename )
- {
- return basename( filename, extension( filename ) );
- }
-
- /**
- * Returns the filename portion of a file specification string.
- * Matches the equally named unix command.
- */
- public static String basename( String filename, String suffix )
- {
- int i = filename.lastIndexOf( File.separator ) + 1;
- int lastDot = ( ( suffix != null ) && ( suffix.length() > 0 ) )
- ? filename.lastIndexOf( suffix ) : -1;
-
- if ( lastDot >= 0 )
- {
- return filename.substring( i, lastDot );
- }
- else if ( i > 0 )
- {
- return filename.substring( i );
- }
- else
- {
- return filename; // else returns all (no path and no extension)
- }
- }
-
- /**
- * Returns the extension portion of a file specification string.
- * This everything after the last dot '.' in the filename (NOT including
- * the dot).
- */
- public static String extension( String filename )
- {
- int lastDot = filename.lastIndexOf( '.' );
-
- if ( lastDot >= 0 )
- {
- return filename.substring( lastDot + 1 );
- }
- else
- {
- return "";
- }
- }
-
- /**
- * Check if a file exits.
- *
- * @param fileName The name of the file to check.
- * @return true if file exists.
- */
- public static boolean fileExists( String fileName )
- {
- File file = new File( fileName );
- return file.exists();
- }
-
- public static String fileRead( String file )
- throws IOException
- {
- return fileRead( new File( file ) );
- }
-
- public static String fileRead( File file )
- throws IOException
- {
- StringBuffer buf = new StringBuffer();
-
- FileInputStream in = new FileInputStream( file );
-
- int count;
- byte[] b = new byte[512];
- while ( ( count = in.read( b ) ) > 0 ) // blocking read
- {
- buf.append( new String( b, 0, count ) );
- }
-
- in.close();
-
- return buf.toString();
- }
-
- /**
- * Writes data to a file. The file will be created if it does not exist.
- *
- * @param fileName The name of the file to write.
- * @param data The content to write to the file.
- */
- public static void fileWrite( String fileName, String data )
- throws IOException
- {
- FileOutputStream out = new FileOutputStream( fileName );
- out.write( data.getBytes() );
- out.close();
- }
-
- /**
- * Deletes a file.
- *
- * @param fileName The name of the file to delete.
- */
- public static void fileDelete( String fileName )
- {
- File file = new File( fileName );
- file.delete();
- }
-
- /**
- * Waits for NFS to propagate a file creation, imposing a timeout.
- *
- * @param fileName The name of the file.
- * @param seconds The maximum time in seconds to wait.
- * @return True if file exists.
- */
- public static boolean waitFor( String fileName, int seconds )
- {
- File file = new File( fileName );
- int timeout = 0;
- int tick = 0;
- while ( !file.exists() )
- {
- if ( tick++ >= 10 )
- {
- tick = 0;
- if ( timeout++ > seconds )
- {
- return false;
- }
- }
- try
- {
- Thread.sleep( 100 );
- }
- catch ( InterruptedException ignore )
- {
- }
- catch ( Exception ex )
- {
- break;
- }
- }
- return true;
- }
-
- /**
- * Creates a file handle.
- *
- * @param fileName The name of the file.
- * @return A <code>File</code> manager.
- */
- public static File getFile( String fileName )
- {
- return new File( fileName );
- }
-
- /**
- * Given a directory and an array of extensions return an array of compliant files.
- *
- * TODO Should an ignore list be passed in?
- * TODO Should a recurse flag be passed in?
- *
- * The given extensions should be like "java" and not like ".java"
- */
- public static String[] getFilesFromExtension( String directory, String[] extensions )
- {
-
- Vector files = new Vector();
-
- java.io.File currentDir = new java.io.File( directory );
-
- String[] unknownFiles = currentDir.list();
-
- if ( unknownFiles == null )
- {
- return new String[0];
- }
-
- for ( int i = 0; i < unknownFiles.length; ++i )
- {
- String currentFileName = directory + System.getProperty( "file.separator" ) + unknownFiles[i];
- java.io.File currentFile = new java.io.File( currentFileName );
-
- if ( currentFile.isDirectory() )
- {
-
-
- //ignore all CVS directories...
- if ( currentFile.getName().equals( "CVS" ) )
- {
- continue;
- }
-
-
- //ok... transverse into this directory and get all the files... then combine
- //them with the current list.
-
- String[] fetchFiles = getFilesFromExtension( currentFileName, extensions );
- files = blendFilesToVector( files, fetchFiles );
-
- }
- else
- {
- //ok... add the file
-
- String add = currentFile.getAbsolutePath();
- if ( isValidFile( add, extensions ) )
- {
- files.addElement( add );
-
- }
-
- }
- }
-
- //ok... move the Vector into the files list...
-
- String[] foundFiles = new String[files.size()];
- files.copyInto( foundFiles );
-
- return foundFiles;
-
- }
-
-
- /**
- * Private hepler method for getFilesFromExtension()
- */
- private static Vector blendFilesToVector( Vector v, String[] files )
- {
-
- for ( int i = 0; i < files.length; ++i )
- {
- v.addElement( files[i] );
- }
-
- return v;
- }
-
- /**
- * Checks to see if a file is of a particular type(s).
- * Note that if the file does not have an extension, an empty string
- * ("") is matched for.
- *
- */
- private static boolean isValidFile( String file, String[] extensions )
- {
-
-
- String extension = extension( file );
- if ( extension == null )
- {
- extension = "";
- }
-
- //ok.. now that we have the "extension" go through the current know
- //excepted extensions and determine if this one is OK.
-
- for ( int i = 0; i < extensions.length; ++i )
- {
- if ( extensions[i].equals( extension ) )
- return true;
- }
-
- return false;
-
- }
-
- /**
- * Simple way to make a directory
- */
- public static void mkdir( String dir )
- {
- File file = new File( dir );
- if ( !file.exists() )
- {
- file.mkdirs();
- }
- }
-
- /**
- * Compare the contents of two files to determine if they are equal or not.
- *
- * @param file1 the first file
- * @param file2 the second file
- * @return true if the content of the files are equal or they both don't exist, false otherwise
- */
- public static boolean contentEquals( final File file1, final File file2 )
- throws IOException
- {
- final boolean file1Exists = file1.exists();
- if ( file1Exists != file2.exists() )
- {
- return false;
- }
-
- if ( !file1Exists )
- {
- // two not existing files are equal
- return true;
- }
-
- if ( file1.isDirectory() || file2.isDirectory() )
- {
- // don't want to compare directory contents
- return false;
- }
-
- InputStream input1 = null;
- InputStream input2 = null;
- try
- {
- input1 = new FileInputStream( file1 );
- input2 = new FileInputStream( file2 );
- return IoUtils.contentEquals( input1, input2 );
-
- }
- finally
- {
- input1.close();
- input2.close();
- }
- }
-
- /**
- * Convert from a <code>URL</code> to a <code>File</code>.
- * @param url File URL.
- * @return The equivalent <code>File</code> object, or <code>null</code> if the URL's protocol
- * is not <code>file</code>
- */
- public static File toFile( final URL url )
- {
- if ( url.getProtocol().equals( "file" ) == false )
- {
- return null;
- }
- else
- {
- final String filename = url.getFile().replace( '/', File.separatorChar );
- return new File( filename );
- }
- }
-
- /**
- * Convert the array of Files into a list of URLs.
- *
- * @param files the array of files
- * @return the array of URLs
- * @throws IOException if an error occurs
- */
- public static URL[] toURLs( final File[] files )
- throws IOException
- {
- final URL[] urls = new URL[files.length];
-
- for ( int i = 0; i < urls.length; i++ )
- {
- urls[i] = files[i].toURL();
- }
-
- return urls;
- }
-
- /**
- * Remove extension from filename.
- * ie
- * <pre>
- * foo.txt --> foo
- * a\b\c.jpg --> a\b\c
- * a\b\c --> a\b\c
- * </pre>
- *
- * @param filename the filename
- * @return the filename minus extension
- */
- public static String removeExtension( final String filename )
- {
- final int index = filename.lastIndexOf( '.' );
-
- if ( -1 == index )
- {
- return filename;
- }
- else
- {
- return filename.substring( 0, index );
- }
- }
-
- /**
- * Get extension from filename.
- * ie
- * <pre>
- * foo.txt --> "txt"
- * a\b\c.jpg --> "jpg"
- * a\b\c --> ""
- * </pre>
- *
- * @param filename the filename
- * @return the extension of filename or "" if none
- */
- public static String getExtension( final String filename )
- {
- final int index = filename.lastIndexOf( '.' );
-
- if ( -1 == index )
- {
- return "";
- }
- else
- {
- return filename.substring( index + 1 );
- }
- }
-
- /**
- * Remove path from filename. Equivalent to the unix command <code>basename</code>
- * ie.
- * <pre>
- * a/b/c.txt --> c.txt
- * a.txt --> a.txt
- * </pre>
- *
- * @param filepath the filepath
- * @return the filename minus path
- */
- public static String removePath( final String filepath )
- {
- return removePath( filepath, File.separatorChar );
- }
-
- /**
- * Remove path from filename.
- * ie.
- * <pre>
- * a/b/c.txt --> c.txt
- * a.txt --> a.txt
- * </pre>
- *
- * @param filepath the filepath
- * @return the filename minus path
- */
- public static String removePath( final String filepath, final char fileSeparatorChar )
- {
- final int index = filepath.lastIndexOf( fileSeparatorChar );
-
- if ( -1 == index )
- {
- return filepath;
- }
- else
- {
- return filepath.substring( index + 1 );
- }
- }
-
- /**
- * Get path from filename. Roughly equivalent to the unix command <code>dirname</code>.
- * ie.
- * <pre>
- * a/b/c.txt --> a/b
- * a.txt --> ""
- * </pre>
- *
- * @param filepath the filepath
- * @return the filename minus path
- */
- public static String getPath( final String filepath )
- {
- return getPath( filepath, File.separatorChar );
- }
-
- /**
- * Get path from filename.
- * ie.
- * <pre>
- * a/b/c.txt --> a/b
- * a.txt --> ""
- * </pre>
- *
- * @param filepath the filepath
- * @return the filename minus path
- */
- public static String getPath( final String filepath, final char fileSeparatorChar )
- {
- final int index = filepath.lastIndexOf( fileSeparatorChar );
- if ( -1 == index )
- {
- return "";
- }
- else
- {
- return filepath.substring( 0, index );
- }
- }
-
- /**
- * Copy file from source to destination. If <code>destinationDirectory</code> does not exist, it
- * (and any parent directories) will be created. If a file <code>source</code> in
- * <code>destinationDirectory</code> exists, it will be overwritten.
- *
- * @param source An existing <code>File</code> to copy.
- * @param destinationDirectory A directory to copy <code>source</code> into.
- *
- * @throws java.io.FileNotFoundException if <code>source</code> isn't a normal file.
- * @throws IllegalArgumentException if <code>destinationDirectory</code> isn't a directory.
- * @throws IOException if <code>source</code> does not exist, the file in
- * <code>destinationDirectory</code> cannot be written to, or an IO error occurs during copying.
- */
- public static void copyFileToDirectory( final String source,
- final String destinationDirectory )
- throws IOException
- {
- copyFileToDirectory( new File( source ),
- new File( destinationDirectory ) );
- }
-
- /**
- * Copy file from source to destination. If <code>destinationDirectory</code> does not exist, it
- * (and any parent directories) will be created. If a file <code>source</code> in
- * <code>destinationDirectory</code> exists, it will be overwritten.
- *
- * @param source An existing <code>File</code> to copy.
- * @param destinationDirectory A directory to copy <code>source</code> into.
- *
- * @throws java.io.FileNotFoundException if <code>source</code> isn't a normal file.
- * @throws IllegalArgumentException if <code>destinationDirectory</code> isn't a directory.
- * @throws IOException if <code>source</code> does not exist, the file in
- * <code>destinationDirectory</code> cannot be written to, or an IO error occurs during copying.
- */
- public static void copyFileToDirectory( final File source,
- final File destinationDirectory )
- throws IOException
- {
- if ( destinationDirectory.exists() && !destinationDirectory.isDirectory() )
- {
- throw new IllegalArgumentException( "Destination is not a directory" );
- }
-
- copyFile( source, new File( destinationDirectory, source.getName() ) );
- }
-
- /**
- * Copy file from source to destination. The directories up to <code>destination</code> will be
- * created if they don't already exist. <code>destination</code> will be overwritten if it
- * already exists.
- *
- * @param source An existing non-directory <code>File</code> to copy bytes from.
- * @param destination A non-directory <code>File</code> to write bytes to (possibly
- * overwriting).
- *
- * @throws IOException if <code>source</code> does not exist, <code>destination</code> cannot be
- * written to, or an IO error occurs during copying.
- *
- * @throws java.io.FileNotFoundException if <code>destination</code> is a directory
- * (use {@link #copyFileToDirectory}).
- */
- public static void copyFile( final File source, final File destination )
- throws IOException
- {
- //check source exists
- if ( !source.exists() )
- {
- final String message = "File " + source + " does not exist";
- throw new IOException( message );
- }
-
- //does destinations directory exist ?
- if ( destination.getParentFile() != null &&
- !destination.getParentFile().exists() )
- {
- destination.getParentFile().mkdirs();
- }
-
- //make sure we can write to destination
- if ( destination.exists() && !destination.canWrite() )
- {
- final String message = "Unable to open file " +
- destination + " for writing.";
- throw new IOException( message );
- }
-
- final FileInputStream input = new FileInputStream( source );
-
- final FileOutputStream output = new FileOutputStream( destination );
-
- IoUtils.copy( input, output );
-
- input.close();
-
- output.close();
-
- if ( source.length() != destination.length() )
- {
- final String message = "Failed to copy full contents from " + source +
- " to " + destination;
- throw new IOException( message );
- }
- }
-
- /**
- * Copies bytes from the URL <code>source</code> to a file <code>destination</code>.
- * The directories up to <code>destination</code> will be created if they don't already exist.
- * <code>destination</code> will be overwritten if it already exists.
- *
- * @param source A <code>URL</code> to copy bytes from.
- * @param destination A non-directory <code>File</code> to write bytes to (possibly
- * overwriting).
- *
- * @throws IOException if
- * <ul>
- * <li><code>source</code> URL cannot be opened</li>
- * <li><code>destination</code> cannot be written to</li>
- * <li>an IO error occurs during copying</li>
- * </ul>
- */
- public static void copyURLToFile( final URL source, final File destination )
- throws IOException
- {
- //does destination directory exist ?
- if ( destination.getParentFile() != null &&
- !destination.getParentFile().exists() )
- {
- destination.getParentFile().mkdirs();
- }
-
- //make sure we can write to destination
- if ( destination.exists() && !destination.canWrite() )
- {
- final String message = "Unable to open file " +
- destination + " for writing.";
- throw new IOException( message );
- }
-
- final InputStream input = source.openStream();
-
- final FileOutputStream output = new FileOutputStream( destination );
-
- IoUtils.copy( input, output );
-
- input.close();
-
- output.close();
- }
-
- /**
- * Normalize a path.
- * Eliminates "/../" and "/./" in a string. Returns <code>null</code> if the ..'s went past the
- * root.
- * Eg:
- * <pre>
- * /foo// --> /foo/
- * /foo/./ --> /foo/
- * /foo/../bar --> /bar
- * /foo/../bar/ --> /bar/
- * /foo/../bar/../baz --> /baz
- * //foo//./bar --> /foo/bar
- * /../ --> null
- * </pre>
- *
- * @param path the path to normalize
- * @return the normalized String, or <code>null</code> if too many ..'s.
- */
- public static String normalize( final String path )
- {
- String normalized = path;
- // Resolve occurrences of "//" in the normalized path
- while ( true )
- {
- int index = normalized.indexOf( "//" );
- if ( index < 0 )
- break;
- normalized = normalized.substring( 0, index ) +
- normalized.substring( index + 1 );
- }
-
- // Resolve occurrences of "/./" in the normalized path
- while ( true )
- {
- int index = normalized.indexOf( "/./" );
- if ( index < 0 )
- break;
- normalized = normalized.substring( 0, index ) +
- normalized.substring( index + 2 );
- }
-
- // Resolve occurrences of "/../" in the normalized path
- while ( true )
- {
- int index = normalized.indexOf( "/../" );
- if ( index < 0 )
- break;
- if ( index == 0 )
- return null; // Trying to go outside our context
- int index2 = normalized.lastIndexOf( '/', index - 1 );
- normalized = normalized.substring( 0, index2 ) +
- normalized.substring( index + 3 );
- }
-
- // Return the normalized path that we have completed
- return normalized;
- }
-
- /**
- * Will concatenate 2 paths. Paths with <code>..</code> will be
- * properly handled.
- * <p>Eg.,<br />
- * <code>/a/b/c</code> + <code>d</code> = <code>/a/b/d</code><br />
- * <code>/a/b/c</code> + <code>../d</code> = <code>/a/d</code><br />
- * </p>
- *
- * Thieved from Tomcat sources...
- *
- * @return The concatenated paths, or null if error occurs
- */
- public static String catPath( final String lookupPath, final String path )
- {
- // Cut off the last slash and everything beyond
- int index = lookupPath.lastIndexOf( "/" );
- String lookup = lookupPath.substring( 0, index );
- String pth = path;
-
- // Deal with .. by chopping dirs off the lookup path
- while ( pth.startsWith( "../" ) )
- {
- if ( lookup.length() > 0 )
- {
- index = lookup.lastIndexOf( "/" );
- lookup = lookup.substring( 0, index );
- }
- else
- {
- // More ..'s than dirs, return null
- return null;
- }
-
- index = pth.indexOf( "../" ) + 3;
- pth = pth.substring( index );
- }
-
- return new StringBuffer( lookup ).append( "/" ).append( pth ).toString();
- }
-
- /**
- * Resolve a file <code>filename</code> to it's canonical form. If <code>filename</code> is
- * relative (doesn't start with <code>/</code>), it will be resolved relative to
- * <code>baseFile</code>, otherwise it is treated as a normal root-relative path.
- *
- * @param baseFile Where to resolve <code>filename</code> from, if <code>filename</code> is
- * relative.
- * @param filename Absolute or relative file path to resolve.
- * @return The canonical <code>File</code> of <code>filename</code>.
- */
- public static File resolveFile( final File baseFile, String filename )
- {
- String filenm = filename;
- if ( '/' != File.separatorChar )
- {
- filenm = filename.replace( '/', File.separatorChar );
- }
-
- if ( '\\' != File.separatorChar )
- {
- filenm = filename.replace( '\\', File.separatorChar );
- }
-
- // deal with absolute files
- if ( filenm.startsWith( File.separator ) )
- {
- File file = new File( filenm );
-
- try
- {
- file = file.getCanonicalFile();
- }
- catch ( final IOException ioe )
- {
- }
-
- return file;
- }
- // FIXME: I'm almost certain this // removal is unnecessary, as getAbsoluteFile() strips
- // them. However, I'm not sure about this UNC stuff. (JT)
- final char[] chars = filename.toCharArray();
- final StringBuffer sb = new StringBuffer();
-
- //remove duplicate file separators in succession - except
- //on win32 at start of filename as UNC filenames can
- //be \\AComputer\AShare\myfile.txt
- int start = 0;
- if ( '\\' == File.separatorChar )
- {
- sb.append( filenm.charAt( 0 ) );
- start++;
- }
-
- for ( int i = start; i < chars.length; i++ )
- {
- final boolean doubleSeparator =
- File.separatorChar == chars[i] && File.separatorChar == chars[i - 1];
-
- if ( !doubleSeparator )
- {
- sb.append( chars[i] );
- }
- }
-
- filenm = sb.toString();
-
- //must be relative
- File file = ( new File( baseFile, filenm ) ).getAbsoluteFile();
-
- try
- {
- file = file.getCanonicalFile();
- }
- catch ( final IOException ioe )
- {
- }
-
- return file;
- }
-
- /**
- * Delete a file. If file is directory delete it and all sub-directories.
- */
- public static void forceDelete( final String file )
- throws IOException
- {
- forceDelete( new File( file ) );
- }
-
- /**
- * Delete a file. If file is directory delete it and all sub-directories.
- */
- public static void forceDelete( final File file )
- throws IOException
- {
- if ( file.isDirectory() )
- {
- deleteDirectory( file );
- }
- else
- {
- if ( !file.delete() )
- {
- final String message =
- "File " + file + " unable to be deleted.";
- throw new IOException( message );
- }
- }
- }
-
- /**
- * Schedule a file to be deleted when JVM exits.
- * If file is directory delete it and all sub-directories.
- */
- public static void forceDeleteOnExit( final File file )
- throws IOException
- {
- if ( file.isDirectory() )
- {
- deleteDirectoryOnExit( file );
- }
- else
- {
- file.deleteOnExit();
- }
- }
-
- /**
- * Recursively schedule directory for deletion on JVM exit.
- */
- private static void deleteDirectoryOnExit( final File directory )
- throws IOException
- {
- if ( !directory.exists() )
- {
- return;
- }
-
- cleanDirectoryOnExit( directory );
- directory.deleteOnExit();
- }
-
- /**
- * Clean a directory without deleting it.
- */
- private static void cleanDirectoryOnExit( final File directory )
- throws IOException
- {
- if ( !directory.exists() )
- {
- final String message = directory + " does not exist";
- throw new IllegalArgumentException( message );
- }
-
- if ( !directory.isDirectory() )
- {
- final String message = directory + " is not a directory";
- throw new IllegalArgumentException( message );
- }
-
- IOException exception = null;
-
- final File[] files = directory.listFiles();
- for ( int i = 0; i < files.length; i++ )
- {
- final File file = files[i];
- try
- {
- forceDeleteOnExit( file );
- }
- catch ( final IOException ioe )
- {
- exception = ioe;
- }
- }
-
- if ( null != exception )
- {
- throw exception;
- }
- }
-
-
- /**
- * Make a directory. If there already exists a file with specified name or
- * the directory is unable to be created then an exception is thrown.
- */
- public static void forceMkdir( final File file )
- throws IOException
- {
- if ( file.exists() )
- {
- if ( file.isFile() )
- {
- final String message = "File " + file + " exists and is " +
- "not a directory. Unable to create directory.";
- throw new IOException( message );
- }
- }
- else
- {
- if ( false == file.mkdirs() )
- {
- final String message = "Unable to create directory " + file;
- throw new IOException( message );
- }
- }
- }
-
- /**
- * Recursively delete a directory.
- */
- public static void deleteDirectory( final String directory )
- throws IOException
- {
- deleteDirectory( new File( directory ) );
- }
-
- /**
- * Recursively delete a directory.
- */
- public static void deleteDirectory( final File directory )
- throws IOException
- {
- if ( !directory.exists() )
- {
- return;
- }
-
- cleanDirectory( directory );
- if ( !directory.delete() )
- {
- final String message =
- "Directory " + directory + " unable to be deleted.";
- throw new IOException( message );
- }
- }
-
- /**
- * Clean a directory without deleting it.
- */
- public static void cleanDirectory( final String directory )
- throws IOException
- {
- cleanDirectory( new File( directory ) );
- }
-
- /**
- * Clean a directory without deleting it.
- */
- public static void cleanDirectory( final File directory )
- throws IOException
- {
- if ( !directory.exists() )
- {
- final String message = directory + " does not exist";
- throw new IllegalArgumentException( message );
- }
-
- if ( !directory.isDirectory() )
- {
- final String message = directory + " is not a directory";
- throw new IllegalArgumentException( message );
- }
-
- IOException exception = null;
-
- final File[] files = directory.listFiles();
- for ( int i = 0; i < files.length; i++ )
- {
- final File file = files[i];
- try
- {
- forceDelete( file );
- }
- catch ( final IOException ioe )
- {
- exception = ioe;
- }
- }
-
- if ( null != exception )
- {
- throw exception;
- }
- }
-
- /**
- * Recursively count size of a directory.
- *
- * @return size of directory in bytes.
- */
- public static long sizeOfDirectory( final String directory )
- {
- return sizeOfDirectory( new File( directory ) );
- }
-
- /**
- * Recursively count size of a directory.
- *
- * @return size of directory in bytes.
- */
- public static long sizeOfDirectory( final File directory )
- {
- if ( !directory.exists() )
- {
- final String message = directory + " does not exist";
- throw new IllegalArgumentException( message );
- }
-
- if ( !directory.isDirectory() )
- {
- final String message = directory + " is not a directory";
- throw new IllegalArgumentException( message );
- }
-
- long size = 0;
-
- final File[] files = directory.listFiles();
- for ( int i = 0; i < files.length; i++ )
- {
- final File file = files[i];
-
- if ( file.isDirectory() )
- {
- size += sizeOfDirectory( file );
- }
- else
- {
- size += file.length();
- }
- }
-
- return size;
- }
-
-
-
-
- public static String FS = System.getProperty( "file.separator" );
-
- /**
- * Create a temporary file in a given directory.
- *
- * <p>The file denoted by the returned abstract pathname did not
- * exist before this method was invoked, any subsequent invocation
- * of this method will yield a different file name.</p>
- * <p>
- * The filename is prefixNNNNNsuffix where NNNN is a random number
- * </p>
- * <p>This method is different to File.createTempFile of JDK 1.2
- * as it doesn't create the file itself.
- * It uses the location pointed to by java.io.tmpdir
- * when the parentDir attribute is
- * null.</p>
- *
- * @param prefix prefix before the random number
- * @param suffix file extension; include the '.'
- * @param parentDir Directory to create the temporary file in -
- * java.io.tmpdir used if not specificed
- *
- * @return a File reference to the new temporary file.
- */
- public static File createTempFile(String prefix, String suffix, File parentDir) {
-
- File result = null;
- String parent = System.getProperty("java.io.tmpdir");
- if (parentDir != null) {
- parent = parentDir.getPath();
- }
- DecimalFormat fmt = new DecimalFormat("#####");
- Random rand = new Random(System.currentTimeMillis()
- +Runtime.getRuntime().freeMemory());
- synchronized (rand) {
- do {
- result = new File(parent,
- prefix + fmt.format(Math.abs(rand.nextInt()))
- + suffix);
- } while (result.exists());
- }
- return result;
- }
-}
diff --git a/wagon-provider-api/src/main/java/org/apache/maven/wagon/util/IoUtils.java b/wagon-provider-api/src/main/java/org/apache/maven/wagon/util/IoUtils.java
deleted file mode 100644
index 3aaa660..0000000
--- a/wagon-provider-api/src/main/java/org/apache/maven/wagon/util/IoUtils.java
+++ /dev/null
@@ -1,780 +0,0 @@
-package org.apache.maven.wagon.util;
-
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2001 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.codehaus.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Turbine" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
- * written permission, please contact codehaus@codehaus.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * "Apache Turbine", nor may "Apache" appear in their name, without
- * prior written permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.codehaus.org/>.
- */
-
-import java.io.*;
-
-/**
- * General IO Stream manipulation.
- * <p>
- * This class provides static utility methods for input/output operations, particularly buffered
- * copying between sources (<code>InputStream</code>, <code>Reader</code>, <code>String</code> and
- * <code>byte[]</code>) and destinations (<code>OutputStream</code>, <code>Writer</code>,
- * <code>String</code> and <code>byte[]</code>).
- * </p>
- *
- * <p>Unless otherwise noted, these <code>copy</code> methods do <em>not</em> flush or close the
- * streams. Often, doing so would require making non-portable assumptions about the streams' origin
- * and further use. This means that both streams' <code>close()</code> methods must be called after
- * copying. if one omits this step, then the stream resources (sockets, file descriptors) are
- * released when the associated Stream is garbage-collected. It is not a good idea to rely on this
- * mechanism. For a good overview of the distinction between "memory management" and "resource
- * management", see <a href="http://www.unixreview.com/articles/1998/9804/9804ja/ja.htm">this
- * UnixReview article</a></p>
- *
- * <p>For each <code>copy</code> method, a variant is provided that allows the caller to specify the
- * buffer size (the default is 4k). As the buffer size can have a fairly large impact on speed, this
- * may be worth tweaking. Often "large buffer -> faster" does not hold, even for large data
- * transfers.</p>
- *
- * <p>For byte-to-char methods, a <code>copy</code> variant allows the encoding to be selected
- * (otherwise the platform default is used).</p>
- *
- * <p>The <code>copy</code> methods use an internal buffer when copying. It is therefore advisable
- * <em>not</em> to deliberately wrap the stream arguments to the <code>copy</code> methods in
- * <code>Buffered*</code> streams. For example, don't do the
- * following:</p>
- *
- * <code>copy( new BufferedInputStream( in ), new BufferedOutputStream( out ) );</code>
- *
- * <p>The rationale is as follows:</p>
- *
- * <p>Imagine that an InputStream's read() is a very expensive operation, which would usually suggest
- * wrapping in a BufferedInputStream. The BufferedInputStream works by issuing infrequent
- * {@link java.io.InputStream#read(byte[] b, int off, int len)} requests on the underlying InputStream, to
- * fill an internal buffer, from which further <code>read</code> requests can inexpensively get
- * their data (until the buffer runs out).</p>
- * <p>However, the <code>copy</code> methods do the same thing, keeping an internal buffer,
- * populated by {@link InputStream#read(byte[] b, int off, int len)} requests. Having two buffers
- * (or three if the destination stream is also buffered) is pointless, and the unnecessary buffer
- * management hurts performance slightly (about 3%, according to some simple experiments).</p>
- *
- * @author <a href="mailto:peter@codehaus.org">Peter Donald</a>
- * @author <a href="mailto:jefft@codehaus.org">Jeff Turner</a>
- * @version CVS $Revision$ $Date$
- * @since 4.0
- */
-
-/*
- * Behold, intrepid explorers; a map of this class:
- *
- * Method Input Output Dependency
- * ------ ----- ------ -------
- * 1 copy InputStream OutputStream (primitive)
- * 2 copy Reader Writer (primitive)
- *
- * 3 copy InputStream Writer 2
- * 4 toString InputStream String 3
- * 5 toByteArray InputStream byte[] 1
- *
- * 6 copy Reader OutputStream 2
- * 7 toString Reader String 2
- * 8 toByteArray Reader byte[] 6
- *
- * 9 copy String OutputStream 2
- * 10 copy String Writer (trivial)
- * 11 toByteArray String byte[] 9
- *
- * 12 copy byte[] Writer 3
- * 13 toString byte[] String 12
- * 14 copy byte[] OutputStream (trivial)
- *
- *
- * Note that only the first two methods shuffle bytes; the rest use these two, or (if possible) copy
- * using native Java copy methods. As there are method variants to specify buffer size and encoding,
- * each row may correspond to up to 4 methods.
- *
- */
-
-public final class IoUtils
-{
- private static final int DEFAULT_BUFFER_SIZE = 1024 * 4;
-
- /**
- * Private constructor to prevent instantiation.
- */
- private IoUtils()
- {
- }
-
- ///////////////////////////////////////////////////////////////
- // Core copy methods
- ///////////////////////////////////////////////////////////////
-
- /**
- * Copy bytes from an <code>InputStream</code> to an <code>OutputStream</code>.
- */
- public static void copy( final InputStream input, final OutputStream output )
- throws IOException
- {
- copy( input, output, DEFAULT_BUFFER_SIZE );
- }
-
- /**
- * Copy bytes from an <code>InputStream</code> to an <code>OutputStream</code>.
- * @param bufferSize Size of internal buffer to use.
- */
- public static void copy( final InputStream input,
- final OutputStream output,
- final int bufferSize )
- throws IOException
- {
- final byte[] buffer = new byte[bufferSize];
- int n = 0;
- while ( -1 != ( n = input.read( buffer ) ) )
- {
- output.write( buffer, 0, n );
- }
- }
-
- /**
- * Copy chars from a <code>Reader</code> to a <code>Writer</code>.
- */
- public static void copy( final Reader input, final Writer output )
- throws IOException
- {
- copy( input, output, DEFAULT_BUFFER_SIZE );
- }
-
- /**
- * Copy chars from a <code>Reader</code> to a <code>Writer</code>.
- * @param bufferSize Size of internal buffer to use.
- */
- public static void copy( final Reader input, final Writer output, final int bufferSize )
- throws IOException
- {
- final char[] buffer = new char[bufferSize];
- int n = 0;
- while ( -1 != ( n = input.read( buffer ) ) )
- {
- output.write( buffer, 0, n );
- }
- output.flush();
- }
-
- ///////////////////////////////////////////////////////////////
- // Derived copy methods
- // InputStream -> *
- ///////////////////////////////////////////////////////////////
-
-
- ///////////////////////////////////////////////////////////////
- // InputStream -> Writer
-
- /**
- * Copy and convert bytes from an <code>InputStream</code> to chars on a
- * <code>Writer</code>.
- * The platform's default encoding is used for the byte-to-char conversion.
- */
- public static void copy( final InputStream input, final Writer output )
- throws IOException
- {
- copy( input, output, DEFAULT_BUFFER_SIZE );
- }
-
- /**
- * Copy and convert bytes from an <code>InputStream</code> to chars on a
- * <code>Writer</code>.
- * The platform's default encoding is used for the byte-to-char conversion.
- * @param bufferSize Size of internal buffer to use.
- */
- public static void copy( final InputStream input, final Writer output, final int bufferSize )
- throws IOException
- {
- final InputStreamReader in = new InputStreamReader( input );
- copy( in, output, bufferSize );
- }
-
- /**
- * Copy and convert bytes from an <code>InputStream</code> to chars on a
- * <code>Writer</code>, using the specified encoding.
- * @param encoding The name of a supported character encoding. See the
- * <a href="http://www.iana.org/assignments/character-sets">IANA
- * Charset Registry</a> for a list of valid encoding types.
- */
- public static void copy( final InputStream input, final Writer output, final String encoding )
- throws IOException
- {
- final InputStreamReader in = new InputStreamReader( input, encoding );
- copy( in, output );
- }
-
- /**
- * Copy and convert bytes from an <code>InputStream</code> to chars on a
- * <code>Writer</code>, using the specified encoding.
- * @param encoding The name of a supported character encoding. See the
- * <a href="http://www.iana.org/assignments/character-sets">IANA
- * Charset Registry</a> for a list of valid encoding types.
- * @param bufferSize Size of internal buffer to use.
- */
- public static void copy( final InputStream input,
- final Writer output,
- final String encoding,
- final int bufferSize )
- throws IOException
- {
- final InputStreamReader in = new InputStreamReader( input, encoding );
- copy( in, output, bufferSize );
- }
-
-
- ///////////////////////////////////////////////////////////////
- // InputStream -> String
-
- /**
- * Get the contents of an <code>InputStream</code> as a String.
- * The platform's default encoding is used for the byte-to-char conversion.
- */
- public static String toString( final InputStream input )
- throws IOException
- {
- return toString( input, DEFAULT_BUFFER_SIZE );
- }
-
- /**
- * Get the contents of an <code>InputStream</code> as a String.
- * The platform's default encoding is used for the byte-to-char conversion.
- * @param bufferSize Size of internal buffer to use.
- */
- public static String toString( final InputStream input, final int bufferSize )
- throws IOException
- {
- final StringWriter sw = new StringWriter();
- copy( input, sw, bufferSize );
- return sw.toString();
- }
-
- /**
- * Get the contents of an <code>InputStream</code> as a String.
- * @param encoding The name of a supported character encoding. See the
- * <a href="http://www.iana.org/assignments/character-sets">IANA
- * Charset Registry</a> for a list of valid encoding types.
- */
- public static String toString( final InputStream input, final String encoding )
- throws IOException
- {
- return toString( input, encoding, DEFAULT_BUFFER_SIZE );
- }
-
- /**
- * Get the contents of an <code>InputStream</code> as a String.
- * @param encoding The name of a supported character encoding. See the
- * <a href="http://www.iana.org/assignments/character-sets">IANA
- * Charset Registry</a> for a list of valid encoding types.
- * @param bufferSize Size of internal buffer to use.
- */
- public static String toString( final InputStream input,
- final String encoding,
- final int bufferSize )
- throws IOException
- {
- final StringWriter sw = new StringWriter();
- copy( input, sw, encoding, bufferSize );
- return sw.toString();
- }
-
- ///////////////////////////////////////////////////////////////
- // InputStream -> byte[]
-
- /**
- * Get the contents of an <code>InputStream</code> as a <code>byte[]</code>.
- */
- public static byte[] toByteArray( final InputStream input )
- throws IOException
- {
- return toByteArray( input, DEFAULT_BUFFER_SIZE );
- }
-
- /**
- * Get the contents of an <code>InputStream</code> as a <code>byte[]</code>.
- * @param bufferSize Size of internal buffer to use.
- */
- public static byte[] toByteArray( final InputStream input, final int bufferSize )
- throws IOException
- {
- final ByteArrayOutputStream output = new ByteArrayOutputStream();
- copy( input, output, bufferSize );
- return output.toByteArray();
- }
-
-
- ///////////////////////////////////////////////////////////////
- // Derived copy methods
- // Reader -> *
- ///////////////////////////////////////////////////////////////
-
- ///////////////////////////////////////////////////////////////
- // Reader -> OutputStream
- /**
- * Serialize chars from a <code>Reader</code> to bytes on an <code>OutputStream</code>, and
- * flush the <code>OutputStream</code>.
- */
- public static void copy( final Reader input, final OutputStream output )
- throws IOException
- {
- copy( input, output, DEFAULT_BUFFER_SIZE );
- }
-
- /**
- * Serialize chars from a <code>Reader</code> to bytes on an <code>OutputStream</code>, and
- * flush the <code>OutputStream</code>.
- * @param bufferSize Size of internal buffer to use.
- */
- public static void copy( final Reader input, final OutputStream output, final int bufferSize )
- throws IOException
- {
- final OutputStreamWriter out = new OutputStreamWriter( output );
- copy( input, out, bufferSize );
- // NOTE: Unless anyone is planning on rewriting OutputStreamWriter, we have to flush
- // here.
- out.flush();
- }
-
- ///////////////////////////////////////////////////////////////
- // Reader -> String
- /**
- * Get the contents of a <code>Reader</code> as a String.
- */
- public static String toString( final Reader input )
- throws IOException
- {
- return toString( input, DEFAULT_BUFFER_SIZE );
- }
-
- /**
- * Get the contents of a <code>Reader</code> as a String.
- * @param bufferSize Size of internal buffer to use.
- */
- public static String toString( final Reader input, final int bufferSize )
- throws IOException
- {
- final StringWriter sw = new StringWriter();
- copy( input, sw, bufferSize );
- return sw.toString();
- }
-
-
- ///////////////////////////////////////////////////////////////
- // Reader -> byte[]
- /**
- * Get the contents of a <code>Reader</code> as a <code>byte[]</code>.
- */
- public static byte[] toByteArray( final Reader input )
- throws IOException
- {
- return toByteArray( input, DEFAULT_BUFFER_SIZE );
- }
-
- /**
- * Get the contents of a <code>Reader</code> as a <code>byte[]</code>.
- * @param bufferSize Size of internal buffer to use.
- */
- public static byte[] toByteArray( final Reader input, final int bufferSize )
- throws IOException
- {
- ByteArrayOutputStream output = new ByteArrayOutputStream();
- copy( input, output, bufferSize );
- return output.toByteArray();
- }
-
-
- ///////////////////////////////////////////////////////////////
- // Derived copy methods
- // String -> *
- ///////////////////////////////////////////////////////////////
-
-
- ///////////////////////////////////////////////////////////////
- // String -> OutputStream
-
- /**
- * Serialize chars from a <code>String</code> to bytes on an <code>OutputStream</code>, and
- * flush the <code>OutputStream</code>.
- */
- public static void copy( final String input, final OutputStream output )
- throws IOException
- {
- copy( input, output, DEFAULT_BUFFER_SIZE );
- }
-
- /**
- * Serialize chars from a <code>String</code> to bytes on an <code>OutputStream</code>, and
- * flush the <code>OutputStream</code>.
- * @param bufferSize Size of internal buffer to use.
- */
- public static void copy( final String input, final OutputStream output, final int bufferSize )
- throws IOException
- {
- final StringReader in = new StringReader( input );
- final OutputStreamWriter out = new OutputStreamWriter( output );
- copy( in, out, bufferSize );
- // NOTE: Unless anyone is planning on rewriting OutputStreamWriter, we have to flush
- // here.
- out.flush();
- }
-
-
-
- ///////////////////////////////////////////////////////////////
- // String -> Writer
-
- /**
- * Copy chars from a <code>String</code> to a <code>Writer</code>.
- */
- public static void copy( final String input, final Writer output )
- throws IOException
- {
- output.write( input );
- }
-
- /**
- * Copy bytes from an <code>InputStream</code> to an
- * <code>OutputStream</code>, with buffering.
- * This is equivalent to passing a
- * {@link java.io.BufferedInputStream} and
- * {@link java.io.BufferedOutputStream} to {@link #copy(InputStream, OutputStream)},
- * and flushing the output stream afterwards. The streams are not closed
- * after the copy.
- * @deprecated Buffering streams is actively harmful! See the class description as to why. Use
- * {@link #copy(InputStream, OutputStream)} instead.
- */
- public static void bufferedCopy( final InputStream input, final OutputStream output )
- throws IOException
- {
- final BufferedInputStream in = new BufferedInputStream( input );
- final BufferedOutputStream out = new BufferedOutputStream( output );
- copy( in, out );
- out.flush();
- }
-
-
- ///////////////////////////////////////////////////////////////
- // String -> byte[]
- /**
- * Get the contents of a <code>String</code> as a <code>byte[]</code>.
- */
- public static byte[] toByteArray( final String input )
- throws IOException
- {
- return toByteArray( input, DEFAULT_BUFFER_SIZE );
- }
-
- /**
- * Get the contents of a <code>String</code> as a <code>byte[]</code>.
- * @param bufferSize Size of internal buffer to use.
- */
- public static byte[] toByteArray( final String input, final int bufferSize )
- throws IOException
- {
- ByteArrayOutputStream output = new ByteArrayOutputStream();
- copy( input, output, bufferSize );
- return output.toByteArray();
- }
-
-
-
- ///////////////////////////////////////////////////////////////
- // Derived copy methods
- // byte[] -> *
- ///////////////////////////////////////////////////////////////
-
-
- ///////////////////////////////////////////////////////////////
- // byte[] -> Writer
-
- /**
- * Copy and convert bytes from a <code>byte[]</code> to chars on a
- * <code>Writer</code>.
- * The platform's default encoding is used for the byte-to-char conversion.
- */
- public static void copy( final byte[] input, final Writer output )
- throws IOException
- {
- copy( input, output, DEFAULT_BUFFER_SIZE );
- }
-
- /**
- * Copy and convert bytes from a <code>byte[]</code> to chars on a
- * <code>Writer</code>.
- * The platform's default encoding is used for the byte-to-char conversion.
- * @param bufferSize Size of internal buffer to use.
- */
- public static void copy( final byte[] input, final Writer output, final int bufferSize )
- throws IOException
- {
- final ByteArrayInputStream in = new ByteArrayInputStream( input );
- copy( in, output, bufferSize );
- }
-
- /**
- * Copy and convert bytes from a <code>byte[]</code> to chars on a
- * <code>Writer</code>, using the specified encoding.
- * @param encoding The name of a supported character encoding. See the
- * <a href="http://www.iana.org/assignments/character-sets">IANA
- * Charset Registry</a> for a list of valid encoding types.
- */
- public static void copy( final byte[] input, final Writer output, final String encoding )
- throws IOException
- {
- final ByteArrayInputStream in = new ByteArrayInputStream( input );
- copy( in, output, encoding );
- }
-
- /**
- * Copy and convert bytes from a <code>byte[]</code> to chars on a
- * <code>Writer</code>, using the specified encoding.
- * @param encoding The name of a supported character encoding. See the
- * <a href="http://www.iana.org/assignments/character-sets">IANA
- * Charset Registry</a> for a list of valid encoding types.
- * @param bufferSize Size of internal buffer to use.
- */
- public static void copy( final byte[] input,
- final Writer output,
- final String encoding,
- final int bufferSize )
- throws IOException
- {
- final ByteArrayInputStream in = new ByteArrayInputStream( input );
- copy( in, output, encoding, bufferSize );
- }
-
-
- ///////////////////////////////////////////////////////////////
- // byte[] -> String
-
- /**
- * Get the contents of a <code>byte[]</code> as a String.
- * The platform's default encoding is used for the byte-to-char conversion.
- */
- public static String toString( final byte[] input )
- throws IOException
- {
- return toString( input, DEFAULT_BUFFER_SIZE );
- }
-
- /**
- * Get the contents of a <code>byte[]</code> as a String.
- * The platform's default encoding is used for the byte-to-char conversion.
- * @param bufferSize Size of internal buffer to use.
- */
- public static String toString( final byte[] input, final int bufferSize )
- throws IOException
- {
- final StringWriter sw = new StringWriter();
- copy( input, sw, bufferSize );
- return sw.toString();
- }
-
- /**
- * Get the contents of a <code>byte[]</code> as a String.
- * @param encoding The name of a supported character encoding. See the
- * <a href="http://www.iana.org/assignments/character-sets">IANA
- * Charset Registry</a> for a list of valid encoding types.
- */
- public static String toString( final byte[] input, final String encoding )
- throws IOException
- {
- return toString( input, encoding, DEFAULT_BUFFER_SIZE );
- }
-
- /**
- * Get the contents of a <code>byte[]</code> as a String.
- * @param encoding The name of a supported character encoding. See the
- * <a href="http://www.iana.org/assignments/character-sets">IANA
- * Charset Registry</a> for a list of valid encoding types.
- * @param bufferSize Size of internal buffer to use.
- */
- public static String toString( final byte[] input,
- final String encoding,
- final int bufferSize )
- throws IOException
- {
- final StringWriter sw = new StringWriter();
- copy( input, sw, encoding, bufferSize );
- return sw.toString();
- }
-
-
- ///////////////////////////////////////////////////////////////
- // byte[] -> OutputStream
-
- /**
- * Copy bytes from a <code>byte[]</code> to an <code>OutputStream</code>.
- */
- public static void copy( final byte[] input, final OutputStream output )
- throws IOException
- {
- copy( input, output, DEFAULT_BUFFER_SIZE );
- }
-
- /**
- * Copy bytes from a <code>byte[]</code> to an <code>OutputStream</code>.
- * @param bufferSize Size of internal buffer to use.
- */
- public static void copy( final byte[] input,
- final OutputStream output,
- final int bufferSize )
- throws IOException
- {
- output.write( input );
- }
-
- /**
- * Compare the contents of two Streams to determine if they are equal or not.
- *
- * @param input1 the first stream
- * @param input2 the second stream
- * @return true if the content of the streams are equal or they both don't exist, false otherwise
- */
- public static boolean contentEquals( final InputStream input1,
- final InputStream input2 )
- throws IOException
- {
- final InputStream bufferedInput1 = new BufferedInputStream( input1 );
- final InputStream bufferedInput2 = new BufferedInputStream( input2 );
-
- int ch = bufferedInput1.read();
- while ( -1 != ch )
- {
- final int ch2 = bufferedInput2.read();
- if ( ch != ch2 )
- {
- return false;
- }
- ch = bufferedInput1.read();
- }
-
- final int ch2 = bufferedInput2.read();
- if ( -1 != ch2 )
- {
- return false;
- }
- else
- {
- return true;
- }
- }
-
- ///////////////////////////////////////////////////////////////
- // close()
-
- /**
- * A IOException ignoring method that simply closes the stream.
- *
- * @param inputStream The stream to close.
- */
- public static void close( InputStream inputStream )
- {
- try
- {
- inputStream.close();
- }
- catch( IOException ex )
- {
- // ignore
- }
- }
-
- /**
- * A IOException ignoring method that simply closes the stream.
- *
- * @param outputStream The stream to close.
- */
- public static void close( OutputStream outputStream )
- {
- try
- {
- outputStream.close();
- }
- catch( IOException ex )
- {
- // ignore
- }
- }
-
- /**
- * A IOException ignoring method that simply closes the reader.
- *
- * @param reader The reader to close.
- */
- public static void close( Reader reader )
- {
- try
- {
- reader.close();
- }
- catch( IOException ex )
- {
- // ignore
- }
- }
-
- /**
- * A IOException ignoring method that simply closes the stream.
- *
- * @param wrtier The writer to close.
- */
- public static void close( Writer writer )
- {
- try
- {
- writer.close();
- }
- catch( IOException ex )
- {
- // ignore
- }
- }
-}
diff --git a/wagon-provider-api/src/main/resources/META-INF/plexus/components.xml b/wagon-provider-api/src/main/resources/META-INF/plexus/components.xml
deleted file mode 100644
index 7f3888f..0000000
--- a/wagon-provider-api/src/main/resources/META-INF/plexus/components.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<component-set>
- <components>
- <component>
- <role>org.apache.maven.wagon.manager.WagonManager</role>
- <implementation>org.apache.maven.wagon.manager.DefaultWagonManager</implementation>
- </component>
- </components>
-</component-set>
\ No newline at end of file
diff --git a/wagon-provider-api/src/test/java/org/apache/maven/wagon/AbstractWagonTest.java b/wagon-provider-api/src/test/java/org/apache/maven/wagon/AbstractWagonTest.java
deleted file mode 100644
index 866a033..0000000
--- a/wagon-provider-api/src/test/java/org/apache/maven/wagon/AbstractWagonTest.java
+++ /dev/null
@@ -1,258 +0,0 @@
-package org.apache.maven.wagon;
-
-/* ====================================================================
- * 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 junit.framework.TestCase;
-import org.apache.maven.wagon.events.MockSessionListener;
-import org.apache.maven.wagon.events.MockTransferListener;
-import org.apache.maven.wagon.repository.Repository;
-
-import java.io.File;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-/**
- * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
- * @version $Id$
- */
-public class AbstractWagonTest extends TestCase
-{
- private String basedir;
-
- private MockWagon wagon = null;
-
- private File destination;
-
- private File source;
-
- private String artifact;
-
- private MockSessionListener sessionListener = null;
-
- private MockTransferListener transferListener = null;
-
- protected void setUp() throws Exception
- {
- super.setUp();
-
- basedir = System.getProperty( "basedir" );
-
- destination = new File( basedir, "target/folder/subfolder" );
-
- source = new File( basedir, "pom.xml" );
-
- wagon = new MockWagon();
-
- sessionListener = new MockSessionListener();
-
- wagon.addSessionListener( sessionListener );
-
- transferListener = new MockTransferListener();
-
- wagon.addTransferListener( transferListener );
-
- }
-
- public void testSessionListenerRegistration()
- {
- assertTrue( wagon.hasSessionListener( sessionListener ) );
-
- wagon.removeSessionListener( sessionListener );
-
- assertFalse( wagon.hasSessionListener( sessionListener ) );
- }
-
- public void testTransferListenerRegistration()
- {
- assertTrue( wagon.hasTransferListener( transferListener ) );
-
- wagon.removeTransferListener( transferListener );
-
- assertFalse( wagon.hasTransferListener( transferListener ) );
- }
-
- public void testSessionOpenEvents()
- throws Exception
- {
- Repository repository = new Repository();
-
- wagon.connect( repository );
-
- assertEquals( repository, wagon.getRepository() );
-
- assertTrue( sessionListener.isSessionOpenningCalled() );
-
- assertTrue( sessionListener.isSessionOpenedCalled() );
-
- //!!
- //assertTrue( sessionListener.isSessionLoggedInCalled() );
-
- //!!
- //assertTrue( sessionListener.isSessionRefusedCalled() );
-
- }
-
- public void testSessionCloseEvents()
- throws Exception
- {
- wagon.disconnect();
-
- //!!
- //assertTrue( sessionListener.isSessionLoggedOffCalled() );
-
- assertTrue( sessionListener.isSessionDisconnectingCalled() );
-
- assertTrue( sessionListener.isSessionDisconnectedCalled() );
- }
-
- public void testGetTransferEvents() throws Exception
- {
- wagon.fireTransferDebug( "fetch debug message" );
-
- Repository repository = new Repository();
-
- wagon.connect( repository );
-
- wagon.get( artifact, destination );
-
- assertTrue( transferListener.isTransferStartedCalled() );
-
- assertTrue( transferListener.isTransferCompletedCalled() );
-
- assertTrue( transferListener.isDebugCalled() );
-
- assertTrue( transferListener.isTransferProgressCalled() );
-
- assertEquals( "fetch debug message", transferListener.getDebugMessage() );
-
- assertEquals( 5, transferListener.getNumberOfProgressCalls() );
- }
-
- public void testGetError()
- {
- MockTransferListener transferListener = new MockTransferListener();
-
- try
- {
- Repository repository = new Repository();
-
- MockWagon wagon = new MockWagon( true );
-
- wagon.addTransferListener( transferListener );
-
- wagon.connect( repository );
-
- wagon.get( artifact, destination );
-
- fail( "Transfer error was expected during deploy" );
- }
- catch ( Exception e )
- {
- }
-
- assertTrue( transferListener.isTransferStartedCalled() );
-
- assertTrue( transferListener.isTransferErrorCalled() );
-
- assertFalse( transferListener.isTransferCompletedCalled() );
- }
-
- public void testPutTransferEvents()
- {
- wagon.fireTransferDebug( "deploy debug message" );
-
- try
- {
- Repository repository = new Repository();
-
- wagon.connect( repository );
-
- wagon.put( source, artifact );
- }
- catch ( Exception e )
- {
- fail( e.getMessage() );
- }
-
- assertTrue( transferListener.isTransferStartedCalled() );
-
- assertTrue( transferListener.isTransferCompletedCalled() );
-
- assertTrue( transferListener.isDebugCalled() );
-
- assertTrue( transferListener.isTransferProgressCalled() );
-
- assertEquals( "deploy debug message", transferListener.getDebugMessage() );
-
- //!!
- //assertEquals( 5, transferListener.getNumberOfProgressCalls() );
- }
-
- /*
- public void testPutError()
- {
- MockInputStream mockInputStream = new MockInputStream();
-
- //forced io error!
- mockInputStream.setForcedError( true );
-
- StreamSource result = new StreamSource( mockInputStream );
-
- PutRequest command = new PutRequest( result, "my favourite resource" );
-
- try
- {
- wagon.transfer( command );
-
- fail( "Transfer error was expected during fetch" );
- }
- catch ( Exception e )
- {
- }
-
- assertTrue( transferListener.isTransferStartedCalled() );
-
- assertTrue( transferListener.isTransferErrorCalled() );
-
- assertFalse( transferListener.isTransferCompletedCalled() );
- }
- */
-
- public void testStreamShutdown()
- {
- wagon.shutdownStream( (InputStream) null );
-
- wagon.shutdownStream( (OutputStream) null );
-
- MockInputStream inputStream = new MockInputStream();
-
- assertFalse( inputStream.isClosed() );
-
- wagon.shutdownStream( inputStream );
-
- assertTrue( inputStream.isClosed() );
-
- MockOutputStream outputStream = new MockOutputStream();
-
- assertFalse( outputStream.isClosed() );
-
- wagon.shutdownStream( outputStream );
-
- assertTrue( outputStream.isClosed() );
- }
-}
diff --git a/wagon-provider-api/src/test/java/org/apache/maven/wagon/CannotConnectExceptionTest.java b/wagon-provider-api/src/test/java/org/apache/maven/wagon/CannotConnectExceptionTest.java
deleted file mode 100644
index e3e141d..0000000
--- a/wagon-provider-api/src/test/java/org/apache/maven/wagon/CannotConnectExceptionTest.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package org.apache.maven.wagon;
-
-/* ====================================================================
- * 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 junit.framework.TestCase;
-
-/**
- * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
- * @version $Id$
- */
-public class CannotConnectExceptionTest
- extends TestCase
-{
- public void testCannotConnectExceptionTest()
- {
- ConnectionException ae = new ConnectionException( "message" );
-
- assertEquals( "message", ae.getMessage() );
-
- ae = new ConnectionException( "full-message", new Throwable( "cause" ) );
-
- assertEquals( "full-message", ae.getMessage() );
-
- assertEquals( "cause", ae.getCause().getMessage() );
- }
-}
diff --git a/wagon-provider-api/src/test/java/org/apache/maven/wagon/LazyFileOutputStreamTest.java b/wagon-provider-api/src/test/java/org/apache/maven/wagon/LazyFileOutputStreamTest.java
deleted file mode 100644
index ba55d6e..0000000
--- a/wagon-provider-api/src/test/java/org/apache/maven/wagon/LazyFileOutputStreamTest.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package org.apache.maven.wagon;
-
-/* ====================================================================
- * 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 java.io.File;
-
-import junit.framework.TestCase;
-import org.apache.maven.wagon.util.FileUtils;
-
-/**
- * @author <a href="mailto:mmaczka@interia.pl">Michal Maczka</a>
- * @version $Id$
- */
-public class LazyFileOutputStreamTest extends TestCase
-{
-
- public void testFileCreation() throws Exception
- {
- File file = FileTestUtils.createUniqueFile( this );
-
- file.deleteOnExit();
-
- assertFalse( file.exists() );
-
- LazyFileOutputStream stream = new LazyFileOutputStream( file );
-
- assertFalse( file.exists() );
-
- String exptected = "michal";
-
- stream.write( exptected.getBytes() );
-
- stream.close();
-
- assertTrue( file.exists() );
-
- String actual = FileUtils.fileRead( file );
-
- assertEquals( exptected, actual );
-
-
- }
-
-}
diff --git a/wagon-provider-api/src/test/java/org/apache/maven/wagon/MockInputStream.java b/wagon-provider-api/src/test/java/org/apache/maven/wagon/MockInputStream.java
deleted file mode 100644
index ddf93b0..0000000
--- a/wagon-provider-api/src/test/java/org/apache/maven/wagon/MockInputStream.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package org.apache.maven.wagon;
-
-/* ====================================================================
- * 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 java.io.IOException;
-import java.io.InputStream;
-
-
-/**
- * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
- * @version $Id$
- */
-public class MockInputStream extends InputStream
-{
-
- private boolean closed = false;
-
- boolean forcedError = false;
-
- public void close()
- {
- closed = true;
- }
-
- /**
- * @return Returns the closed.
- */
- public boolean isClosed()
- {
- return closed;
- }
-
- /**
- * @return Returns the forcedError.
- */
- public boolean isForcedError()
- {
- return forcedError;
- }
-
- /**
- * @see java.io.InputStream#read()
- */
- public int read() throws IOException
- {
- if ( forcedError )
- {
- throw new IOException( "Mock exception" );
- }
- return 0;
- }
-
- /**
- * @param forcedError The forcedError to set.
- */
- public void setForcedError( final boolean forcedError )
- {
- this.forcedError = forcedError;
- }
-
-}
diff --git a/wagon-provider-api/src/test/java/org/apache/maven/wagon/MockOutputStream.java b/wagon-provider-api/src/test/java/org/apache/maven/wagon/MockOutputStream.java
deleted file mode 100644
index 1933c68..0000000
--- a/wagon-provider-api/src/test/java/org/apache/maven/wagon/MockOutputStream.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package org.apache.maven.wagon;
-
-/* ====================================================================
- * 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 java.io.IOException;
-import java.io.OutputStream;
-
-
-/**
- * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
- * @version $Id$
- */
-public class MockOutputStream extends OutputStream
-{
-
- private boolean closed = false;
- private boolean forcedError = false;
-
- public void close()
- {
- closed = true;
- }
-
- /**
- * @see java.io.OutputStream#write(int)
- */
- public void write( final int b ) throws IOException
- {
- if ( forcedError )
- {
- throw new IOException( "Mock exception" );
- }
-
- }
-
- /**
- * @return Returns the closed.
- */
- public boolean isClosed()
- {
- return closed;
- }
-
-
- /**
- * @return Returns the forcedError.
- */
- public boolean isForcedError()
- {
- return forcedError;
- }
-
- /**
- * @param forcedError The forcedError to set.
- */
- public void setForcedError( final boolean forcedError )
- {
- this.forcedError = forcedError;
- }
-
-}
diff --git a/wagon-provider-api/src/test/java/org/apache/maven/wagon/MockWagon.java b/wagon-provider-api/src/test/java/org/apache/maven/wagon/MockWagon.java
deleted file mode 100644
index e0b93d4..0000000
--- a/wagon-provider-api/src/test/java/org/apache/maven/wagon/MockWagon.java
+++ /dev/null
@@ -1,109 +0,0 @@
-package org.apache.maven.wagon;
-
-/* ====================================================================
- * 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.resource.Resource;
-import org.apache.maven.wagon.authorization.AuthorizationException;
-
-import java.io.*;
-
-/**
- * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
- * @version $Id$
- */
-public class MockWagon
- extends StreamWagon
-{
- private boolean errorInputStream;
-
- public MockWagon()
- {
- }
-
- public MockWagon( boolean errorInputStream )
- {
- this.errorInputStream = errorInputStream;
- }
-
-
-
- public void fillInputData( InputData inputData )
- throws TransferFailedException
- {
-
- InputStream is;
-
- if ( errorInputStream )
- {
- MockInputStream mockInputStream = new MockInputStream();
-
- mockInputStream.setForcedError( true );
-
- is = mockInputStream;
-
- }
- else
- {
- byte[] buffer = new byte[1024 * 4 * 5];
-
- is = new ByteArrayInputStream( buffer );
- }
-
- inputData.setInputStream( is );
-
- }
-
- public void fillOutputData( OutputData outputData )
- throws TransferFailedException
- {
-
- OutputStream os;
-
- if ( errorInputStream )
- {
- MockOutputStream mockOutputStream = new MockOutputStream();
-
- mockOutputStream.setForcedError( true );
-
- os = mockOutputStream;
- }
- else
- {
- os = new ByteArrayOutputStream();
- }
-
- outputData.setOutputStream( os );
-
- }
-
- public boolean getIfNewer( String resourceName, File destination, long timestamp)
- throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException
- {
- return false;
- }
-
- public void openConnection()
- {
- }
-
- public void closeConnection()
- {
- }
-
-
-}
diff --git a/wagon-provider-api/src/test/java/org/apache/maven/wagon/NotAuthorizedExceptionTest.java b/wagon-provider-api/src/test/java/org/apache/maven/wagon/NotAuthorizedExceptionTest.java
deleted file mode 100644
index d2728f5..0000000
--- a/wagon-provider-api/src/test/java/org/apache/maven/wagon/NotAuthorizedExceptionTest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package org.apache.maven.wagon;
-
-/* ====================================================================
- * 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 junit.framework.TestCase;
-import org.apache.maven.wagon.authorization.AuthorizationException;
-
-/**
- * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
- * @version $Id$
- */
-public class NotAuthorizedExceptionTest
- extends TestCase
-{
- public void testNotAuthorizedExceptionTest()
- {
- AuthorizationException ae = new AuthorizationException( "message" );
-
- assertEquals( "message", ae.getMessage() );
-
- ae = new AuthorizationException( "full-message", new Throwable( "cause" ) );
-
- assertEquals( "full-message", ae.getMessage() );
-
- assertEquals( "cause", ae.getCause().getMessage() );
- }
-}
diff --git a/wagon-provider-api/src/test/java/org/apache/maven/wagon/PathUtilsTest.java b/wagon-provider-api/src/test/java/org/apache/maven/wagon/PathUtilsTest.java
deleted file mode 100644
index abe819a..0000000
--- a/wagon-provider-api/src/test/java/org/apache/maven/wagon/PathUtilsTest.java
+++ /dev/null
@@ -1,146 +0,0 @@
-package org.apache.maven.wagon;
-
-/* ====================================================================
- * 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 junit.framework.TestCase;
-
-/**
- * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
- * @version $Id$
- */
-public class PathUtilsTest
- extends TestCase
-{
- public void testFilenameResolving()
- {
- assertEquals( "filename", PathUtils.filename( "dir/filename" ) );
-
- assertEquals( "filename", PathUtils.filename( "filename" ) );
-
- assertEquals( "filename", PathUtils.filename( "dir1/dir2/filename" ) );
- }
-
- public void testDirResolving()
- {
- assertEquals( "dir", PathUtils.dirname( "dir/filename" ) );
-
- assertEquals( "", PathUtils.dirname( "filename" ) );
-
- assertEquals( "dir1/dir2", PathUtils.dirname( "dir1/dir2/filename" ) );
- }
-
- public void testDirSpliting()
- {
- final String path = "a/b/c";
-
- final String[] dirs = PathUtils.dirnames( path );
-
- assertNotNull( dirs );
-
- assertEquals( 2, dirs.length );
-
- assertEquals( "a", dirs[0] );
-
- assertEquals( "b", dirs[1] );
-
- }
-
- public void testHostResolving()
- {
- assertEquals( "www.codehaus.org", PathUtils.host( "http://www.codehaus.org" ) );
-
- assertEquals( "localhost", PathUtils.host( null ) );
-
- }
-
- public void testProtocolResolving()
- {
- assertEquals( "http", PathUtils.protocol( "http://www.codehause.org" ) );
- assertEquals( "file", PathUtils.protocol( "file:///c:/temp" ) );
- }
-
- public void testUserInfo()
- {
- String urlWithUsername = "http://brett@www.codehaus.org";
- assertEquals( "brett", PathUtils.user( urlWithUsername ) );
- assertNull( PathUtils.password( urlWithUsername ) );
- assertEquals( "www.codehaus.org", PathUtils.host( urlWithUsername ) );
- assertEquals( "/", PathUtils.basedir( urlWithUsername ) );
- String urlWithUsernamePassword = "http://brett:porter@www.codehaus.org";
- assertEquals( "brett", PathUtils.user( urlWithUsernamePassword ) );
- assertEquals( "porter", PathUtils.password( urlWithUsernamePassword ) );
- assertEquals( "www.codehaus.org", PathUtils.host( urlWithUsernamePassword ) );
- assertEquals( "/", PathUtils.basedir( urlWithUsernamePassword ) );
- }
-
- public void testFileBasedir()
- {
- // see http://www.mozilla.org/quality/networking/testing/filetests.html
-
- // strict forms
- assertEquals( "c:/temp", PathUtils.basedir( "file:///c|/temp" ) );
- assertEquals( "localhost", PathUtils.host( "file:///c|/temp" ) );
- assertEquals( "c:/temp", PathUtils.basedir( "file://localhost/c|/temp" ) );
- assertEquals( "localhost", PathUtils.host( "file://localhost/c|/temp" ) );
- assertEquals( "/temp", PathUtils.basedir( "file:///temp" ) );
- assertEquals( "localhost", PathUtils.host( "file:///temp" ) );
- assertEquals( "/temp", PathUtils.basedir( "file://localhost/temp" ) );
- assertEquals( "localhost", PathUtils.host( "file://localhost/temp" ) );
-
- // strict form, with : for drive separator
- assertEquals( "c:/temp", PathUtils.basedir( "file:///c:/temp" ) );
- assertEquals( "localhost", PathUtils.host( "file:///c:/temp" ) );
- assertEquals( "c:/temp", PathUtils.basedir( "file://localhost/c:/temp" ) );
- assertEquals( "localhost", PathUtils.host( "file://localhost/c:/temp" ) );
-
- // convenience forms
- assertEquals( "c:/temp", PathUtils.basedir( "file://c:/temp" ) );
- assertEquals( "c:/temp", PathUtils.basedir( "file://c|/temp" ) );
- assertEquals( "c:/temp", PathUtils.basedir( "file:c:/temp" ) );
- assertEquals( "c:/temp", PathUtils.basedir( "file:c|/temp" ) );
- assertEquals( "/temp", PathUtils.basedir( "file:/temp" ) );
- }
-
- public void testEmptyBasedir()
- {
- assertEquals( "/", PathUtils.basedir( "http://www.codehaus.org:80" ) );
- assertEquals( "/", PathUtils.basedir( "http://www.codehaus.org" ) );
- assertEquals( "/", PathUtils.basedir( "http://www.codehaus.org:80/" ) );
- assertEquals( "/", PathUtils.basedir( "http://www.codehaus.org/" ) );
- }
-
- public void testPortResolving()
- {
- assertEquals( 80, PathUtils.port( "http://www.codehause.org:80/maven" ) );
- assertEquals( WagonConstants.UNKNOWN_PORT, PathUtils.port( "http://localhost/temp" ) );
-
- assertEquals( 10, PathUtils.port( "ftp://localhost:10" ) );
-
- }
-
- public void testPortBasedir()
- {
- assertEquals( "/maven", PathUtils.basedir( "http://www.codehause.org:80/maven" ) );
- assertEquals( "/temp", PathUtils.basedir( "http://localhost/temp" ) );
-
- assertEquals( "c:/temp", PathUtils.basedir( "file://c:/temp" ) );
- assertEquals( "/", PathUtils.basedir( "http://localhost:80/" ) );
- assertEquals( "/", PathUtils.basedir( "http://localhost/" ) );
- }
-
-}
diff --git a/wagon-provider-api/src/test/java/org/apache/maven/wagon/ResourceDoesNotExistExceptionTest.java b/wagon-provider-api/src/test/java/org/apache/maven/wagon/ResourceDoesNotExistExceptionTest.java
deleted file mode 100644
index d026962..0000000
--- a/wagon-provider-api/src/test/java/org/apache/maven/wagon/ResourceDoesNotExistExceptionTest.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package org.apache.maven.wagon;
-
-/* ====================================================================
- * 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 junit.framework.TestCase;
-
-/**
- * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
- * @version $Id$
- */
-public class ResourceDoesNotExistExceptionTest
- extends TestCase
-{
- public void testResourceDoesNotExistExceptionTest()
- {
- ResourceDoesNotExistException ae = new ResourceDoesNotExistException( "message" );
-
- assertEquals( "message", ae.getMessage() );
-
- ae = new ResourceDoesNotExistException( "full-message", new Throwable( "cause" ) );
-
- assertEquals( "full-message", ae.getMessage() );
-
- assertEquals( "cause", ae.getCause().getMessage() );
- }
-}
diff --git a/wagon-provider-api/src/test/java/org/apache/maven/wagon/TransferFailedExceptionTest.java b/wagon-provider-api/src/test/java/org/apache/maven/wagon/TransferFailedExceptionTest.java
deleted file mode 100644
index 0f57348..0000000
--- a/wagon-provider-api/src/test/java/org/apache/maven/wagon/TransferFailedExceptionTest.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package org.apache.maven.wagon;
-
-/* ====================================================================
- * 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 junit.framework.TestCase;
-
-/**
- * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
- * @version $Id$
- */
-public class TransferFailedExceptionTest
- extends TestCase
-{
- public void testTransferFailedExceptionTest()
- {
- TransferFailedException ae = new TransferFailedException( "message" );
-
- assertEquals( "message", ae.getMessage() );
-
- ae = new TransferFailedException( "full-message", new Throwable( "cause" ) );
-
- assertEquals( "full-message", ae.getMessage() );
-
- assertEquals( "cause", ae.getCause().getMessage() );
- }
-}
diff --git a/wagon-provider-api/src/test/java/org/apache/maven/wagon/authentication/AuthenticationExceptionTest.java b/wagon-provider-api/src/test/java/org/apache/maven/wagon/authentication/AuthenticationExceptionTest.java
deleted file mode 100644
index 39ba220..0000000
--- a/wagon-provider-api/src/test/java/org/apache/maven/wagon/authentication/AuthenticationExceptionTest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package org.apache.maven.wagon.authentication;
-
-/* ====================================================================
- * 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 junit.framework.TestCase;
-import org.apache.maven.wagon.authentication.AuthenticationException;
-
-/**
- * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
- * @version $Id$
- */
-public class AuthenticationExceptionTest
- extends TestCase
-{
- public void testAuthenticationExceptionTest()
- {
- AuthenticationException ae = new AuthenticationException( "message" );
-
- assertEquals( "message", ae.getMessage() );
-
- ae = new AuthenticationException( "full-message", new Throwable( "cause" ) );
-
- assertEquals( "full-message", ae.getMessage() );
-
- assertEquals( "cause", ae.getCause().getMessage() );
- }
-}
diff --git a/wagon-provider-api/src/test/java/org/apache/maven/wagon/authentication/AuthenticationInfoTest.java b/wagon-provider-api/src/test/java/org/apache/maven/wagon/authentication/AuthenticationInfoTest.java
deleted file mode 100644
index ffa3521..0000000
--- a/wagon-provider-api/src/test/java/org/apache/maven/wagon/authentication/AuthenticationInfoTest.java
+++ /dev/null
@@ -1,72 +0,0 @@
-package org.apache.maven.wagon.authentication;
-
-/* ====================================================================
- * 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 junit.framework.TestCase;
-import org.apache.maven.wagon.authentication.AuthenticationInfo;
-
-/**
- * @todo test defaults
- * @author <a href="mailto:jvanzyl@maven.org">Jason van Zyl</a>
- * @version $Id$
- */
-public class AuthenticationInfoTest
- extends TestCase
-{
- public AuthenticationInfoTest( final String name )
- {
- super( name );
- }
-
- public void setUp()
- throws Exception
- {
- super.setUp();
- }
-
- public void tearDown()
- throws Exception
- {
- super.tearDown();
- }
-
- public void testAuthenticationInfoProperties()
- {
- final AuthenticationInfo authenticationInfo = new AuthenticationInfo();
-
-
- authenticationInfo.setUserName( "username" );
-
- assertEquals( "username", authenticationInfo.getUserName() );
-
-
- authenticationInfo.setPassword( "password" );
-
- assertEquals( "password", authenticationInfo.getPassword() );
-
-
- authenticationInfo.setPassphrase( "passphrase" );
-
- assertEquals( "passphrase", authenticationInfo.getPassphrase() );
-
-
- authenticationInfo.setPrivateKey( "privatekey" );
-
- assertEquals( "privatekey", authenticationInfo.getPrivateKey() );
- }
-}
diff --git a/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/MockSessionListener.java b/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/MockSessionListener.java
deleted file mode 100644
index 691e9bc..0000000
--- a/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/MockSessionListener.java
+++ /dev/null
@@ -1,185 +0,0 @@
-package org.apache.maven.wagon.events;
-
-/* ====================================================================
- * 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.
- * ====================================================================
- */
-
-/**
- * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
- * @version $Id$
- */
-public class MockSessionListener implements SessionListener
-{
-
- private boolean connectionOpenningCalled = false;
-
- private boolean debugCalled = false;
-
- private boolean connectionLoggedOffCalled = false;
-
- private boolean connectionLoggedInCalled = false;
-
- private boolean connectionRefusedCalled = false;
-
- private boolean connectionDisconnectedCalled = false;
-
- private boolean connectionDisconnectingCalled = false;
-
- private boolean connectionOpenedCalled = false;
-
- private SessionEvent sessionEvent;
-
- private String message;
-
- private boolean connectionErrorCalled;
-
- public boolean isSessionDisconnectedCalled()
- {
- return connectionDisconnectedCalled;
- }
-
- public boolean isSessionDisconnectingCalled()
- {
- return connectionDisconnectingCalled;
- }
-
- public boolean isSessionLoggedInCalled()
- {
- return connectionLoggedInCalled;
- }
-
- public boolean isSessionLoggedOffCalled()
- {
- return connectionLoggedOffCalled;
- }
-
- public boolean isSessionOpenedCalled()
- {
- return connectionOpenedCalled;
- }
-
- public boolean isSessionOpenningCalled()
- {
- return connectionOpenningCalled;
- }
-
- public boolean isSessionRefusedCalled()
- {
- return connectionRefusedCalled;
- }
-
- public boolean isDebugCalled()
- {
- return debugCalled;
- }
-
- public void reset()
- {
- connectionOpenningCalled = false;
-
- debugCalled = false;
-
- connectionLoggedOffCalled = false;
-
- connectionLoggedInCalled = false;
-
- connectionRefusedCalled = false;
-
- connectionDisconnectedCalled = false;
-
- connectionDisconnectingCalled = false;
-
- connectionOpenedCalled = false;
-
- sessionEvent = null;
-
- message = null;
- }
-
- public void sessionOpening( final SessionEvent connectionEvent )
- {
- connectionOpenningCalled = true;
-
- this.sessionEvent = connectionEvent;
- }
-
- public void sessionOpened( final SessionEvent connectionEvent )
- {
- connectionOpenedCalled = true;
-
- this.sessionEvent = connectionEvent;
-
- }
-
- public void sessionDisconnecting( final SessionEvent connectionEvent )
- {
- connectionDisconnectingCalled = true;
-
- this.sessionEvent = connectionEvent;
- }
-
- public void sessionDisconnected( final SessionEvent connectionEvent )
- {
- connectionDisconnectedCalled = true;
-
- this.sessionEvent = connectionEvent;
- }
-
- public void sessionConnectionRefused( final SessionEvent connectionEvent )
- {
- connectionRefusedCalled = true;
-
- this.sessionEvent = connectionEvent;
- }
-
- public void sessionLoggedIn( final SessionEvent connectionEvent )
- {
- connectionLoggedInCalled = true;
-
- this.sessionEvent = connectionEvent;
- }
-
- public void sessionLoggedOff( final SessionEvent connectionEvent )
- {
- connectionLoggedOffCalled = true;
-
- this.sessionEvent = connectionEvent;
- }
-
- public void sessionError( final SessionEvent connectionEvent )
- {
- connectionErrorCalled = true;
-
- this.sessionEvent = connectionEvent;
- }
-
- public void debug( final String message )
- {
- debugCalled = true;
-
- this.message = message;
- }
-
- public SessionEvent getSessionEvent()
- {
- return sessionEvent;
- }
-
- public String getDebugMessage()
- {
- return message;
- }
-}
diff --git a/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/MockTransferListener.java b/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/MockTransferListener.java
deleted file mode 100644
index cd81a1f..0000000
--- a/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/MockTransferListener.java
+++ /dev/null
@@ -1,153 +0,0 @@
-package org.apache.maven.wagon.events;
-
-/* ====================================================================
- * 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.
- * ====================================================================
- */
-
-/**
- * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
- * @version $Id$
- */
-public class MockTransferListener implements TransferListener
-{
-
- private String debugMessage;
- private boolean debugCalled;
- private TransferEvent transferEvent;
- private boolean transferCompletedCalled;
- private boolean transferProgressCalled;
- private boolean transferStartedCalled;
- private int numberOfProgressCalls;
- private boolean transferErrorCalled;
-
-
- /**
- * @return Returns the debugCalled.
- */
- public boolean isDebugCalled()
- {
- return debugCalled;
- }
-
- /**
- * @return Returns the transferCompletedCalled.
- */
- public boolean isTransferCompletedCalled()
- {
- return transferCompletedCalled;
- }
-
- /**
- * @return Returns the transferEvent.
- */
- public TransferEvent getTransferEvent()
- {
- return transferEvent;
- }
-
- /**
- * @return Returns the transferProgressCalled.
- */
- public boolean isTransferProgressCalled()
- {
- return transferProgressCalled;
- }
-
- /**
- * @return Returns the transferStartedCalled.
- */
- public boolean isTransferStartedCalled()
- {
- return transferStartedCalled;
- }
-
- /**
- * @see org.apache.maven.wagon.events.TransferListener#transferStarted(org.apache.maven.wagon.events.TransferEvent)
- */
- public void transferStarted( final TransferEvent transferEvent )
- {
- this.transferEvent = transferEvent;
- transferStartedCalled = true;
-
- }
-
- /**
- * @see org.apache.maven.wagon.events.TransferListener#transferProgress(org.apache.maven.wagon.events.TransferEvent)
- */
- public void transferProgress( final TransferEvent transferEvent, byte[] buffer, int length )
- {
- this.transferEvent = transferEvent;
- transferProgressCalled = true;
- numberOfProgressCalls++;
-
- }
-
- /**
- * @see org.apache.maven.wagon.events.TransferListener#transferCompleted(org.apache.maven.wagon.events.TransferEvent)
- */
- public void transferCompleted( final TransferEvent transferEvent )
- {
- this.transferEvent = transferEvent;
- transferCompletedCalled = true;
-
- }
-
- /**
- * @see org.apache.maven.wagon.events.TransferListener#debug(java.lang.String)
- */
- public void debug( final String message )
- {
- debugMessage = message;
- debugCalled = true;
-
- }
-
- /**
- * @return
- */
- public String getDebugMessage()
- {
-
- return debugMessage;
- }
-
- /**
- * @return Returns the numberOfprogressCalls.
- */
- public int getNumberOfProgressCalls()
- {
- return numberOfProgressCalls;
- }
-
- /**
- * @see org.apache.maven.wagon.events.TransferListener#transferError(org.apache.maven.wagon.events.TransferEvent)
- */
- public void transferError( final TransferEvent transferEvent )
- {
- this.transferEvent = transferEvent;
- transferErrorCalled = true;
-
- }
-
- /**
- * @return Returns the transferErrorCalled.
- */
- public boolean isTransferErrorCalled()
- {
- return transferErrorCalled;
- }
-
-}
diff --git a/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/SessionEventSupportTest.java b/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/SessionEventSupportTest.java
deleted file mode 100644
index 8cbdba3..0000000
--- a/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/SessionEventSupportTest.java
+++ /dev/null
@@ -1,278 +0,0 @@
-package org.apache.maven.wagon.events;
-
-/* ====================================================================
- * 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 junit.framework.TestCase;
-import org.apache.maven.wagon.Wagon;
-import org.apache.maven.wagon.MockWagon;
-import org.apache.maven.wagon.MockWagon;
-
-/**
- * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
- * @version $Id$
- */
-public class SessionEventSupportTest extends TestCase
-{
-
- private SessionEventSupport eventSupport;
-
-
- /**
- * @see junit.framework.TestCase#setUp()
- */
- protected void setUp() throws Exception
- {
- super.setUp();
-
- eventSupport = new SessionEventSupport();
- }
-
- public void testSessionListenerRegistration()
- {
- final MockSessionListener mock1 = new MockSessionListener();
-
- eventSupport.addSessionListener( mock1 );
-
- assertTrue( eventSupport.hasSessionListener( mock1 ) );
-
- final MockSessionListener mock2 = new MockSessionListener();
-
- assertFalse( eventSupport.hasSessionListener( mock2 ) );
-
- eventSupport.addSessionListener( mock2 );
-
- assertTrue( eventSupport.hasSessionListener( mock1 ) );
-
- assertTrue( eventSupport.hasSessionListener( mock2 ) );
-
- eventSupport.removeSessionListener( mock2 );
-
- assertTrue( eventSupport.hasSessionListener( mock1 ) );
-
- assertFalse( eventSupport.hasSessionListener( mock2 ) );
-
- eventSupport.removeSessionListener( mock1 );
-
- assertFalse( eventSupport.hasSessionListener( mock1 ) );
- }
-
- public void testFireSessionDisconnected()
- {
-
- final MockSessionListener mock1 = new MockSessionListener();
-
- eventSupport.addSessionListener( mock1 );
-
- final MockSessionListener mock2 = new MockSessionListener();
-
- eventSupport.addSessionListener( mock2 );
-
- final Wagon wagon = new MockWagon();
-
- final SessionEvent event = new SessionEvent( wagon, 1 );
-
- eventSupport.fireSessionDisconnected( event );
-
- assertTrue( mock1.isSessionDisconnectedCalled() );
-
- assertTrue( mock2.isSessionDisconnectedCalled() );
-
- assertEquals( event, mock1.getSessionEvent() );
-
- assertEquals( event, mock2.getSessionEvent() );
-
- }
-
- public void testFireSessionDisconneting()
- {
- final MockSessionListener mock1 = new MockSessionListener();
-
- eventSupport.addSessionListener( mock1 );
-
- final MockSessionListener mock2 = new MockSessionListener();
-
- eventSupport.addSessionListener( mock2 );
-
- final Wagon wagon = new MockWagon();
-
- final SessionEvent event = new SessionEvent( wagon, 1 );
-
- eventSupport.fireSessionDisconnecting( event );
-
- assertTrue( mock1.isSessionDisconnectingCalled() );
-
- assertTrue( mock2.isSessionDisconnectingCalled() );
-
- assertEquals( event, mock1.getSessionEvent() );
-
- assertEquals( event, mock2.getSessionEvent() );
- }
-
- public void testFireSessionLoggedIn()
- {
- final MockSessionListener mock1 = new MockSessionListener();
-
- eventSupport.addSessionListener( mock1 );
-
- final MockSessionListener mock2 = new MockSessionListener();
-
- eventSupport.addSessionListener( mock2 );
-
- final Wagon wagon = new MockWagon();
-
- final SessionEvent event = new SessionEvent( wagon, 1 );
-
- eventSupport.fireSessionLoggedIn( event );
-
- assertTrue( mock1.isSessionLoggedInCalled() );
-
- assertTrue( mock2.isSessionLoggedInCalled() );
-
- assertEquals( event, mock1.getSessionEvent() );
-
- assertEquals( event, mock2.getSessionEvent() );
-
- }
-
- public void testFireSessionLoggedOff()
- {
- final MockSessionListener mock1 = new MockSessionListener();
-
- eventSupport.addSessionListener( mock1 );
-
- final MockSessionListener mock2 = new MockSessionListener();
-
- eventSupport.addSessionListener( mock2 );
-
- final Wagon wagon = new MockWagon();
-
- final SessionEvent event = new SessionEvent( wagon, 1 );
-
- eventSupport.fireSessionLoggedOff( event );
-
- assertTrue( mock1.isSessionLoggedOffCalled() );
-
- assertTrue( mock2.isSessionLoggedOffCalled() );
-
- assertEquals( event, mock1.getSessionEvent() );
-
- assertEquals( event, mock2.getSessionEvent() );
- }
-
- public void testFireSessionOpened()
- {
-
- final MockSessionListener mock1 = new MockSessionListener();
-
- eventSupport.addSessionListener( mock1 );
-
- final MockSessionListener mock2 = new MockSessionListener();
-
- eventSupport.addSessionListener( mock2 );
-
- final Wagon wagon = new MockWagon();
-
- final SessionEvent event = new SessionEvent( wagon, 1 );
-
- eventSupport.fireSessionOpened( event );
-
- assertTrue( mock1.isSessionOpenedCalled() );
-
- assertTrue( mock2.isSessionOpenedCalled() );
-
- assertEquals( event, mock1.getSessionEvent() );
-
- assertEquals( event, mock2.getSessionEvent() );
-
- }
-
- public void testFireSessionOpenning()
- {
-
- final MockSessionListener mock1 = new MockSessionListener();
-
- eventSupport.addSessionListener( mock1 );
-
- final MockSessionListener mock2 = new MockSessionListener();
-
- eventSupport.addSessionListener( mock2 );
-
- final Wagon wagon = new MockWagon();
-
- final SessionEvent event = new SessionEvent( wagon, 1 );
-
- eventSupport.fireSessionOpening( event );
-
- assertTrue( mock1.isSessionOpenningCalled() );
-
- assertTrue( mock2.isSessionOpenningCalled() );
-
- assertEquals( event, mock1.getSessionEvent() );
-
- assertEquals( event, mock2.getSessionEvent() );
-
- }
-
- public void testFireSessionRefused()
- {
- final MockSessionListener mock1 = new MockSessionListener();
-
- eventSupport.addSessionListener( mock1 );
-
- final MockSessionListener mock2 = new MockSessionListener();
-
- eventSupport.addSessionListener( mock2 );
-
- final Wagon wagon = new MockWagon();
-
- final SessionEvent event = new SessionEvent( wagon, 1 );
-
- eventSupport.fireSessionConnectionRefused( event );
-
- assertTrue( mock1.isSessionRefusedCalled() );
-
- assertTrue( mock2.isSessionRefusedCalled() );
-
- assertEquals( event, mock1.getSessionEvent() );
-
- assertEquals( event, mock2.getSessionEvent() );
- }
-
- public void testFireDebug()
- {
- final MockSessionListener mock1 = new MockSessionListener();
-
- eventSupport.addSessionListener( mock1 );
-
- final MockSessionListener mock2 = new MockSessionListener();
-
- eventSupport.addSessionListener( mock2 );
-
- eventSupport.fireDebug( "mm" );
-
- assertTrue( mock1.isDebugCalled() );
-
- assertTrue( mock2.isDebugCalled() );
-
- assertEquals( "mm", mock1.getDebugMessage() );
-
- assertEquals( "mm", mock2.getDebugMessage() );
-
- }
-
-}
diff --git a/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/SessionEventTest.java b/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/SessionEventTest.java
deleted file mode 100644
index 0c751ee..0000000
--- a/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/SessionEventTest.java
+++ /dev/null
@@ -1,168 +0,0 @@
-package org.apache.maven.wagon.events;
-
-/* ====================================================================
- * 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 junit.framework.TestCase;
-import org.apache.maven.wagon.authentication.AuthenticationException;
-import org.apache.maven.wagon.repository.Repository;
-import org.apache.maven.wagon.Wagon;
-import org.apache.maven.wagon.MockWagon;
-
-/**
- * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
- * @version $Id$
- */
-public class SessionEventTest extends TestCase
-{
-
- /*
- * @see TestCase#setUp()
- */
- protected void setUp() throws Exception
- {
- super.setUp();
- }
-
- /**
- * Constructor for SESSIONEventTest.
- *
- * @param arg0
- */
- public SessionEventTest( final String arg0 )
- {
- super( arg0 );
- }
-
- /*
- * Class to test for void SESSIONEvent(Wagon, Repository, String, int,
- * int)
- */
- public void testSessionEventProperties()
- {
-
- final Wagon wagon = new MockWagon();
- final Repository repo = new Repository();
- try
- {
- wagon.connect( repo );
- }
- catch ( Exception e )
- {
- fail( e.getMessage() );
- }
- final long timestamp = System.currentTimeMillis();
- final Exception exception = new AuthenticationException( "dummy" );
-
- SessionEvent event =
- new SessionEvent(
- wagon,
- SessionEvent.SESSION_CLOSED );
-
- assertEquals( wagon, event.getWagon() );
- assertEquals( repo, event.getWagon().getRepository() );
-
- assertEquals( SessionEvent.SESSION_CLOSED, event.getEventType() );
-
-
- event = new SessionEvent( wagon, exception );
-
- assertEquals( wagon, event.getWagon() );
- assertEquals( repo, event.getWagon().getRepository() );
- assertEquals( SessionEvent.SESSION_ERROR_OCCURRED, event.getEventType() );
- assertEquals( exception, event.getException() );
-
-
-
-
- event.setException( null );
- assertEquals( null, event.getException() );
-
- event.setException( exception );
- assertEquals( exception, event.getException() );
-
- event.setTimestamp( timestamp );
- assertEquals( timestamp, event.getTimestamp() );
-
- event.setEventType( SessionEvent.SESSION_CLOSED );
- assertEquals( SessionEvent.SESSION_CLOSED, event.getEventType() );
-
- event.setEventType( SessionEvent.SESSION_DISCONNECTED );
- assertEquals( SessionEvent.SESSION_DISCONNECTED, event.getEventType() );
-
- event.setEventType( SessionEvent.SESSION_DISCONNECTING );
- assertEquals( SessionEvent.SESSION_DISCONNECTING, event.getEventType() );
-
- event.setEventType( SessionEvent.SESSION_ERROR_OCCURRED );
- assertEquals( SessionEvent.SESSION_ERROR_OCCURRED, event.getEventType() );
-
- event.setEventType( SessionEvent.SESSION_LOGGED_IN );
- assertEquals( SessionEvent.SESSION_LOGGED_IN, event.getEventType() );
-
- event.setEventType( SessionEvent.SESSION_LOGGED_OFF );
- assertEquals( SessionEvent.SESSION_LOGGED_OFF, event.getEventType() );
-
- event.setEventType( SessionEvent.SESSION_OPENED );
- assertEquals( SessionEvent.SESSION_OPENED, event.getEventType() );
-
- event.setEventType( SessionEvent.SESSION_OPENING );
- assertEquals( SessionEvent.SESSION_OPENING, event.getEventType() );
-
- event.setEventType( SessionEvent.SESSION_CONNECTION_REFUSED );
- assertEquals( SessionEvent.SESSION_CONNECTION_REFUSED, event.getEventType() );
-
-
- try
- {
- event.setEventType( -1 );
- fail( "Exception expected" );
- }
- catch ( IllegalArgumentException e )
- {
- }
-
-
- }
-
- public void testConstantValueConflict()
- {
- final int[] values =
- {
- SessionEvent.SESSION_CLOSED,
- SessionEvent.SESSION_DISCONNECTED,
- SessionEvent.SESSION_DISCONNECTING,
- SessionEvent.SESSION_ERROR_OCCURRED,
- SessionEvent.SESSION_LOGGED_IN,
- SessionEvent.SESSION_LOGGED_OFF,
- SessionEvent.SESSION_OPENED,
- SessionEvent.SESSION_OPENING,
- SessionEvent.SESSION_CONNECTION_REFUSED};
-
- for ( int i = 0; i < values.length; i++ )
- {
- for ( int j = i + 1; j < values.length; j++ )
- {
-
- final String msg =
- "Value confict at [i,j]=[" + i + "," + j + "]";
- assertTrue( msg, values[i] != values[j] );
- }
- }
-
- }
-
-}
diff --git a/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/TransferEventSupportTest.java b/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/TransferEventSupportTest.java
deleted file mode 100644
index 3295307..0000000
--- a/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/TransferEventSupportTest.java
+++ /dev/null
@@ -1,200 +0,0 @@
-package org.apache.maven.wagon.events;
-
-/* ====================================================================
- * 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 junit.framework.TestCase;
-import org.apache.maven.wagon.Wagon;
-import org.apache.maven.wagon.MockWagon;
-
-/**
- * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
- * @version $Id: TransferEventSupportTest.java,v 1.2 2003/11/16 12:41:02 michal
- * Exp $
- */
-public class TransferEventSupportTest extends TestCase
-{
-
- private TransferEventSupport eventSupport;
-
- /**
- * @see junit.framework.TestCase#setUp()
- */
- protected void setUp() throws Exception
- {
-
- super.setUp();
- eventSupport = new TransferEventSupport();
-
- }
-
- public void testTransferListenerRegistration()
- {
- final MockTransferListener mock1 = new MockTransferListener();
- eventSupport.addTransferListener( mock1 );
-
- assertTrue( eventSupport.hasTransferListener( mock1 ) );
- final MockTransferListener mock2 = new MockTransferListener();
-
- assertFalse( eventSupport.hasTransferListener( mock2 ) );
-
- eventSupport.addTransferListener( mock2 );
-
- assertTrue( eventSupport.hasTransferListener( mock1 ) );
- assertTrue( eventSupport.hasTransferListener( mock2 ) );
-
- eventSupport.removeTransferListener( mock2 );
-
- assertTrue( eventSupport.hasTransferListener( mock1 ) );
- assertFalse( eventSupport.hasTransferListener( mock2 ) );
-
- eventSupport.removeTransferListener( mock1 );
- assertFalse( eventSupport.hasTransferListener( mock1 ) );
- }
-
- public void testFireTransferStarted()
- {
- final MockTransferListener mock1 = new MockTransferListener();
- eventSupport.addTransferListener( mock1 );
-
- final MockTransferListener mock2 = new MockTransferListener();
- eventSupport.addTransferListener( mock2 );
-
- final Wagon wagon = new MockWagon();
- final TransferEvent event = getEvent( wagon );
-
- eventSupport.fireTransferStarted( event );
-
- assertTrue( mock1.isTransferStartedCalled() );
- assertTrue( mock2.isTransferStartedCalled() );
- assertEquals( event, mock1.getTransferEvent() );
- assertEquals( event, mock2.getTransferEvent() );
-
- }
-
- public void testFireTransferProgress()
- {
- final MockTransferListener mock1 = new MockTransferListener();
-
- eventSupport.addTransferListener( mock1 );
-
- final MockTransferListener mock2 = new MockTransferListener();
-
- eventSupport.addTransferListener( mock2 );
-
- final Wagon wagon = new MockWagon();
-
- final TransferEvent event = getEvent( wagon );
-
- // TODO: should be testing the buffer
- eventSupport.fireTransferProgress( event, null, 0 );
-
- assertTrue( mock1.isTransferProgressCalled() );
-
- assertTrue( mock2.isTransferProgressCalled() );
-
- assertEquals( event, mock1.getTransferEvent() );
-
- assertEquals( event, mock2.getTransferEvent() );
- }
-
- public void testFireTransferCompleted()
- {
- final MockTransferListener mock1 = new MockTransferListener();
-
- eventSupport.addTransferListener( mock1 );
-
- final MockTransferListener mock2 = new MockTransferListener();
-
- eventSupport.addTransferListener( mock2 );
-
- final Wagon wagon = new MockWagon();
-
- final TransferEvent event = getEvent( wagon );
-
- eventSupport.fireTransferCompleted( event );
-
- assertTrue( mock1.isTransferCompletedCalled() );
-
- assertTrue( mock2.isTransferCompletedCalled() );
-
- assertEquals( event, mock1.getTransferEvent() );
-
- assertEquals( event, mock2.getTransferEvent() );
-
- }
-
- public void testFireTransferError()
- {
- final MockTransferListener mock1 = new MockTransferListener();
-
- eventSupport.addTransferListener( mock1 );
-
- final MockTransferListener mock2 = new MockTransferListener();
-
- eventSupport.addTransferListener( mock2 );
-
- final Wagon wagon = new MockWagon();
-
- final TransferEvent event = getEvent( wagon );
-
- eventSupport.fireTransferError( event );
-
- assertTrue( mock1.isTransferErrorCalled() );
-
- assertTrue( mock2.isTransferErrorCalled() );
-
- assertEquals( event, mock1.getTransferEvent() );
-
- assertEquals( event, mock2.getTransferEvent() );
-
- }
-
- public void testFireDebug()
- {
- final MockTransferListener mock1 = new MockTransferListener();
-
- eventSupport.addTransferListener( mock1 );
-
- final MockTransferListener mock2 = new MockTransferListener();
-
- eventSupport.addTransferListener( mock2 );
-
- eventSupport.fireDebug( "mm" );
-
- assertTrue( mock1.isDebugCalled() );
-
- assertTrue( mock2.isDebugCalled() );
-
- assertEquals( "mm", mock1.getDebugMessage() );
-
- assertEquals( "mm", mock2.getDebugMessage() );
-
- }
-
- private TransferEvent getEvent( final Wagon wagon )
- {
- final TransferEvent event =
- new TransferEvent(
- wagon,
- null,
- TransferEvent.TRANSFER_COMPLETED,
- TransferEvent.REQUEST_GET );
- return event;
- }
-
-}
diff --git a/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/TransferEventTest.java b/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/TransferEventTest.java
deleted file mode 100644
index ad4c003..0000000
--- a/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/TransferEventTest.java
+++ /dev/null
@@ -1,207 +0,0 @@
-package org.apache.maven.wagon.events;
-
-/* ====================================================================
- * 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 junit.framework.TestCase;
-import org.apache.maven.wagon.authentication.AuthenticationException;
-import org.apache.maven.wagon.repository.Repository;
-import org.apache.maven.wagon.Wagon;
-import org.apache.maven.wagon.MockWagon;
-import org.apache.maven.wagon.resource.Resource;
-
-/**
- * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
- * @version $Id$
- */
-public class TransferEventTest extends TestCase
-{
-
- public TransferEventTest( final String name )
- {
- super( name );
- }
-
- /*
- * @see TestCase#setUp()
- */
- protected void setUp() throws Exception
- {
- super.setUp();
- }
-
-
-
- /*
- * Class to test for void TransferEvent(Wagon, Repository, String, int,
- * int)
- */
- public void testTransferEventProperties()
- {
-
- final Wagon wagon = new MockWagon();
-
- final Repository repo = new Repository();
-
- try
- {
- wagon.connect( repo );
- }
- catch ( Exception e )
- {
- fail( e.getMessage() );
- }
- final long timestamp = System.currentTimeMillis();
-
- final Exception exception = new AuthenticationException( "dummy" );
-
- Resource resource = new Resource();
-
- resource.setName( "mm" );
-
- TransferEvent event =
- new TransferEvent(
- wagon,
- resource,
- TransferEvent.TRANSFER_COMPLETED,
- TransferEvent.REQUEST_GET );
-
- assertEquals( wagon, event.getWagon() );
-
- assertEquals( repo, event.getWagon().getRepository() );
-
- assertEquals( "mm", event.getResource().getName() );
-
- assertEquals( TransferEvent.TRANSFER_COMPLETED, event.getEventType() );
-
- assertEquals( TransferEvent.REQUEST_GET, event.getRequestType() );
-
- Resource res = new Resource();
-
- res.setName( "mm" );
-
- event = new TransferEvent( wagon, res, exception );
-
- assertEquals( wagon, event.getWagon() );
-
- assertEquals( repo, event.getWagon().getRepository() );
-
- assertEquals( "mm", event.getResource().getName() );
-
- assertEquals( TransferEvent.TRANSFER_ERROR, event.getEventType() );
-
- assertEquals( exception, event.getException() );
-
-
-
- event.setResource( null );
-
- assertEquals( null, event.getResource() );
-
- res.setName( "/foo/baa" );
-
- event.setResource( res );
-
- assertEquals( "/foo/baa", event.getResource().getName() );
-
- event.setException( null );
-
- assertEquals( null, event.getException() );
-
- event.setException( exception );
-
- assertEquals( exception, event.getException() );
-
- event.setTimestamp( timestamp );
-
- assertEquals( timestamp, event.getTimestamp() );
-
- event.setRequestType( TransferEvent.REQUEST_PUT );
-
- assertEquals( TransferEvent.REQUEST_PUT, event.getRequestType() );
-
- event.setRequestType( TransferEvent.REQUEST_GET );
-
- assertEquals( TransferEvent.REQUEST_GET, event.getRequestType() );
-
- try
- {
- event.setRequestType( -1 );
-
- fail( "Exception expected" );
- }
- catch ( IllegalArgumentException e )
- {
- }
-
- event.setEventType( TransferEvent.TRANSFER_COMPLETED );
-
- assertEquals( TransferEvent.TRANSFER_COMPLETED, event.getEventType() );
-
- event.setEventType( TransferEvent.TRANSFER_ERROR );
-
- assertEquals( TransferEvent.TRANSFER_ERROR, event.getEventType() );
-
- event.setEventType( TransferEvent.TRANSFER_STARTED );
-
- assertEquals( TransferEvent.TRANSFER_STARTED, event.getEventType() );
-
- event.setEventType( TransferEvent.TRANSFER_PROGRESS );
-
- assertEquals( TransferEvent.TRANSFER_PROGRESS, event.getEventType() );
-
- try
- {
- event.setEventType( -1 );
-
- fail( "Exception expected" );
- }
- catch ( IllegalArgumentException e )
- {
- //we expect to be here
- }
-
-
-
- }
-
- public void testConstantValueConflict()
- {
- final int[] values =
- {
- TransferEvent.TRANSFER_COMPLETED,
- TransferEvent.TRANSFER_ERROR,
- TransferEvent.TRANSFER_STARTED,
- TransferEvent.TRANSFER_PROGRESS,
- TransferEvent.REQUEST_GET,
- TransferEvent.REQUEST_PUT};
-
- for ( int i = 0; i < values.length; i++ )
- {
- for ( int j = i + 1; j < values.length; j++ )
- {
-
- final String msg =
- "Value confict at [i,j]=[" + i + "," + j + "]";
-
- assertTrue( msg, values[i] != values[j] );
- }
- }
-
- }
-
-}
diff --git a/wagon-provider-api/src/test/java/org/apache/maven/wagon/proxy/ProxyInfoTest.java b/wagon-provider-api/src/test/java/org/apache/maven/wagon/proxy/ProxyInfoTest.java
deleted file mode 100644
index af92f29..0000000
--- a/wagon-provider-api/src/test/java/org/apache/maven/wagon/proxy/ProxyInfoTest.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package org.apache.maven.wagon.proxy;
-
-/* ====================================================================
- * 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 junit.framework.TestCase;
-import org.apache.maven.wagon.proxy.ProxyInfo;
-
-/**
- * @author <a href="mailto:jvanzyl@maven.org">Jason van Zyl</a>
- * @version $Id$
- */
-public class ProxyInfoTest
- extends TestCase
-{
- public ProxyInfoTest( final String name )
- {
- super( name );
- }
-
- public void setUp()
- throws Exception
- {
- super.setUp();
- }
-
- public void tearDown()
- throws Exception
- {
- super.tearDown();
- }
-
- public void testProxyInfoProperties()
-
- {
- final ProxyInfo proxyInfo = new ProxyInfo();
-
-
- proxyInfo.setUserName( "username" );
-
- assertEquals( "username", proxyInfo.getUserName() );
-
-
- proxyInfo.setPassword( "password" );
-
- assertEquals( "password", proxyInfo.getPassword() );
-
-
- proxyInfo.setHost( "http://www.ibiblio.org" );
-
- assertEquals( "http://www.ibiblio.org", proxyInfo.getHost() );
-
-
- proxyInfo.setPort( 0 );
-
- assertEquals( 0, proxyInfo.getPort() );
-
- proxyInfo.setType( "SOCKSv4" );
-
- assertEquals( "SOCKSv4", proxyInfo.getType() );
- }
-}
diff --git a/wagon-provider-api/src/test/java/org/apache/maven/wagon/repository/RepositoryPermissionsTest.java b/wagon-provider-api/src/test/java/org/apache/maven/wagon/repository/RepositoryPermissionsTest.java
deleted file mode 100644
index 67161fd..0000000
--- a/wagon-provider-api/src/test/java/org/apache/maven/wagon/repository/RepositoryPermissionsTest.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package org.apache.maven.wagon.repository;
-
-/* ====================================================================
- * Copyright 2001-2005 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 junit.framework.TestCase;
-
-/**
- * @author <a href="mailto:brett@apache.org">Brett Porter</a>
- * @version $Id$
- * @todo test defaults
- */
-public class RepositoryPermissionsTest
- extends TestCase
-{
- public RepositoryPermissionsTest( final String name )
- {
- super( name );
- }
-
- public void setUp()
- throws Exception
- {
- super.setUp();
- }
-
- public void tearDown()
- throws Exception
- {
- super.tearDown();
- }
-
- public void testAuthenticationInfoProperties()
- {
- final RepositoryPermissions repositoryPermissions = new RepositoryPermissions();
-
- repositoryPermissions.setDirectoryMode( "directoryMode" );
-
- assertEquals( "directoryMode", repositoryPermissions.getDirectoryMode() );
-
- repositoryPermissions.setFileMode( "fileMode" );
-
- assertEquals( "fileMode", repositoryPermissions.getFileMode() );
-
- repositoryPermissions.setGroup( "group" );
-
- assertEquals( "group", repositoryPermissions.getGroup() );
-
- }
-}
diff --git a/wagon-provider-api/src/test/java/org/apache/maven/wagon/repository/RepositoryTest.java b/wagon-provider-api/src/test/java/org/apache/maven/wagon/repository/RepositoryTest.java
deleted file mode 100644
index 84fc6f9..0000000
--- a/wagon-provider-api/src/test/java/org/apache/maven/wagon/repository/RepositoryTest.java
+++ /dev/null
@@ -1,110 +0,0 @@
-package org.apache.maven.wagon.repository;
-
-/* ====================================================================
- * 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 junit.framework.TestCase;
-import org.apache.maven.wagon.WagonConstants;
-import org.apache.maven.wagon.authentication.AuthenticationInfo;
-
-/**
- * @author <a href="mailto:jvanzyl@maven.org">Jason van Zyl</a>
- * @version $Id$
- */
-public class RepositoryTest
- extends TestCase
-{
- public RepositoryTest( final String name )
- {
- super( name );
- }
-
- public void setUp()
- throws Exception
- {
- super.setUp();
- }
-
- public void tearDown()
- throws Exception
- {
- super.tearDown();
- }
-
- public void testRepositoryProperties()
- throws Exception
- {
- Repository repository = new Repository();
-
- repository.setAuthenticationInfo( new AuthenticationInfo() );
-
- assertNotNull( repository.getAuthenticationInfo() );
-
- repository.setBasedir( "directory" );
-
- assertEquals( "directory", repository.getBasedir() );
-
- repository.setName( "name" );
-
- assertEquals( "name", repository.getName() );
-
- repository.setPort( 0 );
-
- assertEquals( 0, repository.getPort() );
-
- assertEquals( "localhost", repository.getHost() );
-
- repository.setUrl( "http://www.ibiblio.org" );
-
- assertEquals( "http://www.ibiblio.org", repository.getUrl() );
-
- assertEquals( "http", repository.getProtocol() );
-
- assertEquals( "www.ibiblio.org", repository.getHost() );
-
- assertEquals( "/", repository.getBasedir() );
-
- assertEquals( WagonConstants.UNKNOWN_PORT, repository.getPort() );
-
- repository.setUrl( "https://www.ibiblio.org:100/maven" );
-
- assertEquals( "https://www.ibiblio.org:100/maven", repository.getUrl() );
-
- assertEquals( "https", repository.getProtocol() );
-
- assertEquals( "www.ibiblio.org", repository.getHost() );
-
- assertEquals( "/maven", repository.getBasedir() );
-
- assertEquals( 100, repository.getPort() );
-
- assertEquals( "www.ibiblio.org", repository.getHost() );
-
- repository.setBasedir( "basedir" );
-
- assertEquals( "basedir", repository.getBasedir() );
-
- repository.setUrl( "http://brett:porter@www.ibiblio.org" );
-
- assertEquals( "http://www.ibiblio.org", repository.getUrl() );
-
- repository.setUrl( "http://brett@www.ibiblio.org" );
-
- assertEquals( "http://www.ibiblio.org", repository.getUrl() );
-
- }
-}
diff --git a/wagon-provider-api/src/test/resources/org/apache/maven/wagon/manager/DefaultWagonManagerTest.xml b/wagon-provider-api/src/test/resources/org/apache/maven/wagon/manager/DefaultWagonManagerTest.xml
deleted file mode 100644
index 49a1c0e..0000000
--- a/wagon-provider-api/src/test/resources/org/apache/maven/wagon/manager/DefaultWagonManagerTest.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<plexus>
- <components>
- <component>
- <role>org.apache.maven.wagon.Wagon</role>
- <role-hint>a</role-hint>
- <implementation>org.apache.maven.wagon.manager.WagonA</implementation>
- </component>
- <component>
- <role>org.apache.maven.wagon.Wagon</role>
- <role-hint>b1</role-hint>
- <implementation>org.apache.maven.wagon.manager.WagonB</implementation>
- </component>
- <component>
- <role>org.apache.maven.wagon.Wagon</role>
- <role-hint>b2</role-hint>
- <implementation>org.apache.maven.wagon.manager.WagonB</implementation>
- </component>
- <component>
- <role>org.apache.maven.wagon.Wagon</role>
- <role-hint>c</role-hint>
- <implementation>org.apache.maven.wagon.manager.WagonC</implementation>
- </component>
- </components>
-</plexus>
\ No newline at end of file
diff --git a/wagon-provider-api/xdocs/changes.xml b/wagon-provider-api/xdocs/changes.xml
deleted file mode 100644
index 1d013df..0000000
--- a/wagon-provider-api/xdocs/changes.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0"?>
-<document>
- <properties>
- <title>Changes</title>
- <author email="michal.maczka@dimatics.com">Michal Maczka</author>
- </properties>
- <body>
- <release version="1.0-beta-1" date="in CVS">
- <action dev="mmaczka" type="add">
- Imported to Apache CVS
- </action>
- </release>
- </body>
-</document>
-
diff --git a/wagon-provider-api/xdocs/index.xml b/wagon-provider-api/xdocs/index.xml
deleted file mode 100644
index 7f68409..0000000
--- a/wagon-provider-api/xdocs/index.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0"?>
-
-<document>
-
- <properties>
- <title>Wagon API</title>
- <author email="michal.maczka@dimatics.com">Michal Maczka</author>
- </properties>
-
- <body>
-
- <section name="Wagon API">
- <p>
- The "Wagon API" project defines a simple API for transfering resources
- (artifacts) to and from repositories. The word repository is used in this contextx as
- it is commonly used in <a href"http://maven.apache.org/misc/glossary.html">Maven</a>
- And means a storage of artfacts.
- Wagon is a helper project for Maven and it is planned that Wagon will be used in feature
- versions of Maven.
-
- </p>
- </section>
-
- </body>
-</document>
-
diff --git a/wagon-provider-api/xdocs/navigation.xml b/wagon-provider-api/xdocs/navigation.xml
deleted file mode 100644
index bffc859..0000000
--- a/wagon-provider-api/xdocs/navigation.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<project
- name="Wagon FTP provider"
- href="http://maven.apache.org">
-
- <title>Wagon</title>
- <logo href="http://maven.apache.org/maven/images/maven.jsp">Maven</logo>
- <organizationLogo href="/images/jakarta-logo.gif">Jakarta</organizationLogo>
- <body>
- <links>
- <item name="Maven" href="http://maven.apache.org"/>
- <item name="Wagon Main" href="http://maven.apache.org/wagon"/>
- <item name="Jakarta Commons/Net" href="http://jakarta.apache.org/commons/net/"/>
- </links>
-
- <menu name="Wagon">
- <item name="Main" href="/index.html"/>
- <item name="Status" href="/status.html"/>
- <item name="News" href="/news.html"/>
- </menu>
- </body>
-</project>
-
diff --git a/wagon-provider-test/.cvsignore b/wagon-provider-test/.cvsignore
deleted file mode 100644
index db40082..0000000
--- a/wagon-provider-test/.cvsignore
+++ /dev/null
@@ -1,10 +0,0 @@
-*.log
-target
-.classpath
-.project
-default.lst
-test.out
-default.ajsym
-*.iml
-*.ipr
-*.iws
diff --git a/wagon-provider-test/pom.xml b/wagon-provider-test/pom.xml
deleted file mode 100644
index b0aeb44..0000000
--- a/wagon-provider-test/pom.xml
+++ /dev/null
@@ -1,62 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<project>
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>maven</groupId>
- <artifactId>wagon</artifactId>
- <version>1.0-alpha-2-SNAPSHOT</version>
- </parent>
- <groupId>maven</groupId>
- <artifactId>wagon-provider-test</artifactId>
- <name>Wagon Provider Test</name>
- <version>1.0-alpha-2-SNAPSHOT</version>
- <shortDescription>Wagon Provider Parent</shortDescription>
- <inceptionYear>2003</inceptionYear>
- <developers>
- <developer>
- <name>Michal Maczka</name>
- <id>michal</id>
- <email>michal@codehaus.org</email>
- <roles>
- <role>Creator</role>
- <role>Developer</role>
- <role>Release Manager</role>
- </roles>
- </developer>
- </developers>
-
- <dependencies>
- <dependency>
- <groupId>maven</groupId>
- <artifactId>wagon-provider-api</artifactId>
- <version>1.0-alpha-2-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>plexus</groupId>
- <artifactId>plexus-container-api</artifactId>
- <version>1.0-alpha-1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>plexus</groupId>
- <artifactId>plexus-container-default</artifactId>
- <version>1.0-alpha-1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>plexus</groupId>
- <artifactId>plexus-utils</artifactId>
- <version>1.0-alpha-1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>3.8.1</version>
- </dependency>
- </dependencies>
-
-
-</project>
diff --git a/wagon-provider-test/src/main/java/org/apache/maven/wagon/WagonTestCase.java b/wagon-provider-test/src/main/java/org/apache/maven/wagon/WagonTestCase.java
deleted file mode 100644
index cc842a7..0000000
--- a/wagon-provider-test/src/main/java/org/apache/maven/wagon/WagonTestCase.java
+++ /dev/null
@@ -1,303 +0,0 @@
-package org.apache.maven.wagon;
-
-/* ====================================================================
- * 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 java.io.File;
-import java.io.IOException;
-
-import org.apache.maven.wagon.authentication.AuthenticationInfo;
-import org.apache.maven.wagon.observers.ChecksumObserver;
-import org.apache.maven.wagon.observers.Debug;
-import org.apache.maven.wagon.repository.Repository;
-import org.apache.maven.wagon.repository.RepositoryPermissions;
-
-import org.codehaus.plexus.PlexusTestCase;
-import org.codehaus.plexus.util.FileUtils;
-
-/**
- * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
- * @version $Id$
- */
-public abstract class WagonTestCase
- extends PlexusTestCase
-{
- protected static String POM = "pom.xml";
-
- protected Repository localRepository;
-
- protected Repository testRepository;
-
- protected String localRepositoryPath;
-
- protected File sourceFile;
-
- protected File destFile;
-
- protected String resource;
-
- protected File artifactSourceFile;
-
- protected File artifactDestFile;
-
- protected ChecksumObserver checksumObserver;
-
- // ----------------------------------------------------------------------
- // Constructors
- // ----------------------------------------------------------------------
-
- public WagonTestCase( String testName )
- {
- super( testName );
-
- checksumObserver = new ChecksumObserver();
- }
-
- // ----------------------------------------------------------------------
- // Methods that should be provided by subclasses for proper testing
- // ----------------------------------------------------------------------
-
- protected abstract String getTestRepositoryUrl() throws IOException;
-
- protected abstract String getProtocol();
-
- // ----------------------------------------------------------------------
- // 1. Create a local file repository which mimic a users local file
- // Repository.
- //
- // 2. Create a test repository for the type of wagon we are testing. So,
- // for example, for testing the file wagon we might have a test
- // repository url of file://${basedir}/target/file-repository.
- // ----------------------------------------------------------------------
-
- protected void setupRepositories()
- throws Exception
- {
- resource = "test-resource.txt";
-
- // ----------------------------------------------------------------------
- // Create the test repository for the wagon we are testing.
- // ----------------------------------------------------------------------
-
- testRepository = new Repository();
-
- testRepository.setUrl( getTestRepositoryUrl() );
-
- testRepository.setAuthenticationInfo( getAuthInfo() );
-
- testRepository.setPermissions( getPermissions() );
-
- // ----------------------------------------------------------------------
- // Create a test local repository.
- // ----------------------------------------------------------------------
-
- localRepositoryPath = FileTestUtils.createDir( "local-repository" ).getPath();
-
- localRepository = createFileRepository( "file://" + localRepositoryPath );
-
- message( "Local repository: " + localRepository );
-
- File f = new File( localRepositoryPath );
-
- if ( !f.exists() )
- {
- f.mkdirs();
- }
- }
-
- protected void customizeContext()
- throws Exception
- {
- getContainer().addContextValue( "test.repository", localRepositoryPath );
- }
-
- protected void setupWagonTestingFixtures()
- throws Exception
- {
- }
-
- protected void tearDownWagonTestingFixtures()
- throws Exception
- {
- }
-
- // ----------------------------------------------------------------------
- //
- // ----------------------------------------------------------------------
-
- protected AuthenticationInfo getAuthInfo()
- {
- return new AuthenticationInfo();
- }
-
- protected RepositoryPermissions getPermissions()
- {
- return new RepositoryPermissions();
- }
-
- protected Wagon getWagon()
- throws Exception
- {
- Wagon wagon = (Wagon) lookup( Wagon.ROLE, getProtocol() );
-
- Debug debug = new Debug();
-
- wagon.addSessionListener( debug );
-
- wagon.addTransferListener( debug );
-
- return wagon;
- }
-
- private void message( String message )
- {
- System.out.println( "---------------------------------------------------------------------------------------------------------" );
-
- System.out.println( message );
-
- System.out.println( "---------------------------------------------------------------------------------------------------------" );
- }
-
- // ----------------------------------------------------------------------
- //
- // ----------------------------------------------------------------------
-
- public void testWagon()
- throws Exception
- {
- setupRepositories();
-
- setupWagonTestingFixtures();
-
- fileRoundTripTesting();
-
- tearDownWagonTestingFixtures();
- }
-
- // ----------------------------------------------------------------------
- // File <--> File round trip testing
- // ----------------------------------------------------------------------
- // We are testing taking a file, our sourcefile, and placing it into the
- // test repository that we have setup.
- // ----------------------------------------------------------------------
-
- protected void putFile()
- throws Exception
- {
- message( "Putting test artifact: " + resource + " into test repository " + testRepository );
-
- Wagon wagon = getWagon();
-
- wagon.addTransferListener( checksumObserver );
-
- wagon.connect( testRepository );
-
- sourceFile = new File( basedir, POM );
-
- wagon.put( sourceFile, resource );
-
- wagon.removeTransferListener( checksumObserver );
-
- wagon.disconnect();
- }
-
- protected void getFile()
- throws Exception
- {
- message( "Getting test artifact from test repository " + testRepository );
-
- Wagon wagon = getWagon();
-
- wagon.addTransferListener( checksumObserver );
-
- wagon.connect( testRepository );
-
- destFile = FileTestUtils.createUniqueFile( this );
-
- destFile.deleteOnExit();
-
- wagon.get( resource, destFile );
-
- wagon.removeTransferListener( checksumObserver );
-
- wagon.disconnect();
- }
-
- protected void fileRoundTripTesting()
- throws Exception
- {
- message( "File round trip testing ..." );
-
- putFile();
-
- getFile();
-
- System.out.println( "checksumObserver:" + checksumObserver );
-
- System.out.println( "actual:" + checksumObserver.getActualChecksum() );
-
- System.out.println( "expected:" + checksumObserver.getExpectedChecksum() );
-
- assertTrue( checksumObserver.cheksumIsValid() );
-
- compareContents( sourceFile, destFile );
- }
-
- protected void compareContents( File sourceFile, File destFile )
- throws Exception
- {
- // Now compare the conents of the artifact that was placed in
- // the repository with the contents of the artifact that was
- // retrieved from the repository.
-
- System.out.println( "sourceFile = " + sourceFile );
-
- System.out.println( "destFile = " + destFile );
-
- System.out.println( "---------------------------------------------------------------------------------------------------------" );
-
- System.out.print( "Evaluating and comparing ... " );
-
- String sourceContent = FileUtils.fileRead( sourceFile );
-
- String destContent = FileUtils.fileRead( destFile );
-
- assertEquals( sourceContent, destContent );
-
- System.out.println( "OK" );
-
- System.out.println( "---------------------------------------------------------------------------------------------------------" );
- }
-
- // ----------------------------------------------------------------------
- //
- // ----------------------------------------------------------------------
-
- protected Repository createFileRepository( String url )
- {
- File path = new File( url.substring( 7 ) );
-
- path.mkdirs();
-
- Repository repository = new Repository();
-
- repository.setUrl( url );
-
- return repository;
- }
-
-}
diff --git a/wagon-providers/pom.xml b/wagon-providers/pom.xml
deleted file mode 100644
index 3d82960..0000000
--- a/wagon-providers/pom.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<project>
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>maven</groupId>
- <artifactId>wagon</artifactId>
- <version>1.0-alpha-2-SNAPSHOT</version>
- </parent>
- <groupId>maven</groupId>
- <artifactId>wagon-providers</artifactId>
- <name>Wagon Providers Parent</name>
- <version>1.0-alpha-2-SNAPSHOT</version>
- <type>pom</type>
- <shortDescription>Wagon Provider Parent</shortDescription>
- <inceptionYear>2003</inceptionYear>
- <developers>
- <developer>
- <name>Michal Maczka</name>
- <id>michal</id>
- <email>michal@codehaus.org</email>
- <roles>
- <role>Creator</role>
- <role>Developer</role>
- <role>Release Manager</role>
- </roles>
- </developer>
- </developers>
- <dependencies>
- <dependency>
- <groupId>maven</groupId>
- <artifactId>wagon-provider-test</artifactId>
- <version>1.0-alpha-2-SNAPSHOT</version>
- </dependency>
- </dependencies>
-</project>
diff --git a/wagon-providers/wagon-file/.cvsignore b/wagon-providers/wagon-file/.cvsignore
deleted file mode 100644
index 442a240..0000000
--- a/wagon-providers/wagon-file/.cvsignore
+++ /dev/null
@@ -1,11 +0,0 @@
-*.log
-target
-.classpath
-.project
-default.lst
-test.out
-default.ajsym
-*.iml
-*.ipr
-*.iws
-destination
diff --git a/wagon-providers/wagon-file/pom.xml b/wagon-providers/wagon-file/pom.xml
deleted file mode 100644
index 1963ded..0000000
--- a/wagon-providers/wagon-file/pom.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<project>
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>maven</groupId>
- <artifactId>wagon-providers</artifactId>
- <version>1.0-alpha-2-SNAPSHOT</version>
- </parent>
- <groupId>maven</groupId>
- <artifactId>wagon-file</artifactId>
- <name>Wagon File Provider</name>
- <version>1.0-alpha-2-SNAPSHOT</version>
- <description></description>
- <shortDescription>Wagon Provider for file protocol</shortDescription>
- <package>org.apache.maven.wagon.providers.file</package>
- <inceptionYear>2003</inceptionYear>
- <developers>
- <developer>
- <name>Michal Maczka</name>
- <id>michal</id>
- <email>michal@codehaus.org</email>
- <roles>
- <role>Creator</role>
- <role>Developer</role>
- <role>Release Manager</role>
- </roles>
- </developer>
- </developers>
-</project>
diff --git a/wagon-providers/wagon-file/src/main/java/org/apache/maven/wagon/providers/file/FileWagon.java b/wagon-providers/wagon-file/src/main/java/org/apache/maven/wagon/providers/file/FileWagon.java
deleted file mode 100644
index d10f75f..0000000
--- a/wagon-providers/wagon-file/src/main/java/org/apache/maven/wagon/providers/file/FileWagon.java
+++ /dev/null
@@ -1,109 +0,0 @@
-package org.apache.maven.wagon.providers.file;
-
-/* ====================================================================
- * 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.*;
-import org.apache.maven.wagon.resource.Resource;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-/**
- * Wagon Provider for Local File System
- *
- * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
- * @version $Id$
- */
-public class FileWagon
- extends StreamWagon
-{
-
- // get
- public void fillInputData( InputData inputData )
- throws TransferFailedException, ResourceDoesNotExistException
- {
-
- Resource resource = inputData.getResource();
-
- File file = new File( getRepository().getBasedir(), resource.getName() );
-
- if ( !file.exists() )
- {
- throw new ResourceDoesNotExistException( "File: " + file + " does not exist" );
- }
-
- try
- {
- InputStream in = new FileInputStream( file );
-
- inputData.setInputStream( in );
-
- resource.setContentLength( file.length() );
-
- resource.setLastModified( file.lastModified() );
- }
- catch ( FileNotFoundException e)
- {
- throw new TransferFailedException( "Could not read from file: " + file.getAbsolutePath(), e );
- }
- }
-
- // put
- public void fillOutputData( OutputData outputData ) throws TransferFailedException
- {
-
- Resource resource = outputData.getResource();
-
- File file = new File( getRepository().getBasedir(), resource.getName() );
-
- File dir = file.getParentFile();
-
- if ( dir != null && !dir.exists() )
- {
-
- if ( !dir.mkdirs() )
- {
- String msg = "Some of the requied directories do not exist and could not be create. " +
- "Requested path: " + file.getAbsolutePath();
-
- throw new TransferFailedException( msg );
- }
- }
-
- OutputStream outputStream = new LazyFileOutputStream( file );
-
- outputData.setOutputStream( outputStream );
-
- resource.setContentLength( file.length() );
-
- resource.setLastModified( file.lastModified() );
-
-
- }
-
- public void openConnection()
- {
- }
-
- public void closeConnection()
- {
- }
-}
diff --git a/wagon-providers/wagon-file/src/main/resources/META-INF/plexus/components.xml b/wagon-providers/wagon-file/src/main/resources/META-INF/plexus/components.xml
deleted file mode 100644
index 8cfa23f..0000000
--- a/wagon-providers/wagon-file/src/main/resources/META-INF/plexus/components.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<component-set>
- <components>
- <component>
- <role>org.apache.maven.wagon.Wagon</role>
- <role-hint>file</role-hint>
- <implementation>org.apache.maven.wagon.providers.file.FileWagon</implementation>
- <instantiation-strategy>per-lookup</instantiation-strategy>
- </component>
- </components>
-</component-set>
\ No newline at end of file
diff --git a/wagon-providers/wagon-file/src/test/java/org/apache/maven/wagon/providers/file/FileWagonTest.java b/wagon-providers/wagon-file/src/test/java/org/apache/maven/wagon/providers/file/FileWagonTest.java
deleted file mode 100644
index 538d635..0000000
--- a/wagon-providers/wagon-file/src/test/java/org/apache/maven/wagon/providers/file/FileWagonTest.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package org.apache.maven.wagon.providers.file;
-
-/* ====================================================================
- * 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.FileTestUtils;
-import org.apache.maven.wagon.WagonTestCase;
-
-import java.io.File;
-import java.io.IOException;
-
-/**
- * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
- * @version $Id$
- */
-public class FileWagonTest
- extends WagonTestCase
-{
- public FileWagonTest( String testname )
- {
- super ( testname );
- }
-
- protected String getProtocol()
- {
- return "file";
- }
-
- protected String getTestRepositoryUrl() throws IOException
- {
- File file = FileTestUtils.createUniqueDir( getName() + ".file-repository." );
-
- return "file://" + file.getPath();
- }
-}
diff --git a/wagon-providers/wagon-ftp/.cvsignore b/wagon-providers/wagon-ftp/.cvsignore
deleted file mode 100644
index db40082..0000000
--- a/wagon-providers/wagon-ftp/.cvsignore
+++ /dev/null
@@ -1,10 +0,0 @@
-*.log
-target
-.classpath
-.project
-default.lst
-test.out
-default.ajsym
-*.iml
-*.ipr
-*.iws
diff --git a/wagon-providers/wagon-ftp/LICENSE.txt b/wagon-providers/wagon-ftp/LICENSE.txt
deleted file mode 100644
index d645695..0000000
--- a/wagon-providers/wagon-ftp/LICENSE.txt
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- 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.
diff --git a/wagon-providers/wagon-ftp/pom.xml b/wagon-providers/wagon-ftp/pom.xml
deleted file mode 100644
index 430f87c..0000000
--- a/wagon-providers/wagon-ftp/pom.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<project>
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>maven</groupId>
- <artifactId>wagon-providers</artifactId>
- <version>1.0-alpha-2-SNAPSHOT</version>
- </parent>
- <groupId>maven</groupId>
- <artifactId>wagon-ftp</artifactId>
- <name>Wagon FTP Provider</name>
- <version>1.0-alpha-2-SNAPSHOT</version>
- <description></description>
- <shortDescription>Provider for FTP protocol for Wagon</shortDescription>
- <package>org.apache.maven.wagon.providers.ftp</package>
- <inceptionYear>2003</inceptionYear>
- <developers>
- <developer>
- <name>Michal Maczka</name>
- <id>michal</id>
- <email>michal.maczka@dimatics.com</email>
- <organization>Dimatics</organization>
- <roles>
- <role>Creator</role>
- <role>Developer</role>
- <role>Release Manager</role>
- </roles>
- </developer>
- </developers>
-
- <dependencies>
- <dependency>
- <groupId>commons-net</groupId>
- <artifactId>commons-net</artifactId>
- <version>1.1.0</version>
- </dependency>
-
- <!-- Embedded Ftp Server used for testing-->
-
- <dependency>
- <groupId>plexus</groupId>
- <artifactId>plexus-ftpd</artifactId>
- <version>1.0-SNAPSHOT</version>
- </dependency>
- </dependencies>
-</project>
diff --git a/wagon-providers/wagon-ftp/src/main/java/org/apache/maven/wagon/providers/ftp/FtpWagon.java b/wagon-providers/wagon-ftp/src/main/java/org/apache/maven/wagon/providers/ftp/FtpWagon.java
deleted file mode 100644
index 41a3f46..0000000
--- a/wagon-providers/wagon-ftp/src/main/java/org/apache/maven/wagon/providers/ftp/FtpWagon.java
+++ /dev/null
@@ -1,384 +0,0 @@
-package org.apache.maven.wagon.providers.ftp;
-
-/*
- * 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.commons.net.ProtocolCommandEvent;
-import org.apache.commons.net.ProtocolCommandListener;
-import org.apache.commons.net.ftp.FTP;
-import org.apache.commons.net.ftp.FTPClient;
-import org.apache.commons.net.ftp.FTPFile;
-import org.apache.commons.net.ftp.FTPReply;
-import org.apache.maven.wagon.ConnectionException;
-import org.apache.maven.wagon.InputData;
-import org.apache.maven.wagon.OutputData;
-import org.apache.maven.wagon.PathUtils;
-import org.apache.maven.wagon.ResourceDoesNotExistException;
-import org.apache.maven.wagon.StreamWagon;
-import org.apache.maven.wagon.TransferFailedException;
-import org.apache.maven.wagon.WagonConstants;
-import org.apache.maven.wagon.authentication.AuthenticationException;
-import org.apache.maven.wagon.authentication.AuthenticationInfo;
-import org.apache.maven.wagon.repository.RepositoryPermissions;
-import org.apache.maven.wagon.resource.Resource;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-public class FtpWagon
- extends StreamWagon
-{
- private FTPClient ftp;
-
- public void openConnection()
- throws ConnectionException, AuthenticationException
- {
- AuthenticationInfo authInfo = getRepository().getAuthenticationInfo();
-
- if ( authInfo == null )
- {
- throw new IllegalArgumentException( "Authentication Credentials cannot be null for FTP protocol" );
- }
-
- String username = authInfo.getUserName();
-
- String password = authInfo.getPassword();
-
- String host = getRepository().getHost();
-
- ftp = new FTPClient();
-
- ftp.addProtocolCommandListener( new PrintCommandListener( this ) );
-
- try
- {
- if ( getRepository().getPort() != WagonConstants.UNKNOWN_PORT )
- {
- ftp.connect( host, getRepository().getPort() );
- }
- else
- {
- ftp.connect( host );
- }
-
- // After connection attempt, you should check the reply code to
- // verify
- // success.
- int reply = ftp.getReplyCode();
-
- if ( !FTPReply.isPositiveCompletion( reply ) )
- {
- fireSessionConnectionRefused();
-
- fireSessionDisconnecting();
-
- ftp.disconnect();
-
- fireSessionDisconnected();
-
- throw new AuthenticationException( "FTP server refused connection." );
- }
- }
- catch ( IOException e )
- {
- if ( ftp.isConnected() )
- {
- try
- {
- fireSessionError( e );
-
- fireSessionDisconnecting();
-
- ftp.disconnect();
-
- fireSessionDisconnected();
- }
- catch ( IOException f )
- {
- // do nothing
- }
- }
-
- throw new AuthenticationException( "Could not connect to server." );
- }
-
- try
- {
- if ( ftp.login( username.trim(), password.trim() ) == false )
- {
- fireSessionConnectionRefused();
-
- throw new AuthenticationException( "Cannot login to remote system" );
- }
-
- fireSessionDebug( "Remote system is " + ftp.getSystemName() );
-
- // Set to binary mode.
- ftp.setFileType( FTP.BINARY_FILE_TYPE );
-
-
- // Use passive mode as default because most of us are
- // behind firewalls these days.
- // TODO [BP]: make optional based on a flag
- ftp.enterLocalPassiveMode();
-
- boolean dirChanged = ftp.changeWorkingDirectory( getRepository().getBasedir() );
-
- if ( !dirChanged )
- {
- throw new ConnectionException( "Required directories: '" + getRepository().getBasedir() + "' are missing" );
- }
- }
- catch ( IOException e )
- {
- throw new ConnectionException( "Cannot login to remote system" );
- }
- }
-
- protected void firePutCompleted( Resource resource, File file )
- {
- try
- {
- // TODO [BP]: verify the order is correct
- ftp.completePendingCommand();
-
- RepositoryPermissions permissions = repository.getPermissions();
-
- if ( permissions != null && permissions.getGroup() != null )
- {
- // ignore failures
- ftp.sendSiteCommand( "CHGRP " + permissions.getGroup() );
- }
-
- if ( permissions != null && permissions.getFileMode() != null )
- {
- // ignore failures
- ftp.sendSiteCommand( "CHMOD " + permissions.getFileMode() );
- }
- }
- catch ( IOException e )
- {
- // TODO: handle
- // michal I am not sure what error means in that context
- // I think that we will be able to recover or simply we will fail later on
- }
-
- super.firePutCompleted( resource, file );
- }
-
-
- protected void fireGetCompleted( Resource resource, File localFile )
- {
- try
- {
- ftp.completePendingCommand();
- }
- catch ( IOException e )
- {
- // michal I am not sure what error means in that context
- // actually I am not even sure why we have to invoke that command
- // I think that we will be able to recover or simply we will fail later on
- }
- super.fireGetCompleted( resource, localFile );
- }
-
- public void closeConnection()
- throws ConnectionException
- {
- if ( ftp.isConnected() )
- {
- try
- {
- // This is a NPE rethink shutting down the streams
- ftp.disconnect();
- }
- catch ( IOException e)
- {
- throw new ConnectionException( "Failed to close connection to FTP repository", e );
- }
- }
- }
-
-
- public void fillOutputData( OutputData outputData )
- throws TransferFailedException
- {
-
- OutputStream os;
-
- Resource resource = outputData.getResource();
-
- RepositoryPermissions permissions = repository.getPermissions();
-
- try
- {
- String[] dirs = PathUtils.dirnames( resource.getName() );
-
- for ( int i = 0; i < dirs.length; i++ )
- {
- boolean dirChanged = ftp.changeWorkingDirectory( dirs[i] );
-
- if ( !dirChanged )
- {
- // first, try to create it
- boolean success = ftp.makeDirectory( dirs[i] );
-
- if ( success )
- {
- if ( permissions != null && permissions.getGroup() != null )
- {
- // ignore failures
- ftp.sendSiteCommand( "CHGRP " + permissions.getGroup() );
- }
-
- if ( permissions != null && permissions.getDirectoryMode() != null )
- {
- // ignore failures
- ftp.sendSiteCommand( "CHMOD " + permissions.getDirectoryMode() );
- }
-
- dirChanged = ftp.changeWorkingDirectory( dirs[i] );
- }
- }
-
- if ( !dirChanged )
- {
- String msg = " Resource " + resource + " not found. Directory " + dirs[i] + " does not exist";
-
- throw new ResourceDoesNotExistException( msg );
- }
- }
-
- // we come back to orginal basedir so
- // FTP wagon is ready for next requests
- for ( int i = 0; i < dirs.length; i++ )
- {
- if ( !ftp.changeWorkingDirectory( ".." ) )
- {
- throw new TransferFailedException( "Unable to return to the base directory" );
- }
- }
-
-
- os = ftp.storeFileStream( resource.getName() );
-
- if ( os == null )
- {
- String msg = "Cannot transfer resource: '" +
- resource + "' Output stream is null. FTP Server response: " +
- ftp.getReplyString();
-
- throw new TransferFailedException( msg );
-
- }
-
- fireTransferDebug( "resource = " + resource );
-
- }
- catch ( Exception e )
- {
- throw new TransferFailedException( "Cannot transfer: ", e );
- }
-
- outputData.setOutputStream( os );
-
- }
-
- // ----------------------------------------------------------------------
- //
- // ----------------------------------------------------------------------
-
- public void fillInputData( InputData inputData )
- throws TransferFailedException, ResourceDoesNotExistException
- {
- InputStream is;
-
- Resource resource = inputData.getResource();
-
- try
- {
- String[] dirs = PathUtils.dirnames( resource.getName() );
-
- for ( int i = 0; i < dirs.length; i++ )
- {
- boolean dirChanged = ftp.changeWorkingDirectory( dirs[i] );
-
- if ( !dirChanged )
- {
- String msg = "Resource " + resource + " not found. Directory " + dirs[i] + " does not exist";
-
- throw new ResourceDoesNotExistException( msg );
- }
- }
-
- FTPFile[] ftpFiles= ftp.listFiles( "" );
-
- long contenetLength = ftpFiles[ 0 ].getSize();
-
- //@todo check how it works! javadoc of common login says:
- // Returns the file timestamp. This usually the last modification time.
- //
- long lastModified = ftpFiles[ 0 ].getTimestamp().getTimeInMillis();
-
- resource.setContentLength( contenetLength );
-
- resource.setLastModified( lastModified );
-
- is = ftp.retrieveFileStream( PathUtils.filename( resource.getName() ) );
-
- for ( int i = 0; i < dirs.length; i++ )
- {
- ftp.changeWorkingDirectory( ".." );
- }
- }
- catch ( Exception e )
- {
- throw new TransferFailedException( e.getMessage() );
- }
-
- inputData.setInputStream( is );
- }
-
-
- public class PrintCommandListener
- implements ProtocolCommandListener
- {
- FtpWagon wagon;
-
- public PrintCommandListener( FtpWagon wagon )
- {
- this.wagon = wagon;
- }
-
- public void protocolCommandSent( ProtocolCommandEvent event )
- {
- wagon.fireSessionDebug( "Command sent: " + event.getMessage() );
-
- }
-
- public void protocolReplyReceived( ProtocolCommandEvent event )
- {
- wagon.fireSessionDebug( "Reply received: " + event.getMessage() );
- }
- }
-
- protected void fireSessionDebug( String msg )
- {
- super.fireSessionDebug( msg );
- }
-}
diff --git a/wagon-providers/wagon-ftp/src/main/resources/META-INF/plexus/components.xml b/wagon-providers/wagon-ftp/src/main/resources/META-INF/plexus/components.xml
deleted file mode 100644
index f1482f9..0000000
--- a/wagon-providers/wagon-ftp/src/main/resources/META-INF/plexus/components.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<component-set>
- <components>
- <component>
- <role>org.apache.maven.wagon.Wagon</role>
- <role-hint>ftp</role-hint>
- <implementation>org.apache.maven.wagon.providers.ftp.FtpWagon</implementation>
- <instantiation-strategy>per-lookup</instantiation-strategy>
- </component>
- </components>
-</component-set>
diff --git a/wagon-providers/wagon-ftp/src/test/java/org/apache/maven/wagon/providers/ftp/FtpWagonTest.java b/wagon-providers/wagon-ftp/src/test/java/org/apache/maven/wagon/providers/ftp/FtpWagonTest.java
deleted file mode 100644
index b7e2189..0000000
--- a/wagon-providers/wagon-ftp/src/test/java/org/apache/maven/wagon/providers/ftp/FtpWagonTest.java
+++ /dev/null
@@ -1,74 +0,0 @@
-package org.apache.maven.wagon.providers.ftp;
-
-/*
- * 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.ftpserver.interfaces.FtpServerInterface;
-import org.apache.maven.wagon.authentication.AuthenticationInfo;
-import org.apache.maven.wagon.WagonTestCase;
-
-/**
- * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
- * @version $Id$
- */
-public class FtpWagonTest
- extends WagonTestCase
-{
-
- public FtpWagonTest( String testName )
- {
- super( testName );
-
- }
-
- private FtpServerInterface server;
-
- protected String getProtocol()
- {
- return "ftp";
- }
-
- protected void setupWagonTestingFixtures()
- throws Exception
- {
- super.setUp();
-
- server = (FtpServerInterface)lookup( FtpServerInterface.ROLE );
-
- }
-
- protected void tearDownWagonTestingFixtures()
- throws Exception
- {
- release( server );
- }
-
- protected String getTestRepositoryUrl()
- {
- return "ftp://localhost:10023";
- }
-
- public AuthenticationInfo getAuthInfo()
- {
- AuthenticationInfo authInfo = new AuthenticationInfo();
-
- authInfo.setUserName( "admin" );
-
- authInfo.setPassword( "admin" );
-
- return authInfo;
- }
-}
diff --git a/wagon-providers/wagon-ftp/src/test/resources/org/apache/maven/wagon/providers/ftp/FtpWagonTest.xml b/wagon-providers/wagon-ftp/src/test/resources/org/apache/maven/wagon/providers/ftp/FtpWagonTest.xml
deleted file mode 100644
index 977ed0b..0000000
--- a/wagon-providers/wagon-ftp/src/test/resources/org/apache/maven/wagon/providers/ftp/FtpWagonTest.xml
+++ /dev/null
@@ -1,119 +0,0 @@
-<plexus>
- <lifecycle-handler-manager implementation="org.codehaus.plexus.lifecycle.DefaultLifecycleHandlerManager">
- <default-lifecycle-handler-id>avalon</default-lifecycle-handler-id>
- <lifecycle-handlers>
- <lifecycle-handler implementation="org.codehaus.plexus.personality.avalon.AvalonLifecycleHandler">
- <id>avalon</id>
- <name>Avalon Lifecycle Handler</name>
- <begin-segment>
- <phase implementation="org.codehaus.plexus.personality.avalon.lifecycle.phase.LogEnablePhase"/>
- <phase implementation="org.codehaus.plexus.personality.avalon.lifecycle.phase.ContextualizePhase"/>
- <phase implementation="org.codehaus.plexus.personality.avalon.lifecycle.phase.ServicePhase"/>
- <phase implementation="org.codehaus.plexus.personality.avalon.lifecycle.phase.ComposePhase"/>
- <phase implementation="org.codehaus.plexus.personality.avalon.lifecycle.phase.ConfigurePhase"/>
- <phase implementation="org.codehaus.plexus.personality.avalon.lifecycle.phase.InitializePhase"/>
- <phase implementation="org.codehaus.plexus.personality.avalon.lifecycle.phase.StartPhase"/>
- </begin-segment>
- <suspend-segment>
- <phase implementation="org.codehaus.plexus.personality.avalon.lifecycle.phase.SuspendPhase"/>
- </suspend-segment>
- <resume-segment>
- <phase implementation="org.codehaus.plexus.personality.avalon.lifecycle.phase.ResumePhase"/>
- <phase implementation="org.codehaus.plexus.personality.avalon.lifecycle.phase.RecontextualizePhase"/>
- <phase implementation="org.codehaus.plexus.personality.avalon.lifecycle.phase.ReconfigurePhase"/>
- </resume-segment>
- <end-segment>
- <phase implementation="org.codehaus.plexus.personality.avalon.lifecycle.phase.StopPhase"/>
- <phase implementation="org.codehaus.plexus.personality.avalon.lifecycle.phase.DisposePhase"/>
- </end-segment>
- </lifecycle-handler>
- </lifecycle-handlers>
- </lifecycle-handler-manager>
-
- <components>
- <component>
- <role>org.apache.avalon.cornerstone.services.threads.ThreadManager</role>
- <implementation>org.apache.avalon.cornerstone.blocks.threads.DefaultThreadManager</implementation>
- <configuration>
- <thread-group>
- <name>default</name>
- <!-- normal priority = 5, max-priority = 10 -->
- <priority>5</priority>
- <!-- are threads deamon threads ? -->
- <is-daemon>false</is-daemon>
- <max-threads>40</max-threads>
- <!-- these are ignored at the moment but will be fixed in later revisions -->
- <min-threads>20</min-threads>
- <min-spare-threads>20</min-spare-threads>
- </thread-group>
- </configuration>
- </component>
-
- <component>
- <role>org.apache.avalon.cornerstone.services.connection.ConnectionManager</role>
- <implementation>org.apache.avalon.cornerstone.blocks.connection.DefaultConnectionManager</implementation>
- <!--
- <requirements>
- <requirement>
- <role>org.apache.avalon.cornerstone.services.threads.ThreadManager</role>
- </requirement>
- </requirements>
- -->
- </component>
-
- <component>
- <role>org.apache.avalon.cornerstone.services.sockets.SocketManager</role>
- <implementation>org.apache.avalon.cornerstone.blocks.sockets.DefaultSocketManager</implementation>
- <configuration>
- <server-sockets>
- <factory name="plain" class="org.apache.avalon.cornerstone.blocks.sockets.DefaultServerSocketFactory"/>
- </server-sockets>
- <client-sockets>
- <factory name="plain" class="org.apache.avalon.cornerstone.blocks.sockets.DefaultSocketFactory"/>
- </client-sockets>
- </configuration>
- </component>
-
- <component>
- <role>org.apache.ftpserver.usermanager.UserManagerInterface</role>
- <implementation>org.apache.ftpserver.usermanager.PropertiesUserManager</implementation>
- <configuration>
- <base-directory>${basedir}/target/test-output/</base-directory>
- </configuration>
- </component>
- <component>
- <role>org.apache.ftpserver.ip.IpRestrictorInterface</role>
- <implementation>org.apache.ftpserver.ip.FileIpRestrictor</implementation>
- <configuration>
- <base-directory>${basedir}/target/test-output/local-repository</base-directory>
- </configuration>
- </component>
- <component>
- <role>org.apache.ftpserver.interfaces.FtpServerInterface</role>
- <implementation>org.apache.ftpserver.FtpServerImpl</implementation>
- <!--
- <requirements>
- <requirement>
- <role>org.apache.avalon.cornerstone.services.sockets.SocketManager</role>
- </requirement>
- <requirement>
- <role>org.apache.avalon.cornerstone.services.connection.ConnectionManager</role>
- </requirement>
- <requirement>
- <role>org.apache.ftpserver.ip.IpRestrictorInterface</role>
- </requirement>
- <requirement>
- <role>org.apache.ftpserver.usermanager.UserManagerInterface</role>
- </requirement>
- </requirements>
- -->
- <configuration>
- <server-host>localhost</server-host>
- <self-host>localhost</self-host>
- <remote-admin-allowed>false</remote-admin-allowed>
- <ftp-port>10023</ftp-port>
- <default-user-root>${basedir}/target/test-output/local-repository</default-user-root>
- </configuration>
- </component>
- </components>
-</plexus>
diff --git a/wagon-providers/wagon-ftp/xdocs/changes.xml b/wagon-providers/wagon-ftp/xdocs/changes.xml
deleted file mode 100644
index 1d013df..0000000
--- a/wagon-providers/wagon-ftp/xdocs/changes.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0"?>
-<document>
- <properties>
- <title>Changes</title>
- <author email="michal.maczka@dimatics.com">Michal Maczka</author>
- </properties>
- <body>
- <release version="1.0-beta-1" date="in CVS">
- <action dev="mmaczka" type="add">
- Imported to Apache CVS
- </action>
- </release>
- </body>
-</document>
-
diff --git a/wagon-providers/wagon-ftp/xdocs/index.xml b/wagon-providers/wagon-ftp/xdocs/index.xml
deleted file mode 100644
index 3901706..0000000
--- a/wagon-providers/wagon-ftp/xdocs/index.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0"?>
-
-<document>
-
- <properties>
- <title>Wagon FTP provider</title>
- <author email="michal.maczka@dimatics.com">Michal Maczka</author>
- </properties>
-
- <body>
-
- <section name="Wagon FTP provider">
- <p>
- This project is an implementation of Wagon provider for FTP protocol
- based on
- <a href="http://jakarta.apache.org/commons/net/">Jakarta-Commons/Net</a>
- </p>
- </section>
-
- <section name="Features">
- <p>
- </p>
- </section>
-
- </body>
-</document>
diff --git a/wagon-providers/wagon-ftp/xdocs/navigation.xml b/wagon-providers/wagon-ftp/xdocs/navigation.xml
deleted file mode 100644
index 647b4b7..0000000
--- a/wagon-providers/wagon-ftp/xdocs/navigation.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<project
- name="Wagon FTP provider"
- href="http://plexus.werken.com/">
-
- <title>Wagon</title>
- <logo href="/images/plexus-logo.gif">Maven</logo>
- <organizationLogo href="/images/jakarta-logo.gif">Jakarta</organizationLogo>
- <body>
- <links>
- <item name="Maven" href="http://maven.apache.org"/>
- <item name="Wagon Main" href="http://maven.apache.org/wagon"/>
- <item name="Jakarta Commons/Net" href="http://jakarta.apache.org/commons/net/"/>
- </links>
-
- <menu name="Wagon">
- <item name="Main" href="/index.html"/>
- <item name="Status" href="/status.html"/>
- <item name="News" href="/news.html"/>
- </menu>
- </body>
-</project>
-
diff --git a/wagon-providers/wagon-http-lightweight/.cvsignore b/wagon-providers/wagon-http-lightweight/.cvsignore
deleted file mode 100644
index 442a240..0000000
--- a/wagon-providers/wagon-http-lightweight/.cvsignore
+++ /dev/null
@@ -1,11 +0,0 @@
-*.log
-target
-.classpath
-.project
-default.lst
-test.out
-default.ajsym
-*.iml
-*.ipr
-*.iws
-destination
diff --git a/wagon-providers/wagon-http-lightweight/pom.xml b/wagon-providers/wagon-http-lightweight/pom.xml
deleted file mode 100644
index 519e0cd..0000000
--- a/wagon-providers/wagon-http-lightweight/pom.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<project>
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>maven</groupId>
- <artifactId>wagon-providers</artifactId>
- <version>1.0-alpha-2-SNAPSHOT</version>
- </parent>
- <groupId>maven</groupId>
- <artifactId>wagon-http-lightweight</artifactId>
- <name>Wagon Lightweight HTTP Provider</name>
- <version>1.0-alpha-2-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>
- <!-- Testing -->
- <dependency>
- <groupId>plexus</groupId>
- <artifactId>plexus-jetty-httpd</artifactId>
- <version>1.0-SNAPSHOT</version>
- </dependency>
- </dependencies>
-</project>
diff --git a/wagon-providers/wagon-http-lightweight/src/main/java/org/apache/maven/wagon/providers/http/LightweightHttpWagon.java b/wagon-providers/wagon-http-lightweight/src/main/java/org/apache/maven/wagon/providers/http/LightweightHttpWagon.java
deleted file mode 100644
index 635ea18..0000000
--- a/wagon-providers/wagon-http-lightweight/src/main/java/org/apache/maven/wagon/providers/http/LightweightHttpWagon.java
+++ /dev/null
@@ -1,142 +0,0 @@
-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.InputData;
-import org.apache.maven.wagon.OutputData;
-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.proxy.ProxyInfo;
-import org.apache.maven.wagon.repository.Repository;
-import org.apache.maven.wagon.resource.Resource;
-
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.net.Authenticator;
-import java.net.MalformedURLException;
-import java.net.PasswordAuthentication;
-import java.net.URL;
-import java.net.URLConnection;
-
-/**
- * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
- * @version $Id$
- */
-public class LightweightHttpWagon
- extends StreamWagon
-{
- private String previousProxyExclusions;
- private String previousProxyHost;
- private String previousProxyPort;
-
- public void fillInputData( InputData inputData )
- throws TransferFailedException, ResourceDoesNotExistException
- {
- Repository repository = getRepository();
- String repositoryUrl = repository.getUrl();
- Resource resource = inputData.getResource();
- try
- {
- URL url;
- if ( repositoryUrl.endsWith( "/" ) )
- {
- url = new URL( repositoryUrl + resource.getName() );
- }
- else
- {
- url = new URL( repositoryUrl + "/" + resource.getName() );
- }
- URLConnection urlConnection = url.openConnection();
- inputData.setInputStream( urlConnection.getInputStream() );
- resource.setLastModified( urlConnection.getLastModified() );
- resource.setContentLength( urlConnection.getContentLength() );
- }
- 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 void fillOutputData( OutputData outputData )
- throws TransferFailedException
- {
- throw new UnsupportedOperationException( "PUT operation is not supported by Light Weight HTTP wagon" );
- }
-
- public void openConnection()
- throws ConnectionException, AuthenticationException
- {
- previousProxyHost = System.getProperty( "http.proxyHost" );
- previousProxyPort = System.getProperty( "http.proxyPort" );
- previousProxyExclusions = System.getProperty( "http.nonProxyHosts" );
-
- final ProxyInfo proxyInfo = this.proxyInfo;
- if ( proxyInfo != null )
- {
- System.setProperty( "http.proxyHost", proxyInfo.getHost() );
- System.setProperty( "http.proxyPort", String.valueOf( proxyInfo.getPort() ) );
- if ( proxyInfo.getNonProxyHosts() != null )
- {
- System.setProperty( "http.nonProxyHosts", proxyInfo.getNonProxyHosts() );
- }
- if ( proxyInfo.getUserName() != null )
- {
- Authenticator.setDefault( new Authenticator()
- {
- protected PasswordAuthentication getPasswordAuthentication()
- {
- String password = "";
- if ( proxyInfo.getPassword() != null )
- {
- password = proxyInfo.getPassword();
- }
- return new PasswordAuthentication( proxyInfo.getUserName(), password.toCharArray() );
- }
- } );
- }
- }
- }
-
- public void closeConnection()
- throws ConnectionException
- {
- if ( previousProxyHost != null )
- {
- System.setProperty( "http.proxyHost", previousProxyHost );
- }
- if ( previousProxyPort != null )
- {
- System.setProperty( "http.proxyPort", previousProxyPort );
- }
- if ( previousProxyExclusions != null )
- {
- System.setProperty( "http.nonProxyHosts", previousProxyExclusions );
- }
- }
-}
-
diff --git a/wagon-providers/wagon-http-lightweight/src/main/resources/META-INF/plexus/components.xml b/wagon-providers/wagon-http-lightweight/src/main/resources/META-INF/plexus/components.xml
deleted file mode 100644
index c8d005e..0000000
--- a/wagon-providers/wagon-http-lightweight/src/main/resources/META-INF/plexus/components.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<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>
diff --git a/wagon-providers/wagon-http-lightweight/src/test/java/org/apache/maven/wagon/providers/http/LightweightHttpWagonTest.java b/wagon-providers/wagon-http-lightweight/src/test/java/org/apache/maven/wagon/providers/http/LightweightHttpWagonTest.java
deleted file mode 100644
index a6b8019..0000000
--- a/wagon-providers/wagon-http-lightweight/src/test/java/org/apache/maven/wagon/providers/http/LightweightHttpWagonTest.java
+++ /dev/null
@@ -1,91 +0,0 @@
-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.FileTestUtils;
-import org.apache.maven.wagon.WagonTestCase;
-import org.codehaus.plexus.jetty.Httpd;
-
-import java.io.File;
-
-/**
- * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
- * @version $Id$
- */
-public class LightweightHttpWagonTest
- extends WagonTestCase
-{
-
- public LightweightHttpWagonTest( String testName )
- {
- super( testName );
- }
-
- private Httpd httpd;
-
- protected String getProtocol()
- {
- return "http";
- }
-
- protected String getTestRepositoryUrl()
- {
- return "http://localhost:10007";
- }
-
- protected void setupWagonTestingFixtures()
- throws Exception
- {
- // For a PUT the artifact must exist already which is how a PUT works by
- // default so we must place a dummy artifact in the http repo first before
- // the actual PUT operation.
-
- // File round trip testing
-
- File file = FileTestUtils.createUniqueFile( "local-repository", "test-resource.txt" ) ;
-
- file.delete();
-
- file.getParentFile().mkdirs();
-
- FileTestUtils.generateFile( file.getAbsolutePath(), "file-dummy" );
-
- // For a PUT the artifact must exist already which is how a PUT works by
- // default so we must place a dummy artifact in the http repo first before
- // the actual PUT operation.
-
- File f = new File( FileTestUtils.createDir( "http-repository"), "test-resource.txt" );
-
- f.delete();
-
- f.getParentFile().mkdirs();
-
- FileTestUtils.generateFile( f.getAbsolutePath(), "artifact-dummy" );
-
- httpd = (Httpd) lookup( Httpd.ROLE );
- }
-
- protected void fileRoundTripTesting() {
- // skip - PUT not supported
- }
-
- protected void tearDownWagonTestingFixtures()
- throws Exception
- {
- release( httpd );
- }
-}
diff --git a/wagon-providers/wagon-http-lightweight/src/test/resources/org/apache/maven/wagon/providers/http/LightweightHttpWagonTest.xml b/wagon-providers/wagon-http-lightweight/src/test/resources/org/apache/maven/wagon/providers/http/LightweightHttpWagonTest.xml
deleted file mode 100644
index 281fafc..0000000
--- a/wagon-providers/wagon-http-lightweight/src/test/resources/org/apache/maven/wagon/providers/http/LightweightHttpWagonTest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<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/test-output/http-repository</document-root>
- </context>
- </contexts>
- </configuration>
- </component>
- </components>
-</plexus>
\ No newline at end of file
diff --git a/wagon-providers/wagon-http/.cvsignore b/wagon-providers/wagon-http/.cvsignore
deleted file mode 100644
index db40082..0000000
--- a/wagon-providers/wagon-http/.cvsignore
+++ /dev/null
@@ -1,10 +0,0 @@
-*.log
-target
-.classpath
-.project
-default.lst
-test.out
-default.ajsym
-*.iml
-*.ipr
-*.iws
diff --git a/wagon-providers/wagon-http/LICENSE.txt b/wagon-providers/wagon-http/LICENSE.txt
deleted file mode 100644
index d645695..0000000
--- a/wagon-providers/wagon-http/LICENSE.txt
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- 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.
diff --git a/wagon-providers/wagon-http/pom.xml b/wagon-providers/wagon-http/pom.xml
deleted file mode 100644
index a8dec38..0000000
--- a/wagon-providers/wagon-http/pom.xml
+++ /dev/null
@@ -1,73 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<project>
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>maven</groupId>
- <artifactId>wagon-providers</artifactId>
- <version>1.0-alpha-2-SNAPSHOT</version>
- </parent>
- <groupId>maven</groupId>
- <artifactId>wagon-http</artifactId>
- <name>Wagon HTTP Provider</name>
- <version>1.0-alpha-2-SNAPSHOT</version>
- <shortDescription>Wagon Provider for HTTP/HTTPS protocols based on jakarta-commons-httpclient</shortDescription>
- <package>org.apache.maven.wagon.providers.http</package>
- <inceptionYear>2003</inceptionYear>
- <url>http://maven.apache.org/wagon/wagon-providers/wagon-http</url>
- <issueTrackingUrl>http://jira.codehaus.org/BrowseProject.jspa?id=10319</issueTrackingUrl>
- <siteDirectory>/www/maven.apache.org/wagon/wagon-providers/wagon-http</siteDirectory>
-
- <developers>
- <developer>
- <name>Michal Maczka</name>
- <id>michal</id>
- <email>michal.maczka@dimatics.com</email>
- <organization>Dimatics</organization>
- <roles>
- <role>Creator</role>
- <role>Developer</role>
- <role>Release Manager</role>
- </roles>
- </developer>
- </developers>
-
- <dependencies>
- <!-- TODO: update to v3.0+ for cross-host redirects to work -->
- <dependency>
- <groupId>commons-httpclient</groupId>
- <artifactId>commons-httpclient</artifactId>
- <version>2.0.2</version>
- <type>jar</type>
- </dependency>
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>1.0.3</version>
- <type>jar</type>
- </dependency>
- <dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
- <version>1.0.1</version>
- <type>jar</type>
- </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>
diff --git a/wagon-providers/wagon-http/src/main/java/org/apache/maven/wagon/providers/http/HttpWagon.java b/wagon-providers/wagon-http/src/main/java/org/apache/maven/wagon/providers/http/HttpWagon.java
deleted file mode 100644
index 9704da6..0000000
--- a/wagon-providers/wagon-http/src/main/java/org/apache/maven/wagon/providers/http/HttpWagon.java
+++ /dev/null
@@ -1,433 +0,0 @@
-package org.apache.maven.wagon.providers.http;
-
-/*
- * Copyright 2001-2005 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.commons.httpclient.Credentials;
-import org.apache.commons.httpclient.Header;
-import org.apache.commons.httpclient.HostConfiguration;
-import org.apache.commons.httpclient.HttpClient;
-import org.apache.commons.httpclient.HttpRecoverableException;
-import org.apache.commons.httpclient.HttpStatus;
-import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
-import org.apache.commons.httpclient.UsernamePasswordCredentials;
-import org.apache.commons.httpclient.NTCredentials;
-import org.apache.commons.httpclient.methods.GetMethod;
-import org.apache.commons.httpclient.methods.PutMethod;
-import org.apache.commons.httpclient.util.DateParseException;
-import org.apache.commons.httpclient.util.DateParser;
-import org.apache.commons.lang.StringUtils;
-import org.apache.maven.wagon.AbstractWagon;
-import org.apache.maven.wagon.ResourceDoesNotExistException;
-import org.apache.maven.wagon.TransferFailedException;
-import org.apache.maven.wagon.authentication.AuthenticationInfo;
-import org.apache.maven.wagon.authorization.AuthorizationException;
-import org.apache.maven.wagon.resource.Resource;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Locale;
-import java.util.Date;
-import java.util.TimeZone;
-import java.text.SimpleDateFormat;
-
-/**
- * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
- * @version $Id$
- */
-public class HttpWagon
- extends AbstractWagon
-{
- private final static int DEFAULT_NUMBER_OF_ATTEMPTS = 3;
-
- private final static int SC_NULL = -1;
-
- private HttpClient client = null;
-
- private int numberOfAttempts = DEFAULT_NUMBER_OF_ATTEMPTS;
-
- private static final TimeZone GMT_TIME_ZONE = TimeZone.getTimeZone( "GMT" );
-
- public void openConnection()
- {
- client = new HttpClient( new MultiThreadedHttpConnectionManager() );
-
- final AuthenticationInfo authInfo = getRepository().getAuthenticationInfo();
-
- String username = null;
-
- String password = null;
-
- if ( authInfo != null )
- {
- username = authInfo.getUserName();
-
- password = authInfo.getPassword();
- }
-
- String host = getRepository().getHost();
-
- if ( StringUtils.isNotEmpty( username ) && StringUtils.isNotEmpty( password ) )
- {
- Credentials creds = new UsernamePasswordCredentials( username, password );
-
- client.getState().setCredentials( null, host, creds );
- client.getState().setAuthenticationPreemptive( true );
- }
-
- HostConfiguration hc = new HostConfiguration();
-
- if ( proxyInfo != null )
- {
- String proxyUsername = proxyInfo.getUserName();
-
- String proxyPassword = proxyInfo.getPassword();
-
- String proxyHost = proxyInfo.getHost();
-
- int proxyPort = proxyInfo.getPort();
-
- String proxyNtlmHost = proxyInfo.getNtlmHost();
-
- String proxyNtlmDomain = proxyInfo.getNtlmDomain();
-
- if ( proxyHost != null )
- {
- hc.setProxy( proxyHost, proxyPort );
-
- if ( proxyUsername != null && proxyPassword != null )
- {
- Credentials creds;
- if ( proxyNtlmHost != null || proxyNtlmDomain != null )
- {
- creds = new NTCredentials( proxyUsername, proxyPassword, proxyNtlmHost, proxyNtlmDomain );
- }
- else
- {
- creds = new UsernamePasswordCredentials( proxyUsername, proxyPassword );
- }
-
- client.getState().setProxyCredentials( null, proxyHost, creds );
- client.getState().setAuthenticationPreemptive( true );
- }
- }
- }
-
- hc.setHost( host );
-
- //start a session with the webserver
- client.setHostConfiguration( hc );
- }
-
- // put
- public void put( File source, String resourceName )
- throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException
- {
- String url = getRepository().getUrl() + "/" + resourceName;
-
- PutMethod putMethod = new PutMethod( url );
-
- Resource resource = new Resource( resourceName );
-
- try
- {
- InputStream is = new PutInputStream( source, resource, this, getTransferEventSupport() );
-
- putMethod.setRequestBody( is );
- }
- catch ( FileNotFoundException e )
- {
- fireTransferError( resource, e );
-
- throw new ResourceDoesNotExistException( "Source file does not exist: " + source, e );
- }
-
- int statusCode = SC_NULL;
-
- int attempt = 0;
-
- fireTransferDebug( "about to execute client for put" );
-
- // We will retry up to NumberOfAttempts times.
- while ( ( statusCode == SC_NULL ) && ( attempt < getNumberOfAttempts() ) )
- {
- try
- {
- firePutStarted( resource, source );
-
- statusCode = client.executeMethod( putMethod );
-
- firePutCompleted( resource, source );
-
- }
- catch ( HttpRecoverableException e )
- {
- attempt++;
-
- continue;
- }
- catch ( IOException e )
- {
- throw new TransferFailedException( e.getMessage(), e );
- }
- }
-
- fireTransferDebug( url + " - Status code: " + statusCode );
-
- // Check that we didn't run out of retries.
- switch ( statusCode )
- {
- case HttpStatus.SC_OK:
- break;
-
- case HttpStatus.SC_CREATED:
- break;
-
- case SC_NULL:
- throw new TransferFailedException( "Failed to transfer file: " + url + " after " + attempt +
- " attempts" );
-
- case HttpStatus.SC_FORBIDDEN:
- throw new AuthorizationException( "Access denided to: " + url );
-
- case HttpStatus.SC_NOT_FOUND:
- throw new ResourceDoesNotExistException( "File: " + url + " does not exist" );
-
- //add more entries here
- default :
- throw new TransferFailedException( "Failed to transfer file: " + url + ". Return code is: " +
- statusCode );
- }
-
- putMethod.releaseConnection();
-
- firePutCompleted( resource, source );
- }
-
- public void closeConnection()
- {
- }
-
- public void get( String resourceName, File destination )
- throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException
- {
- get( resourceName, destination, 0 );
- }
-
- public boolean getIfNewer( String resourceName, File destination, long timestamp ) throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException
- {
- return get( resourceName, destination, timestamp );
- }
-
- /**
- *
- * @param resourceName
- * @param destination
- * @param timestamp the timestamp to check against, only downloading if newer. If <code>0</code>, always download
- * @return
- * @throws TransferFailedException
- * @throws ResourceDoesNotExistException
- * @throws AuthorizationException
- *
- * @return <code>true</code> if newer version was downloaded, <code>false</code> otherwise.
- */
- public boolean get( String resourceName, File destination, long timestamp )
- throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException
- {
-
- boolean retValue = false;
-
- String url = getRepository().getUrl() + "/" + resourceName;
-
- GetMethod getMethod = new GetMethod( url );
-
- try
- {
- getMethod.addRequestHeader( "Cache-control", "no-cache" );
-
- getMethod.addRequestHeader( "Cache-store", "no-store" );
-
- getMethod.addRequestHeader( "Pragma", "no-cache" );
-
- getMethod.addRequestHeader( "Expires", "0" );
-
- if ( timestamp > 0 )
- {
- SimpleDateFormat fmt = new SimpleDateFormat( "EEE, dd-MMM-yy HH:mm:ss zzz", Locale.US );
- fmt.setTimeZone( GMT_TIME_ZONE );
- Header hdr = new Header( "If-Modified-Since", fmt.format( new Date( timestamp ) ) );
- fireTransferDebug( "sending ==> " + hdr + "(" + timestamp + ")" );
- getMethod.addRequestHeader( hdr );
- }
-
- int statusCode = SC_NULL;
-
- int attempt = 0;
-
- // We will retry up to NumberOfAttempts times.
- while ( ( statusCode == SC_NULL ) && ( attempt < getNumberOfAttempts() ) )
- {
- try
- {
- // execute the getMethod.
- statusCode = client.executeMethod( getMethod );
- }
- catch ( HttpRecoverableException e )
- {
- attempt++;
-
- continue;
- }
- catch ( IOException e )
- {
- throw new TransferFailedException( e.getMessage(), e );
- }
- }
-
- fireTransferDebug( url + " - Status code: " + statusCode );
-
- // TODO [BP]: according to httpclient docs, really should swallow the output on error. verify if that is required
- switch ( statusCode )
- {
- case HttpStatus.SC_OK:
- break;
-
- case HttpStatus.SC_NOT_MODIFIED:
- return false;
-
- case SC_NULL:
- throw new TransferFailedException( "Failed to transfer file: " + url + " after " + attempt +
- " attempts" );
-
- case HttpStatus.SC_FORBIDDEN:
- throw new AuthorizationException( "Access denided to: " + url );
-
- case HttpStatus.SC_UNAUTHORIZED:
- throw new AuthorizationException( "Not authorized." );
-
- case HttpStatus.SC_PROXY_AUTHENTICATION_REQUIRED:
- throw new AuthorizationException( "Not authorized by proxy." );
-
- case HttpStatus.SC_NOT_FOUND:
- throw new ResourceDoesNotExistException( "File: " + url + " does not exist" );
-
- //add more entries here
- default :
- throw new TransferFailedException( "Failed to trasfer file: " + url + ". Return code is: " +
- statusCode );
- }
-
- Resource resource = new Resource( resourceName );
-
- InputStream is = null;
-
- Header contentLengthHeader = getMethod.getResponseHeader( "Content-Length" );
-
- if ( contentLengthHeader != null )
- {
- try
- {
- long contentLength = Integer.valueOf( contentLengthHeader.getValue() ).intValue();
-
- resource.setContentLength( contentLength );
- }
- catch ( NumberFormatException e )
- {
- fireTransferDebug( "error parsing content length header '" + contentLengthHeader.getValue() + "' " + e );
- }
- }
-
- Header lastModifiedHeader = getMethod.getResponseHeader( "Last-Modified" );
-
- long lastModified = 0;
-
- if ( lastModifiedHeader != null )
- {
- try
- {
- lastModified = DateParser.parseDate( lastModifiedHeader.getValue() ).getTime();
- }
- catch ( DateParseException e )
- {
- fireTransferDebug( "Unable to parse last modified header" );
- }
-
- fireTransferDebug( "last-modified = " + lastModifiedHeader.getValue() + " (" + lastModified + ")" );
- }
-
- if ( timestamp < lastModified )
- {
- retValue = true;
-
- try
- {
- is = getMethod.getResponseBodyAsStream();
-
- getTransfer( resource, destination, is );
- }
- catch ( Exception e )
- {
- fireTransferError( resource, e );
-
- if ( destination.exists() )
- {
- boolean deleted = destination.delete();
-
- if ( ! deleted )
- {
- destination.deleteOnExit();
- }
- }
-
- String msg = "Error occured while deploying to remote repository:" + getRepository();
-
- throw new TransferFailedException( msg, e );
- }
- finally
- {
- shutdownStream( is );
- }
-
- if ( lastModified > 0 )
- {
- resource.setLastModified( lastModified );
- }
- }
- else
- {
- fireTransferDebug( "Local file is newer: not downloaded" );
- }
-
- return retValue;
- }
- finally
- {
- getMethod.releaseConnection();
- }
- }
-
- public int getNumberOfAttempts()
- {
- return numberOfAttempts;
- }
-
- public void setNumberOfAttempts( int numberOfAttempts )
- {
- this.numberOfAttempts = numberOfAttempts;
- }
-}
diff --git a/wagon-providers/wagon-http/src/main/java/org/apache/maven/wagon/providers/http/PutInputStream.java b/wagon-providers/wagon-http/src/main/java/org/apache/maven/wagon/providers/http/PutInputStream.java
deleted file mode 100644
index 679165a..0000000
--- a/wagon-providers/wagon-http/src/main/java/org/apache/maven/wagon/providers/http/PutInputStream.java
+++ /dev/null
@@ -1,83 +0,0 @@
-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.events.TransferEventSupport;
-import org.apache.maven.wagon.events.TransferEvent;
-import org.apache.maven.wagon.Wagon;
-import org.apache.maven.wagon.resource.Resource;
-
-import java.io.FileInputStream;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-
-
-
-/**
- *
- *
- * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
- * @version $Id$
- */
-public class PutInputStream extends FileInputStream
-{
-
- private TransferEventSupport eventSupport;
-
- private TransferEvent event;
-
- public PutInputStream( File file, Resource resource, Wagon wagon, TransferEventSupport eventSupport ) throws FileNotFoundException
- {
- super(file);
-
- this.eventSupport = eventSupport;
-
- event = new TransferEvent( wagon, resource, TransferEvent.TRANSFER_PROGRESS, TransferEvent.REQUEST_PUT );
-
- event.setLocalFile( file );
-
- }
-
-
- public int read( byte b[] ) throws IOException
- {
- return read( b, 0, b.length );
-
- }
-
- public int read() throws IOException
- {
- byte b[] = new byte[ 1 ];
-
- return read( b );
-
- }
-
- public int read( byte b[], int off, int len ) throws IOException
- {
- int retValue = super.read(b, off, len);
-
- event.setTimestamp( System.currentTimeMillis() );
-
- eventSupport.fireTransferProgress( event, b, retValue );
-
- return retValue;
- }
-
-}
diff --git a/wagon-providers/wagon-http/src/main/resources/META-INF/plexus/components.xml b/wagon-providers/wagon-http/src/main/resources/META-INF/plexus/components.xml
deleted file mode 100644
index 6fa1244..0000000
--- a/wagon-providers/wagon-http/src/main/resources/META-INF/plexus/components.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<component-set>
- <components>
- <component>
- <role>org.apache.maven.wagon.Wagon</role>
- <role-hint>http</role-hint>
- <implementation>org.apache.maven.wagon.providers.http.HttpWagon</implementation>
- <instantiation-strategy>per-lookup</instantiation-strategy>
- </component>
- </components>
-</component-set>
diff --git a/wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/HttpWagonTest.java b/wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/HttpWagonTest.java
deleted file mode 100644
index 04a5cbe..0000000
--- a/wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/HttpWagonTest.java
+++ /dev/null
@@ -1,87 +0,0 @@
-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.FileTestUtils;
-import org.apache.maven.wagon.WagonTestCase;
-import org.codehaus.plexus.jetty.Httpd;
-
-import java.io.File;
-
-/**
- * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
- * @version $Id$
- */
-public class HttpWagonTest
- extends WagonTestCase
-{
-
- public HttpWagonTest( String testName )
- {
- super( testName );
- }
-
- private Httpd httpd;
-
- protected String getProtocol()
- {
- return "http";
- }
-
- protected String getTestRepositoryUrl()
- {
- return "http://localhost:10007";
- }
-
- protected void setupWagonTestingFixtures()
- throws Exception
- {
- // For a PUT the artifact must exist already which is how a PUT works by
- // default so we must place a dummy artifact in the http repo first before
- // the actual PUT operation.
-
- // File round trip testing
-
- File file = FileTestUtils.createUniqueFile( "local-repository", "test-resource.txt" ) ;
-
- file.delete();
-
- file.getParentFile().mkdirs();
-
- FileTestUtils.generateFile( file.getAbsolutePath(), "file-dummy" );
-
- // For a PUT the artifact must exist already which is how a PUT works by
- // default so we must place a dummy artifact in the http repo first before
- // the actual PUT operation.
-
- File f = new File( FileTestUtils.createDir( "http-repository"), "test-resource.txt" );
-
- f.delete();
-
- f.getParentFile().mkdirs();
-
- FileTestUtils.generateFile( f.getAbsolutePath(), "artifact-dummy" );
-
- httpd = (Httpd) lookup( Httpd.ROLE );
- }
-
- protected void tearDownWagonTestingFixtures()
- throws Exception
- {
- release( httpd );
- }
-}
diff --git a/wagon-providers/wagon-http/src/test/resources/org/apache/maven/wagon/providers/http/HttpWagonTest.xml b/wagon-providers/wagon-http/src/test/resources/org/apache/maven/wagon/providers/http/HttpWagonTest.xml
deleted file mode 100644
index 281fafc..0000000
--- a/wagon-providers/wagon-http/src/test/resources/org/apache/maven/wagon/providers/http/HttpWagonTest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<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/test-output/http-repository</document-root>
- </context>
- </contexts>
- </configuration>
- </component>
- </components>
-</plexus>
\ No newline at end of file
diff --git a/wagon-providers/wagon-http/xdocs/changes.xml b/wagon-providers/wagon-http/xdocs/changes.xml
deleted file mode 100644
index 1d013df..0000000
--- a/wagon-providers/wagon-http/xdocs/changes.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0"?>
-<document>
- <properties>
- <title>Changes</title>
- <author email="michal.maczka@dimatics.com">Michal Maczka</author>
- </properties>
- <body>
- <release version="1.0-beta-1" date="in CVS">
- <action dev="mmaczka" type="add">
- Imported to Apache CVS
- </action>
- </release>
- </body>
-</document>
-
diff --git a/wagon-providers/wagon-http/xdocs/index.xml b/wagon-providers/wagon-http/xdocs/index.xml
deleted file mode 100644
index e7745e3..0000000
--- a/wagon-providers/wagon-http/xdocs/index.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0"?>
-
-<document>
-
- <properties>
- <title>Wagon HTTP provider</title>
- <author email="michal.maczka@dimatics.com">Michal Maczka</author>
- </properties>
-
- <body>
-
- <section name="Wagon File provider">
- <p>
- This project is an implementation of Wagon provider
- for <b>http</b> and <b>https</b> protocols
- </p>
- </section>
- <section name="Featuries">
- <p>
- <ul>
- <li>Only <b>GET</b> request is supported</li>
- </ul>
- </p>
- </section>
- <section name="TODO">
- <p>
- <ul>
- <li>
- Support for proxy servers should match the one offered
- by <b>commons-httpclient</b>
- </li>
- <li>
- If dedicated web application were written,
- or generally speaking if some dedicated service were istallled
- at the web server with which HttpWagon is communicating it would
- be possible to implement PUT request.
- </li>
- </ul>
- </p>
- </section>
- </body>
-</document>
diff --git a/wagon-providers/wagon-http/xdocs/navigation.xml b/wagon-providers/wagon-http/xdocs/navigation.xml
deleted file mode 100644
index bffc859..0000000
--- a/wagon-providers/wagon-http/xdocs/navigation.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<project
- name="Wagon FTP provider"
- href="http://maven.apache.org">
-
- <title>Wagon</title>
- <logo href="http://maven.apache.org/maven/images/maven.jsp">Maven</logo>
- <organizationLogo href="/images/jakarta-logo.gif">Jakarta</organizationLogo>
- <body>
- <links>
- <item name="Maven" href="http://maven.apache.org"/>
- <item name="Wagon Main" href="http://maven.apache.org/wagon"/>
- <item name="Jakarta Commons/Net" href="http://jakarta.apache.org/commons/net/"/>
- </links>
-
- <menu name="Wagon">
- <item name="Main" href="/index.html"/>
- <item name="Status" href="/status.html"/>
- <item name="News" href="/news.html"/>
- </menu>
- </body>
-</project>
-
diff --git a/wagon-providers/wagon-ssh/.cvsignore b/wagon-providers/wagon-ssh/.cvsignore
deleted file mode 100644
index db40082..0000000
--- a/wagon-providers/wagon-ssh/.cvsignore
+++ /dev/null
@@ -1,10 +0,0 @@
-*.log
-target
-.classpath
-.project
-default.lst
-test.out
-default.ajsym
-*.iml
-*.ipr
-*.iws
diff --git a/wagon-providers/wagon-ssh/LICENSE.txt b/wagon-providers/wagon-ssh/LICENSE.txt
deleted file mode 100644
index d645695..0000000
--- a/wagon-providers/wagon-ssh/LICENSE.txt
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- 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.
diff --git a/wagon-providers/wagon-ssh/pom.xml b/wagon-providers/wagon-ssh/pom.xml
deleted file mode 100644
index c03556b..0000000
--- a/wagon-providers/wagon-ssh/pom.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<project>
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>maven</groupId>
- <artifactId>wagon-providers</artifactId>
- <version>1.0-alpha-2-SNAPSHOT</version>
- </parent>
- <groupId>maven</groupId>
- <artifactId>wagon-ssh</artifactId>
- <name>Wagon SSH Provider</name>
- <version>1.0-alpha-2-SNAPSHOT</version>
- <description></description>
- <shortDescription>Wagon Provider for protocols from SSH2 family based on JSCH</shortDescription>
- <package>org.apache.maven.wagon.providers.ssh</package>
- <inceptionYear>2003</inceptionYear>
- <developers>
- <developer>
- <name>Michal Maczka</name>
- <id>michal</id>
- <email>michal@codehaus.org</email>
- <roles>
- <role>Creator</role>
- <role>Developer</role>
- <role>Release Manager</role>
- </roles>
- </developer>
- </developers>
- <dependencies>
- <dependency>
- <groupId>jsch</groupId>
- <artifactId>jsch</artifactId>
- <version>0.1.14</version>
- <type>jar</type>
- </dependency>
- </dependencies>
-</project>
diff --git a/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/ScpWagon.java b/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/ScpWagon.java
deleted file mode 100644
index d5e18b8..0000000
--- a/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/ScpWagon.java
+++ /dev/null
@@ -1,636 +0,0 @@
-package org.apache.maven.wagon.providers.ssh;
-
-/*
- * 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 com.jcraft.jsch.ChannelExec;
-import com.jcraft.jsch.JSch;
-import com.jcraft.jsch.Proxy;
-import com.jcraft.jsch.ProxyHTTP;
-import com.jcraft.jsch.ProxySOCKS5;
-import com.jcraft.jsch.Session;
-import com.jcraft.jsch.UserInfo;
-import org.apache.maven.wagon.AbstractWagon;
-import org.apache.maven.wagon.LazyFileOutputStream;
-import org.apache.maven.wagon.PathUtils;
-import org.apache.maven.wagon.ResourceDoesNotExistException;
-import org.apache.maven.wagon.TransferFailedException;
-import org.apache.maven.wagon.WagonConstants;
-import org.apache.maven.wagon.repository.RepositoryPermissions;
-import org.apache.maven.wagon.resource.Resource;
-import org.apache.maven.wagon.events.TransferEvent;
-import org.apache.maven.wagon.authentication.AuthenticationException;
-import org.apache.maven.wagon.authentication.AuthenticationInfo;
-import org.apache.maven.wagon.authorization.AuthorizationException;
-import org.apache.maven.wagon.proxy.ProxyInfo;
-import org.codehaus.plexus.util.StringUtils;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-/**
- * A base class for deployers and fetchers using protocols from SSH2 family and
- * JSch library for underlining implmenetation
- * <p/>
- * This is responsible for authentification stage of the process.
- * <p/>
- * We will first try to use public keys for authentication and if that doesn't
- * work then we fall back to using the login and password
- *
- * @todo [BP] add compression flag
- *
- * @version $Id$
- */
-public class ScpWagon
- extends AbstractWagon implements SshCommandExecutor
-{
- public static String EXEC_CHANNEL = "exec";
-
- public static int DEFAULT_SSH_PORT = 22;
-
- public static int SOCKS5_PROXY_PORT = 1080;
-
- protected Session session = null;
-
- // ----------------------------------------------------------------------
- //
- // ----------------------------------------------------------------------
-
- public void openConnection()
- throws AuthenticationException
- {
- try
- {
- final AuthenticationInfo authInfo = getRepository().getAuthenticationInfo();
-
- if ( authInfo == null )
- {
- throw new IllegalArgumentException( "Authentication Credentials cannot be null for SSH protocol" );
- }
-
- JSch jsch = new JSch();
-
- int port = getRepository().getPort();
-
- if ( port == WagonConstants.UNKNOWN_PORT )
- {
- port = DEFAULT_SSH_PORT;
- }
-
- String host = getRepository().getHost();
-
- session = jsch.getSession( authInfo.getUserName(), host, port );
-
- // If user don't define a password, he want to use a private key
- if ( authInfo.getPassword() == null )
- {
- File privateKey;
-
- if ( authInfo.getPrivateKey() != null )
- {
- privateKey = new File( authInfo.getPrivateKey() );
- }
- else
- {
- privateKey = findPrivateKey();
- }
-
- if ( privateKey.exists() )
- {
- if ( authInfo.getPassphrase() == null )
- {
- authInfo.setPassphrase( "" );
- }
-
- fireSessionDebug( "Using private key: " + privateKey );
-
- jsch.addIdentity( privateKey.getAbsolutePath(), authInfo.getPassphrase() );
- }
- else
- {
- String msg = "Private key was not found. You must define a private key or a password for repo: " + getRepository().getName();
-
- throw new AuthenticationException( msg );
- }
- }
-
- if ( proxyInfo != null && proxyInfo.getHost() != null )
- {
- Proxy proxy;
-
- int proxyPort = proxyInfo.getPort();
-
- // HACK: if port == 1080 we will use SOCKS5 Proxy, otherwise will use HTTP Proxy
- if ( proxyPort == SOCKS5_PROXY_PORT )
- {
- proxy = new ProxySOCKS5( proxyInfo.getHost() );
- ( ( ProxySOCKS5 ) proxy ).setUserPasswd( proxyInfo.getUserName(),
- proxyInfo.getPassword() );
- }
- else
- {
- proxy = new ProxyHTTP( proxyInfo.getHost(), proxyPort );
- ( ( ProxyHTTP ) proxy ).setUserPasswd( proxyInfo.getUserName(),
- proxyInfo.getPassword() );
- }
-
- proxy.connect( session, host, port );
- }
-
- // username and password will be given via UserInfo interface.
- UserInfo ui = new WagonUserInfo( authInfo );
-
- session.setUserInfo( ui );
-
- session.connect();
- }
- catch ( Exception e )
- {
- fireSessionError( e );
-
- throw new AuthenticationException( "Cannot connect. Reason: " + e.getMessage(), e );
- }
- }
-
- // ----------------------------------------------------------------------
- //
- // ----------------------------------------------------------------------
-
- private File findPrivateKey()
- {
- String privateKeyDirectory = System.getProperty( "wagon.privateKeyDirectory" );
-
- if ( privateKeyDirectory == null )
- {
- privateKeyDirectory = System.getProperty( "user.home" );
- }
-
- File privateKey = new File( privateKeyDirectory, ".ssh/id_dsa" );
-
- if ( !privateKey.exists() )
- {
- privateKey = new File( privateKeyDirectory, ".ssh/id_rsa" );
- }
-
- return privateKey;
- }
-
- // ----------------------------------------------------------------------
- //
- // ----------------------------------------------------------------------
-
- public void closeConnection()
- {
- if ( session != null )
- {
- session.disconnect();
- }
- }
-
- public void executeCommand( String command )
- throws TransferFailedException
- {
- ChannelExec channel = null;
-
- try
- {
- fireTransferDebug( "Executing command: " + command );
-
- channel = ( ChannelExec ) session.openChannel( EXEC_CHANNEL );
-
- channel.setCommand( command );
-
- channel.connect();
- }
- catch ( Exception e )
- {
- throw new TransferFailedException( "Cannot execute remote command: " + command, e );
- }
- finally
- {
- if ( channel != null )
- {
- channel.disconnect();
- }
- }
- }
-
- public void put( File source, String resourceName )
- throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException
- {
-
- String basedir = getRepository().getBasedir();
-
- resourceName = StringUtils.replace(resourceName, "\\", "/");
- String dir = PathUtils.dirname( resourceName );
- dir = StringUtils.replace(dir, "\\", "/");
-
- String mkdirCmd = "mkdir -p " + basedir + "/" + dir + "\n";
-
- executeCommand( mkdirCmd );
-
- ChannelExec channel = null;
-
- //I/O streams for remote scp
- OutputStream out = null;
-
- InputStream in;
-
- try
- {
- // exec 'scp -t rfile' remotely
- String command = "scp -t " + basedir + "/" + resourceName;
-
- fireTransferDebug( "Executing command: " + command );
-
- channel = ( ChannelExec ) session.openChannel( EXEC_CHANNEL );
-
- channel.setCommand( command );
-
- // get I/O streams for remote scp
- out = channel.getOutputStream();
-
- in = channel.getInputStream();
-
- channel.connect();
-
- byte[] tmp = new byte[ 1 ];
-
- if ( checkAck( in ) != 0 )
- {
- throw new TransferFailedException( "ACK check failed" );
- }
-
- // send "C0644 filesize filename", where filename should not include '/'
- long filesize = source.length();
-
- command = "C0644 " + filesize + " ";
-
- if( resourceName.lastIndexOf( '/' ) > 0 )
- {
- command += resourceName.substring( resourceName.lastIndexOf( '/' ) + 1 );
- }
- else
- {
- command+=resourceName;
- }
-
- command += "\n";
-
- out.write( command.getBytes() );
-
- out.flush();
-
- if ( checkAck( in ) != 0 )
- {
- throw new TransferFailedException( "ACK check failed" );
- }
-
-
- Resource resource = new Resource( resourceName );
-
- putTransfer( resource, source, out, false );
-
- byte[] buf = new byte[ 1024 ];
-
- // send '\0'
- buf[ 0 ] = 0;
-
- out.write( buf, 0, 1 );
-
- out.flush();
-
- if ( checkAck( in ) != 0 )
- {
- throw new TransferFailedException( "ACK check failed" );
- }
- }
- catch ( Exception e )
- {
- String msg = "Error occured while deploying '" + resourceName + "' to remote repository: " + getRepository().getUrl();
-
- throw new TransferFailedException( msg, e );
- }
-
- RepositoryPermissions permissions = getRepository().getPermissions();
-
- if ( permissions != null && permissions.getGroup() != null )
- {
- executeCommand( "chgrp " + permissions.getGroup() + " " + basedir + "/" + resourceName + "\n" );
- }
-
- if ( permissions != null && permissions.getFileMode() != null )
- {
- executeCommand( "chmod " + permissions.getFileMode() + " " + basedir + "/" + resourceName + "\n" );
- }
-
- if ( channel != null )
- {
- shutdownStream( out );
-
- channel.disconnect();
- }
- }
-
- public void get( String resourceName, File destination )
- throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException
- {
- ChannelExec channel = null;
-
- //I/O streams for remote scp
- OutputStream out = null;
-
- InputStream in = null;
-
- createParentDirectories( destination );
-
- LazyFileOutputStream outputStream = new LazyFileOutputStream( destination );
-
- String basedir = getRepository().getBasedir();
-
- //@todo get content lenght and last modified
- Resource resource = new Resource( resourceName );
-
-
- try
- {
- String cmd = "scp -f " + basedir + "/" + resourceName;
-
- fireTransferDebug( "Executing command: " + cmd );
-
- channel = ( ChannelExec ) session.openChannel( EXEC_CHANNEL );
-
- channel.setCommand( cmd );
-
- // get I/O streams for remote scp
- out = channel.getOutputStream();
-
- in = channel.getInputStream();
-
- channel.connect();
-
- byte[] buf = new byte[ 1024 ];
-
- // send '\0'
- buf[ 0 ] = 0;
-
- out.write( buf, 0, 1 );
-
- out.flush();
-
- while ( true )
- {
- // TODO: is this really an ACK, or just an in.read()? If the latter, change checkAck method to not return a value, but throw an exception on non-zero result
- int c = checkAck( in );
-
- if ( c != 'C' )
- {
- break;
- }
-
- // read '0644 '
- in.read( buf, 0, 5 );
-
- int filesize = 0;
-
- // get file size
- while ( true )
- {
- in.read( buf, 0, 1 );
-
- if ( buf[ 0 ] == ' ' )
- {
- break;
- }
-
- filesize = filesize * 10 + ( buf[ 0 ] - '0' );
- }
-
- resource.setContentLength( filesize );
-
-
- for ( int i = 0; ; i++ )
- {
- in.read( buf, i, 1 );
-
- if ( buf[ i ] == ( byte ) 0x0a )
- {
- break;
- }
- }
-
- // send '\0'
- buf[ 0 ] = 0;
-
- out.write( buf, 0, 1 );
-
- out.flush();
-
- fireGetStarted( resource, destination );
-
- TransferEvent transferEvent = new TransferEvent( this, resource, TransferEvent.TRANSFER_PROGRESS, TransferEvent.REQUEST_GET );
-
- try
- {
- while ( true )
- {
- int len = Math.min( buf.length, filesize );
-
- in.read( buf, 0, len );
-
- outputStream.write( buf, 0, len );
-
- fireTransferProgress( transferEvent, buf, len );
-
- filesize -= len;
-
- if ( filesize == 0 )
- {
- break;
- }
- }
- }
- catch ( IOException e )
- {
- fireTransferError( resource, e );
-
- shutdownStream( outputStream );
-
- if ( destination.exists() )
- {
- boolean deleted = destination.delete();
-
- if ( !deleted )
- {
- destination.deleteOnExit();
- }
- }
-
- String msg = "GET request of: " + resource + " from " + repository.getName() + "failed";
-
- throw new TransferFailedException( msg, e );
-
- }
-
- fireGetCompleted( resource, destination );
-
- if ( checkAck( in ) != 0 )
- {
- throw new TransferFailedException( "Wrong ACK" );
- }
- else
- {
- fireTransferDebug( "ACK check: OK" );
- }
-
- // send '\0'
- buf[ 0 ] = 0;
-
- out.write( buf, 0, 1 );
-
- out.flush();
- }
- }
- catch ( Exception e )
- {
- fireTransferError( resource, e );
-
- if ( destination.exists() )
- {
- boolean deleted = destination.delete();
-
- if ( !deleted )
- {
- destination.deleteOnExit();
- }
- }
-
- String msg = "Error occured while deploying to remote repository:" + getRepository();
-
- throw new TransferFailedException( msg, e );
- }
- finally
- {
- if ( out != null )
- {
- shutdownStream( out );
- }
- if ( channel != null )
- {
- channel.disconnect();
- }
-
- shutdownStream( outputStream );
- }
- }
-
- public boolean getIfNewer( String resourceName, File destination, long timestamp )
- {
- throw new UnsupportedOperationException( "getIfNewer is scp wagon must be still implemented" );
- }
-
-// ----------------------------------------------------------------------
-// JSch user info
-// ----------------------------------------------------------------------
-// TODO: are the prompt values really right? Is there an alternative to UserInfo?
- public static class WagonUserInfo
- implements UserInfo
- {
- AuthenticationInfo authInfo;
-
- WagonUserInfo( AuthenticationInfo authInfo )
- {
- this.authInfo = authInfo;
- }
-
- public String getPassphrase()
- {
- return authInfo.getPassphrase();
- }
-
- public String getPassword()
- {
- return authInfo.getPassword();
- }
-
- public boolean promptPassphrase( String arg0 )
- {
- return true;
- }
-
- public boolean promptPassword( String arg0 )
- {
- return true;
- }
-
- public boolean promptYesNo( String arg0 )
- {
- return true;
- }
-
- public void showMessage( String message )
- {
- // TODO: is this really debug?
- //fireTransferDebug( message );
- }
- }
-
- static int checkAck( InputStream in ) throws IOException
- {
- int b = in.read();
- // b may be 0 for success,
- // 1 for error,
- // 2 for fatal error,
- // -1
-
- if ( b == 0 || b == -1 )
- {
- return b;
- }
-
- if ( b == 1 || b == 2 )
- {
- StringBuffer sb = new StringBuffer();
-
- int c;
-
- do
- {
- c = in.read();
-
- sb.append( ( char ) c );
- }
- while ( c != '\n' );
-
- if ( b == 1 )
- {
- // TODO: log (throw exception?)
- // error
- System.out.print( sb.toString() );
- }
- if ( b == 2 )
- {
- // TODO: throw exception
- // fatal error
- System.out.print( sb.toString() );
- }
- }
-
- return b;
- }
-}
diff --git a/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/SshCommandExecutor.java b/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/SshCommandExecutor.java
deleted file mode 100644
index 991e6d4..0000000
--- a/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/SshCommandExecutor.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package org.apache.maven.wagon.providers.ssh;
-
-import org.apache.maven.wagon.Wagon;
-import org.apache.maven.wagon.TransferFailedException;
-
-/**
- * @author <a href="mailto:mmaczka@interia.pl">Michal Maczka</a>
- *
- * @version $Id$
- *
- */
-public interface SshCommandExecutor extends Wagon
-{
- void executeCommand( String command ) throws TransferFailedException;
-}
diff --git a/wagon-providers/wagon-ssh/src/main/resources/META-INF/plexus/components.xml b/wagon-providers/wagon-ssh/src/main/resources/META-INF/plexus/components.xml
deleted file mode 100644
index 7a133db..0000000
--- a/wagon-providers/wagon-ssh/src/main/resources/META-INF/plexus/components.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<component-set>
- <components>
- <component>
- <role>org.apache.maven.wagon.Wagon</role>
- <role-hint>scp</role-hint>
- <implementation>org.apache.maven.wagon.providers.ssh.ScpWagon</implementation>
- <instantiation-strategy>per-lookup</instantiation-strategy>
- </component>
- <component>
- <role>org.apache.maven.wagon.providers.ssh.SshCommandExecutor</role>
- <implementation>org.apache.maven.wagon.providers.ssh.ScpWagon</implementation>
- <instantiation-strategy>per-lookup</instantiation-strategy>
- </component>
- </components>
-</component-set>
diff --git a/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/ScpWagonTest.java b/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/ScpWagonTest.java
deleted file mode 100644
index f346d3d..0000000
--- a/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/ScpWagonTest.java
+++ /dev/null
@@ -1,68 +0,0 @@
-package org.apache.maven.wagon.providers.ssh;
-
-/*
- * 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.authentication.AuthenticationInfo;
-
-import java.io.File;
-
-/**
- * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
- * @version $Id$
- */
-public class ScpWagonTest
- extends WagonTestCase
-{
- public ScpWagonTest( String testName )
- {
- super( testName );
- }
-
- protected String getProtocol()
- {
- return "scp";
- }
-
- public String getTestRepositoryUrl()
- {
- return TestData.getTestRepositoryUrl();
- }
-
-
-
- protected AuthenticationInfo getAuthInfo()
- {
- AuthenticationInfo authInfo = new AuthenticationInfo();
-
- String userName = TestData.getUserName();
-
- authInfo.setUserName( userName );
-
- File privateKey = TestData.getPrivateKey() ;
-
- if ( privateKey.exists() )
- {
- authInfo.setPrivateKey( privateKey.getAbsolutePath() );
-
- authInfo.setPassphrase( "" );
- }
-
- return authInfo;
- }
-
-}
diff --git a/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/ScpWagonWithSshPrivateKeySearchTest.java b/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/ScpWagonWithSshPrivateKeySearchTest.java
deleted file mode 100644
index 06567af..0000000
--- a/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/ScpWagonWithSshPrivateKeySearchTest.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package org.apache.maven.wagon.providers.ssh;
-
-/*
- * 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.authentication.AuthenticationInfo;
-
-/**
- * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
- * @version $Id$
- */
-public class ScpWagonWithSshPrivateKeySearchTest
- extends WagonTestCase
-{
- public ScpWagonWithSshPrivateKeySearchTest( String testName )
- {
- super( testName );
-
- }
-
- protected String getProtocol()
- {
- return "scp";
- }
-
- public String getTestRepositoryUrl()
- {
- return TestData.getTestRepositoryUrl();
- }
-
-
- protected AuthenticationInfo getAuthInfo()
- {
- AuthenticationInfo authInfo = new AuthenticationInfo();
-
- String userName = TestData.getUserName();
-
- authInfo.setUserName( userName );
-
- authInfo.setPassphrase( "" );
-
- return authInfo;
- }
-
-
-}
diff --git a/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/TestData.java b/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/TestData.java
deleted file mode 100644
index 6a15479..0000000
--- a/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/TestData.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package org.apache.maven.wagon.providers.ssh;
-
-/*
- * 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 java.io.File;
-
-/**
- * @author <a href="michal@codehaus.org">Michal Maczka</a>
- * @version $Id$
- */
-public class TestData
-{
- public static String getTestRepositoryUrl()
- {
- return "scp://beaver.codehaus.org//home/projects/" + getUserName() + "/public_html";
- }
-
- public static String getUserName()
- {
-
- String retValue = System.getProperty( "testuser.name" );
-
- if ( retValue == null )
- {
- retValue = System.getProperty( "user.name" );
- }
-
- return retValue;
- }
-
- public static File getPrivateKey()
- {
- File retValue = new File( System.getProperty( "user.home" ), "/.ssh/id_dsa" );
-
- return retValue;
- }
-}
diff --git a/wagon-providers/wagon-ssh/xdocs/changes.xml b/wagon-providers/wagon-ssh/xdocs/changes.xml
deleted file mode 100644
index 1d013df..0000000
--- a/wagon-providers/wagon-ssh/xdocs/changes.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0"?>
-<document>
- <properties>
- <title>Changes</title>
- <author email="michal.maczka@dimatics.com">Michal Maczka</author>
- </properties>
- <body>
- <release version="1.0-beta-1" date="in CVS">
- <action dev="mmaczka" type="add">
- Imported to Apache CVS
- </action>
- </release>
- </body>
-</document>
-
diff --git a/wagon-providers/wagon-ssh/xdocs/index.xml b/wagon-providers/wagon-ssh/xdocs/index.xml
deleted file mode 100644
index eaacf71..0000000
--- a/wagon-providers/wagon-ssh/xdocs/index.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0"?>
-
-<document>
-
- <properties>
- <title>Wagon File provider</title>
- <author email="michal.maczka@dimatics.com">Michal Maczka</author>
- </properties>
-
- <body>
-
- <section name="Wagon SCH provider">
- <p>
- This project is an implementation of Wagon provider
- for <b>scp</b> and <b>sftp</b> protocols
- using <a href="http://www.jcraft.com/jsch/">JSCH</a> library
- </p>
- </section>
- <section name="Features">
- <p>
- <ul>
- <li>
- SCP and SFTP protocols are supported.
- </li>
- <li>
- <b>PUT</b> and <b>GET</b> requests are
- are supported for both protocols.
- </li>
- <li>
- SCH Wagon is able to set remote UNIX group
- for deployed resource (see: xxx ), but for SFTP protocol
- group id should be a positive integer.
- </li>
- </ul>
- </p>
- </section>
- </body>
-</document>
diff --git a/wagon-providers/wagon-ssh/xdocs/navigation.xml b/wagon-providers/wagon-ssh/xdocs/navigation.xml
deleted file mode 100644
index bffc859..0000000
--- a/wagon-providers/wagon-ssh/xdocs/navigation.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<project
- name="Wagon FTP provider"
- href="http://maven.apache.org">
-
- <title>Wagon</title>
- <logo href="http://maven.apache.org/maven/images/maven.jsp">Maven</logo>
- <organizationLogo href="/images/jakarta-logo.gif">Jakarta</organizationLogo>
- <body>
- <links>
- <item name="Maven" href="http://maven.apache.org"/>
- <item name="Wagon Main" href="http://maven.apache.org/wagon"/>
- <item name="Jakarta Commons/Net" href="http://jakarta.apache.org/commons/net/"/>
- </links>
-
- <menu name="Wagon">
- <item name="Main" href="/index.html"/>
- <item name="Status" href="/status.html"/>
- <item name="News" href="/news.html"/>
- </menu>
- </body>
-</project>
-