BefatorNix/java/wagon/wagon-api.patch
2025-10-05 22:57:02 +02:00

386 lines
14 KiB
Diff

diff --git a/project.xml b/project.xml
index 6da5111..d4ee587 100644
--- a/project.xml
+++ b/project.xml
@@ -75,11 +75,6 @@
<version>1.0-SNAPSHOT</version>
</dependency>
<!-- Testing -->
- <dependency>
- <groupId>maven</groupId>
- <artifactId>maven-model</artifactId>
- <version>2.0-SNAPSHOT</version>
- </dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
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
index 1db31bd..96380a6 100644
--- 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
@@ -17,7 +17,6 @@ package org.apache.maven.wagon;
* ====================================================================
*/
-import org.apache.maven.wagon.artifact.Artifact;
import org.apache.maven.wagon.authentication.AuthenticationException;
import org.apache.maven.wagon.events.SessionEvent;
import org.apache.maven.wagon.events.SessionEventSupport;
@@ -224,25 +223,6 @@ public abstract class AbstractWagon
//
// ----------------------------------------------------------------------
- protected String artifactUrl( Artifact artifact )
- {
- return source.artifactUrl( artifact );
- }
-
- protected String artifactPath( Artifact artifact )
- {
- return source.artifactPath( artifact );
- }
-
- protected String fullArtifactPath( Artifact artifact )
- {
- return source.fullArtifactPath( artifact );
- }
-
- // ----------------------------------------------------------------------
- //
- // ----------------------------------------------------------------------
-
protected void fireTransferProgress( TransferEvent transferEvent )
{
transferEventSupport.fireTransferProgress( transferEvent );
diff --git a/wagon-provider-api/src/main/java/org/apache/maven/wagon/Conductor.java b/wagon-provider-api/src/main/java/org/apache/maven/wagon/Conductor.java
deleted file mode 100644
index fa7489b..0000000
--- a/wagon-provider-api/src/main/java/org/apache/maven/wagon/Conductor.java
+++ /dev/null
@@ -1,75 +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.codehaus.plexus.embed.Embedder;
-import org.apache.maven.wagon.manager.WagonManager;
-import org.apache.maven.wagon.repository.Repository;
-
-
-/**
- * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
- * @version $Id$
- */
-public class Conductor
- implements WagonManager
-{
- private Embedder embedder;
-
- private WagonManager wagonManager;
-
- // ----------------------------------------------------------------------
- //
- // ----------------------------------------------------------------------
-
- public Conductor()
- throws Exception
- {
- embedder = new Embedder();
-
- embedder.start();
-
- wagonManager = (WagonManager) embedder.lookup( WagonManager.ROLE );
- }
-
- // ----------------------------------------------------------------------
- //
- // ----------------------------------------------------------------------
-
- public Wagon getWagon( String protocol )
- throws UnsupportedProtocolException
- {
- return wagonManager.getWagon( protocol );
- }
-
- public void releaseWagon( Wagon wagon ) throws Exception
- {
- wagonManager.releaseWagon( wagon );
- }
-
-
- public void addRepository( Repository repository )
- {
- wagonManager.addRepository( repository );
- }
-
- public void removeRepository( Repository repository )
- {
- wagonManager.removeRepository( repository );
- }
-}
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
index 4e68996..9469aa1 100644
--- 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
@@ -17,7 +17,6 @@ package org.apache.maven.wagon;
* ====================================================================
*/
-import org.apache.maven.wagon.artifact.Artifact;
import org.apache.maven.wagon.authentication.AuthenticationException;
import org.apache.maven.wagon.authorization.AuthorizationException;
@@ -48,36 +47,6 @@ public abstract class StreamWagon
public abstract void closeConnection()
throws ConnectionException;
- // ----------------------------------------------------------------------
- // We take the artifact and create the resource from that so we can
- // just hand it off to get(String,File) below. So we might get an
- // Artifact where:
- //
- // groupId = maven
- // artifactId = wagon-api
- // type = pom
- // extension = pom
- // version = 1.0
- // layout = ${groupId}/{$type}s/${artifactId}-${version}.${extension}
- //
- // so the resource ends up looking like:
- //
- // maven/poms/wagon-api-1.0.pom
- //
- // ----------------------------------------------------------------------
-
- public void get( Artifact artifact, File destination )
- throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException
- {
- get( artifactPath( artifact ), destination );
- }
-
- public void put( File source, Artifact artifact )
- throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException
- {
- put( source, artifactPath( artifact ) );
- }
-
// ----------------------------------------------------------------------
//
// ----------------------------------------------------------------------
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
index 1547bfc..1978cc4 100644
--- 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
@@ -17,7 +17,6 @@ package org.apache.maven.wagon;
* ====================================================================
*/
-import org.apache.maven.wagon.artifact.Artifact;
import org.apache.maven.wagon.authentication.AuthenticationException;
import org.apache.maven.wagon.authorization.AuthorizationException;
import org.apache.maven.wagon.events.SessionListener;
@@ -40,17 +39,6 @@ public interface Wagon
void put( File source, String destination )
throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException;
- // ----------------------------------------------------------------------
- // Artifact/File handling
- // ----------------------------------------------------------------------
-
- void get( Artifact artifact, File destination )
- throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException;
-
- void put( File source, Artifact artifact )
- throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException;
-
-
// ----------------------------------------------------------------------
// /Stream handling
// ----------------------------------------------------------------------
diff --git a/wagon-provider-api/src/main/java/org/apache/maven/wagon/WagonTestCase.java b/wagon-provider-api/src/main/java/org/apache/maven/wagon/WagonTestCase.java
index 520094f..d698afd 100644
--- a/wagon-provider-api/src/main/java/org/apache/maven/wagon/WagonTestCase.java
+++ b/wagon-provider-api/src/main/java/org/apache/maven/wagon/WagonTestCase.java
@@ -17,8 +17,6 @@ package org.apache.maven.wagon;
* ====================================================================
*/
-import org.apache.maven.wagon.artifact.Artifact;
-import org.apache.maven.wagon.artifact.DefaultArtifact;
import org.apache.maven.wagon.observers.Debug;
import org.apache.maven.wagon.observers.ChecksumObserver;
import org.apache.maven.wagon.repository.Repository;
@@ -47,8 +45,6 @@ public abstract class WagonTestCase
//protected MavenXpp3Reader modelReader;
- protected Artifact artifact;
-
protected File sourceFile;
protected File destFile;
@@ -194,8 +190,6 @@ public abstract class WagonTestCase
fileRoundTripTesting();
- artifactRoundTripTesting();
-
tearDownWagonTestingFixtures();
}
@@ -268,62 +262,6 @@ public abstract class WagonTestCase
compareContents( sourceFile, destFile );
}
- // ----------------------------------------------------------------------
- // File <--> Artifact/Repository round trip testing
- // ----------------------------------------------------------------------
- // 1. Place an artifact in the test repository.
- // 2. Get the same artifact that was just placed in the test repository.
- // 3. Compare the contents of the file that was place in the test
- // repository with the value of the artifact retrieved from the
- // test repository, they should be the same.
- // ----------------------------------------------------------------------
-
- protected void putArtifact()
- throws Exception
- {
- message( "Putting file into test repository " + testRepository );
-
- Wagon wagon = getWagon();
-
- wagon.connect( testRepository );
-
- artifactSourceFile = new File( basedir, "project.xml" );
-
- wagon.put( artifactSourceFile, getTestArtifact() );
-
- wagon.disconnect();
- }
-
- protected void getArtifact()
- throws Exception
- {
- message( "Getting test artifact from test repository " + testRepository );
-
- Wagon wagon = getWagon();
-
- wagon.connect( testRepository );
-
- artifactDestFile = FileTestUtils.createUniqueFile( this );
-
- artifactDestFile.deleteOnExit();
-
- wagon.get( getTestArtifact(), artifactDestFile );
-
- wagon.disconnect();
- }
-
- protected void artifactRoundTripTesting()
- throws Exception
- {
- message( "Artifact round trip testing ..." );
-
- putArtifact();
-
- getArtifact();
-
- compareContents( artifactSourceFile, artifactDestFile );
- }
-
protected void compareContents( File sourceFile, File destFile )
throws Exception
{
@@ -350,19 +288,6 @@ public abstract class WagonTestCase
System.out.println( "---------------------------------------------------------------------------------------------------------" );
}
- protected Artifact getTestArtifact()
- throws Exception
- {
- if ( artifact == null )
- {
- //Model model = modelReader.read( new FileReader( new File( basedir, "project.xml" ) ) );
-
- artifact = new DefaultArtifact( "groupId", "artifactId", "1.0", "pom" );
- }
-
- return artifact;
- }
-
// ----------------------------------------------------------------------
//
// ----------------------------------------------------------------------
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
index 41fc3a3..1b0484c 100644
--- 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
@@ -21,7 +21,6 @@ import org.apache.maven.wagon.proxy.ProxyInfo;
import org.apache.maven.wagon.authentication.AuthenticationInfo;
import org.apache.maven.wagon.WagonConstants;
import org.apache.maven.wagon.PathUtils;
-import org.apache.maven.wagon.artifact.Artifact;
import org.codehaus.plexus.util.StringUtils;
import java.io.Serializable;
@@ -57,11 +56,22 @@ public class Repository
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;
@@ -188,21 +198,6 @@ public class Repository
return layout;
}
- public String artifactPath( Artifact artifact )
- {
- return interpolateLayout( artifact.getGroupId(), artifact.getArtifactId(), artifact.getType(), artifact.getVersion() );
- }
-
- public String fullArtifactPath( Artifact artifact )
- {
- return getBasedir() + "/" + artifactPath( artifact );
- }
-
- public String artifactUrl( Artifact artifact )
- {
- return getUrl() + "/" + artifactPath( artifact );
- }
-
private String interpolateLayout( String groupId, String artifactId, String type, String version )
{
String layout = getLayout();