[MNG-7128] keep blocked attribute from mirrors in artifact repositories

This commit is contained in:
Hervé Boutemy 2021-03-25 23:51:26 +01:00
parent c3cf29438e
commit 1ab29f5485
7 changed files with 52 additions and 0 deletions

View File

@ -73,6 +73,12 @@ public interface ArtifactRepository
@Deprecated
void setBlacklisted( boolean blackListed );
/** @since 3.8.1 **/
boolean isBlocked();
/** @since 3.8.1 **/
void setBlocked( boolean blocked );
//
// New interface methods for the repository system.
//

View File

@ -54,6 +54,8 @@ public class DefaultArtifactRepository
private List<ArtifactRepository> mirroredRepositories = Collections.emptyList();
private boolean blocked;
/**
* Create a local repository or a test repository.
*
@ -264,4 +266,14 @@ public class DefaultArtifactRepository
}
}
public boolean isBlocked()
{
return blocked;
}
public void setBlocked( boolean blocked )
{
this.blocked = blocked;
}
}

View File

@ -440,6 +440,8 @@ public class LegacyRepositorySystem
effectiveRepository.setMirroredRepositories( mirroredRepos );
effectiveRepository.setBlocked( aliasedRepo.isBlocked() );
effectiveRepositories.add( effectiveRepository );
}
@ -496,6 +498,7 @@ public class LegacyRepositorySystem
mirror.setId( repo.getId() );
mirror.setUrl( repo.getUrl() );
mirror.setLayout( repo.getContentType() );
mirror.setBlocked( repo.isBlocked() );
return mirror;
}
}
@ -532,6 +535,8 @@ public class LegacyRepositorySystem
{
repository.setLayout( getLayout( mirror.getLayout() ) );
}
repository.setBlocked( mirror.isBlocked() );
}
}

View File

@ -210,6 +210,7 @@ public class RepositoryUtils
builder.setAuthentication( toAuthentication( repo.getAuthentication() ) );
builder.setProxy( toProxy( repo.getProxy() ) );
builder.setMirroredRepositories( toRepos( repo.getMirroredRepositories() ) );
builder.setBlocked( repo.isBlocked() );
result = builder.build();
}
return result;

View File

@ -427,6 +427,15 @@ public class LegacyLocalRepositoryManager
{
}
public boolean isBlocked()
{
return false;
}
public void setBlocked( boolean blocked )
{
}
}
}

View File

@ -59,6 +59,8 @@ public class MavenArtifactRepository
private List<ArtifactRepository> mirroredRepositories = Collections.emptyList();
private boolean blocked;
public MavenArtifactRepository()
{
}
@ -162,6 +164,8 @@ public class MavenArtifactRepository
sb.append( ", update => " ).append( releases.getUpdatePolicy() ).append( ']' );
}
sb.append( " blocked: " ).append( isBlocked() ).append( '\n' );
return sb.toString();
}
@ -416,4 +420,14 @@ public class MavenArtifactRepository
}
}
public boolean isBlocked()
{
return blocked;
}
public void setBlocked( boolean blocked )
{
this.blocked = blocked;
}
}

View File

@ -199,6 +199,7 @@ public class MavenRepositorySystem
mirror.setId( repo.getId() );
mirror.setUrl( repo.getUrl() );
mirror.setLayout( repo.getContentType() );
mirror.setBlocked( repo.isBlocked() );
return mirror;
}
}
@ -235,6 +236,8 @@ public class MavenRepositorySystem
{
repository.setLayout( getLayout( mirror.getLayout() ) );
}
repository.setBlocked( mirror.isBlocked() );
}
}
@ -674,6 +677,8 @@ public class MavenRepositorySystem
effectiveRepository.setMirroredRepositories( mirroredRepos );
effectiveRepository.setBlocked( aliasedRepo.isBlocked() );
effectiveRepositories.add( effectiveRepository );
}