Examples of ManageGroupCommand


Examples of org.apache.karaf.cellar.core.control.ManageGroupCommand

     * @return the Object resulting of the command execution.
     * @throws Exception in case of execution failure.
     */
    protected Object doExecute(ManageGroupAction action, String group, Group source, Collection<String> nodeIds, Boolean suppressOutput) throws Exception {

        ManageGroupCommand command = new ManageGroupCommand(clusterManager.generateId());

        // looking for nodes and check if exist
        Set<Node> recipientList = new HashSet<Node>();
        if (nodeIds != null && !nodeIds.isEmpty()) {
            for (String nodeId : nodeIds) {
                Node node = clusterManager.findNodeById(nodeId);
                if (node == null) {
                    System.err.println("Cluster node " + nodeId + " doesn't exist");
                } else {
                    recipientList.add(node);
                }
            }
        } else {
            recipientList.add(clusterManager.getNode());
        }

        if (recipientList.size() < 1) {
            return null;
        }

        command.setDestination(recipientList);
        command.setAction(action);

        if (group != null) {
            command.setGroupName(group);
        }

        if (source != null) {
            command.setSourceGroup(source);
        }

        Map<Node, ManageGroupResult> results = executionContext.execute(command);
        if (!suppressOutput) {
            if (results == null || results.isEmpty()) {
View Full Code Here

Examples of org.apache.karaf.cellar.core.control.ManageGroupCommand

            if (g.getNodes() != null && !g.getNodes().isEmpty()) {
                for (Node n : g.getNodes()) {
                    nodes.add(n.getId());
                }
                ManageGroupCommand command = new ManageGroupCommand(clusterManager.generateId());
                command.setAction(ManageGroupAction.QUIT);
                command.setGroupName(name);
                Set<Node> recipientList = clusterManager.listNodes(nodes);
                command.setDestination(recipientList);
                executionContext.execute(command);
            }

            groupManager.deleteGroup(name);
        } finally {
View Full Code Here

Examples of org.apache.karaf.cellar.core.control.ManageGroupCommand

        }

        Set<Node> nodes = new HashSet<Node>();
        nodes.add(node);

        ManageGroupCommand command = new ManageGroupCommand(clusterManager.generateId());
        command.setAction(ManageGroupAction.JOIN);
        command.setGroupName(groupName);
        command.setDestination(nodes);

        executionContext.execute(command);
    }
View Full Code Here

Examples of org.apache.karaf.cellar.core.control.ManageGroupCommand

        }

        Set<Node> nodes = new HashSet<Node>();
        nodes.add(node);

        ManageGroupCommand command = new ManageGroupCommand(clusterManager.generateId());
        command.setAction(ManageGroupAction.QUIT);
        command.setGroupName(groupName);
        command.setDestination(nodes);
        executionContext.execute(command);
    }
View Full Code Here

Examples of org.apache.karaf.cellar.core.control.ManageGroupCommand

            List<String> nodes = new ArrayList<String>();
            if (g.getNodes() != null && !g.getNodes().isEmpty()) {
                for (Node n : g.getNodes()) {
                    nodes.add(n.getId());
                }
                ManageGroupCommand command = new ManageGroupCommand(clusterManager.generateId());
                command.setAction(ManageGroupAction.QUIT);
                command.setGroupName(group);
                Set<Node> recipientList = clusterManager.listNodes(nodes);
                command.setDestination(recipientList);
                try {
                    executionContext.execute(command);
                } catch (Exception e) {
                    LOGGER.error("Can't send the cluster group command");
                    success = false;
View Full Code Here

Examples of org.apache.karaf.cellar.core.control.ManageGroupCommand

     * @param suppressOutput
     * @return
     * @throws Exception
     */
    protected Object doExecute(ManageGroupAction action, String group, Collection<String> nodes, Boolean suppressOutput) throws Exception {
        ManageGroupCommand command = new ManageGroupCommand(clusterManager.generateId());
        Set<Node> recipientList = clusterManager.listNodes(nodes);

        //Set the recipient list
        if (recipientList != null && !recipientList.isEmpty()) {
            command.setDestination(recipientList);
        } else {
            Set<Node> recipients = new HashSet<Node>();
            recipients.add(clusterManager.getNode());
            command.setDestination(recipients);
        }

        command.setAction(action);

        if (group != null) {
            command.setGroupName(group);
        }

        Map<Node, ManageGroupResult> results = executionContext.execute(command);
        if (!suppressOutput) {
            if (results == null || results.isEmpty()) {
View Full Code Here

Examples of org.apache.karaf.cellar.core.control.ManageGroupCommand

            if (g.getNodes() != null && !g.getNodes().isEmpty()) {
                for (Node n : g.getNodes()) {
                    nodes.add(n.getId());
                }
                ManageGroupCommand command = new ManageGroupCommand(clusterManager.generateId());
                command.setAction(ManageGroupAction.QUIT);
                command.setGroupName(name);
                Set<Node> recipientList = clusterManager.listNodes(nodes);
                command.setDestination(recipientList);
                executionContext.execute(command);
            }

            groupManager.deleteGroup(name);
        } finally {
View Full Code Here

Examples of org.apache.karaf.cellar.core.control.ManageGroupCommand

    }

    public void join(String group, String nodeId) throws Exception {
        List<String> nodes = new ArrayList<String>();
        nodes.add(nodeId);
        ManageGroupCommand command = new ManageGroupCommand(clusterManager.generateId());
        command.setAction(ManageGroupAction.JOIN);
        command.setGroupName(group);
        Set<Node> recipientList = clusterManager.listNodes(nodes);
        command.setDestination(recipientList);
        executionContext.execute(command);
    }
View Full Code Here

Examples of org.apache.karaf.cellar.core.control.ManageGroupCommand

    }

    public void quit(String group, String nodeId) throws Exception {
        List<String> nodes = new ArrayList<String>();
        nodes.add(nodeId);
        ManageGroupCommand command = new ManageGroupCommand(clusterManager.generateId());
        command.setAction(ManageGroupAction.QUIT);
        command.setGroupName(group);
        Set<Node> recipientList = clusterManager.listNodes(nodes);
        command.setDestination(recipientList);
        executionContext.execute(command);
    }
View Full Code Here

Examples of org.apache.karaf.cellar.core.control.ManageGroupCommand

        TabularType tableType = new TabularType("Nodes", "Table of all Karaf Cellar nodes", nodeType, new String[]{ "id" });

        TabularData table = new TabularDataSupport(tableType);

        ManageGroupCommand command = new ManageGroupCommand(clusterManager.generateId());
        Set<Node> recipientList = new HashSet<Node>();
        recipientList.add(clusterManager.getNode());
        command.setDestination(recipientList);
        command.setAction(ManageGroupAction.LIST);

        Map<Node, ManageGroupResult> results = executionContext.execute(command);
        for (Node node : results.keySet()) {
            CompositeData data = new CompositeDataSupport(nodeType,
                    new String[]{ "id", "hostname", "port" },
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.