From 9a2860b467d9c130c2d5ddf76ba3c3dd9c34442a Mon Sep 17 00:00:00 2001 From: Martin Stockhammer Date: Tue, 16 Jun 2020 10:57:24 +0200 Subject: [PATCH] Removing reference to URL in content API --- .../repository/RemoteRepositoryContent.java | 13 ------------- .../mock/RemoteRepositoryContentMock.java | 7 ------- .../proxy/maven/MavenRepositoryProxyHandler.java | 12 ++++++++---- .../mock/RemoteRepositoryContentMock.java | 7 ------- .../content/RemoteDefaultRepositoryContent.java | 15 --------------- 5 files changed, 8 insertions(+), 46 deletions(-) diff --git a/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/RemoteRepositoryContent.java b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/RemoteRepositoryContent.java index 3c58aae73..bc67aa0fe 100644 --- a/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/RemoteRepositoryContent.java +++ b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/RemoteRepositoryContent.java @@ -51,19 +51,6 @@ public interface RemoteRepositoryContent extends RepositoryContent */ RemoteRepository getRepository(); - /** - *

- * Convenience method to get the repository url. - *

- * - *

- * Equivalent to calling new RepositoryURL( this.getRepository().getUrl() ) - *

- * - * @return the repository url. - */ - RepositoryURL getURL(); - /** * Set the repository configuration to associate with this * repository content. diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/mock/RemoteRepositoryContentMock.java b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/mock/RemoteRepositoryContentMock.java index e9410c460..b26ca756e 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/mock/RemoteRepositoryContentMock.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/mock/RemoteRepositoryContentMock.java @@ -19,7 +19,6 @@ package org.apache.archiva.repository.mock; * under the License. */ -import org.apache.archiva.model.RepositoryURL; import org.apache.archiva.repository.LayoutException; import org.apache.archiva.repository.RemoteRepository; import org.apache.archiva.repository.RemoteRepositoryContent; @@ -46,12 +45,6 @@ public class RemoteRepositoryContentMock implements RemoteRepositoryContent return null; } - @Override - public RepositoryURL getURL( ) - { - return null; - } - @Override public void setRepository( RemoteRepository repo ) { diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/main/java/org/apache/archiva/proxy/maven/MavenRepositoryProxyHandler.java b/archiva-modules/archiva-maven/archiva-maven-proxy/src/main/java/org/apache/archiva/proxy/maven/MavenRepositoryProxyHandler.java index 039ca0376..32560ebdd 100644 --- a/archiva-modules/archiva-maven/archiva-maven-proxy/src/main/java/org/apache/archiva/proxy/maven/MavenRepositoryProxyHandler.java +++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/main/java/org/apache/archiva/proxy/maven/MavenRepositoryProxyHandler.java @@ -19,7 +19,6 @@ package org.apache.archiva.proxy.maven; * under the License. */ -import org.apache.archiva.model.RepositoryURL; import org.apache.archiva.proxy.DefaultRepositoryProxyHandler; import org.apache.archiva.proxy.NotFoundException; import org.apache.archiva.proxy.NotModifiedException; @@ -27,7 +26,10 @@ import org.apache.archiva.proxy.ProxyException; import org.apache.archiva.proxy.model.NetworkProxy; import org.apache.archiva.proxy.model.ProxyConnector; import org.apache.archiva.proxy.model.RepositoryProxyHandler; -import org.apache.archiva.repository.*; +import org.apache.archiva.repository.ManagedRepository; +import org.apache.archiva.repository.RemoteRepository; +import org.apache.archiva.repository.RepositoryCredentials; +import org.apache.archiva.repository.RepositoryType; import org.apache.archiva.repository.base.PasswordCredentials; import org.apache.archiva.repository.storage.StorageAsset; import org.apache.commons.lang3.StringUtils; @@ -45,6 +47,7 @@ import org.springframework.stereotype.Service; import javax.inject.Inject; import java.io.IOException; +import java.net.URI; import java.nio.file.Files; import java.nio.file.Path; import java.util.ArrayList; @@ -116,14 +119,15 @@ public class MavenRepositoryProxyHandler extends DefaultRepositoryProxyHandler { * @throws ProxyException * @throws NotModifiedException */ + @Override protected void transferResources( ProxyConnector connector, RemoteRepository remoteRepository, StorageAsset tmpResource, StorageAsset[] checksumFiles, String url, String remotePath, StorageAsset resource, Path workingDirectory, ManagedRepository repository ) throws ProxyException, NotModifiedException { Wagon wagon = null; try { - RepositoryURL repoUrl = remoteRepository.getContent().getURL(); - String protocol = repoUrl.getProtocol(); + URI repoUrl = remoteRepository.getLocation( ); + String protocol = repoUrl.getScheme( ); NetworkProxy networkProxy = null; String proxyId = connector.getProxyId(); if (StringUtils.isNotBlank(proxyId)) { diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/repository/mock/RemoteRepositoryContentMock.java b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/repository/mock/RemoteRepositoryContentMock.java index 6e51de0c0..7aacf06b0 100644 --- a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/repository/mock/RemoteRepositoryContentMock.java +++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/repository/mock/RemoteRepositoryContentMock.java @@ -20,7 +20,6 @@ package org.apache.archiva.repository.mock; */ import org.apache.archiva.common.utils.VersionUtil; -import org.apache.archiva.model.RepositoryURL; import org.apache.archiva.repository.LayoutException; import org.apache.archiva.repository.RemoteRepository; import org.apache.archiva.repository.RemoteRepositoryContent; @@ -52,12 +51,6 @@ public class RemoteRepositoryContentMock implements RemoteRepositoryContent return repository; } - @Override - public RepositoryURL getURL( ) - { - return new RepositoryURL(repository.getLocation().toString()); - } - @Override public void setRepository( RemoteRepository repo ) { diff --git a/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/content/RemoteDefaultRepositoryContent.java b/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/content/RemoteDefaultRepositoryContent.java index 532062948..09876cb9b 100644 --- a/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/content/RemoteDefaultRepositoryContent.java +++ b/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/content/RemoteDefaultRepositoryContent.java @@ -18,7 +18,6 @@ package org.apache.archiva.repository.maven.content; * under the License. */ -import org.apache.archiva.model.RepositoryURL; import org.apache.archiva.repository.RemoteRepository; import org.apache.archiva.repository.RemoteRepositoryContent; @@ -48,20 +47,6 @@ public class RemoteDefaultRepositoryContent return repository; } - @Override - public RepositoryURL getURL( ) - { - try - { - return new RepositoryURL( repository.getLocation( ).toString( ) ); - } - catch ( Exception e ) - { - log.error( "Could not convert location url {}", repository.getLocation( ) ); - return new RepositoryURL( "" ); - } - } - @Override public void setRepository( RemoteRepository repository ) {