|
Lines 418-423
Link Here
|
| 418 |
//download from the best available mirror |
418 |
//download from the best available mirror |
| 419 |
String baseLocation = getLocation(descriptor); |
419 |
String baseLocation = getLocation(descriptor); |
| 420 |
String mirrorLocation = getMirror(baseLocation); |
420 |
String mirrorLocation = getMirror(baseLocation); |
|
|
421 |
IStatus status = downloadArtifact(descriptor, mirrorLocation, destination, monitor); |
| 422 |
IStatus result = reportStatus(descriptor, destination, status); |
| 423 |
// if the original download went reasonably but the reportStatus found some issues |
| 424 |
// (e..g, in the processing steps/validators) then mark the mirror as bad and return |
| 425 |
// a retry code (assuming we have more mirrors) |
| 426 |
if ((status.isOK() || status.matches(IStatus.INFO | IStatus.WARNING)) && result.getSeverity() == IStatus.ERROR) { |
| 427 |
if (mirrors != null) { |
| 428 |
mirrors.reportResult(mirrorLocation, result); |
| 429 |
if (mirrors.hasValidMirror()) |
| 430 |
return new MultiStatus(Activator.ID, CODE_RETRY, new IStatus[] {result}, "Retry another mirror", null); //$NON-NLS-1$ |
| 431 |
} |
| 432 |
} |
| 433 |
// if the original status was a retry, don't lose that. |
| 434 |
return status.getCode() == CODE_RETRY ? status : result; |
| 435 |
} |
| 436 |
|
| 437 |
private IStatus downloadArtifact(IArtifactDescriptor descriptor, String mirrorLocation, OutputStream destination, IProgressMonitor monitor) { |
| 421 |
IStatus result = getTransport().download(mirrorLocation, destination, monitor); |
438 |
IStatus result = getTransport().download(mirrorLocation, destination, monitor); |
| 422 |
if (mirrors != null) |
439 |
if (mirrors != null) |
| 423 |
mirrors.reportResult(mirrorLocation, result); |
440 |
mirrors.reportResult(mirrorLocation, result); |
|
Lines 468-481
Link Here
|
| 468 |
if (!status.isOK() && status.getSeverity() != IStatus.INFO) |
485 |
if (!status.isOK() && status.getSeverity() != IStatus.INFO) |
| 469 |
return status; |
486 |
return status; |
| 470 |
|
487 |
|
| 471 |
status = downloadArtifact(descriptor, destination, monitor); |
488 |
return downloadArtifact(descriptor, destination, monitor); |
| 472 |
IStatus result = reportStatus(descriptor, destination, status); |
|
|
| 473 |
// if the original status was RETRY then ensure that we return that status. It is |
| 474 |
// however important to call reportStatus() either way as it updates information |
| 475 |
// in addition to collecting status. |
| 476 |
// TODO we should remove this when there is more time for testing. |
| 477 |
return status.getCode() == CODE_RETRY ? status : result; |
| 478 |
|
| 479 |
} |
489 |
} |
| 480 |
|
490 |
|
| 481 |
public synchronized IArtifactDescriptor[] getArtifactDescriptors(IArtifactKey key) { |
491 |
public synchronized IArtifactDescriptor[] getArtifactDescriptors(IArtifactKey key) { |