[KARAF-2169] Introduce *.listener property (and some cleanups)
Project: http://git-wip-us.apache.org/repos/asf/karaf-cellar/repo Commit: http://git-wip-us.apache.org/repos/asf/karaf-cellar/commit/dc7ec508 Tree: http://git-wip-us.apache.org/repos/asf/karaf-cellar/tree/dc7ec508 Diff: http://git-wip-us.apache.org/repos/asf/karaf-cellar/diff/dc7ec508 Branch: refs/heads/cellar-2.3.x Commit: dc7ec5087d042d240099a35a6233ffd7b88ae205 Parents: 3353319 Author: Jean-Baptiste Onofré <[email protected]> Authored: Sat Jan 10 13:44:58 2015 +0100 Committer: Jean-Baptiste Onofré <[email protected]> Committed: Sat Jan 10 13:44:58 2015 +0100 ---------------------------------------------------------------------- assembly/src/main/resources/groups.cfg | 3 ++ assembly/src/main/resources/node.cfg | 8 ++++ .../cellar/bundle/LocalBundleListener.java | 49 +++++++++++++++----- .../config/LocalConfigurationListener.java | 27 ++++++++++- .../karaf/cellar/core/Configurations.java | 1 + .../apache/karaf/cellar/features/Constants.java | 10 ++-- .../cellar/features/FeaturesEventHandler.java | 18 +++---- .../karaf/cellar/features/FeaturesSupport.java | 20 ++++---- .../cellar/features/FeaturesSynchronizer.java | 42 ++++++++--------- .../cellar/features/LocalFeaturesListener.java | 48 +++++++++++++++---- .../cellar/features/RepositoryEventHandler.java | 14 +++--- .../features/shell/FeatureCommandSupport.java | 6 +-- .../features/shell/InstallFeatureCommand.java | 2 +- .../features/shell/ListGroupFeatures.java | 2 +- .../features/shell/UninstallFeatureCommand.java | 2 +- .../cellar/features/shell/UrlAddCommand.java | 4 +- .../cellar/features/shell/UrlListCommand.java | 2 +- .../cellar/features/shell/UrlRemoveCommand.java | 4 +- .../internal/CellarFeaturesMBeanImpl.java | 20 ++++---- 19 files changed, 190 insertions(+), 92 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/dc7ec508/assembly/src/main/resources/groups.cfg ---------------------------------------------------------------------- diff --git a/assembly/src/main/resources/groups.cfg b/assembly/src/main/resources/groups.cfg index 5193a84..4337320 100644 --- a/assembly/src/main/resources/groups.cfg +++ b/assembly/src/main/resources/groups.cfg @@ -1,3 +1,6 @@ +# +# This property stores the cluster groups for which the local node is member +# groups = default default.config.whitelist.inbound = * http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/dc7ec508/assembly/src/main/resources/node.cfg ---------------------------------------------------------------------- diff --git a/assembly/src/main/resources/node.cfg b/assembly/src/main/resources/node.cfg index 1725ade..5db7ba9 100644 --- a/assembly/src/main/resources/node.cfg +++ b/assembly/src/main/resources/node.cfg @@ -4,6 +4,14 @@ groups = default # +# These properties define if the local event listeners (per resource) +# A local listener listens for local events (like bundle install, etc) and broadcast this state change to the cluster +# +bundle.listener = false +config.listener = false +feature.listener = false + +# # Cluster event producer # producer = true http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/dc7ec508/bundle/src/main/java/org/apache/karaf/cellar/bundle/LocalBundleListener.java ---------------------------------------------------------------------- diff --git a/bundle/src/main/java/org/apache/karaf/cellar/bundle/LocalBundleListener.java b/bundle/src/main/java/org/apache/karaf/cellar/bundle/LocalBundleListener.java index 9f8df0b..c1ba8ed 100644 --- a/bundle/src/main/java/org/apache/karaf/cellar/bundle/LocalBundleListener.java +++ b/bundle/src/main/java/org/apache/karaf/cellar/bundle/LocalBundleListener.java @@ -21,9 +21,11 @@ import org.apache.karaf.cellar.core.event.EventType; import org.apache.karaf.features.Feature; import org.osgi.framework.BundleEvent; import org.osgi.framework.SynchronousBundleListener; +import org.osgi.service.cm.Configuration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.util.Dictionary; import java.util.List; import java.util.Map; import java.util.Set; @@ -46,6 +48,11 @@ public class LocalBundleListener extends BundleSupport implements SynchronousBun @Override public void bundleChanged(BundleEvent event) { + if (!isEnabled()) { + LOGGER.debug("CELLAR BUNDLE: local listener is disabled"); + return; + } + if (event.getBundle().getBundleId() == 0 && (event.getType() == BundleEvent.STOPPING || event.getType() == BundleEvent.STOPPED)) { LOGGER.debug("CELLAR BUNDLE: Karaf shutdown detected, removing Cellar LocalBundleListener"); bundleContext.removeBundleListener(this); @@ -106,30 +113,50 @@ public class LocalBundleListener extends BundleSupport implements SynchronousBun } // check the features first - List<Feature> matchingFeatures = retrieveFeature(bundleLocation); - for (Feature feature : matchingFeatures) { - if (!isAllowed(group, "features", feature.getName(), EventType.OUTBOUND)) { - LOGGER.debug("CELLAR BUNDLE: bundle {} is contained in feature {} marked BLOCKED OUTBOUND for cluster group {}", bundleLocation, feature.getName(), group.getName()); - return; - } - } - + List<Feature> matchingFeatures = retrieveFeature(bundleLocation); + for (Feature feature : matchingFeatures) { + if (!isAllowed(group, "features", feature.getName(), EventType.OUTBOUND)) { + LOGGER.debug("CELLAR BUNDLE: bundle {} is contained in feature {} marked BLOCKED OUTBOUND for cluster group {}", bundleLocation, feature.getName(), group.getName()); + return; + } + } + // broadcast the cluster bundle event ClusterBundleEvent clusterBundleEvent = new ClusterBundleEvent(symbolicName, version, bundleLocation, type); clusterBundleEvent.setSourceGroup(group); eventProducer.produce(clusterBundleEvent); } catch (Exception e) { - LOGGER.error("CELLAR BUNDLE: failed to create cluster bundle event", e); - } finally { + LOGGER.error("CELLAR BUNDLE: failed to create cluster bundle event", e); + } finally { Thread.currentThread().setContextClassLoader(originalClassLoader); } - } else LOGGER.debug("CELLAR BUNDLE: bundle {} is marked BLOCKED OUTBOUND for cluster group {}", bundleLocation, group.getName()); + } else + LOGGER.debug("CELLAR BUNDLE: bundle {} is marked BLOCKED OUTBOUND for cluster group {}", bundleLocation, group.getName()); } } } } + /** + * Check if the local node bundle listener is enabled in the etc/org.apache.karaf.cellar.groups.cfg. + * + * @return true if enabled, false else. + */ + private boolean isEnabled() { + try { + Configuration configuration = configurationAdmin.getConfiguration(Configurations.NODE, null); + Dictionary<String, Object> properties = configuration.getProperties(); + if (properties != null) { + String value = properties.get(Constants.CATEGORY + Configurations.SEPARATOR + Configurations.LISTENER).toString(); + return Boolean.parseBoolean(value); + } + } catch (Exception e) { + LOGGER.warn("CELLAR BUNDLE: can't check listener configuration", e); + } + return false; + } + public void init() { bundleContext.addBundleListener(this); } http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/dc7ec508/config/src/main/java/org/apache/karaf/cellar/config/LocalConfigurationListener.java ---------------------------------------------------------------------- diff --git a/config/src/main/java/org/apache/karaf/cellar/config/LocalConfigurationListener.java b/config/src/main/java/org/apache/karaf/cellar/config/LocalConfigurationListener.java index c88fd0d..a74cf92 100644 --- a/config/src/main/java/org/apache/karaf/cellar/config/LocalConfigurationListener.java +++ b/config/src/main/java/org/apache/karaf/cellar/config/LocalConfigurationListener.java @@ -47,6 +47,11 @@ public class LocalConfigurationListener extends ConfigurationSupport implements @Override public void configurationEvent(ConfigurationEvent event) { + if (!isEnabled()) { + LOGGER.debug("CELLAR CONFIG: local listener is disabled"); + return; + } + // check if the producer is ON if (eventProducer.getSwitch().getStatus().equals(SwitchStatus.OFF)) { LOGGER.debug("CELLAR CONFIG: cluster event producer is OFF"); @@ -100,9 +105,29 @@ public class LocalConfigurationListener extends ConfigurationSupport implements } catch (Exception e) { LOGGER.error("CELLAR CONFIG: failed to update configuration with PID {} to the cluster group {}", pid, group.getName(), e); } - } else LOGGER.debug("CELLAR CONFIG: configuration with PID {} is marked BLOCKED OUTBOUND for cluster group {}", pid, group.getName()); + } else + LOGGER.debug("CELLAR CONFIG: configuration with PID {} is marked BLOCKED OUTBOUND for cluster group {}", pid, group.getName()); + } + } + } + + /** + * Check if the local config listener is enabled in the etc/org.apache.karaf.cellar.groups.cfg. + * + * @return true if enabled, false else. + */ + private boolean isEnabled() { + try { + Configuration configuration = configurationAdmin.getConfiguration(Configurations.NODE, null); + Dictionary<String, Object> properties = configuration.getProperties(); + if (properties != null) { + String value = properties.get(Constants.CATEGORY + Configurations.SEPARATOR + Configurations.LISTENER).toString(); + return Boolean.parseBoolean(value); } + } catch (Exception e) { + LOGGER.warn("CELLAR CONFIG: can't check listener configuration", e); } + return false; } public void init() { http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/dc7ec508/core/src/main/java/org/apache/karaf/cellar/core/Configurations.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/karaf/cellar/core/Configurations.java b/core/src/main/java/org/apache/karaf/cellar/core/Configurations.java index 23787e5..c947071 100644 --- a/core/src/main/java/org/apache/karaf/cellar/core/Configurations.java +++ b/core/src/main/java/org/apache/karaf/cellar/core/Configurations.java @@ -26,6 +26,7 @@ public class Configurations { public static final String CONSUMER = "consumer"; public static final String HANDLER = "handler"; + public static final String LISTENER = "listener"; public static final String SEPARATOR = "."; public static final String DELIMETER = ","; public static final String SYNC = "sync"; http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/dc7ec508/features/src/main/java/org/apache/karaf/cellar/features/Constants.java ---------------------------------------------------------------------- diff --git a/features/src/main/java/org/apache/karaf/cellar/features/Constants.java b/features/src/main/java/org/apache/karaf/cellar/features/Constants.java index 6db9913..c5a6b55 100644 --- a/features/src/main/java/org/apache/karaf/cellar/features/Constants.java +++ b/features/src/main/java/org/apache/karaf/cellar/features/Constants.java @@ -18,9 +18,11 @@ package org.apache.karaf.cellar.features; */ public class Constants { - public static final String REPOSITORIES = "org.apache.karaf.cellar.repositories"; - public static final String FEATURES = "org.apache.karaf.cellar.features"; - public static final String REPOSITORIES_CATEGORY = "features.repositories"; - public static final String FEATURES_CATEGORY = "features"; + // hazelcast map name + public static final String REPOSITORIES_MAP = "org.apache.karaf.cellar.repositories"; + public static final String FEATURES_MAP = "org.apache.karaf.cellar.features"; + + // configuration category + public static final String CATEGORY = "features"; } http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/dc7ec508/features/src/main/java/org/apache/karaf/cellar/features/FeaturesEventHandler.java ---------------------------------------------------------------------- diff --git a/features/src/main/java/org/apache/karaf/cellar/features/FeaturesEventHandler.java b/features/src/main/java/org/apache/karaf/cellar/features/FeaturesEventHandler.java index 684ed26..179d245 100644 --- a/features/src/main/java/org/apache/karaf/cellar/features/FeaturesEventHandler.java +++ b/features/src/main/java/org/apache/karaf/cellar/features/FeaturesEventHandler.java @@ -58,19 +58,19 @@ public class FeaturesEventHandler extends FeaturesSupport implements EventHandle // check if the handler switch is ON if (this.getSwitch().getStatus().equals(SwitchStatus.OFF)) { - LOGGER.debug("CELLAR FEATURES: {} switch is OFF, cluster event is not handled", SWITCH_ID); + LOGGER.debug("CELLAR FEATURES_MAP: {} switch is OFF, cluster event is not handled", SWITCH_ID); return; } // check if the group is local if (!groupManager.isLocalGroup(event.getSourceGroup().getName())) { - LOGGER.debug("CELLAR FEATURES: node is not part of the event cluster group {}", event.getSourceGroup().getName()); + LOGGER.debug("CELLAR FEATURES_MAP: node is not part of the event cluster group {}", event.getSourceGroup().getName()); return; } String name = event.getName(); String version = event.getVersion(); - if (isAllowed(event.getSourceGroup(), Constants.FEATURES_CATEGORY, name, EventType.INBOUND) || event.getForce()) { + if (isAllowed(event.getSourceGroup(), Constants.CATEGORY, name, EventType.INBOUND) || event.getForce()) { FeatureEvent.EventType type = event.getType(); Boolean isInstalled = isFeatureInstalledLocally(name, version); try { @@ -85,25 +85,25 @@ public class FeaturesEventHandler extends FeaturesSupport implements EventHandle options.add(FeaturesService.Option.NoAutoRefreshBundles); } if (version != null) { - LOGGER.debug("CELLAR FEATURES: installing feature {}/{}", name, version); + LOGGER.debug("CELLAR FEATURES_MAP: installing feature {}/{}", name, version); featuresService.installFeature(name, version, options); } else { - LOGGER.debug("CELLAR FEATURES: installing feature {}", name); + LOGGER.debug("CELLAR FEATURES_MAP: installing feature {}", name); featuresService.installFeature(name, options); } } else if (FeatureEvent.EventType.FeatureUninstalled.equals(type) && isInstalled) { if (version != null) { - LOGGER.debug("CELLAR FEATURES: un-installing feature {}/{}", name, version); + LOGGER.debug("CELLAR FEATURES_MAP: un-installing feature {}/{}", name, version); featuresService.uninstallFeature(name, version); } else { - LOGGER.debug("CELLAR FEATURES: un-installing feature {}", name); + LOGGER.debug("CELLAR FEATURES_MAP: un-installing feature {}", name); featuresService.uninstallFeature(name); } } } catch (Exception e) { - LOGGER.error("CELLAR FEATURES: failed to handle event", e); + LOGGER.error("CELLAR FEATURES_MAP: failed to handle event", e); } - } else LOGGER.debug("CELLAR FEATURES: feature {} is marked BLOCKED INBOUND for cluster group {}", name, event.getSourceGroup().getName()); + } else LOGGER.debug("CELLAR FEATURES_MAP: feature {} is marked BLOCKED INBOUND for cluster group {}", name, event.getSourceGroup().getName()); } @Override http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/dc7ec508/features/src/main/java/org/apache/karaf/cellar/features/FeaturesSupport.java ---------------------------------------------------------------------- diff --git a/features/src/main/java/org/apache/karaf/cellar/features/FeaturesSupport.java b/features/src/main/java/org/apache/karaf/cellar/features/FeaturesSupport.java index 02733e8..43a9307 100644 --- a/features/src/main/java/org/apache/karaf/cellar/features/FeaturesSupport.java +++ b/features/src/main/java/org/apache/karaf/cellar/features/FeaturesSupport.java @@ -90,16 +90,16 @@ public class FeaturesSupport extends CellarSupport { public void pushFeature(Feature feature, Group group) { if (feature != null) { String groupName = group.getName(); - Map<FeatureInfo, Boolean> clusterFeatures = clusterManager.getMap(Constants.FEATURES + Configurations.SEPARATOR + groupName); + Map<FeatureInfo, Boolean> clusterFeatures = clusterManager.getMap(Constants.FEATURES_MAP + Configurations.SEPARATOR + groupName); - if (isAllowed(group, Constants.FEATURES_CATEGORY, feature.getName(), EventType.OUTBOUND)) { + if (isAllowed(group, Constants.CATEGORY, feature.getName(), EventType.OUTBOUND)) { if (featuresService != null && clusterFeatures != null) { FeatureInfo info = new FeatureInfo(feature.getName(), feature.getVersion()); Boolean installed = featuresService.isInstalled(feature); clusterFeatures.put(info, installed); } - } else LOGGER.debug("CELLAR FEATURES: feature {} is marked BLOCKED OUTBOUND for cluster group {}", feature.getName(), groupName); - } else LOGGER.warn("CELLAR FEATURES: feature is null"); + } else LOGGER.debug("CELLAR FEATURES_MAP: feature {} is marked BLOCKED OUTBOUND for cluster group {}", feature.getName(), groupName); + } else LOGGER.warn("CELLAR FEATURES_MAP: feature is null"); } /** @@ -113,15 +113,15 @@ public class FeaturesSupport extends CellarSupport { public void pushFeature(Feature feature, Group group, Boolean force) { if (feature != null) { String groupName = group.getName(); - Map<FeatureInfo, Boolean> clusterFeatures = clusterManager.getMap(Constants.FEATURES + Configurations.SEPARATOR + groupName); + Map<FeatureInfo, Boolean> clusterFeatures = clusterManager.getMap(Constants.FEATURES_MAP + Configurations.SEPARATOR + groupName); - if (isAllowed(group, Constants.FEATURES_CATEGORY, feature.getName(), EventType.OUTBOUND)) { + if (isAllowed(group, Constants.CATEGORY, feature.getName(), EventType.OUTBOUND)) { if (featuresService != null && clusterFeatures != null) { FeatureInfo info = new FeatureInfo(feature.getName(), feature.getVersion()); clusterFeatures.put(info, force); } - } else LOGGER.debug("CELLAR FEATURES: feature {} is marked BLOCKED OUTBOUND for cluster group {}", feature.getName(), groupName); - } else LOGGER.warn("CELLAR FEATURES: feature is null"); + } else LOGGER.debug("CELLAR FEATURES_MAP: feature {} is marked BLOCKED OUTBOUND for cluster group {}", feature.getName(), groupName); + } else LOGGER.warn("CELLAR FEATURES_MAP: feature is null"); } /** @@ -132,7 +132,7 @@ public class FeaturesSupport extends CellarSupport { */ public void pushRepository(Repository repository, Group group) { String groupName = group.getName(); - List<String> clusterRepositories = clusterManager.getList(Constants.REPOSITORIES + Configurations.SEPARATOR + groupName); + List<String> clusterRepositories = clusterManager.getList(Constants.REPOSITORIES_MAP + Configurations.SEPARATOR + groupName); boolean found = false; for (String clusterRepository : clusterRepositories) { @@ -155,7 +155,7 @@ public class FeaturesSupport extends CellarSupport { */ public void removeRepository(Repository repository, Group group) { String groupName = group.getName(); - List<String> clusterRepositories = clusterManager.getList(Constants.REPOSITORIES + Configurations.SEPARATOR + groupName); + List<String> clusterRepositories = clusterManager.getList(Constants.REPOSITORIES_MAP + Configurations.SEPARATOR + groupName); if (featuresService != null && clusterRepositories != null) { URI uri = repository.getURI(); http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/dc7ec508/features/src/main/java/org/apache/karaf/cellar/features/FeaturesSynchronizer.java ---------------------------------------------------------------------- diff --git a/features/src/main/java/org/apache/karaf/cellar/features/FeaturesSynchronizer.java b/features/src/main/java/org/apache/karaf/cellar/features/FeaturesSynchronizer.java index a459be1..bd0d907 100644 --- a/features/src/main/java/org/apache/karaf/cellar/features/FeaturesSynchronizer.java +++ b/features/src/main/java/org/apache/karaf/cellar/features/FeaturesSynchronizer.java @@ -47,7 +47,7 @@ public class FeaturesSynchronizer extends FeaturesSupport implements Synchronize if (isSyncEnabled(group)) { pull(group); push(group); - } else LOGGER.debug("CELLAR FEATURES: sync is disabled for cluster group {}", group.getName()); + } else LOGGER.debug("CELLAR FEATURES_MAP: sync is disabled for cluster group {}", group.getName()); } } } @@ -66,10 +66,10 @@ public class FeaturesSynchronizer extends FeaturesSupport implements Synchronize public void pull(Group group) { if (group != null) { String groupName = group.getName(); - LOGGER.debug("CELLAR FEATURES: pulling features repositories and features from cluster group {}", groupName); - List<String> clusterRepositories = clusterManager.getList(Constants.REPOSITORIES + Configurations.SEPARATOR + groupName); - Map<FeatureInfo, Boolean> clusterFeatures = clusterManager.getMap(Constants.FEATURES + Configurations.SEPARATOR + groupName); - clusterManager.getList(Constants.FEATURES + Configurations.SEPARATOR + groupName); + LOGGER.debug("CELLAR FEATURES_MAP: pulling features repositories and features from cluster group {}", groupName); + List<String> clusterRepositories = clusterManager.getList(Constants.REPOSITORIES_MAP + Configurations.SEPARATOR + groupName); + Map<FeatureInfo, Boolean> clusterFeatures = clusterManager.getMap(Constants.FEATURES_MAP + Configurations.SEPARATOR + groupName); + clusterManager.getList(Constants.FEATURES_MAP + Configurations.SEPARATOR + groupName); ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); @@ -79,13 +79,13 @@ public class FeaturesSynchronizer extends FeaturesSupport implements Synchronize for (String url : clusterRepositories) { try { if (!isRepositoryRegisteredLocally(url)) { - LOGGER.debug("CELLAR FEATURES: adding repository {}", url); + LOGGER.debug("CELLAR FEATURES_MAP: adding repository {}", url); featuresService.addRepository(new URI(url)); } } catch (MalformedURLException e) { - LOGGER.warn("CELLAR FEATURES: failed to add clusterFeatures repository {} (URL is malformed)", url, e); + LOGGER.warn("CELLAR FEATURES_MAP: failed to add clusterFeatures repository {} (URL is malformed)", url, e); } catch (Exception e) { - LOGGER.warn("CELLAR FEATURES: failed to add clusterFeatures repository {}", url, e); + LOGGER.warn("CELLAR FEATURES_MAP: failed to add clusterFeatures repository {}", url, e); } } } @@ -95,7 +95,7 @@ public class FeaturesSynchronizer extends FeaturesSupport implements Synchronize for (FeatureInfo info : clusterFeatures.keySet()) { String name = info.getName(); // check if feature is blocked - if (isAllowed(group, Constants.FEATURES_CATEGORY, name, EventType.INBOUND)) { + if (isAllowed(group, Constants.CATEGORY, name, EventType.INBOUND)) { Boolean clusterInstalled = clusterFeatures.get(info); Boolean locallyInstalled = isFeatureInstalledLocally(info.getName(), info.getVersion()); @@ -109,21 +109,21 @@ public class FeaturesSynchronizer extends FeaturesSupport implements Synchronize // if feature has to be installed locally if (clusterInstalled && !locallyInstalled) { try { - LOGGER.debug("CELLAR FEATURES: installing feature {}/{}", info.getName(), info.getVersion()); + LOGGER.debug("CELLAR FEATURES_MAP: installing feature {}/{}", info.getName(), info.getVersion()); featuresService.installFeature(info.getName(), info.getVersion()); } catch (Exception e) { - LOGGER.warn("CELLAR FEATURES: failed to install feature {}/{} ", new Object[]{ info.getName(), info.getVersion() }, e); + LOGGER.warn("CELLAR FEATURES_MAP: failed to install feature {}/{} ", new Object[]{ info.getName(), info.getVersion() }, e); } // if feature has to be uninstalled locally } else if (!clusterInstalled && locallyInstalled) { try { - LOGGER.debug("CELLAR FEATURES: un-installing feature {}/{}", info.getName(), info.getVersion()); + LOGGER.debug("CELLAR FEATURES_MAP: un-installing feature {}/{}", info.getName(), info.getVersion()); featuresService.uninstallFeature(info.getName(), info.getVersion()); } catch (Exception e) { - LOGGER.warn("CELLAR FEATURES: failed to uninstall feature {}/{} ", new Object[]{ info.getName(), info.getVersion() }, e); + LOGGER.warn("CELLAR FEATURES_MAP: failed to uninstall feature {}/{} ", new Object[]{ info.getName(), info.getVersion() }, e); } } - } else LOGGER.warn("CELLAR FEATURES: feature {} is marked BLOCKED INBOUND for cluster group {}", name, groupName); + } else LOGGER.warn("CELLAR FEATURES_MAP: feature {} is marked BLOCKED INBOUND for cluster group {}", name, groupName); } } } finally { @@ -141,8 +141,8 @@ public class FeaturesSynchronizer extends FeaturesSupport implements Synchronize public void push(Group group) { if (group != null) { String groupName = group.getName(); - LOGGER.debug("CELLAR FEATURES: pushing features repositories and features in cluster group {}.",groupName); - clusterManager.getList(Constants.FEATURES + Configurations.SEPARATOR + groupName); + LOGGER.debug("CELLAR FEATURES_MAP: pushing features repositories and features in cluster group {}.",groupName); + clusterManager.getList(Constants.FEATURES_MAP + Configurations.SEPARATOR + groupName); ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader(); try { @@ -155,14 +155,14 @@ public class FeaturesSynchronizer extends FeaturesSupport implements Synchronize repositoryList = featuresService.listRepositories(); featuresList = featuresService.listFeatures(); } catch (Exception e) { - LOGGER.warn("CELLAR FEATURES: unable to list features", e); + LOGGER.warn("CELLAR FEATURES_MAP: unable to list features", e); } // push the local features repositories to the cluster group if (repositoryList != null && repositoryList.length > 0) { for (Repository repository : repositoryList) { pushRepository(repository, group); - LOGGER.debug("CELLAR FEATURES: pushing repository {} in cluster group {}", repository.getName(), group.getName()); + LOGGER.debug("CELLAR FEATURES_MAP: pushing repository {} in cluster group {}", repository.getName(), group.getName()); } } @@ -170,7 +170,7 @@ public class FeaturesSynchronizer extends FeaturesSupport implements Synchronize if (featuresList != null && featuresList.length > 0) { for (Feature feature : featuresList) { pushFeature(feature, group); - LOGGER.debug("CELLAR FEATURES: pushing feature {} in cluster group {}", feature.getName(), group.getName()); + LOGGER.debug("CELLAR FEATURES_MAP: pushing feature {} in cluster group {}", feature.getName(), group.getName()); } } } finally { @@ -194,12 +194,12 @@ public class FeaturesSynchronizer extends FeaturesSupport implements Synchronize Configuration configuration = configurationAdmin.getConfiguration(Configurations.GROUP); Dictionary<String, Object> properties = configuration.getProperties(); if (properties != null) { - String propertyKey = groupName + Configurations.SEPARATOR + Constants.FEATURES_CATEGORY + Configurations.SEPARATOR + Configurations.SYNC; + String propertyKey = groupName + Configurations.SEPARATOR + Constants.CATEGORY + Configurations.SEPARATOR + Configurations.SYNC; String propertyValue = (String) properties.get(propertyKey); result = Boolean.parseBoolean(propertyValue); } } catch (IOException e) { - LOGGER.warn("CELLAR FEATURES: error while checking if sync is enabled", e); + LOGGER.warn("CELLAR FEATURES_MAP: error while checking if sync is enabled", e); } return result; } http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/dc7ec508/features/src/main/java/org/apache/karaf/cellar/features/LocalFeaturesListener.java ---------------------------------------------------------------------- diff --git a/features/src/main/java/org/apache/karaf/cellar/features/LocalFeaturesListener.java b/features/src/main/java/org/apache/karaf/cellar/features/LocalFeaturesListener.java index b589d61..3419f88 100644 --- a/features/src/main/java/org/apache/karaf/cellar/features/LocalFeaturesListener.java +++ b/features/src/main/java/org/apache/karaf/cellar/features/LocalFeaturesListener.java @@ -21,9 +21,11 @@ import org.apache.karaf.cellar.core.event.EventType; import org.apache.karaf.features.Feature; import org.apache.karaf.features.FeatureEvent; import org.apache.karaf.features.RepositoryEvent; +import org.osgi.service.cm.Configuration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.util.Dictionary; import java.util.Map; import java.util.Set; @@ -54,9 +56,14 @@ public class LocalFeaturesListener extends FeaturesSupport implements org.apache @Override public void featureEvent(FeatureEvent event) { + if (!isEnabled()) { + LOGGER.debug("CELLAR FEATURES_MAP: local listener is disabled"); + return; + } + // check if the producer is ON if (eventProducer.getSwitch().getStatus().equals(SwitchStatus.OFF)) { - LOGGER.debug("CELLAR FEATURES: cluster event producer is OFF"); + LOGGER.debug("CELLAR FEATURES_MAP: cluster event producer is OFF"); return; } @@ -70,7 +77,7 @@ public class LocalFeaturesListener extends FeaturesSupport implements org.apache String name = feature.getName(); String version = feature.getVersion(); - if (isAllowed(group, Constants.FEATURES_CATEGORY, name, EventType.OUTBOUND)) { + if (isAllowed(group, Constants.CATEGORY, name, EventType.OUTBOUND)) { FeatureEvent.EventType type = event.getType(); // update the features in the cluster group @@ -84,7 +91,8 @@ public class LocalFeaturesListener extends FeaturesSupport implements org.apache ClusterFeaturesEvent featureEvent = new ClusterFeaturesEvent(name, version, type); featureEvent.setSourceGroup(group); eventProducer.produce(featureEvent); - } else LOGGER.debug("CELLAR FEATURES: feature {} is marked BLOCKED OUTBOUND for cluster group {}", name, group.getName()); + } else + LOGGER.debug("CELLAR FEATURES_MAP: feature {} is marked BLOCKED OUTBOUND for cluster group {}", name, group.getName()); } } } @@ -98,9 +106,14 @@ public class LocalFeaturesListener extends FeaturesSupport implements org.apache @Override public void repositoryEvent(RepositoryEvent event) { + if (!isEnabled()) { + LOGGER.debug("CELLAR FEATURES_MAP: local listener is disabled"); + return; + } + // check if the producer is ON if (eventProducer.getSwitch().getStatus().equals(SwitchStatus.OFF)) { - LOGGER.debug("CELLAR FEATURES: cluster event producer is OFF"); + LOGGER.debug("CELLAR FEATURES_MAP: cluster event producer is OFF"); return; } @@ -120,7 +133,7 @@ public class LocalFeaturesListener extends FeaturesSupport implements org.apache // update the repositories in the cluster group pushRepository(event.getRepository(), group); // update the features in the cluster group - Map<FeatureInfo, Boolean> clusterFeatures = clusterManager.getMap(Constants.FEATURES + Configurations.SEPARATOR + group.getName()); + Map<FeatureInfo, Boolean> clusterFeatures = clusterManager.getMap(Constants.FEATURES_MAP + Configurations.SEPARATOR + group.getName()); try { for (Feature feature : event.getRepository().getFeatures()) { // check the feature in the cluster group @@ -137,20 +150,20 @@ public class LocalFeaturesListener extends FeaturesSupport implements org.apache } } } catch (Exception e) { - LOGGER.warn("CELLAR FEATURES: failed to update the cluster group", e); + LOGGER.warn("CELLAR FEATURES_MAP: failed to update the cluster group", e); } } else { // update the repositories in the cluster group removeRepository(event.getRepository(), group); // update the features in the cluster group - Map<FeatureInfo, Boolean> clusterFeatures = clusterManager.getMap(Constants.FEATURES + Configurations.SEPARATOR + group.getName()); + Map<FeatureInfo, Boolean> clusterFeatures = clusterManager.getMap(Constants.FEATURES_MAP + Configurations.SEPARATOR + group.getName()); try { for (Feature feature : event.getRepository().getFeatures()) { FeatureInfo info = new FeatureInfo(feature.getName(), feature.getVersion()); clusterFeatures.remove(info); } } catch (Exception e) { - LOGGER.warn("CELLAR FEATURES: failed to update the cluster group", e); + LOGGER.warn("CELLAR FEATURES_MAP: failed to update the cluster group", e); } } @@ -164,6 +177,25 @@ public class LocalFeaturesListener extends FeaturesSupport implements org.apache } } + /** + * Check if the local node feature listener is enabled in the etc/org.apache.karaf.cellar.groups.cfg. + * + * @return true if enabled, false else. + */ + private boolean isEnabled() { + try { + Configuration configuration = configurationAdmin.getConfiguration(Configurations.NODE, null); + Dictionary<String, Object> properties = configuration.getProperties(); + if (properties != null) { + String value = properties.get(Constants.CATEGORY + Configurations.SEPARATOR + Configurations.LISTENER).toString(); + return Boolean.parseBoolean(value); + } + } catch (Exception e) { + LOGGER.warn("CELLAR FEATURE: can't check listener configuration", e); + } + return false; + } + public EventProducer getEventProducer() { return eventProducer; } http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/dc7ec508/features/src/main/java/org/apache/karaf/cellar/features/RepositoryEventHandler.java ---------------------------------------------------------------------- diff --git a/features/src/main/java/org/apache/karaf/cellar/features/RepositoryEventHandler.java b/features/src/main/java/org/apache/karaf/cellar/features/RepositoryEventHandler.java index a63670b..15c5c72 100644 --- a/features/src/main/java/org/apache/karaf/cellar/features/RepositoryEventHandler.java +++ b/features/src/main/java/org/apache/karaf/cellar/features/RepositoryEventHandler.java @@ -54,13 +54,13 @@ public class RepositoryEventHandler extends FeaturesSupport implements EventHand // check if the handler is ON if (eventSwitch.getStatus().equals(SwitchStatus.OFF)) { - LOGGER.debug("CELLAR FEATURES: {} switch is OFF, cluster event is not handled", SWITCH_ID); + LOGGER.debug("CELLAR FEATURES_MAP: {} switch is OFF, cluster event is not handled", SWITCH_ID); return; } // check if the group is local if (!groupManager.isLocalGroup(event.getSourceGroup().getName())) { - LOGGER.debug("CELLAR FEATURES: node is not part of the event cluster group {}", event.getSourceGroup().getName()); + LOGGER.debug("CELLAR FEATURES_MAP: node is not part of the event cluster group {}", event.getSourceGroup().getName()); return; } @@ -70,21 +70,21 @@ public class RepositoryEventHandler extends FeaturesSupport implements EventHand // TODO check if isAllowed if (RepositoryEvent.EventType.RepositoryAdded.equals(type)) { if (!isRepositoryRegisteredLocally(uri)) { - LOGGER.debug("CELLAR FEATURES: adding repository URI {}", uri); + LOGGER.debug("CELLAR FEATURES_MAP: adding repository URI {}", uri); featuresService.addRepository(new URI(uri), event.getInstall()); } else { - LOGGER.debug("CELLAR FEATURES: repository URI {} is already registered locally"); + LOGGER.debug("CELLAR FEATURES_MAP: repository URI {} is already registered locally"); } } else { if (isRepositoryRegisteredLocally(uri)) { - LOGGER.debug("CELLAR FEATURES: removing repository URI {}", uri); + LOGGER.debug("CELLAR FEATURES_MAP: removing repository URI {}", uri); featuresService.removeRepository(new URI(uri), event.getUninstall()); } else { - LOGGER.debug("CELLAR FEATURES: repository URI {} is not registered locally"); + LOGGER.debug("CELLAR FEATURES_MAP: repository URI {} is not registered locally"); } } } catch (Exception e) { - LOGGER.error("CELLAR FEATURES: failed to add/remove repository URI {}", uri, e); + LOGGER.error("CELLAR FEATURES_MAP: failed to add/remove repository URI {}", uri, e); } } http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/dc7ec508/features/src/main/java/org/apache/karaf/cellar/features/shell/FeatureCommandSupport.java ---------------------------------------------------------------------- diff --git a/features/src/main/java/org/apache/karaf/cellar/features/shell/FeatureCommandSupport.java b/features/src/main/java/org/apache/karaf/cellar/features/shell/FeatureCommandSupport.java index 3733a2c..4e543fa 100644 --- a/features/src/main/java/org/apache/karaf/cellar/features/shell/FeatureCommandSupport.java +++ b/features/src/main/java/org/apache/karaf/cellar/features/shell/FeatureCommandSupport.java @@ -57,7 +57,7 @@ public abstract class FeatureCommandSupport extends CellarCommandSupport { if (group == null || group.getNodes().isEmpty()) { FeatureInfo info = new FeatureInfo(feature, version); - Map<FeatureInfo, Boolean> clusterFeatures = clusterManager.getMap(Constants.FEATURES + Configurations.SEPARATOR + groupName); + Map<FeatureInfo, Boolean> clusterFeatures = clusterManager.getMap(Constants.FEATURES_MAP + Configurations.SEPARATOR + groupName); // check the existing configuration if (version == null || (version.trim().length() < 1)) { for (FeatureInfo f : clusterFeatures.keySet()) { @@ -103,7 +103,7 @@ public abstract class FeatureCommandSupport extends CellarCommandSupport { ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); - Map<FeatureInfo, Boolean> clusterFeatures = clusterManager.getMap(Constants.FEATURES + Configurations.SEPARATOR + groupName); + Map<FeatureInfo, Boolean> clusterFeatures = clusterManager.getMap(Constants.FEATURES_MAP + Configurations.SEPARATOR + groupName); if (clusterFeatures == null) return false; @@ -138,7 +138,7 @@ public abstract class FeatureCommandSupport extends CellarCommandSupport { support.setClusterManager(this.clusterManager); support.setGroupManager(this.groupManager); support.setConfigurationAdmin(this.configurationAdmin); - return support.isAllowed(group, Constants.FEATURES_CATEGORY, name, EventType.OUTBOUND); + return support.isAllowed(group, Constants.CATEGORY, name, EventType.OUTBOUND); } public FeaturesService getFeaturesService() { http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/dc7ec508/features/src/main/java/org/apache/karaf/cellar/features/shell/InstallFeatureCommand.java ---------------------------------------------------------------------- diff --git a/features/src/main/java/org/apache/karaf/cellar/features/shell/InstallFeatureCommand.java b/features/src/main/java/org/apache/karaf/cellar/features/shell/InstallFeatureCommand.java index 5e32ebe..7d00bab 100644 --- a/features/src/main/java/org/apache/karaf/cellar/features/shell/InstallFeatureCommand.java +++ b/features/src/main/java/org/apache/karaf/cellar/features/shell/InstallFeatureCommand.java @@ -68,7 +68,7 @@ public class InstallFeatureCommand extends FeatureCommandSupport { } // check if the outbound event is allowed - if (!isAllowed(group, Constants.FEATURES_CATEGORY, feature, EventType.OUTBOUND)) { + if (!isAllowed(group, Constants.CATEGORY, feature, EventType.OUTBOUND)) { System.err.println("Feature " + feature + " is blocked outbound for cluster group " + groupName); return null; } http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/dc7ec508/features/src/main/java/org/apache/karaf/cellar/features/shell/ListGroupFeatures.java ---------------------------------------------------------------------- diff --git a/features/src/main/java/org/apache/karaf/cellar/features/shell/ListGroupFeatures.java b/features/src/main/java/org/apache/karaf/cellar/features/shell/ListGroupFeatures.java index 633e534..a2b2262 100644 --- a/features/src/main/java/org/apache/karaf/cellar/features/shell/ListGroupFeatures.java +++ b/features/src/main/java/org/apache/karaf/cellar/features/shell/ListGroupFeatures.java @@ -47,7 +47,7 @@ public class ListGroupFeatures extends FeatureCommandSupport { try { Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); - Map<FeatureInfo, Boolean> clusterFeatures = clusterManager.getMap(Constants.FEATURES + Configurations.SEPARATOR + groupName); + Map<FeatureInfo, Boolean> clusterFeatures = clusterManager.getMap(Constants.FEATURES_MAP + Configurations.SEPARATOR + groupName); if (clusterFeatures != null && !clusterFeatures.isEmpty()) { System.out.println("Features in cluster group " + groupName); System.out.println(String.format(HEADER_FORMAT, "Status", "Version", "Name")); http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/dc7ec508/features/src/main/java/org/apache/karaf/cellar/features/shell/UninstallFeatureCommand.java ---------------------------------------------------------------------- diff --git a/features/src/main/java/org/apache/karaf/cellar/features/shell/UninstallFeatureCommand.java b/features/src/main/java/org/apache/karaf/cellar/features/shell/UninstallFeatureCommand.java index b0c0407..de1b6de 100644 --- a/features/src/main/java/org/apache/karaf/cellar/features/shell/UninstallFeatureCommand.java +++ b/features/src/main/java/org/apache/karaf/cellar/features/shell/UninstallFeatureCommand.java @@ -61,7 +61,7 @@ public class UninstallFeatureCommand extends FeatureCommandSupport { } // check if the outbound event is allowed - if (!isAllowed(group, Constants.FEATURES_CATEGORY, feature, EventType.OUTBOUND)) { + if (!isAllowed(group, Constants.CATEGORY, feature, EventType.OUTBOUND)) { System.err.println("Feature " + feature + " is blocked outbound for cluster group " + groupName); return null; } http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/dc7ec508/features/src/main/java/org/apache/karaf/cellar/features/shell/UrlAddCommand.java ---------------------------------------------------------------------- diff --git a/features/src/main/java/org/apache/karaf/cellar/features/shell/UrlAddCommand.java b/features/src/main/java/org/apache/karaf/cellar/features/shell/UrlAddCommand.java index 0070acf..027798a 100644 --- a/features/src/main/java/org/apache/karaf/cellar/features/shell/UrlAddCommand.java +++ b/features/src/main/java/org/apache/karaf/cellar/features/shell/UrlAddCommand.java @@ -64,9 +64,9 @@ public class UrlAddCommand extends FeatureCommandSupport { try { Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); // get the repositories in the cluster group - List<String> clusterRepositories = clusterManager.getList(Constants.REPOSITORIES + Configurations.SEPARATOR + groupName); + List<String> clusterRepositories = clusterManager.getList(Constants.REPOSITORIES_MAP + Configurations.SEPARATOR + groupName); // get the features in the cluster group - Map<FeatureInfo, Boolean> clusterFeatures = clusterManager.getMap(Constants.FEATURES + Configurations.SEPARATOR + groupName); + Map<FeatureInfo, Boolean> clusterFeatures = clusterManager.getMap(Constants.FEATURES_MAP + Configurations.SEPARATOR + groupName); for (String url : urls) { // check if the URL is already registered http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/dc7ec508/features/src/main/java/org/apache/karaf/cellar/features/shell/UrlListCommand.java ---------------------------------------------------------------------- diff --git a/features/src/main/java/org/apache/karaf/cellar/features/shell/UrlListCommand.java b/features/src/main/java/org/apache/karaf/cellar/features/shell/UrlListCommand.java index cea6468..7bc2fd8 100644 --- a/features/src/main/java/org/apache/karaf/cellar/features/shell/UrlListCommand.java +++ b/features/src/main/java/org/apache/karaf/cellar/features/shell/UrlListCommand.java @@ -37,7 +37,7 @@ public class UrlListCommand extends FeatureCommandSupport { } // get the repositories in the cluster group - List<String> clusterRepositories = clusterManager.getList(Constants.REPOSITORIES + Configurations.SEPARATOR + groupName); + List<String> clusterRepositories = clusterManager.getList(Constants.REPOSITORIES_MAP + Configurations.SEPARATOR + groupName); for (String clusterRepository : clusterRepositories) { System.out.println(clusterRepository); http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/dc7ec508/features/src/main/java/org/apache/karaf/cellar/features/shell/UrlRemoveCommand.java ---------------------------------------------------------------------- diff --git a/features/src/main/java/org/apache/karaf/cellar/features/shell/UrlRemoveCommand.java b/features/src/main/java/org/apache/karaf/cellar/features/shell/UrlRemoveCommand.java index 6a8ec78..f52df52 100644 --- a/features/src/main/java/org/apache/karaf/cellar/features/shell/UrlRemoveCommand.java +++ b/features/src/main/java/org/apache/karaf/cellar/features/shell/UrlRemoveCommand.java @@ -61,9 +61,9 @@ public class UrlRemoveCommand extends FeatureCommandSupport { } // get the repositories in the cluster group - List<String> clusterRepositories = clusterManager.getList(Constants.REPOSITORIES + Configurations.SEPARATOR + groupName); + List<String> clusterRepositories = clusterManager.getList(Constants.REPOSITORIES_MAP + Configurations.SEPARATOR + groupName); // get the features in the cluster group - Map<FeatureInfo, Boolean> clusterFeatures = clusterManager.getMap(Constants.FEATURES + Configurations.SEPARATOR + groupName); + Map<FeatureInfo, Boolean> clusterFeatures = clusterManager.getMap(Constants.FEATURES_MAP + Configurations.SEPARATOR + groupName); for (String url : urls) { // looking for the URL in the list http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/dc7ec508/management/src/main/java/org/apache/karaf/cellar/management/internal/CellarFeaturesMBeanImpl.java ---------------------------------------------------------------------- diff --git a/management/src/main/java/org/apache/karaf/cellar/management/internal/CellarFeaturesMBeanImpl.java b/management/src/main/java/org/apache/karaf/cellar/management/internal/CellarFeaturesMBeanImpl.java index 7110e5e..efc250c 100644 --- a/management/src/main/java/org/apache/karaf/cellar/management/internal/CellarFeaturesMBeanImpl.java +++ b/management/src/main/java/org/apache/karaf/cellar/management/internal/CellarFeaturesMBeanImpl.java @@ -108,7 +108,7 @@ public class CellarFeaturesMBeanImpl extends StandardMBean implements CellarFeat support.setClusterManager(this.clusterManager); support.setGroupManager(this.groupManager); support.setConfigurationAdmin(this.configurationAdmin); - if (!support.isAllowed(group, Constants.FEATURES_CATEGORY, name, EventType.OUTBOUND)) { + if (!support.isAllowed(group, Constants.CATEGORY, name, EventType.OUTBOUND)) { throw new IllegalArgumentException("Feature " + name + " is blocked outbound for cluster group " + groupName); } @@ -117,7 +117,7 @@ public class CellarFeaturesMBeanImpl extends StandardMBean implements CellarFeat Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); // get the features in the cluster group - Map<FeatureInfo, Boolean> clusterFeatures = clusterManager.getMap(Constants.FEATURES + Configurations.SEPARATOR + groupName); + Map<FeatureInfo, Boolean> clusterFeatures = clusterManager.getMap(Constants.FEATURES_MAP + Configurations.SEPARATOR + groupName); // check if the feature exist FeatureInfo feature = null; @@ -201,7 +201,7 @@ public class CellarFeaturesMBeanImpl extends StandardMBean implements CellarFeat support.setClusterManager(this.clusterManager); support.setGroupManager(this.groupManager); support.setConfigurationAdmin(this.configurationAdmin); - if (!support.isAllowed(group, Constants.FEATURES_CATEGORY, name, EventType.OUTBOUND)) { + if (!support.isAllowed(group, Constants.CATEGORY, name, EventType.OUTBOUND)) { throw new IllegalArgumentException("Feature " + name + " is blocked outbound for cluster group " + groupName); } @@ -210,7 +210,7 @@ public class CellarFeaturesMBeanImpl extends StandardMBean implements CellarFeat Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); // get the features in the cluster group - Map<FeatureInfo, Boolean> clusterFeatures = clusterManager.getMap(Constants.FEATURES + Configurations.SEPARATOR + groupName); + Map<FeatureInfo, Boolean> clusterFeatures = clusterManager.getMap(Constants.FEATURES_MAP + Configurations.SEPARATOR + groupName); // check if the feature exist FeatureInfo feature = null; @@ -265,7 +265,7 @@ public class CellarFeaturesMBeanImpl extends StandardMBean implements CellarFeat ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); try { - Map<FeatureInfo, Boolean> clusterFeatures = clusterManager.getMap(Constants.FEATURES + Configurations.SEPARATOR + group); + Map<FeatureInfo, Boolean> clusterFeatures = clusterManager.getMap(Constants.FEATURES_MAP + Configurations.SEPARATOR + group); if (clusterFeatures != null && !clusterFeatures.isEmpty()) { for (FeatureInfo feature : clusterFeatures.keySet()) { boolean installed = clusterFeatures.get(feature); @@ -290,7 +290,7 @@ public class CellarFeaturesMBeanImpl extends StandardMBean implements CellarFeat } // get the distributed URLs list - List<String> clusterRepositories = clusterManager.getList(Constants.REPOSITORIES + Configurations.SEPARATOR + groupName); + List<String> clusterRepositories = clusterManager.getList(Constants.REPOSITORIES_MAP + Configurations.SEPARATOR + groupName); List<String> result = new ArrayList<String>(); for (String url : clusterRepositories) { @@ -322,9 +322,9 @@ public class CellarFeaturesMBeanImpl extends StandardMBean implements CellarFeat try { Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); // get the features repositories in the cluster group - List<String> clusterRepositories = clusterManager.getList(Constants.REPOSITORIES + Configurations.SEPARATOR + groupName); + List<String> clusterRepositories = clusterManager.getList(Constants.REPOSITORIES_MAP + Configurations.SEPARATOR + groupName); // get the features in the cluster group - Map<FeatureInfo, Boolean> clusterFeatures = clusterManager.getMap(Constants.FEATURES + Configurations.SEPARATOR + groupName); + Map<FeatureInfo, Boolean> clusterFeatures = clusterManager.getMap(Constants.FEATURES_MAP + Configurations.SEPARATOR + groupName); // check if the URL is already registered boolean found = false; @@ -408,9 +408,9 @@ public class CellarFeaturesMBeanImpl extends StandardMBean implements CellarFeat } // get the features repositories in the cluster group - List<String> clusterRepositories = clusterManager.getList(Constants.REPOSITORIES + Configurations.SEPARATOR + groupName); + List<String> clusterRepositories = clusterManager.getList(Constants.REPOSITORIES_MAP + Configurations.SEPARATOR + groupName); // get the features in the cluster group - Map<FeatureInfo, Boolean> clusterFeatures = clusterManager.getMap(Constants.FEATURES + Configurations.SEPARATOR + groupName); + Map<FeatureInfo, Boolean> clusterFeatures = clusterManager.getMap(Constants.FEATURES_MAP + Configurations.SEPARATOR + groupName); // looking for the URL in the list boolean found = false;
