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() );
}
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:
// 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.

View File

@ -52,10 +52,6 @@ public interface ArtifactRepository
void setLayout( ArtifactRepositoryLayout layout );
String getKey();
void setBlacklisted( boolean blackListed );
boolean isBlacklisted();
// 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>
* @version $Id$
*/
//TODO: this needs to be decoupled from Wagon
@Deprecated
public class DefaultArtifactRepository
extends Repository
implements ArtifactRepository

View File

@ -103,17 +103,6 @@ public class DefaultArtifactRepositoryFactory
ArtifactRepositoryPolicy snapshots,
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 )
{
snapshots = new ArtifactRepositoryPolicy();
@ -137,7 +126,6 @@ public class DefaultArtifactRepositoryFactory
}
ArtifactRepository repository = new MavenArtifactRepository( id, url, repositoryLayout, snapshots, releases );
repository.setBlacklisted( blacklisted );
artifactRepositories.put( id, repository );

View File

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

View File

@ -81,16 +81,8 @@ public class DefaultRepositoryMetadataManager
}
catch ( TransferFailedException e )
{
getLogger().warn(
metadata + " could not be retrieved from repository: " + repository.getId()
+ " due to an error: " + e.getMessage() );
getLogger().warn( metadata + " could not be retrieved from repository: " + repository.getId() + " due to an error: " + e.getMessage() );
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
{