Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlyn Normington2011-03-11 07:52:27 -0500
committerGlyn Normington2011-03-11 07:52:27 -0500
commitac3c5ba2941238b13de087db6842089625b8af2d (patch)
tree2c6ed87128b5b55489de613b52f7ca2425c52567
parent8f64e16cb93381c4532b57963d9b02e885e8e17d (diff)
downloadorg.eclipse.virgo.kernel-ac3c5ba2941238b13de087db6842089625b8af2d.tar.gz
org.eclipse.virgo.kernel-ac3c5ba2941238b13de087db6842089625b8af2d.tar.xz
org.eclipse.virgo.kernel-ac3c5ba2941238b13de087db6842089625b8af2d.zip
bug 336941: add a method to Region to allow its subgraph to be visited
-rw-r--r--org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/Region.java7
-rw-r--r--org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionBundleFindHook.java2
-rw-r--r--org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/internal/BundleIdBasedRegion.java6
3 files changed, 14 insertions, 1 deletions
diff --git a/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/Region.java b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/Region.java
index 0a3323bd..376fa778 100644
--- a/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/Region.java
+++ b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/Region.java
@@ -181,5 +181,12 @@ public interface Region {
* @return a {@link Set} of {@link FilteredRegion FilteredRegions} of head regions and region filters
*/
Set<FilteredRegion> getEdges();
+
+ /**
+ * Visit the subgraph connected to this region.
+ *
+ * @param visitor a {@link RegionDigraphVisitor} to be called as the subgraph is navigated
+ */
+ void visitSubgraph(RegionDigraphVisitor visitor);
}
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 8ab946a1..104fe5e7 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
@@ -57,7 +57,7 @@ public final class RegionBundleFindHook implements FindHook {
}
Visitor visitor = new Visitor(bundles);
- this.regionDigraph.visitSubgraph(finderRegion, visitor);
+ finderRegion.visitSubgraph(visitor);
Set<Bundle> allowed = visitor.getAllowed();
bundles.retainAll(allowed);
diff --git a/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/internal/BundleIdBasedRegion.java b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/internal/BundleIdBasedRegion.java
index e4aaec86..569633ef 100644
--- a/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/internal/BundleIdBasedRegion.java
+++ b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/internal/BundleIdBasedRegion.java
@@ -22,6 +22,7 @@ import java.util.Set;
import org.eclipse.virgo.kernel.osgi.region.Region;
import org.eclipse.virgo.kernel.osgi.region.RegionDigraph;
import org.eclipse.virgo.kernel.osgi.region.RegionDigraph.FilteredRegion;
+import org.eclipse.virgo.kernel.osgi.region.RegionDigraphVisitor;
import org.eclipse.virgo.kernel.osgi.region.RegionFilter;
import org.eclipse.virgo.kernel.serviceability.NonNull;
import org.eclipse.virgo.util.math.ConcurrentHashSet;
@@ -273,4 +274,9 @@ final class BundleIdBasedRegion implements Region {
return this.regionDigraph.getEdges(this);
}
+ @Override
+ public void visitSubgraph(RegionDigraphVisitor visitor) {
+ this.regionDigraph.visitSubgraph(this, visitor);
+ }
+
}

Back to the top