use of org.apache.ivy.plugins.repository.url.URLRepository in project ant-ivy by apache.
the class JarResolver method setSettings.
@Override
public void setSettings(ResolverSettings settings) {
super.setSettings(settings);
if (url == null) {
return;
}
// let's resolve the url
ArtifactDownloadReport report;
EventManager eventManager = getEventManager();
try {
if (eventManager != null) {
getRepository().addTransferListener(eventManager);
}
Resource jarResource = new URLResource(url, this.getTimeoutConstraint());
CacheResourceOptions options = new CacheResourceOptions();
report = getRepositoryCacheManager().downloadRepositoryResource(jarResource, "jarrepository", "jar", "jar", options, new URLRepository());
} finally {
if (eventManager != null) {
getRepository().removeTransferListener(eventManager);
}
}
if (report.getDownloadStatus() == DownloadStatus.FAILED) {
throw new RuntimeException("The jar file " + url.toExternalForm() + " could not be downloaded (" + report.getDownloadDetails() + ")");
}
setJarFile(report.getLocalFile());
}
use of org.apache.ivy.plugins.repository.url.URLRepository in project ant-ivy by apache.
the class MirroredURLResolver method downloadMirrorList.
private File downloadMirrorList() {
final URLRepository urlRepository = new URLRepository(this.getTimeoutConstraint());
if (getEventManager() != null) {
urlRepository.addTransferListener(getEventManager());
}
final URLResource mirrorResource = new URLResource(mirrorListUrl, this.getTimeoutConstraint());
CacheResourceOptions options = new CacheResourceOptions();
ArtifactDownloadReport report = getRepositoryCacheManager().downloadRepositoryResource(mirrorResource, "mirrorlist", "text", "txt", options, urlRepository);
return report.getLocalFile();
}
Aggregations