Package org.apache.karaf.cellar.core

Examples of org.apache.karaf.cellar.core.Group


    public void joinGroup(String targetGroupName) {
        LOGGER.info("CELLAR GROUP: Joining group {}.",targetGroupName);
        Node node = clusterManager.getNode();
        Map<String, Group> groups = groupManager.listGroups();
        if (groups != null && !groups.isEmpty()) {
            Group targetGroup = groups.get(targetGroupName);
            if (targetGroup == null) {
                groupManager.registerGroup(targetGroupName);
            } else if (!targetGroup.getNodes().contains(node)) {
                targetGroup.getNodes().add(node);
                groupManager.listGroups().put(targetGroupName, targetGroup);
                groupManager.registerGroup(targetGroup);
            }
        }
    }
View Full Code Here


    public void quitGroup(String targetGroupName) {
        LOGGER.info("CELLAR GROUP: Quiting group {}.",targetGroupName);
        Node node = clusterManager.getNode();
        Map<String, Group> groups = groupManager.listGroups();
        if (groups != null && !groups.isEmpty()) {
            Group targetGroup = groups.get(targetGroupName);
            if (targetGroup.getNodes().contains(node)) {
                targetGroup.getNodes().remove(node);
                groupManager.unRegisterGroup(targetGroup);
            }
        }
    }
View Full Code Here

    public Boolean updateFeatureStatus(String groupName, String feature, String version, Boolean status) {
        Boolean result = Boolean.FALSE;
        ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
        try {
            Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
            Group group = groupManager.findGroupByName(groupName);
            if (group == null || group.getNodes().isEmpty()) {
                FeatureInfo info = new FeatureInfo(feature, version);
                Map<FeatureInfo, Boolean> features = clusterManager.getMap(Constants.FEATURES + Configurations.SEPARATOR + groupName);
                //1st check the existing configuration
                if (version == null || (version.trim().length() < 1)) {
                    for (FeatureInfo f : features.keySet()) {
View Full Code Here

    @Argument(index = 2, name = "version", description = "The feature version.", required = false, multiValued = false)
    String version;

    @Override
    protected Object doExecute() throws Exception {
        Group group = groupManager.findGroupByName(groupName);
        EventProducer producer = eventTransportFactory.getEventProducer(groupName, true);
        RemoteFeaturesEvent event = new RemoteFeaturesEvent(feature, version, FeatureEvent.EventType.FeatureInstalled);
        event.setForce(true);
        event.setSourceGroup(group);
        producer.produce(event);
View Full Code Here

    @Argument(index = 2, name = "version", description = "The feature version.", required = false, multiValued = false)
    String version;

    @Override
    protected Object doExecute() throws Exception {
        Group group = groupManager.findGroupByName(groupName);
        EventProducer producer = eventTransportFactory.getEventProducer(groupName, true);
        RemoteFeaturesEvent event = new RemoteFeaturesEvent(feature, version, FeatureEvent.EventType.FeatureUninstalled);
        event.setForce(true);
        event.setSourceGroup(group);
        producer.produce(event);
View Full Code Here

    @Argument(index = 2, name = "count", description = "The number of nodes to transfer.", required = false, multiValued = false)
    int count = 1;

    @Override
    protected Object doExecute() throws Exception {
        Group sourceGroup = groupManager.findGroupByName(sourceGroupName);
        if (sourceGroup != null) {
            List<String> eligibleMembers = new LinkedList<String>();
            Set<Node> groupMembers = sourceGroup.getNodes();

            for (Node node : groupMembers) {
                Set<Group> nodeGroups = groupManager.listGroups(node);
                //If the node only belongs to the source group then it is eligible.
                if (nodeGroups != null && nodeGroups.size() == 1) {
View Full Code Here

    @Argument(index = 1, name = "url", description = "The repository URL to add in the OBR service.", required = true, multiValued = false)
    String url;

    public Object doExecute() throws Exception {
        // find the group for the given name
        Group group = groupManager.findGroupByName(groupName);
        // create an event and produce it
        EventProducer producer = eventTransportFactory.getEventProducer(groupName, true);
        ObrUrlEvent event = new ObrUrlEvent(url, Constants.URL_REMOVE_EVENT_TYPE);
        event.setForce(true);
        event.setSourceGroup(group);
View Full Code Here

    @Argument(index = 1, name = "url", description = "The repository URL to register in the OBR service.", required = true, multiValued = false)
    String url;

    public Object doExecute() throws Exception {
        // find group for the given name
        Group group = groupManager.findGroupByName(groupName);
        // create an event and produce it
        EventProducer producer = eventTransportFactory.getEventProducer(groupName, true);
        ObrUrlEvent event = new ObrUrlEvent(url, Constants.URL_ADD_EVENT_TYPE);
        event.setForce(true);
        event.setSourceGroup(group);
View Full Code Here

    @Override
    protected Object doExecute() throws Exception {
        ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
        try {
            Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
            Group g = groupManager.findGroupByName(group);
            if (g == null) {
                System.out.println("Group " + group + " doesn't exist");
                return null;
            }
            List<String> nodes = new LinkedList<String>();

            if (g.getNodes() != null && !g.getNodes().isEmpty()) {
                for (Node n : g.getNodes()) {
                    nodes.add(n.getId());
                }
                doExecute(ManageGroupAction.QUIT, group, nodes);
            }
View Full Code Here

    boolean start = false;

    @Override
    protected Object doExecute() throws Exception {
        // find the group for the given name
        Group group = groupManager.findGroupByName(groupName);
        // create an event and produce it
        EventProducer producer = eventTransportFactory.getEventProducer(groupName, true);
        int type = 0;
        if (start) type = Constants.BUNDLE_START_EVENT_TYPE;
        ObrBundleEvent event = new ObrBundleEvent(bundleId, type);
View Full Code Here

TOP

Related Classes of org.apache.karaf.cellar.core.Group

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.