Package org.jboss.as.console.client.domain.model

Examples of org.jboss.as.console.client.domain.model.ServerInstance


                                @Override
                                public void onFailure(Throwable caught) {
                                    numResponses++;

                                    ServerInstance instance = createInstanceModel(handle);
                                    instance.setHost(host);
                                    instance.setRunning(false);
                                    instance.setInterfaces(new HashMap<String, String>());
                                    instance.setSocketBindings(new HashMap<String, String>());
                                    instanceList.add(instance);

                                    checkComplete(instanceList, cb);
                                }

                                @Override
                                public void onSuccess(DMRResponse result) {

                                    numResponses++;

                                    ModelNode response = result.get();
                                    ModelNode compositeResponse = response.get(RESULT);

                                    ServerInstance instance = createInstanceModel(handle);
                                    instance.setHost(host);
                                    instance.setInterfaces(new HashMap<String, String>());
                                    instance.setSocketBindings(new HashMap<String, String>());
                                    instanceList.add(instance);

                                    if(response.isFailure())
                                    {
                                        instance.setRunning(false);
                                    }
                                    else
                                    {

                                        ModelNode instanceModel = compositeResponse.get("step-1").get(RESULT);
                                        instance.setRunning(handle.isStarted());

                                        //instance.setProfile(instanceModel.get("profile-name").asString());

                                        if(instanceModel.hasDefined("server-state"))
                                        {
                                            String state = instanceModel.get("server-state").asString();
                                            if(state.equals("reload-required"))
                                            {
                                                instance.setFlag(ServerFlag.RELOAD_REQUIRED);
                                            }
                                            else if (state.equals("restart-required"))
                                            {
                                                instance.setFlag(ServerFlag.RESTART_REQUIRED);
                                            }
                                        }

                                        // ---- interfaces

                                        List<Property> interfaces = Collections.EMPTY_LIST;

                                        if(compositeResponse.hasDefined("step-2"))
                                        {
                                            interfaces = compositeResponse.get("step-2").get(RESULT).asPropertyList();

                                            for(Property intf : interfaces)
                                            {
                                                if(intf.getValue().hasDefined("resolved-address"))
                                                {
                                                    instance.getInterfaces().put(
                                                            intf.getName(),
                                                            intf.getValue().get("resolved-address").asString()
                                                    );
                                                }
                                            }
                                        }

                                        // ---- socket binding
                                        List<Property> sockets = Collections.EMPTY_LIST;
                                        if(compositeResponse.hasDefined("step-3"))
                                        {
                                            sockets = compositeResponse.get("step-3").get(RESULT).asPropertyList();

                                            for(Property socket : sockets)
                                            {
                                                instance.getSocketBindings().put(
                                                        socket.getName(),
                                                        socket.getValue().get("port-offset").asString()
                                                );

                                            }
View Full Code Here


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


            @Override
            public void onFailure(Throwable caught) {
                ServerInstance instance = createInstanceModel(handle);
                instance.setRunning(false);
                callback.onSuccess(instance);
            }

            @Override
            public void onSuccess(DMRResponse result) {

                ModelNode statusResponse = result.get();
                ModelNode payload = statusResponse.get(RESULT);

                ServerInstance instance = createInstanceModel(handle);

                if(statusResponse.isFailure())
                {
                    instance.setRunning(false);
                }
                else
                {
                    instance.setRunning(handle.isStarted());

                    if(payload.hasDefined("server-state"))
                    {
                        String state = payload.get("server-state").asString();
                        if(state.equals("reload-required"))
                        {
                            instance.setFlag(ServerFlag.RELOAD_REQUIRED);
                        }
                        else if (state.equals("restart-required"))
                        {
                            instance.setFlag(ServerFlag.RESTART_REQUIRED);
                        }
                    }

                }
View Full Code Here

            }
        });
    }

    private ServerInstance createInstanceModel(Server handle) {
        ServerInstance instance = factory.serverInstance().as();
        instance.setName(handle.getName());
        instance.setServer(handle.getName());
        instance.setGroup(handle.getGroup());
        instance.setProfile(handle.getProfile());
        return instance;
    }
