}
catch ( TransferFailedException e )
{
- getLogger().info( "Skipping repository " + repository.getUrl() + ": " + e.getMessage() );
+ String message = "Skipping repository " + repository.getUrl() + ": " + e.getMessage();
+ processRepositoryFailure( repository, message, e );
}
catch ( ResourceDoesNotExistException e )
{
}
catch ( AuthorizationException e )
{
- getLogger().info( "Skipping repository " + repository.getUrl() + ": " + e.getMessage() );
+ String message = "Skipping repository " + repository.getUrl() + ": " + e.getMessage();
+ processRepositoryFailure( repository, message, e );
}
catch ( UnsupportedProtocolException e )
{
- getLogger().info( "Skipping repository " + repository.getUrl() + ": no wagonManager configured " +
- "for protocol " + repository.getProtocol() );
+ String message = "Skipping repository " + repository.getUrl() + ": no wagonManager configured " +
+ "for protocol " + repository.getProtocol();
+ processRepositoryFailure( repository, message, e );
}
finally
{
getLogger().error( "Problem disconnecting from wagonManager - ignoring: " + e.getMessage() );
}
}
+
+ private void processRepositoryFailure( ProxyRepository repository, String message, Throwable t )
+ throws ProxyException
+ {
+ if ( repository.isHardfail() )
+ {
+ throw new ProxyException(
+ "An error occurred in hardfailing repository " + repository.getName() + "...\n " + message, t );
+ }
+ else
+ {
+ getLogger().debug( message, t );
+ }
+ }
}
ProxyRepository repo = new ProxyRepository( repoConfig.getKey(), repoConfig.getUrl(), layout );
repo.setCacheFailures( repoConfig.getCacheFailures() );
repo.setCachePeriod( repoConfig.getCachePeriod() );
+ repo.setHardfail( repoConfig.getHardFail() );
if ( repoConfig instanceof HttpRepoConfiguration )
{
HttpRepoConfiguration httpRepo = (HttpRepoConfiguration) repoConfig;
MavenProxyConfiguration httpProxy = httpRepo.getProxy();
- repo.setProxy( httpProxy.getHost(), httpProxy.getPort(),
- httpProxy.getUsername(), httpProxy.getPassword() );
+ repo.setProxy( httpProxy.getHost(), httpProxy.getPort(), httpProxy.getUsername(),
+ httpProxy.getPassword() );
}
repoList.add( repo );
private boolean cacheFailures = false;
+ private boolean hardfail = false;
+
private ProxyInfo proxy;
public ProxyRepository( String id, String url, ArtifactRepositoryLayout layout, boolean cacheFailures,
{
this.proxy = proxy;
}
+
+ /**
+ * Checks the repository hardfail setting.
+ *
+ * @return true if the hardfail is enabled, otherwise, returns false.
+ */
+ public boolean isHardfail()
+ {
+ return hardfail;
+ }
+
+ /**
+ * If hardfail is set to true, then any unexpected errors from retrieving files from this repository
+ * will cause the download to fail.
+ *
+ * @param hardfail set to true to enable hard failures
+ */
+ public void setHardfail( boolean hardfail )
+ {
+ this.hardfail = hardfail;
+ }
}