Skip to content

Commit

Permalink
[MNG-7128] keep blocked attribute from mirrors in artifact repositories
Browse files Browse the repository at this point in the history
  • Loading branch information
hboutemy committed Mar 25, 2021
1 parent a469068 commit d295dc3
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ public class DefaultArtifactRepository

private List<ArtifactRepository> mirroredRepositories = Collections.emptyList();

private boolean blocked;

/**
* Create a local repository or a test repository.
*
Expand Down Expand Up @@ -264,4 +266,14 @@ public void setMirroredRepositories( List<ArtifactRepository> mirroredRepositori
}
}

public boolean isBlocked()
{
return blocked;
}

public void setBlocked( boolean blocked )
{
this.blocked = blocked;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,8 @@ public List<ArtifactRepository> getEffectiveRepositories( List<ArtifactRepositor

effectiveRepository.setMirroredRepositories( mirroredRepos );

effectiveRepository.setBlocked( aliasedRepo.isBlocked() );

effectiveRepositories.add( effectiveRepository );
}

Expand Down Expand Up @@ -502,6 +504,7 @@ private Mirror getMirror( RepositorySystemSession session, ArtifactRepository re
mirror.setId( repo.getId() );
mirror.setUrl( repo.getUrl() );
mirror.setLayout( repo.getContentType() );
mirror.setBlocked( repo.isBlocked() );
return mirror;
}
}
Expand Down Expand Up @@ -538,6 +541,8 @@ private void injectMirror( ArtifactRepository repository, Mirror mirror )
{
repository.setLayout( getLayout( mirror.getLayout() ) );
}

repository.setBlocked( mirror.isBlocked() );
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ public static RemoteRepository toRepo( ArtifactRepository repo )
builder.setAuthentication( toAuthentication( repo.getAuthentication() ) );
builder.setProxy( toProxy( repo.getProxy() ) );
builder.setMirroredRepositories( toRepos( repo.getMirroredRepositories() ) );
builder.setBlocked( repo.isBlocked() );
result = builder.build();
}
return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,15 @@ public void setMirroredRepositories( List<ArtifactRepository> mirroredRepositori
{
}

public boolean isBlocked()
{
return false;
}

public void setBlocked( boolean blocked )
{
}

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ public class MavenArtifactRepository

private List<ArtifactRepository> mirroredRepositories = Collections.emptyList();

private boolean blocked;

public MavenArtifactRepository()
{
}
Expand Down Expand Up @@ -160,6 +162,8 @@ public String toString()
sb.append( ", update => " ).append( releases.getUpdatePolicy() ).append( "]\n" );
}

sb.append( " blocked: " ).append( isBlocked() ).append( '\n' );

return sb.toString();
}

Expand Down Expand Up @@ -414,4 +418,14 @@ public void setMirroredRepositories( List<ArtifactRepository> mirroredRepositori
}
}

public boolean isBlocked()
{
return blocked;
}

public void setBlocked( boolean blocked )
{
this.blocked = blocked;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ private Mirror getMirror( RepositorySystemSession session, ArtifactRepository re
mirror.setId( repo.getId() );
mirror.setUrl( repo.getUrl() );
mirror.setLayout( repo.getContentType() );
mirror.setBlocked( repo.isBlocked() );
return mirror;
}
}
Expand Down Expand Up @@ -226,6 +227,8 @@ private void injectMirror( ArtifactRepository repository, Mirror mirror )
{
repository.setLayout( getLayout( mirror.getLayout() ) );
}

repository.setBlocked( mirror.isBlocked() );
}
}

Expand Down Expand Up @@ -671,6 +674,8 @@ public List<ArtifactRepository> getEffectiveRepositories( List<ArtifactRepositor

effectiveRepository.setMirroredRepositories( mirroredRepos );

effectiveRepository.setBlocked( aliasedRepo.isBlocked() );

effectiveRepositories.add( effectiveRepository );
}

Expand Down

0 comments on commit d295dc3

Please sign in to comment.