View Full Code Here

        serverList.getSelectionModel().addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
            @Override
            public void onSelectionChange(SelectionChangeEvent event) {

                ServerInstance server = getSelectedServer();
                Host selectedHost = getSelectedHost();

                if(selectedHost!=null &server!=null)
                {
                    presenter.onServerSelected(selectedHost, server);
                    updateDisplay();
                }

            }
        });


        HorizontalPanel millerHeader = new HorizontalPanel();
        Label host = new Label("Host");
        millerHeader.add(host);
        Label server = new Label("Server");

        millerHeader.add(server);

        host.getElement().getParentElement().setAttribute("width", "50%");
        server.getElement().getParentElement().setAttribute("width", "50%");


        layout.add(millerHeader);

        millerHeader.getElement().addClassName("server-picker-table-header");
View Full Code Here

            @Override
            public void onSuccess(List<ServerInstance> serverInstances) {

                if(serverInstances.isEmpty())
                {
                    ServerInstance blank = factory.serverInstance().as();
                    blank.setHost(NOT_SET);
                    blank.setName(NOT_SET);
                    callback.onSuccess(new ServerInstanceList(blank, Collections.EMPTY_LIST));
                }
                else
                {
                    ServerInstance server = getSelectedServerInstance(serverInstances);
                    callback.onSuccess(new ServerInstanceList(server, serverInstances));
                }
            }
        });
    }
View Full Code Here

    private ServerInstance getSelectedServerInstance(List<ServerInstance> serverInstances) {

        if(serverInstances.isEmpty()) throw new IllegalStateException("No server instances available!");

        ServerInstance matched = null;

        ServerInstance active = null;

        // match by preselection
        for(ServerInstance server : serverInstances)
        {
            if(server.isRunning())
View Full Code Here

                            for (Property property : properties) {
                                String name = property.getName();
                                ModelNode scModel = property.getValue();
                                String group = scModel.get("group").asString();

                                ServerInstance serverInstance = beanFactory.serverInstance().as();
                                serverInstance.setName(name);
                                serverInstance.setServer(name);
                                serverInstance.setGroup(group);
                                serverInstance.setProfile(groupToProfile.get(group));
                                serverInstance.setHost(hostInfo.getName());
                                serverInstance.setRunning(scModel.get("status").asString().equalsIgnoreCase("STARTED"));
                                serverInstance.setSocketBindings(new HashMap<String, String>());

                                servers.add(serverInstance);
                            }
                            hostInfo.setServerInstances(servers);
                        }
View Full Code Here

                        List<Property> properties = stepsResult.asPropertyList();
                        for (Iterator<Property> iterator = properties.iterator(); iterator.hasNext(); ) {
                            Property property = iterator.next();
                            String step = property.getName();
                            ModelNode node = property.getValue();
                            ServerInstance serverInstance = stepToServer.get(step);
                            if (serverInstance != null) {
                                // step-n: server state
                                if (node.get(RESULT).isDefined()) {
                                    String state = node.get(RESULT).asString();
                                    if (state.equals("reload-required")) {
                                        serverInstance.setFlag(ServerFlag.RELOAD_REQUIRED);
                                    } else if (state.equals("restart-required")) {
                                        serverInstance.setFlag(ServerFlag.RESTART_REQUIRED);
                                    }
                                }

                                // step-n + 1: socket binding groups
                                property = iterator.next();
                                node = property.getValue();
                                if (node.get(RESULT).isDefined()) {
                                    List<Property> sockets = node.get(RESULT).asPropertyList();
                                    for (Property socket : sockets) {
                                        serverInstance.getSocketBindings()
                                                .put(socket.getName(), socket.getValue().get("port-offset").asString());
                                    }
                                }
                            }
                        }
View Full Code Here

            host.setServerInstances(new ArrayList<ServerInstance>());

            // server instances
            for (int x = 0; x < (Random.nextInt(5) + 1); x++) {
                int groupIndex = Random.nextInt(groupNames.length - 1);
                ServerInstance serverInstance = beanFactory.serverInstance().as();
                serverInstance.setGroup(groupNames[groupIndex]);
                serverInstance.setRunning((groupIndex % 2 == 0));
                if (serverInstance.isRunning()) {
                    if (Random.nextBoolean()) {
                        serverInstance.setFlag(Random.nextBoolean() ? RESTART_REQUIRED : RELOAD_REQUIRED);
                    } else {
                        serverInstance.setFlag(null);
                    }
                }
                serverInstance.setName(groupNames[groupIndex] + "-" + x);
                serverInstance.setSocketBindings(Collections.<String, String>emptyMap());
                serverInstance.setInterfaces(Collections.<String, String>emptyMap());

                host.getServerInstances().add(serverInstance);
            }
            hostInfos.add(host);
        }
