Package org.jboss.as.controller.client.helpers.domain

Examples of org.jboss.as.controller.client.helpers.domain.ServerIdentity


    }

    private boolean listServers() throws Exception {
        stdout.println("\nReading the list of configured servers:");
        for(Map.Entry<ServerIdentity, ServerStatus> server : client.getServerStatuses().entrySet()) {
            ServerIdentity id = server.getKey();
            stdout.println("\nServer:\n");
            stdout.println("server name:         " + id.getServerName());
            stdout.println("host controller name: " + id.getHostName());
            stdout.println("server group name:   " + id.getServerGroupName());
            stdout.println("status:              " + server.getValue());
        }
        return continuePrompt();
    }
View Full Code Here


        return continuePrompt();
    }

    private boolean dumpServer()  throws Exception {

        ServerIdentity server = chooseServer(ServerStatus.STARTED);
        if (server != null) {
            stdout.println("\nReading runtime configuration for " + server.getServerName() + "\n");

            ModelNode op = new ModelNode();
            op.get("operation").set("read-config-as-xml");
            ModelNode address = op.get("address");
            address.add("host", server.getHostName());
            address.add("server", server.getServerName());
            stdout.println(executeForResult(OperationBuilder.Factory.create(op).build()).asString());
        }
        return continuePrompt();
    }
View Full Code Here

        }
        return continuePrompt();
    }

    private boolean stopServer() throws Exception {
        ServerIdentity server = chooseServer(ServerStatus.STARTED);
        if (server != null) {
            System.out.println("\nStopping server " + server.getServerName() + "\n");
            ServerStatus status = client.stopServer(server.getHostName(), server.getServerName(), -1, TimeUnit.SECONDS);
            System.out.println("Stop executed. Server status is " + status);
        }
        return continuePrompt();
    }
View Full Code Here

        }
        return continuePrompt();
    }

    private boolean startServer() throws Exception {
        ServerIdentity server = chooseServer(ServerStatus.STOPPED, ServerStatus.DISABLED);
        if (server != null) {
            System.out.println("\nStarting server " + server.getServerName() + "\n");
            ServerStatus status = client.startServer(server.getHostName(), server.getServerName());
            System.out.println("Start executed. Server status is " + status);
        }
        return continuePrompt();
    }
View Full Code Here

        }
        return continuePrompt();
    }

    private boolean restartServer() throws Exception {
        ServerIdentity server = chooseServer(ServerStatus.STARTED);
        if (server != null) {
            System.out.println("\nRestarting server " + server.getServerName() + "\n");
            ServerStatus status = client.restartServer(server.getHostName(), server.getServerName(), -1, TimeUnit.SECONDS);
            System.out.println("Restart executed. Server status is " + status);
        }
        return continuePrompt();
    }
View Full Code Here

        return executeForResult(OperationBuilder.Factory.create(op).build());
    }

    private boolean removeServer() throws Exception {

        ServerIdentity server = chooseServer(ServerStatus.STOPPED, ServerStatus.DISABLED);
        if (server != null) {
            stdout.println("Removing server " + server.getServerName());
            ModelNode op = new ModelNode();
            op.get("operation").set("remove");
            ModelNode address = op.get("address");
            address.add("host", server.getHostName());
            address.add("server-config", server.getServerName());
            boolean success = true;
            try {
                executeForResult(OperationBuilder.Factory.create(op).build());
            }
            catch (Exception e) {
View Full Code Here

        }
        return continuePrompt();
    }

    private ServerIdentity chooseServer(ServerStatus valid, ServerStatus...alsoValid) throws IOException {
        ServerIdentity result = null;
        SortedMap<String, ServerIdentity> servers = getValidServers(valid, alsoValid);
        if (servers.size() == 0) {
            StringBuilder sb = new StringBuilder("No servers are in a valid state to perform this operation. Servers must have status ");
            sb.append(valid);
            if (alsoValid != null) {
View Full Code Here

    private Collection<ServerIdentity> resultToServerIdentitySet(final ModelNode result) {
        final Collection<ServerIdentity> servers = new ArrayList<ServerIdentity>();
        for(final Property serverGroup : result.get(SERVER_GROUPS).asPropertyList()) {
            for(Property server : serverGroup.getValue().asPropertyList()) {
                final String host = server.getValue().get(HOST).asString();
                servers.add(new ServerIdentity(host, serverGroup.getName(), server.getName()));
            }
        }
        return servers;
    }
View Full Code Here

                ModelNode address = new ModelNode();
                address.add("host", host);
                address.add("server-config", server);
                String group = readAttribute("group", address).asString();
                ServerStatus status = Enum.valueOf(ServerStatus.class, readAttribute("status", address).asString());
                ServerIdentity id = new ServerIdentity(host, group, server);
                result.put(id, status);
            }

        }
        return result;
View Full Code Here

                ModelNode address = new ModelNode();
                address.add("host", host);
                address.add("server-config", server);
                String group = readAttribute("group", address).asString();
                ServerStatus status = Enum.valueOf(ServerStatus.class, readAttribute("status", address).asString());
                ServerIdentity id = new ServerIdentity(host, group, server);
                result.put(id, status);
            }

        }
        return result;
View Full Code Here

TOP

Related Classes of org.jboss.as.controller.client.helpers.domain.ServerIdentity

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.