@Override public String getId(String alias) throws Exception { Node node = clusterManager.findNodeByAlias(alias); if (node != null) { return node.getId(); } return null; }
@Override public String getAlias(String id) throws Exception { Node node = clusterManager.findNodeById(id); if (node != null) { return node.getAlias(); } return null; }
/** * List the nodes in a given cluster group. * * @param group the cluster group. * @return a Set with the nodes. */ @Override public Set<Node> listNodesByGroup(Group group) { return group.getNodes(); }
/** * Check if a configuration is allowed. * * @param group the cluster group. * @param category the configuration category constant. * @param pid the configuration PID. * @param type the cluster event type. * @return true if the cluster event type is allowed, false else. */ public boolean isAllowed(Group group, String category, String pid, EventType type) { CellarSupport support = new CellarSupport(); support.setClusterManager(this.clusterManager); support.setGroupManager(this.groupManager); support.setConfigurationAdmin(this.configurationAdmin); return support.isAllowed(group, category, pid, type); }
/** * Remove a {@link Node} from the target {@link Group}. * * @param targetGroupName the target group name where to remove the node. */ public void quitGroup(String 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); } } }
/** * Remove {@link Node} from all {@link Group}s. */ public void purgeGroups() { Node node = clusterManager.getNode(); Set<String> groupNames = groupManager.listGroupNames(node); if (groupNames != null && !groupNames.isEmpty()) { for (String targetGroupName : groupNames) { quitGroup(targetGroupName); } } }
/** * Add cluster groups where the local node is belonging. * * @param group the cluster group candidate for completion. * @return true if the cluster group has been accepted, false else. */ @Override protected boolean acceptsGroup(Group group) { Node node = groupManager.getNode(); if (group.getNodes().contains(node)) return true; else return false; }
@Override public void setAlias(String alias) throws Exception { if (alias == null) { throw new IllegalArgumentException("Alias is null"); } if (clusterManager.findNodeByAlias(alias) != null) { throw new IllegalArgumentException("Alias " + alias + " already exists"); } clusterManager.setNodeAlias(alias); }
/** * Check if a configuration is allowed. * * @param group the cluster group. * @param category the configuration category constant. * @param pid the configuration PID. * @param type the cluster event type. * @return true if the cluster event type is allowed, false else. */ public boolean isClusterConfigPIDAllowed(Group group, String category, String pid, EventType type) { CellarSupport support = new CellarSupport(); support.setClusterManager(this.karafCellarClusterManager); support.setGroupManager(this.karafCellarGroupManager); support.setConfigurationAdmin(this.osgiConfigurationAdmin); return support.isAllowed(group, category, pid, type); }
/** * Remove a {@link Node} from the target {@link Group}. * * @param targetGroupName the target group name where to remove the node. */ public void quitGroup(String 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); } } }
@Override public String getId(String alias) throws Exception { Node node = clusterManager.findNodeByAlias(alias); if (node != null) { return node.getId(); } return null; }
/** * Remove {@link Node} from all {@link Group}s. */ public void purgeGroups() { Node node = clusterManager.getNode(); Set<String> groupNames = groupManager.listGroupNames(node); if (groupNames != null && !groupNames.isEmpty()) { for (String targetGroupName : groupNames) { quitGroup(targetGroupName); } } }
/** * Accept the cluster groups which don't include the local node. * * @param group the cluster group to check. * @return true if the cluster group doesn't include the local node, false else. */ @Override protected boolean acceptsGroup(Group group) { Node node = groupManager.getNode(); if (group.getNodes().contains(node)) return false; else return true; }
@Override public String getAlias(String id) throws Exception { Node node = clusterManager.findNodeById(id); if (node != null) { return node.getAlias(); } return null; }
/** * List the nodes in a given cluster group. * * @param group the cluster group. * @return a Set with the nodes. */ @Override public Set<Node> listNodesByGroup(Group group) { return group.getNodes(); }
/** * Check if a configuration is allowed. * * @param group the cluster group. * @param category the configuration category constant. * @param pid the configuration PID. * @param type the cluster event type. * @return true if the cluster event type is allowed, false else. */ public boolean isAllowed(Group group, String category, String pid, EventType type) { CellarSupport support = new CellarSupport(); support.setClusterManager(this.clusterManager); support.setGroupManager(this.groupManager); support.setConfigurationAdmin(this.configurationAdmin); return support.isAllowed(group, category, pid, type); }
/** * Accept the cluster groups which don't include the local node. * * @param group the cluster group to check. * @return true if the cluster group doesn't include the local node, false else. */ @Override protected boolean acceptsGroup(Group group) { Node node = groupManager.getNode(); if (group.getNodes().contains(node)) return false; else return true; }
/** * Check if a configuration is allowed. * * @param group the cluster group. * @param category the configuration category constant. * @param pid the configuration PID. * @param type the cluster event type. * @return true if the cluster event type is allowed, false else. */ public boolean isClusterConfigPIDAllowed(Group group, String category, String pid, EventType type) { CellarSupport support = new CellarSupport(); support.setClusterManager(this.karafCellarClusterManager); support.setGroupManager(this.karafCellarGroupManager); support.setConfigurationAdmin(this.osgiConfigurationAdmin); return support.isAllowed(group, category, pid, type); }
/** * Add cluster groups where the local node is belonging. * * @param group the cluster group candidate for completion. * @return true if the cluster group has been accepted, false else. */ @Override protected boolean acceptsGroup(Group group) { Node node = groupManager.getNode(); if (group.getNodes().contains(node)) return true; else return false; }
/** * Check if an OBR cluster event is allowed. * * @param group the cluster group. * @param category the OBR category name. * @param id the event ID. * @param type the event type (inbound, outbound). * @return in case of check failure. */ public boolean isAllowed(Group group, String category, String id, EventType type) { CellarSupport support = new CellarSupport(); support.setClusterManager(this.clusterManager); support.setGroupManager(this.groupManager); support.setConfigurationAdmin(this.configurationAdmin); return support.isAllowed(group, category, id, type); }