o moving blacklisting up and out of the repository itself

o remove magic policy creation in the artifact implementation, it's already done in the request populator


git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@787010 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jason van Zyl 2009-06-21 13:24:04 +00:00
parent ea5445af38
commit c646df62b4
6 changed files with 6 additions and 46 deletions

View File

@ -333,10 +333,7 @@ public class DefaultWagonManager
{ {
logger.debug( "Skipping disabled repository " + repository.getId() ); logger.debug( "Skipping disabled repository " + repository.getId() );
} }
else if ( repository.isBlacklisted() )
{
logger.debug( "Skipping blacklisted repository " + repository.getId() );
}
// If the artifact is a snapshot, we need to determine whether it's time to check this repository for an update: // If the artifact is a snapshot, we need to determine whether it's time to check this repository for an update:
// 1. If it's forced, then check // 1. If it's forced, then check
// 2. If the updateInterval has been exceeded since the last check for this artifact on this repository, then check. // 2. If the updateInterval has been exceeded since the last check for this artifact on this repository, then check.

View File

@ -52,10 +52,6 @@ public interface ArtifactRepository
void setLayout( ArtifactRepositoryLayout layout ); void setLayout( ArtifactRepositoryLayout layout );
String getKey(); String getKey();
void setBlacklisted( boolean blackListed );
boolean isBlacklisted();
// New interface methods for the repository system. // New interface methods for the repository system.

View File

@ -33,7 +33,7 @@ import org.apache.maven.wagon.repository.Repository;
* @author <a href="michal.maczka@dimatics.com">Michal Maczka </a> * @author <a href="michal.maczka@dimatics.com">Michal Maczka </a>
* @version $Id$ * @version $Id$
*/ */
//TODO: this needs to be decoupled from Wagon @Deprecated
public class DefaultArtifactRepository public class DefaultArtifactRepository
extends Repository extends Repository
implements ArtifactRepository implements ArtifactRepository

View File

@ -103,17 +103,6 @@ public class DefaultArtifactRepositoryFactory
ArtifactRepositoryPolicy snapshots, ArtifactRepositoryPolicy snapshots,
ArtifactRepositoryPolicy releases ) ArtifactRepositoryPolicy releases )
{ {
boolean blacklisted = false;
if ( artifactRepositories.containsKey( id ) )
{
ArtifactRepository repository = artifactRepositories.get( id );
// TODO: this should be an if there are duplicates?
if ( repository.getUrl().equals( url ) )
{
blacklisted = repository.isBlacklisted();
}
}
if ( snapshots == null ) if ( snapshots == null )
{ {
snapshots = new ArtifactRepositoryPolicy(); snapshots = new ArtifactRepositoryPolicy();
@ -137,7 +126,6 @@ public class DefaultArtifactRepositoryFactory
} }
ArtifactRepository repository = new MavenArtifactRepository( id, url, repositoryLayout, snapshots, releases ); ArtifactRepository repository = new MavenArtifactRepository( id, url, repositoryLayout, snapshots, releases );
repository.setBlacklisted( blacklisted );
artifactRepositories.put( id, repository ); artifactRepositories.put( id, repository );

View File

@ -30,8 +30,6 @@ import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
public class MavenArtifactRepository public class MavenArtifactRepository
implements ArtifactRepository implements ArtifactRepository
{ {
public static final int UNKNOWN_PORT = -1;
private String id; private String id;
private String url; private String url;
@ -67,24 +65,13 @@ public class MavenArtifactRepository
this.id = id; this.id = id;
this.url = url; this.url = url;
this.layout = layout; this.layout = layout;
this.snapshots = snapshots;
this.releases = releases;
// //
// Derive these from the URL // Derive these from the URL
// //
this.protocol = protocol( url ); this.protocol = protocol( url );
this.basedir = basedir( url ); this.basedir = basedir( url );
this.snapshots = snapshots;
this.releases = releases;
if ( this.snapshots == null )
{
this.snapshots = new ArtifactRepositoryPolicy( true, ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS, ArtifactRepositoryPolicy.CHECKSUM_POLICY_IGNORE );
}
if ( this.releases == null )
{
this.releases = new ArtifactRepositoryPolicy( true, ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS, ArtifactRepositoryPolicy.CHECKSUM_POLICY_IGNORE );
}
} }
public String pathOf( Artifact artifact ) public String pathOf( Artifact artifact )
@ -332,7 +319,7 @@ public class MavenArtifactRepository
return false; return false;
} }
final ArtifactRepository other = (ArtifactRepository) obj; ArtifactRepository other = (ArtifactRepository) obj;
if ( id == null ) if ( id == null )
{ {

View File

@ -81,16 +81,8 @@ public class DefaultRepositoryMetadataManager
} }
catch ( TransferFailedException e ) catch ( TransferFailedException e )
{ {
getLogger().warn( getLogger().warn( metadata + " could not be retrieved from repository: " + repository.getId() + " due to an error: " + e.getMessage() );
metadata + " could not be retrieved from repository: " + repository.getId()
+ " due to an error: " + e.getMessage() );
getLogger().debug( "Exception", e ); getLogger().debug( "Exception", e );
getLogger().info( "Repository '" + repository.getId() + "' will be blacklisted" );
repository.setBlacklisted( true );
// TODO: [jc; 08-Nov-2005] revisit this for 2.1
// suppressing logging to avoid logging this error twice.
} }
finally finally
{ {