Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.virgo.kernel.agent.dm/.classpath1
-rw-r--r--org.eclipse.virgo.kernel.agent.dm/src/main/java/org/eclipse/virgo/kernel/agent/dm/internal/DeployerFailureListener.java19
-rw-r--r--org.eclipse.virgo.kernel.deployer.test/src/main/java/META-INF/MANIFEST.MF2
-rw-r--r--org.eclipse.virgo.kernel.deployer.test/src/test/resources/config/org.eclipse.virgo.kernel.userregion.properties1
-rw-r--r--org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/RegionManager.java8
-rw-r--r--org.eclipse.virgo.kernel.test/src/test/resources/config/org.eclipse.virgo.kernel.userregion.properties1
6 files changed, 30 insertions, 2 deletions
diff --git a/org.eclipse.virgo.kernel.agent.dm/.classpath b/org.eclipse.virgo.kernel.agent.dm/.classpath
index 7b32f1c8..72c21e62 100644
--- a/org.eclipse.virgo.kernel.agent.dm/.classpath
+++ b/org.eclipse.virgo.kernel.agent.dm/.classpath
@@ -41,5 +41,6 @@
<classpathentry kind="src" path="/org.eclipse.virgo.kernel.core"/>
<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.core/3.0.0.RELEASE/org.springframework.core-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.core/3.0.0.RELEASE/org.springframework.core-sources-3.0.0.RELEASE.jar"/>
<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.beans/3.0.0.RELEASE/org.springframework.beans-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.beans/3.0.0.RELEASE/org.springframework.beans-sources-3.0.0.RELEASE.jar"/>
+ <classpathentry kind="src" path="/org.eclipse.virgo.kernel.osgi"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
diff --git a/org.eclipse.virgo.kernel.agent.dm/src/main/java/org/eclipse/virgo/kernel/agent/dm/internal/DeployerFailureListener.java b/org.eclipse.virgo.kernel.agent.dm/src/main/java/org/eclipse/virgo/kernel/agent/dm/internal/DeployerFailureListener.java
index cca255c7..dda9f689 100644
--- a/org.eclipse.virgo.kernel.agent.dm/src/main/java/org/eclipse/virgo/kernel/agent/dm/internal/DeployerFailureListener.java
+++ b/org.eclipse.virgo.kernel.agent.dm/src/main/java/org/eclipse/virgo/kernel/agent/dm/internal/DeployerFailureListener.java
@@ -12,10 +12,13 @@
package org.eclipse.virgo.kernel.agent.dm.internal;
import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
import org.osgi.framework.FrameworkUtil;
+import org.osgi.framework.ServiceReference;
import org.osgi.service.event.Event;
import org.osgi.service.event.EventHandler;
+import org.eclipse.virgo.kernel.osgi.region.RegionMembership;
import org.eclipse.virgo.medic.eventlog.EventLogger;
/**
@@ -36,6 +39,10 @@ final class DeployerFailureListener implements EventHandler {
private static final String FAILURE_TOPIC = "org/osgi/service/blueprint/container/FAILURE";
private final EventLogger eventLogger;
+
+ private volatile RegionMembership regionMembership;
+
+ private volatile boolean agentInRegion;
public DeployerFailureListener(EventLogger eventLogger) {
this.eventLogger = eventLogger;
@@ -55,8 +62,16 @@ final class DeployerFailureListener implements EventHandler {
}
private boolean inThisRegion(Bundle bundle) {
- Bundle agentBundle = FrameworkUtil.getBundle(getClass());
- return agentBundle.getBundleContext().getBundle(bundle.getBundleId()) == bundle;
+ if (regionMembership == null) {
+ Bundle agentBundle = FrameworkUtil.getBundle(getClass());
+ BundleContext bundleContext = agentBundle.getBundleContext();
+ ServiceReference<RegionMembership> regionMembershipServiceReference = bundleContext.getServiceReference(RegionMembership.class);
+ if (regionMembershipServiceReference != null) {
+ this.regionMembership = bundleContext.getService(regionMembershipServiceReference);
+ this.agentInRegion = this.regionMembership.contains(agentBundle);
+ }
+ }
+ return this.regionMembership != null ? this.regionMembership.contains(bundle) == this.agentInRegion : true;
}
}
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/main/java/META-INF/MANIFEST.MF b/org.eclipse.virgo.kernel.deployer.test/src/main/java/META-INF/MANIFEST.MF
index 7353e09c..c49e7c13 100644
--- a/org.eclipse.virgo.kernel.deployer.test/src/main/java/META-INF/MANIFEST.MF
+++ b/org.eclipse.virgo.kernel.deployer.test/src/main/java/META-INF/MANIFEST.MF
@@ -1,4 +1,6 @@
Manifest-Version: 1.0
+Bundle-ClassPath: .,org.springframework.beans-2.5.6.A.jar,org.springfr
+ amework.core-2.5.6.A.jar
Bundle-Version: 2.2.0
Tool: Bundlor 1.0.0.RELEASE
Bundle-Name: Virgo Kernel Deployer Test
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/resources/config/org.eclipse.virgo.kernel.userregion.properties b/org.eclipse.virgo.kernel.deployer.test/src/test/resources/config/org.eclipse.virgo.kernel.userregion.properties
index 9b0f9ef3..07810350 100644
--- a/org.eclipse.virgo.kernel.deployer.test/src/test/resources/config/org.eclipse.virgo.kernel.userregion.properties
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/resources/config/org.eclipse.virgo.kernel.userregion.properties
@@ -48,6 +48,7 @@ packageImports =\
serviceImports =\
org.eclipse.virgo.kernel.osgi.region.Region,\
+ org.eclipse.virgo.kernel.osgi.region.RegionMembership,\
org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer,\
org.eclipse.virgo.kernel.deployer.core.DeployUriNormaliser,\
org.eclipse.virgo.kernel.install.artifact.ScopeServiceRepository,\
diff --git a/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/RegionManager.java b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/RegionManager.java
index 386c3cfe..54b0a3f4 100644
--- a/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/RegionManager.java
+++ b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/RegionManager.java
@@ -152,6 +152,7 @@ final class RegionManager {
return bundleId > bundleContext.getBundle().getBundleId() || bundleId == 0L;
}
};
+
registerResolverHookFactory(new RegionResolverHookFactory(regionMembership, expandedUserRegionImportsProperty));
@@ -165,11 +166,18 @@ final class RegionManager {
BundleContext userRegionBundleContext = initialiseUserRegionBundles();
+ registerRegionMembership(regionMembership, userRegionBundleContext);
+
registerRegionService(new ImmutableRegion(REGION_USER, userRegionBundleContext));
publishUserRegionBundleContext(userRegionBundleContext);
}
+ private void registerRegionMembership(RegionMembership regionMembership, BundleContext userRegionBundleContext) {
+ this.tracker.track(this.bundleContext.registerService(RegionMembership.class, regionMembership, null));
+ this.tracker.track(userRegionBundleContext.registerService(RegionMembership.class, regionMembership, null));
+ }
+
private void registerServiceFindHook(org.osgi.framework.hooks.service.FindHook serviceFindHook) {
this.tracker.track(this.bundleContext.registerService(org.osgi.framework.hooks.service.FindHook.class, serviceFindHook, null));
}
diff --git a/org.eclipse.virgo.kernel.test/src/test/resources/config/org.eclipse.virgo.kernel.userregion.properties b/org.eclipse.virgo.kernel.test/src/test/resources/config/org.eclipse.virgo.kernel.userregion.properties
index 7ed8240f..6b0777d6 100644
--- a/org.eclipse.virgo.kernel.test/src/test/resources/config/org.eclipse.virgo.kernel.userregion.properties
+++ b/org.eclipse.virgo.kernel.test/src/test/resources/config/org.eclipse.virgo.kernel.userregion.properties
@@ -44,6 +44,7 @@ packageImports =\
serviceImports =\
org.eclipse.virgo.kernel.osgi.region.Region,\
+ org.eclipse.virgo.kernel.osgi.region.RegionMembership,\
org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer,\
org.eclipse.virgo.kernel.deployer.core.DeployUriNormaliser,\
org.eclipse.virgo.kernel.install.artifact.ScopeServiceRepository,\

Back to the top