@Override @Transactional protected void handle(final DownloadImageMsg msg) { final DownloadImageReply reply = new DownloadImageReply(); final ImageInventory iinv = msg.getImageInventory(); final String installPath = PathUtil.join(getSelf().getUrl(), BackupStoragePathMaker.makeImageInstallPath(iinv)); String sql = "update ImageBackupStorageRefVO set installPath = :installPath " + "where backupStorageUuid = :bsUuid and imageUuid = :imageUuid"; Query q = dbf.getEntityManager().createQuery(sql); q.setParameter("installPath", installPath); q.setParameter("bsUuid", msg.getBackupStorageUuid()); q.setParameter("imageUuid", msg.getImageInventory().getUuid()); q.executeUpdate(); download(iinv.getUrl(), installPath, iinv.getUuid(), new ReturnValueCompletion<DownloadResult>(msg) { @Override public void success(DownloadResult res) { reply.setInstallPath(installPath); reply.setSize(res.size); reply.setActualSize(res.actualSize); reply.setMd5sum(res.md5sum); reply.setFormat(res.format); bus.reply(msg, reply); } @Override public void fail(ErrorCode errorCode) { reply.setError(errorCode); bus.reply(msg, reply); } }); }
q.executeUpdate(); final DownloadImageReply reply = new DownloadImageReply(); httpCall(DOWNLOAD_IMAGE_PATH, cmd, DownloadRsp.class, new ReturnValueCompletion<DownloadRsp>(msg) { @Override
@Override protected void handle(DownloadImageMsg msg) { ImageInventory inv = msg.getImageInventory(); DownloadImageReply reply = new DownloadImageReply(); reply.setMd5sum(Platform.getUuid()); reply.setInstallPath(Utils.getPathUtil().join(self.getUrl(), inv.getName())); reply.setSize(100); reply.setActualSize(100L); reply.setFormat("simulator"); bus.reply(msg, reply); }
.update(); final DownloadImageReply reply = new DownloadImageReply(); HttpCaller<DownloadRsp> caller = new HttpCaller<>(DOWNLOAD_IMAGE_PATH, cmd, DownloadRsp.class, new ReturnValueCompletion<DownloadRsp>(msg) { @Override