use of org.commonjava.maven.galley.event.FileNotFoundEvent in project galley by Commonjava.
the class TransferManagerImpl method retrieveFirst.
@Override
public Transfer retrieveFirst(final VirtualResource virt, final EventMetadata eventMetadata) throws TransferException {
Transfer target = null;
TransferException lastError = null;
int tries = 0;
for (final ConcreteResource res : virt) {
tries++;
if (res == null) {
continue;
}
try {
target = retrieve(res, true, eventMetadata);
lastError = null;
if (target != null && target.exists()) {
return target;
}
} catch (final TransferException e) {
logger.warn("Failed to retrieve: {}. {} more tries. (Reason: {})", res, (virt.toConcreteResources().size() - tries), e.getMessage());
lastError = e;
}
}
if (lastError != null) {
throw lastError;
}
fileEventManager.fire(new FileNotFoundEvent(virt, eventMetadata));
return null;
}
Aggregations