You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by jb...@apache.org on 2016/09/09 12:10:30 UTC
[1/2] karaf-cellar git commit: [KARAF-4702] Check white/blacklists
before syncing bundle and config state with cluster
Repository: karaf-cellar
Updated Branches:
refs/heads/master 2514ce522 -> 43b5348d4
[KARAF-4702] Check white/blacklists before syncing bundle and config state with cluster
Project: http://git-wip-us.apache.org/repos/asf/karaf-cellar/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf-cellar/commit/dde5c715
Tree: http://git-wip-us.apache.org/repos/asf/karaf-cellar/tree/dde5c715
Diff: http://git-wip-us.apache.org/repos/asf/karaf-cellar/diff/dde5c715
Branch: refs/heads/master
Commit: dde5c7152bad293132230b6dcbf8903b55e61b14
Parents: 2514ce5
Author: Sergiy Shyrkov <ss...@jahia.com>
Authored: Thu Sep 8 17:47:08 2016 +0200
Committer: Jean-Baptiste Onofr� <jb...@apache.org>
Committed: Fri Sep 9 13:59:17 2016 +0200
----------------------------------------------------------------------
.../karaf/cellar/bundle/BundleSynchronizer.java | 26 +++++++++++---------
.../config/ConfigurationSynchronizer.java | 20 ++++++++-------
2 files changed, 26 insertions(+), 20 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/dde5c715/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleSynchronizer.java
----------------------------------------------------------------------
diff --git a/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleSynchronizer.java b/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleSynchronizer.java
index 76f2f1b..ae16895 100644
--- a/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleSynchronizer.java
+++ b/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleSynchronizer.java
@@ -173,7 +173,7 @@ public class BundleSynchronizer extends BundleSupport implements Synchronizer {
// cleanup the local bundles not present on the cluster
for (Bundle bundle : bundleContext.getBundles()) {
String id = getId(bundle);
- if (!clusterBundles.containsKey(id)) {
+ if (!clusterBundles.containsKey(id) && isAllowed(group, Constants.CATEGORY, bundle.getLocation(), EventType.INBOUND)) {
// the bundle is not present on the cluster, so it has to be uninstalled locally
try {
bundle.uninstall();
@@ -267,17 +267,21 @@ public class BundleSynchronizer extends BundleSupport implements Synchronizer {
} else LOGGER.trace("CELLAR BUNDLE: bundle {} is marked BLOCKED OUTBOUND for cluster group {}", bundleLocation, groupName);
}
// clean bundles on the cluster not present locally
- for (String id : clusterBundles.keySet()) {
- boolean found = false;
- for (Bundle bundle : bundleContext.getBundles()) {
- String localBundleId = getId(bundle);
- if (id.equals(localBundleId)) {
- found = true;
- break;
+ for (Map.Entry<String, BundleState> entry : clusterBundles.entrySet()) {
+ String id = entry.getKey();
+ BundleState state = entry.getValue();
+ if (state != null && isAllowed(group, Constants.CATEGORY, state.getLocation(), EventType.OUTBOUND)) {
+ boolean found = false;
+ for (Bundle bundle : bundleContext.getBundles()) {
+ String localBundleId = getId(bundle);
+ if (id.equals(localBundleId)) {
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ clusterBundles.remove(id);
}
- }
- if (!found) {
- clusterBundles.remove(id);
}
}
} finally {
http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/dde5c715/config/src/main/java/org/apache/karaf/cellar/config/ConfigurationSynchronizer.java
----------------------------------------------------------------------
diff --git a/config/src/main/java/org/apache/karaf/cellar/config/ConfigurationSynchronizer.java b/config/src/main/java/org/apache/karaf/cellar/config/ConfigurationSynchronizer.java
index 6676668..8931cb0 100644
--- a/config/src/main/java/org/apache/karaf/cellar/config/ConfigurationSynchronizer.java
+++ b/config/src/main/java/org/apache/karaf/cellar/config/ConfigurationSynchronizer.java
@@ -156,7 +156,7 @@ public class ConfigurationSynchronizer extends ConfigurationSupport implements S
try {
for (Configuration configuration : configurationAdmin.listConfigurations(null)) {
String pid = configuration.getPid();
- if (!clusterConfigurations.containsKey(pid)) {
+ if (!clusterConfigurations.containsKey(pid) && isAllowed(group, Constants.CATEGORY, pid, EventType.INBOUND)) {
configuration.delete();
}
}
@@ -228,15 +228,17 @@ public class ConfigurationSynchronizer extends ConfigurationSupport implements S
}
// clean configurations on the cluster not present locally
for (String pid : clusterConfigurations.keySet()) {
- boolean found = false;
- for (Configuration configuration : configurationAdmin.listConfigurations(null)) {
- if (configuration.getPid().equals(pid)) {
- found = true;
- break;
+ if (isAllowed(group, Constants.CATEGORY, pid, EventType.OUTBOUND)) {
+ boolean found = false;
+ for (Configuration configuration : configurationAdmin.listConfigurations(null)) {
+ if (configuration.getPid().equals(pid)) {
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ clusterConfigurations.remove(pid);
}
- }
- if (!found) {
- clusterConfigurations.remove(pid);
}
}
} catch (IOException ex) {
[2/2] karaf-cellar git commit: [KARAF-4702] This closes #36
Posted by jb...@apache.org.
[KARAF-4702] This closes #36
Project: http://git-wip-us.apache.org/repos/asf/karaf-cellar/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf-cellar/commit/43b5348d
Tree: http://git-wip-us.apache.org/repos/asf/karaf-cellar/tree/43b5348d
Diff: http://git-wip-us.apache.org/repos/asf/karaf-cellar/diff/43b5348d
Branch: refs/heads/master
Commit: 43b5348d46272f297b75323ba849f50eef650f59
Parents: 2514ce5 dde5c71
Author: Jean-Baptiste Onofr� <jb...@apache.org>
Authored: Fri Sep 9 14:10:22 2016 +0200
Committer: Jean-Baptiste Onofr� <jb...@apache.org>
Committed: Fri Sep 9 14:10:22 2016 +0200
----------------------------------------------------------------------
.../karaf/cellar/bundle/BundleSynchronizer.java | 26 +++++++++++---------
.../config/ConfigurationSynchronizer.java | 20 ++++++++-------
2 files changed, 26 insertions(+), 20 deletions(-)
----------------------------------------------------------------------