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;
 }
Ejemplo n.º 4
0
    public UpdateInfoPanel() {
      ApplicationInfo appInfo = ApplicationInfo.getInstance();
      myBuildNumber.setText(appInfo.getBuild().asString() + ")");
      final String version = appInfo.getFullVersion();

      myVersionNumber.setText(version);
      myNewBuildNumber.setText(myLatestBuild.getNumber().asString() + ")");
      myNewVersionNumber.setText(myLatestBuild.getVersion());
      myUpdateMessageLabel.setBackground(UIUtil.getLabelBackground());
      myScrollPane.setBackground(UIUtil.getLabelBackground());
      myScrollPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
      if (myLatestBuild.getMessage() != null) {
        StringBuilder builder = new StringBuilder();
        builder
            .append("<html><head>")
            .append(UIUtil.getCssFontDeclaration(UIUtil.getLabelFont()))
            .append("</head><body>")
            .append(StringUtil.formatLinks(myLatestBuild.getMessage()))
            .append("</body></html>");
        myUpdateMessageLabel.setText(builder.toString());
        myUpdateMessageLabel.addHyperlinkListener(BrowserHyperlinkListener.INSTANCE);
      } else {
        myUpdateMessageLabel.setVisible(false);
      }

      PatchInfo patch = myLatestBuild.findPatchForCurrentBuild();
      if (patch == null) {
        myPatchAvailableLabel.setVisible(false);
        myPatchSizeLabel.setVisible(false);
      } else {
        myPatchSizeLabel.setText(patch.getSize() + "MB");
      }

      if (SystemInfo.isMac) {
        myManualCheckLabel.setText(
            "<html><br>To check for new updates manually, use the <b>"
                + ApplicationNamesInfo.getInstance().getProductName()
                + " | Check for Updates</b> command.</html>");
      }

      LabelTextReplacingUtil.replaceText(myPanel);
    }