Exemplo n.º 1
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)));
            }
          });
    }
  }
Exemplo n.º 2
0
  @Override
  public void execute(Control<BootstrapContext> control) {

    BootstrapContext bootstrap = control.getContext();

    if (bootstrap.hasProperty(BootstrapContext.STANDALONE)) {
      String value = bootstrap.isStandalone() ? "standalone" : "domain";
      analytics.trackEvent("bootstrap", "exec-mode", value);
      analytics.trackEvent("bootstrap", "console-version", Build.VERSION);

      control.proceed();
    } else {
      bootstrap.setlastError(new RuntimeException("Failed to resolve execution mode"));
      control.abort();
    }
  }
Exemplo n.º 3
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();
          }
        });
  }
Exemplo n.º 4
0
 @Override
 protected void revealInParent() {
   if (bootstrapContext.isStandalone()) {
     revealStrategy.revealInRuntimeParent(this);
   } else {
     revealStrategy.revealInDomain(this);
   }
 }
Exemplo n.º 5
0
 @Inject
 public PatchManager(
     final DispatchAsync dispatcher,
     final BootstrapContext bootstrapContext,
     final HostStore hostStore,
     BeanFactory beanFactory) {
   this.dispatcher = dispatcher;
   this.standalone = bootstrapContext.isStandalone();
   this.hostStore = hostStore;
   this.beanFactory = beanFactory;
 }
  @Override
  public void execute() {
    String initialToken = History.getToken();
    if (!initialToken.isEmpty() && !isBlackListed(initialToken)) {
      List<PlaceRequest> hierarchy = formatter.toPlaceRequestHierarchy(initialToken);
      final PlaceRequest placeRequest = hierarchy.get(hierarchy.size() - 1);

      Scheduler.get()
          .scheduleDeferred(
              new Scheduler.ScheduledCommand() {
                @Override
                public void execute() {
                  placeManager.revealPlace(placeRequest, true);
                }
              });
      bootstrapContext.setInitialPlace(placeRequest.getNameToken());
    } else {
      placeManager.revealDefaultPlace();
    }
  }