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(); } }); }
@Override protected void revealInParent() { if (bootstrapContext.isStandalone()) { revealStrategy.revealInRuntimeParent(this); } else { revealStrategy.revealInDomain(this); } }
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))); } }); } }
@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(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(); } }