Package org.jboss.as.console.client.core

Examples of org.jboss.as.console.client.core.BootstrapContext


public class ChoseProcessor implements Function<BootstrapContext> {

    @Override
    public void execute(Control<BootstrapContext> control) {

        BootstrapContext bootstrap = control.getContext();
        ResponseProcessorFactory.INSTANCE.bootstrap(bootstrap.isStandalone());
        control.proceed();
    }
View Full Code Here


    }

    @Override
    public void execute(final Control<BootstrapContext> control) {

        final BootstrapContext context = control.getContext();

        if(!context.isStandalone())
        {
            profileStore.loadProfiles(new SimpleCallback<List<ProfileRecord>>() {

                @Override
                public void onFailure(Throwable caught) {
                    context.setlastError(caught);
                    control.abort();
                }

                @Override
                public void onSuccess(List<ProfileRecord> result) {
View Full Code Here

        this.domainManager = domainManager;
    }

    @Override
    public void execute(final Control<BootstrapContext> control) {
        final BootstrapContext context = control.getContext();

        if(!context.isStandalone())
        {
            domainManager.getHosts(new SimpleCallback<HostList>() {

                @Override
                public void onFailure(Throwable caught) {
                    context.setlastError(caught);
                    control.abort();
                }

                @Override
                public void onSuccess(HostList hostList) {
View Full Code Here

    }

    @Override
    public void execute(final Control<BootstrapContext> control) {

        final BootstrapContext context = control.getContext();

        final ModelNode operation = new ModelNode();
        operation.get(OP).set(COMPOSITE);
        operation.get(ADDRESS).setEmptyList();

        ModelNode step;
        List<ModelNode> steps = new ArrayList<ModelNode>();

        // exec type
        step = new ModelNode();
        step.get(OP).set(READ_ATTRIBUTE_OPERATION);
        step.get(NAME).set("process-type");
        step.get(ADDRESS).setEmptyList();
        steps.add(step);

        // product name
        step = new ModelNode();
        step.get(OP).set(READ_ATTRIBUTE_OPERATION);
        step.get(NAME).set("product-name");
        step.get(ADDRESS).setEmptyList();
        steps.add(step);

        // release codename
        step = new ModelNode();
        step.get(OP).set(READ_ATTRIBUTE_OPERATION);
        step.get(NAME).set("release-codename");
        step.get(ADDRESS).setEmptyList();
        steps.add(step);

        // product version
        step = new ModelNode();
        step.get(OP).set(READ_ATTRIBUTE_OPERATION);
        step.get(NAME).set("product-version");
        step.get(ADDRESS).setEmptyList();
        steps.add(step);

        // release version
        step = new ModelNode();
        step.get(OP).set(READ_ATTRIBUTE_OPERATION);
        step.get(NAME).set("release-version");
        step.get(ADDRESS).setEmptyList();
        steps.add(step);

        // whoami
        step = new ModelNode();
        step.get(OP).set("whoami");
        step.get(ADDRESS).setEmptyList();
        steps.add(step);

        operation.get(STEPS).set(steps);

        dispatcher.execute(new DMRAction(operation), new AsyncCallback<DMRResponse>() {

            @Override
            public void onFailure(Throwable caught) {
                context.setlastError(caught);
                Log.error(caught.getMessage());
                control.abort();
            }

            @Override
            public void onSuccess(DMRResponse result) {
                ModelNode response = result.get();
                if(response.isFailure()) {
                    context.setlastError(new RuntimeException(response.getFailureDescription()));
                    control.abort();
                } else {
                    // capture exec mode
                    ModelNode execMode = response.get(RESULT).get("step-1");
                    boolean isServer = execMode.get(RESULT).asString().equals("Server");
                    context.setProperty(BootstrapContext.STANDALONE, Boolean.valueOf(isServer).toString());

                    // product name, release codename
                    ModelNode productName = response.get(RESULT).get("step-2");
                    ModelNode releaseCodename = response.get(RESULT).get("step-3");
                    if (productName.get(RESULT).isDefined()) {
                        context.setProductName(productName.get(RESULT).asString());
                    } else if (releaseCodename.get(RESULT).isDefined()) {
                        context.setProductName(releaseCodename.get(RESULT).asString());
                    }

                    // product version, release version
                    ModelNode productVersion = response.get(RESULT).get("step-4");
                    ModelNode releaseVersion = response.get(RESULT).get("step-5");
                    if (productVersion.get(RESULT).isDefined()) {
                        context.setProductVersion(productVersion.get(RESULT).asString());
                    } else if (releaseVersion.get(RESULT).isDefined()) {
                        context.setProductVersion(releaseVersion.get(RESULT).asString());
                    }

                    ModelNode whoami = response.get(RESULT).get("step-6");
                    String username = whoami.get(RESULT).get("identity").get("username").asString();

                    context.setPrincipal(username);

                    System.out.println(context.getProductName() + " " + context.getProductVersion());
                    control.proceed();
                }
            }
        });
    }
View Full Code Here

        if(!GWT.isScript())
        {
            // Verify the domain API is available
            // Has the server been started?

            BootstrapContext bootstrap = MODULES.getBootstrapContext();
            String url = bootstrap.getProperty(BootstrapContext.DOMAIN_API);
            final String message = "Unable to connect domain API: '"+url+
                    "'. Has the server been started?";

            RequestBuilder rb = new RequestBuilder(
                    RequestBuilder.GET,
View Full Code Here

    }

    private void identifyManagementModel() {
        // distinguish standalone and domain mode
        final BootstrapContext bootstrap = MODULES.getBootstrapContext();
        ModelNode operation = new ModelNode();
        operation.get(OP).set(READ_CHILDREN_NAMES_OPERATION);
        operation.get(CHILD_TYPE).set("subsystem");
        operation.get(ADDRESS).setEmptyList();

        MODULES.getDispatchAsync().execute(new DMRAction(operation), new AsyncCallback<DMRResponse>() {
            @Override
            public void onFailure(Throwable caught) {
                bootstrap.setProperty(BootstrapContext.STANDALONE, "false");
                loadMainApp();
            }

            @Override
            public void onSuccess(DMRResponse result) {
                bootstrap.setProperty(BootstrapContext.STANDALONE, "true");
                loadMainApp();
            }
        });

    }
View Full Code Here

    }

    @Override
    public void execute(final Iterator<BoostrapStep> iterator, final AsyncCallback<Boolean> outcome) {

        BootstrapContext bootstrapContext = Console.getBootstrapContext();

        if(!bootstrapContext.isStandalone())
        {
            profileStore.loadProfiles(new SimpleCallback<List<ProfileRecord>>() {

                @Override
                public void onFailure(Throwable caught) {
View Full Code Here

    }

    @Override
    public void execute(final Iterator<BoostrapStep> iterator, final AsyncCallback<Boolean> outcome) {

        BootstrapContext bootstrapContext = Console.getBootstrapContext();

        if(!bootstrapContext.isStandalone())
        {
            domainManager.getHosts(new SimpleCallback<HostList>() {
                @Override
                public void onSuccess(HostList hostList) {
                    Log.info("Identified " + hostList.getHosts().size() + " hosts in this domain");
View Full Code Here

    }

    @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", prodConfig.getConsoleVersion());

            control.proceed();
        }
        else
        {
            bootstrap.setlastError(new RuntimeException("Failed to resolve execution mode"));
            control.abort();
        }
    }
View Full Code Here

    }

    @Override
    public void execute(final Control<BootstrapContext> control) {

        final BootstrapContext context = control.getContext();

        final ModelNode operation = new ModelNode();
        operation.get(OP).set(COMPOSITE);
        operation.get(ADDRESS).setEmptyList();

        ModelNode step;
        List<ModelNode> steps = new ArrayList<ModelNode>();

        // exec type
        step = new ModelNode();
        step.get(OP).set(READ_ATTRIBUTE_OPERATION);
        step.get(NAME).set("process-type");
        step.get(ADDRESS).setEmptyList();
        steps.add(step);

        // product name
        step = new ModelNode();
        step.get(OP).set(READ_ATTRIBUTE_OPERATION);
        step.get(NAME).set("product-name");
        step.get(ADDRESS).setEmptyList();
        steps.add(step);

        // release codename
        step = new ModelNode();
        step.get(OP).set(READ_ATTRIBUTE_OPERATION);
        step.get(NAME).set("release-codename");
        step.get(ADDRESS).setEmptyList();
        steps.add(step);

        // product version
        step = new ModelNode();
        step.get(OP).set(READ_ATTRIBUTE_OPERATION);
        step.get(NAME).set("product-version");
        step.get(ADDRESS).setEmptyList();
        steps.add(step);

        // release version
        step = new ModelNode();
        step.get(OP).set(READ_ATTRIBUTE_OPERATION);
        step.get(NAME).set("release-version");
        step.get(ADDRESS).setEmptyList();
        steps.add(step);

        operation.get(STEPS).set(steps);

        dispatcher.execute(new DMRAction(operation), new AsyncCallback<DMRResponse>() {

            @Override
            public void onFailure(Throwable caught) {
                context.setlastError(caught);
                Log.error(caught.getMessage());
                control.abort();
            }

            @Override
            public void onSuccess(DMRResponse result) {
                ModelNode response = result.get();
                if(response.isFailure()) {
                    context.setlastError(new RuntimeException(response.getFailureDescription()));
                    control.abort();
                } else {
                    // capture exec mode
                    ModelNode execMode = response.get(RESULT).get("step-1");
                    boolean isServer = execMode.get(RESULT).asString().equals("Server");
                    context.setProperty(BootstrapContext.STANDALONE, Boolean.valueOf(isServer).toString());

                    // product name, release codename
                    ModelNode productName = response.get(RESULT).get("step-2");
                    ModelNode releaseCodename = response.get(RESULT).get("step-3");
                    if (productName.get(RESULT).isDefined()) {
                        context.setProductName(productName.get(RESULT).asString());
                    } else if (releaseCodename.get(RESULT).isDefined()) {
                        context.setProductName(releaseCodename.get(RESULT).asString());
                    }

                    // product version, release version
                    ModelNode productVersion = response.get(RESULT).get("step-4");
                    ModelNode releaseVersion = response.get(RESULT).get("step-5");
                    if (productVersion.get(RESULT).isDefined()) {
                        context.setProductVersion(productVersion.get(RESULT).asString());
                    } else if (releaseVersion.get(RESULT).isDefined()) {
                        context.setProductVersion(releaseVersion.get(RESULT).asString());
                    }

                    System.out.println(context.getProductName() + " " + context.getProductVersion());
                    control.proceed();
                }
            }
        });
    }
View Full Code Here

TOP

Related Classes of org.jboss.as.console.client.core.BootstrapContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.