Example #1
0
  public void restart() {
    ModelNode restartNode = new ModelNode();
    if (!bootstrapContext.isStandalone()) {
      restartNode.get(ADDRESS).add("host", domainManager.getSelectedHost());
    }
    restartNode.get(OP).set(SHUTDOWN);
    restartNode.get("restart").set(true);

    final RestartModal restartModal = new RestartModal();
    restartModal.center();

    RestartOp restartOp = new RestartOp(dispatcher);
    restartOp.start(
        dispatcher,
        restartNode,
        new TimeoutOperation.Callback() {
          @Override
          public void onSuccess() {
            // TODO Doesn't need a full reload if a non-dc host was patched
            Window.Location.reload();
          }

          @Override
          public void onTimeout() {
            // TODO Is there another way out?
            restartModal.timeout();
          }

          @Override
          public void onError(final Throwable caught) {
            // TODO Is there another way out?
            restartModal.error();
          }
        });
  }
Example #2
0
  public void launchApplyWizard() {
    // this callback is directly called from the standalone branch
    // or after the running server instances are retrieved in the domain branch
    final Callback<ApplyContext, Throwable> contextCallback =
        new Callback<ApplyContext, Throwable>() {
          @Override
          public void onFailure(final Throwable caught) {
            Log.error("Unable to launch apply patch wizard", caught);
            Console.error(
                Console.CONSTANTS.patch_manager_apply_new_wizard_error(), caught.getMessage());
          }

          @Override
          public void onSuccess(final ApplyContext context) {
            window = new DefaultWindow(Console.CONSTANTS.patch_manager_apply_patch());
            window.setWidth(480);
            window.setHeight(NORMAL_WINDOW_HEIGHT);
            window.trapWidget(
                new ApplyWizard(
                        PatchManagerPresenter.this,
                        context,
                        Console.CONSTANTS.patch_manager_apply_patch(),
                        dispatcher,
                        patchManager)
                    .asWidget());
            window.setGlassEnabled(true);
            window.center();
          }
        };

    if (bootstrapContext.isStandalone()) {
      contextCallback.onSuccess(
          new ApplyContext(
              true,
              null,
              Collections.<String>emptyList(),
              patchManager.baseAddress(),
              bootstrapContext.getProperty(BootstrapContext.PATCH_API)));
    } else {
      final String host = domainManager.getSelectedHost();
      dispatcher.execute(
          new DMRAction(getRunningServersOp(host)),
          new GetRunningServersCallback(contextCallback) {
            @Override
            protected void onServers(final List<String> runningServers) {
              contextCallback.onSuccess(
                  new ApplyContext(
                      false,
                      host,
                      runningServers,
                      patchManager.baseAddress(),
                      bootstrapContext.getProperty(BootstrapContext.PATCH_API)));
            }
          });
    }
  }
Example #3
0
 private PlaceRequest hostPlaceRequest() {
   return new PlaceRequest.Builder()
       .nameToken(getProxy().getNameToken())
       .with("host", domainManager.getSelectedHost())
       .build();
 }