throw new FetchException(FetchExceptionMode.NOT_ENOUGH_DISK_SPACE);
} catch (IOException e) {
throw new FetchException(FetchExceptionMode.BUCKET_ERROR);
}
// Return the data
onSuccess(new FetchResult(clientMetadata, out), context);
return;
} else {
if(logMINOR) Logger.minor(this, "Fetching archive (thisKey="+thisKey+ ')');
// Metadata cannot contain pointers to files which don't exist.
// We enforce this in ArchiveHandler.
// Therefore, the archive needs to be fetched.
final boolean persistent = this.persistent;
fetchArchive(true, archiveMetadata, filename, new ArchiveExtractCallback() {
private static final long serialVersionUID = 1L;
@Override
public void gotBucket(Bucket data, ClientContext context) {
if(logMINOR) Logger.minor(this, "Returning data");
// Because this will be processed immediately, and because the callback uses a StreamGenerator,
// we can simply pass in the output bucket, even if it is not persistent.
// If we ever change it so a StreamGenerator can be saved, we'll have to copy here.
// Transient buckets should throw if attempted to store.
onSuccess(new FetchResult(clientMetadata, data), context);
}
@Override
public void notInArchive(ClientContext context) {
onFailure(new FetchException(FetchExceptionMode.NOT_IN_ARCHIVE), false, context);
}