protected void handle(final DownloadImageMsg msg) { final DownloadCmd cmd = new DownloadCmd(); cmd.url = msg.getImageInventory().getUrl(); cmd.installPath = makeImageInstallPath(msg.getImageInventory().getUuid()); cmd.imageUuid = msg.getImageInventory().getUuid(); Query q = dbf.getEntityManager().createQuery(sql); q.setParameter("installPath", cmd.installPath); q.setParameter("bsUuid", msg.getBackupStorageUuid()); q.setParameter("imageUuid", msg.getImageInventory().getUuid()); q.executeUpdate();
@Override public DownloadImageMsg call(String arg) { DownloadImageMsg dmsg = new DownloadImageMsg(inv); dmsg.setBackupStorageUuid(arg); dmsg.setFormat(msgData.getFormat()); dmsg.setSystemTags(msgData.getSystemTags()); bus.makeTargetServiceIdByResourceUuid(dmsg, BackupStorageConstant.SERVICE_ID, arg); return dmsg; } });
private void handleBase(DownloadImageMsg msg) { checkState(msg); checkStatus(msg); exceptionIfImageSizeGreaterThanAvailableCapacity(msg.getImageInventory().getUrl()); handle(msg); }
@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); }
@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); } }); }
@Override protected void handle(final DownloadImageMsg msg) { final DownloadCmd cmd = new DownloadCmd(); cmd.url = msg.getImageInventory().getUrl(); cmd.installPath = makeImageInstallPath(msg.getImageInventory().getUuid()); cmd.imageUuid = msg.getImageInventory().getUuid(); cmd.sendCommandUrl = restf.getSendCommandUrl(); .condAnd(ImageBackupStorageRefVO_.backupStorageUuid, SimpleQuery.Op.EQ, msg.getBackupStorageUuid()) .condAnd(ImageBackupStorageRefVO_.imageUuid, SimpleQuery.Op.EQ, msg.getImageInventory().getUuid()) .set(ImageBackupStorageRefVO_.installPath, cmd.installPath) .update();