Removing reference to URL in content API

This commit is contained in:
Martin Stockhammer 2020-06-16 10:57:24 +02:00
parent 7a9803bf0f
commit 9a2860b467
5 changed files with 8 additions and 46 deletions

View File

@ -51,19 +51,6 @@ public interface RemoteRepositoryContent extends RepositoryContent
*/ */
RemoteRepository getRepository(); RemoteRepository getRepository();
/**
* <p>
* Convenience method to get the repository url.
* </p>
*
* <p>
* Equivalent to calling <code>new RepositoryURL( this.getRepository().getUrl() )</code>
* </p>
*
* @return the repository url.
*/
RepositoryURL getURL();
/** /**
* Set the repository configuration to associate with this * Set the repository configuration to associate with this
* repository content. * repository content.

View File

@ -19,7 +19,6 @@ package org.apache.archiva.repository.mock;
* under the License. * under the License.
*/ */
import org.apache.archiva.model.RepositoryURL;
import org.apache.archiva.repository.LayoutException; import org.apache.archiva.repository.LayoutException;
import org.apache.archiva.repository.RemoteRepository; import org.apache.archiva.repository.RemoteRepository;
import org.apache.archiva.repository.RemoteRepositoryContent; import org.apache.archiva.repository.RemoteRepositoryContent;
@ -46,12 +45,6 @@ public class RemoteRepositoryContentMock implements RemoteRepositoryContent
return null; return null;
} }
@Override
public RepositoryURL getURL( )
{
return null;
}
@Override @Override
public void setRepository( RemoteRepository repo ) public void setRepository( RemoteRepository repo )
{ {

View File

@ -19,7 +19,6 @@ package org.apache.archiva.proxy.maven;
* under the License. * under the License.
*/ */
import org.apache.archiva.model.RepositoryURL;
import org.apache.archiva.proxy.DefaultRepositoryProxyHandler; import org.apache.archiva.proxy.DefaultRepositoryProxyHandler;
import org.apache.archiva.proxy.NotFoundException; import org.apache.archiva.proxy.NotFoundException;
import org.apache.archiva.proxy.NotModifiedException; 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.NetworkProxy;
import org.apache.archiva.proxy.model.ProxyConnector; import org.apache.archiva.proxy.model.ProxyConnector;
import org.apache.archiva.proxy.model.RepositoryProxyHandler; 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.base.PasswordCredentials;
import org.apache.archiva.repository.storage.StorageAsset; import org.apache.archiva.repository.storage.StorageAsset;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -45,6 +47,7 @@ import org.springframework.stereotype.Service;
import javax.inject.Inject; import javax.inject.Inject;
import java.io.IOException; import java.io.IOException;
import java.net.URI;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.util.ArrayList; import java.util.ArrayList;
@ -116,14 +119,15 @@ public class MavenRepositoryProxyHandler extends DefaultRepositoryProxyHandler {
* @throws ProxyException * @throws ProxyException
* @throws NotModifiedException * @throws NotModifiedException
*/ */
@Override
protected void transferResources( ProxyConnector connector, RemoteRepository remoteRepository, protected void transferResources( ProxyConnector connector, RemoteRepository remoteRepository,
StorageAsset tmpResource, StorageAsset[] checksumFiles, String url, String remotePath, StorageAsset resource, StorageAsset tmpResource, StorageAsset[] checksumFiles, String url, String remotePath, StorageAsset resource,
Path workingDirectory, ManagedRepository repository ) Path workingDirectory, ManagedRepository repository )
throws ProxyException, NotModifiedException { throws ProxyException, NotModifiedException {
Wagon wagon = null; Wagon wagon = null;
try { try {
RepositoryURL repoUrl = remoteRepository.getContent().getURL(); URI repoUrl = remoteRepository.getLocation( );
String protocol = repoUrl.getProtocol(); String protocol = repoUrl.getScheme( );
NetworkProxy networkProxy = null; NetworkProxy networkProxy = null;
String proxyId = connector.getProxyId(); String proxyId = connector.getProxyId();
if (StringUtils.isNotBlank(proxyId)) { if (StringUtils.isNotBlank(proxyId)) {

View File

@ -20,7 +20,6 @@ package org.apache.archiva.repository.mock;
*/ */
import org.apache.archiva.common.utils.VersionUtil; import org.apache.archiva.common.utils.VersionUtil;
import org.apache.archiva.model.RepositoryURL;
import org.apache.archiva.repository.LayoutException; import org.apache.archiva.repository.LayoutException;
import org.apache.archiva.repository.RemoteRepository; import org.apache.archiva.repository.RemoteRepository;
import org.apache.archiva.repository.RemoteRepositoryContent; import org.apache.archiva.repository.RemoteRepositoryContent;
@ -52,12 +51,6 @@ public class RemoteRepositoryContentMock implements RemoteRepositoryContent
return repository; return repository;
} }
@Override
public RepositoryURL getURL( )
{
return new RepositoryURL(repository.getLocation().toString());
}
@Override @Override
public void setRepository( RemoteRepository repo ) public void setRepository( RemoteRepository repo )
{ {

View File

@ -18,7 +18,6 @@ package org.apache.archiva.repository.maven.content;
* under the License. * under the License.
*/ */
import org.apache.archiva.model.RepositoryURL;
import org.apache.archiva.repository.RemoteRepository; import org.apache.archiva.repository.RemoteRepository;
import org.apache.archiva.repository.RemoteRepositoryContent; import org.apache.archiva.repository.RemoteRepositoryContent;
@ -48,20 +47,6 @@ public class RemoteDefaultRepositoryContent
return repository; 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 @Override
public void setRepository( RemoteRepository repository ) public void setRepository( RemoteRepository repository )
{ {