/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }
support.setGroupManager(this.groupManager); support.setConfigurationAdmin(this.configurationAdmin); if (!support.isAllowed(group, Constants.CATEGORY, location, EventType.OUTBOUND)) { System.err.println("Bundle location " + location + " is blocked outbound for cluster group " + groupName); return null;
/** * 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); }
if (!support.isAllowed(group, Constants.CATEGORY, location, EventType.OUTBOUND)) { continue;
support.setGroupManager(this.groupManager); support.setConfigurationAdmin(this.configurationAdmin); if (!support.isAllowed(group, Constants.CATEGORY, pid, EventType.OUTBOUND)) { throw new IllegalStateException("Configuration PID " + pid + " is blocked outbound for cluster group " + groupName);
if (!support.isAllowed(group, Constants.CATEGORY, location, EventType.OUTBOUND)) { continue;
if (!support.isAllowed(group, Constants.CATEGORY, location, EventType.OUTBOUND)) { continue;
support.setGroupManager(this.groupManager); support.setConfigurationAdmin(this.configurationAdmin); if (!support.isAllowed(group, Constants.CATEGORY, pid, EventType.OUTBOUND)) { throw new IllegalStateException("Configuration PID " + pid + " is blocked outbound for cluster group " + groupName);
support.setGroupManager(this.groupManager); support.setConfigurationAdmin(this.configurationAdmin); if (!support.isAllowed(group, Constants.CATEGORY, pid, EventType.OUTBOUND)) { throw new IllegalArgumentException("Configuration PID " + pid + " is blocked outbound for cluster group " + groupName);
support.setGroupManager(this.groupManager); support.setConfigurationAdmin(this.configurationAdmin); if (!support.isAllowed(group, Constants.CATEGORY, pid, EventType.OUTBOUND)) { throw new IllegalArgumentException("Configuration PID " + pid + " is blocked outbound for cluster group " + groupName);
support.setGroupManager(this.groupManager); support.setConfigurationAdmin(this.configurationAdmin); if (!support.isAllowed(group, Constants.CATEGORY, pid, EventType.OUTBOUND)) { throw new IllegalStateException("Configuration PID " + pid + " is blocked outbound for cluster group " + groupName);
@Override protected Object doExecute() throws Exception { // check if the group exists Group group = groupManager.findGroupByName(groupName); if (group == null) { System.err.println("Cluster group " + groupName + " doesn't exist"); return null; } // check if the producer is ON if (eventProducer.getSwitch().getStatus().equals(SwitchStatus.OFF)) { System.err.println("Cluster event producer is OFF"); return null; } CellarSupport support = new CellarSupport(); support.setConfigurationAdmin(configurationAdmin); support.setGroupManager(groupManager); support.setClusterManager(clusterManager); // check if the kar is allowed if (support.isAllowed(group, Constants.CATEGORY, name, EventType.OUTBOUND)) { // broadcast cluster event ClusterKarEvent clusterEvent = new ClusterKarEvent(name, true); clusterEvent.setSourceGroup(group); clusterEvent.setInstall(false); eventProducer.produce(clusterEvent); } else { System.err.println("KAR " + name + " is blocked outbound for cluster group " + groupName); } return null; }
@Override protected Object doExecute() throws Exception { // check if the group exists Group group = groupManager.findGroupByName(groupName); if (group == null) { System.err.println("Cluster group " + groupName + " doesn't exist"); return null; } // check if the producer is ON if (eventProducer.getSwitch().getStatus().equals(SwitchStatus.OFF)) { System.err.println("Cluster event producer is OFF"); return null; } CellarSupport support = new CellarSupport(); support.setConfigurationAdmin(configurationAdmin); support.setGroupManager(groupManager); support.setClusterManager(clusterManager); // check if the kar is allowed if (support.isAllowed(group, Constants.CATEGORY, url, EventType.OUTBOUND)) { // broadcast cluster event ClusterKarEvent clusterEvent = new ClusterKarEvent(url, true); clusterEvent.setSourceGroup(group); clusterEvent.setInstall(true); eventProducer.produce(clusterEvent); } else { System.err.println("KAR " + url + " is blocked outbound for cluster group " + groupName); } return null; }
support.setGroupManager(this.groupManager); support.setConfigurationAdmin(this.configurationAdmin); if (!support.isAllowed(group, Constants.CATEGORY, pid, EventType.OUTBOUND)) { throw new IllegalStateException("Configuration PID " + pid + " is blocked outbound for cluster group " + groupName);
@Override public void deployBundle(String groupName, String bundleId, boolean start, boolean deployOptional) throws Exception { // check if the group exists Group group = groupManager.findGroupByName(groupName); if (group == null) { throw new IllegalArgumentException("Cluster group " + groupName + " doesn't exist"); } // check if the producer is ON if (eventProducer.getSwitch().getStatus().equals(SwitchStatus.OFF)) { throw new IllegalStateException("Cluster event producer is OFF"); } // check if the bundle ID is allowed outbound CellarSupport support = new CellarSupport(); support.setClusterManager(this.clusterManager); support.setGroupManager(this.groupManager); support.setConfigurationAdmin(this.configurationAdmin); if (!support.isAllowed(group, Constants.BUNDLES_CONFIG_CATEGORY, bundleId, EventType.OUTBOUND)) { throw new IllegalArgumentException("OBR bundle " + bundleId + " is blocked outbound for cluster group " + groupName); } // broadcast a cluster event ClusterObrBundleEvent event = new ClusterObrBundleEvent(bundleId, start, deployOptional); event.setSourceGroup(group); event.setSourceNode(clusterManager.getNode()); eventProducer.produce(event); }
support.setGroupManager(this.groupManager); support.setConfigurationAdmin(this.configurationAdmin); if (!support.isAllowed(group, Constants.URLS_CONFIG_CATEGORY, url, EventType.OUTBOUND)) { throw new IllegalArgumentException("OBR URL " + url + " is blocked outbound for cluster group " + groupName);