@Override public void onAdminCommandEvent(String name, GfSseInboundEvent event) { try { AdminCommandState acs = event.getData(AdminCommandState.class, "application/json"); String id = acs.getId(); if (StringUtils.ok(id)) { if (terse) { rac.closeSse(id, ActionReport.ExitCode.SUCCESS); } else { rac.closeSse(strings.get("detach.jobid", id), ActionReport.ExitCode.SUCCESS); } } else { logger.log(Level.SEVERE, strings.getString("detach.noid", "Command was started but id was not retrieved. Can not detach.")); } } catch (IOException ex) { logger.log(Level.SEVERE, null, ex); } }
if (AdminCommandState.EVENT_STATE_CHANGED.equals(event.getName())) { AdminCommandState acs = event.getData(AdminCommandState.class, MEDIATYPE_JSON); if (acs.getId() != null) { instanceId = acs.getId(); if (logger.isLoggable(Level.FINEST)) { logger.log(Level.FINEST, "Command instance ID: {0}", instanceId); if (acs.getState() == AdminCommandState.State.COMPLETED || acs.getState() == AdminCommandState.State.RECORDED || acs.getState() == AdminCommandState.State.REVERTED) { if (acs.getActionReport() != null) { setActionReport(acs.getActionReport()); if (!acs.isOutboundPayloadEmpty()) { logger.log(Level.FINEST, "Romote command holds data. Must load it"); downloadPayloadFromManaged(instanceId); } else if (acs.getState() == AdminCommandState.State.FAILED_RETRYABLE) { logger.log(Level.INFO, strings.get("remotecommand.failedretryable", acs.getId())); if (acs.getActionReport() != null) { setActionReport(acs.getActionReport()); } else if (acs.getState() == AdminCommandState.State.RUNNING_RETRYABLE) { logger.log(Level.FINEST, "Command stores checkpoint and is retryable"); retryableCommand = true;