Ejemplo n.º 1
0
  public void rollback(
      final PatchInfo patchInfo,
      final boolean resetConfiguration,
      final boolean overrideAll,
      final AsyncCallback<Void> callback) {
    ModelNode rollbackOp = baseAddress();
    rollbackOp.get(OP).set("rollback");
    rollbackOp.get("patch-id").set(patchInfo.getId());
    rollbackOp.get("reset-configuration").set(resetConfiguration);
    rollbackOp.get("override-all").set(overrideAll);

    dispatcher.execute(
        new DMRAction(rollbackOp),
        new AsyncCallback<DMRResponse>() {
          @Override
          public void onFailure(final Throwable caught) {
            callback.onFailure(caught);
          }

          @Override
          public void onSuccess(final DMRResponse response) {
            ModelNode result = response.get();
            if (!result.hasDefined(OUTCOME) || result.isFailure()) {
              callback.onFailure(new RuntimeException(result.getFailureDescription()));
            } else {
              callback.onSuccess(null);
            }
          }
        });
  }
Ejemplo n.º 2
0
  public void getPatchInfo(final PatchInfo patch, final AsyncCallback<PatchInfo> callback) {
    ModelNode patchInfoOp = baseAddress();
    patchInfoOp.get(OP).set("patch-info");
    patchInfoOp.get("patch-id").set(patch.getId());

    dispatcher.execute(
        new DMRAction(patchInfoOp),
        new AsyncCallback<DMRResponse>() {
          @Override
          public void onFailure(final Throwable caught) {
            callback.onFailure(caught);
          }

          @Override
          public void onSuccess(final DMRResponse response) {
            ModelNode result = response.get();
            if (!result.hasDefined(OUTCOME) || result.isFailure()) {
              callback.onFailure(new RuntimeException(result.getFailureDescription()));
            } else {
              ModelNode payload = result.get(RESULT);
              patch.setIdentityName(payload.get("identity-name").asString());
              patch.setIdentityVersion(payload.get("identity-version").asString());
              patch.setDescription(payload.get("description").asString());
              if (payload.get("link").isDefined()) {
                patch.setLink(payload.get("link").asString());
              } else {
                patch.setLink("");
              }
              callback.onSuccess(patch);
            }
          }
        });
  }
Ejemplo n.º 3
0
 private PatchInfo historyToPatchInfo(final ModelNode node) {
   PatchInfo patchInfo = beanFactory.patchInfo().as();
   patchInfo.setId(node.get("patch-id").asString());
   patchInfo.setType(node.get("type").asString());
   patchInfo.setAppliedAt(node.get("applied-at").asString());
   patchInfo.setIdentityName("");
   patchInfo.setIdentityVersion("");
   patchInfo.setDescription("");
   patchInfo.setLink("");
   return patchInfo;
 }