View Full Code Here

                                @Override
                                public void onFailure(Throwable caught) {
                                    numResponses++;

                                    ServerInstance instance = createInstanceModel(handle);
                                    instance.setHost(host);
                                    instance.setRunning(false);
                                    instance.setInterfaces(new HashMap<String, String>());
                                    instance.setSocketBindings(new HashMap<String, String>());
                                    instanceList.add(instance);

                                    checkComplete(instanceList, cb);
                                }

                                @Override
                                public void onSuccess(DMRResponse result) {

                                    numResponses++;

                                    ModelNode response = result.get();
                                    ModelNode compositeResponse = response.get(RESULT);

                                    ServerInstance instance = createInstanceModel(handle);
                                    instance.setHost(host);
                                    instance.setInterfaces(new HashMap<String, String>());
                                    instance.setSocketBindings(new HashMap<String, String>());
                                    instanceList.add(instance);

                                    if(response.isFailure())
                                    {
                                        instance.setRunning(false);
                                    }
                                    else
                                    {

                                        ModelNode instanceModel = compositeResponse.get("step-1").get(RESULT);
                                        instance.setRunning(handle.isStarted());

                                        //instance.setProfile(instanceModel.get("profile-name").asString());

                                        if(instanceModel.hasDefined("server-state"))
                                        {
                                            String state = instanceModel.get("server-state").asString();
                                            if(state.equals("reload-required"))
                                            {
                                                instance.setFlag(ServerFlag.RELOAD_REQUIRED);
                                            }
                                            else if (state.equals("restart-required"))
                                            {
                                                instance.setFlag(ServerFlag.RESTART_REQUIRED);
                                            }
                                        }

                                        // ---- interfaces

                                        List<Property> interfaces = new ArrayList<Property>();

                                        if(compositeResponse.hasDefined("step-2"))
                                        {
                                            interfaces = compositeResponse.get("step-2").get(RESULT).asPropertyList();

                                            for(Property intf : interfaces)
                                            {
                                                if(intf.getValue().hasDefined("resolved-address"))
                                                {
                                                    instance.getInterfaces().put(
                                                            intf.getName(),
                                                            intf.getValue().get("resolved-address").asString()
                                                    );
                                                }
                                            }
                                        }

                                        // ---- socket binding
                                        List<Property> sockets = new ArrayList<Property>();
                                        if(compositeResponse.hasDefined("step-3"))
                                        {
                                            sockets = compositeResponse.get("step-3").get(RESULT).asPropertyList();

                                            for(Property socket : sockets)
                                            {
                                                instance.getSocketBindings().put(
                                                        socket.getName(),
                                                        socket.getValue().get("port-offset").asString()
                                                );

                                            }
View Full Code Here

TOP

Related Classes of org.jboss.as.console.client.domain.model.ServerInstance

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.