@Override public String handleAnswer(DownloadAnswer answer) { if (s_logger.isTraceEnabled()) { s_logger.trace("handleAnswer, answer status=" + answer.getDownloadStatus() + ", curr state=" + getName()); } switch (answer.getDownloadStatus()) { case DOWNLOAD_IN_PROGRESS: getDownloadListener().scheduleStatusCheck(RequestType.GET_STATUS); return Status.DOWNLOAD_IN_PROGRESS.toString(); case DOWNLOADED: getDownloadListener().cancelTimeoutTask(); return Status.DOWNLOADED.toString(); case NOT_DOWNLOADED: getDownloadListener().scheduleStatusCheck(RequestType.GET_STATUS); return Status.NOT_DOWNLOADED.toString(); case DOWNLOAD_ERROR: getDownloadListener().cancelStatusTask(); getDownloadListener().cancelTimeoutTask(); return Status.DOWNLOAD_ERROR.toString(); case UNKNOWN: getDownloadListener().cancelStatusTask(); getDownloadListener().cancelTimeoutTask(); return Status.DOWNLOAD_ERROR.toString(); default: return null; } }
updateBuilder.setDownloadState(answer.getDownloadStatus()); updateBuilder.setLastUpdated(new Date()); updateBuilder.setErrorString(answer.getErrorString()); if (answer.getDownloadStatus() == VMTemplateStorageResourceAssoc.Status.DOWNLOAD_ERROR || answer.getDownloadStatus() == VMTemplateStorageResourceAssoc.Status.ABANDONED || answer.getDownloadStatus() == VMTemplateStorageResourceAssoc.Status.UNKNOWN) { CreateCmdResult result = new CreateCmdResult(null, null); result.setSuccess(false); (volStoreVO == null ? -1L : volStoreVO.getZoneId()), null, msg, msg); s_logger.error(msg); } else if (answer.getDownloadStatus() == VMTemplateStorageResourceAssoc.Status.DOWNLOADED) { CreateCmdResult result = new CreateCmdResult(null, null); caller.complete(result);
updateBuilder.setDownloadState(answer.getDownloadStatus()); updateBuilder.setLastUpdated(new Date()); updateBuilder.setErrorString(answer.getErrorString()); if (answer.getDownloadStatus() == VMTemplateStorageResourceAssoc.Status.DOWNLOAD_ERROR || answer.getDownloadStatus() == VMTemplateStorageResourceAssoc.Status.ABANDONED || answer.getDownloadStatus() == VMTemplateStorageResourceAssoc.Status.UNKNOWN) { CreateCmdResult result = new CreateCmdResult(null, null); result.setSuccess(false); _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_UPLOAD_FAILED, _vmTemplateZoneDao.listByTemplateId(obj.getId()).get(0).getZoneId(), null, msg, msg); s_logger.error(msg); } else if (answer.getDownloadStatus() == VMTemplateStorageResourceAssoc.Status.DOWNLOADED) { if (answer.getCheckSum() != null) { VMTemplateVO templateDaoBuilder = _templateDao.createForUpdate();
@Override public String handleAnswer(DownloadAnswer answer) { switch (answer.getDownloadStatus()) { case DOWNLOAD_IN_PROGRESS: getDownloadListener().scheduleStatusCheck(RequestType.GET_STATUS); return Status.DOWNLOAD_IN_PROGRESS.toString(); case DOWNLOADED: getDownloadListener().scheduleImmediateStatusCheck(RequestType.PURGE); getDownloadListener().cancelTimeoutTask(); return Status.DOWNLOADED.toString(); case NOT_DOWNLOADED: getDownloadListener().scheduleStatusCheck(RequestType.GET_STATUS); return Status.NOT_DOWNLOADED.toString(); case DOWNLOAD_ERROR: getDownloadListener().cancelStatusTask(); getDownloadListener().cancelTimeoutTask(); return Status.DOWNLOAD_ERROR.toString(); case UNKNOWN: getDownloadListener().cancelStatusTask(); getDownloadListener().cancelTimeoutTask(); return Status.DOWNLOAD_ERROR.toString(); default: return null; } }