Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlyn Normington2011-03-11 06:46:53 -0500
committerGlyn Normington2011-03-11 06:46:53 -0500
commit36afe704889052aae229e3e04449a597cf202e8c (patch)
tree997c35d757bf113482b04105c422dc6d87aa2e52
parentf935a65eadbf04669d5478d22d9bf69884c91ac3 (diff)
downloadorg.eclipse.virgo.kernel-36afe704889052aae229e3e04449a597cf202e8c.tar.gz
org.eclipse.virgo.kernel-36afe704889052aae229e3e04449a597cf202e8c.tar.xz
org.eclipse.virgo.kernel-36afe704889052aae229e3e04449a597cf202e8c.zip
bug 336941: move the non-recursive case into the visitor; factor a method out the recursive case
-rw-r--r--org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionBundleFindHook.java30
1 files changed, 17 insertions, 13 deletions
diff --git a/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionBundleFindHook.java b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionBundleFindHook.java
index 7a04f5a3..b0099615 100644
--- a/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionBundleFindHook.java
+++ b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionBundleFindHook.java
@@ -98,12 +98,20 @@ public final class RegionBundleFindHook implements FindHook {
this.allowed = this.allowedStack.pop();
}
}
+
+ private void allowInRegion(Region r) {
+ for (Bundle b : this.bundles) {
+ if (r.contains(b)) {
+ getAllowed().add(b);
+ }
+ }
+ }
}
private Set<Bundle> getAllowed(Region r, Visitor visitor, Set<Region> path) {
if (!path.contains(r)) {
- allowBundlesInRegion(r, visitor);
+ visitor.allowInRegion(r);
allowImportedBundles(r, visitor, path);
}
@@ -112,21 +120,17 @@ public final class RegionBundleFindHook implements FindHook {
private void allowImportedBundles(Region r, Visitor visitor, Set<Region> path) {
for (FilteredRegion fr : this.regionDigraph.getEdges(r)) {
- visitor.pushAllowed();
- getAllowed(fr.getRegion(), visitor, extendPath(r, path));
- Set<Bundle> a = visitor.getAllowed();
- visitor.popAllowed();
- filter(a, fr.getFilter());
- visitor.getAllowed().addAll(a);
+ allowTransitive(r, visitor, path, fr);
}
}
- private void allowBundlesInRegion(Region r, Visitor visitor) {
- for (Bundle b : visitor.getBundles()) {
- if (r.contains(b)) {
- visitor.getAllowed().add(b);
- }
- }
+ private void allowTransitive(Region r, Visitor visitor, Set<Region> path, FilteredRegion fr) {
+ visitor.pushAllowed();
+ getAllowed(fr.getRegion(), visitor, extendPath(r, path));
+ Set<Bundle> a = visitor.getAllowed();
+ visitor.popAllowed();
+ filter(a, fr.getFilter());
+ visitor.getAllowed().addAll(a);
}
private Set<Region> extendPath(Region r, Set<Region> path) {

Back to the top