Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2012-08-04 20:48:53 +0000
committerThomas Watson2012-08-04 20:48:53 +0000
commit4486fd747641838456a29d34040cd52cf455277d (patch)
tree0bb9cbf3ac8d546d481689b4eed021ae648cabe7 /bundles
parent747c370b8bca654fa338a231de2120d692fd74b8 (diff)
downloadrt.equinox.framework-4486fd747641838456a29d34040cd52cf455277d.tar.gz
rt.equinox.framework-4486fd747641838456a29d34040cd52cf455277d.tar.xz
rt.equinox.framework-4486fd747641838456a29d34040cd52cf455277d.zip
Provide proper origin for install event.
Diffstat (limited to 'bundles')
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/Module.java2
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleContainer.java14
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleContainerAdaptor.java8
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxContainerAdaptor.java4
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxEventPublisher.java12
5 files changed, 25 insertions, 15 deletions
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/Module.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/Module.java
index 7e8edfab9..e464a0732 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/Module.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/Module.java
@@ -418,7 +418,7 @@ public abstract class Module implements BundleReference, BundleStartLevel, Compa
}
final void publishEvent(ModuleEvent type) {
- revisions.getContainer().getAdaptor().publishEvent(type, this);
+ revisions.getContainer().getAdaptor().publishModuleEvent(type, this, this);
}
/**
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleContainer.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleContainer.java
index e79d7fc6e..467569fc0 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleContainer.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleContainer.java
@@ -218,7 +218,7 @@ public final class ModuleContainer {
Module result = moduleDatabase.install(location, builder, revisionInfo);
- adaptor.publishEvent(ModuleEvent.INSTALLED, result);
+ adaptor.publishModuleEvent(ModuleEvent.INSTALLED, result, origin);
return result;
} finally {
@@ -299,14 +299,14 @@ public final class ModuleContainer {
if (Module.RESOLVED_SET.contains(previousState)) {
// set the state to installed and publish unresolved event
module.setState(State.INSTALLED);
- adaptor.publishEvent(ModuleEvent.UNRESOLVED, module);
+ adaptor.publishModuleEvent(ModuleEvent.UNRESOLVED, module, module);
}
moduleDatabase.update(module, builder, revisionInfo);
} finally {
module.unlockStateChange(ModuleEvent.UPDATED);
}
// only publish updated event on success
- adaptor.publishEvent(ModuleEvent.UPDATED, module);
+ adaptor.publishModuleEvent(ModuleEvent.UPDATED, module, module);
if (Module.ACTIVE_SET.contains(previousState)) {
try {
@@ -345,13 +345,13 @@ public final class ModuleContainer {
if (Module.RESOLVED_SET.contains(previousState)) {
// set the state to installed and publish unresolved event
module.setState(State.INSTALLED);
- adaptor.publishEvent(ModuleEvent.UNRESOLVED, module);
+ adaptor.publishModuleEvent(ModuleEvent.UNRESOLVED, module, module);
}
module.setState(State.UNINSTALLED);
} finally {
module.unlockStateChange(ModuleEvent.UNINSTALLED);
}
- adaptor.publishEvent(ModuleEvent.UNINSTALLED, module);
+ adaptor.publishModuleEvent(ModuleEvent.UNINSTALLED, module, module);
}
ModuleWiring getWiring(ModuleRevision revision) {
@@ -542,7 +542,7 @@ public final class ModuleContainer {
}
for (Module module : modulesLocked) {
- adaptor.publishEvent(ModuleEvent.RESOLVED, module);
+ adaptor.publishModuleEvent(ModuleEvent.RESOLVED, module, module);
}
return true;
}
@@ -697,7 +697,7 @@ public final class ModuleContainer {
// publish unresolved events after giving up all locks
for (Module module : modulesUnresolved) {
- adaptor.publishEvent(ModuleEvent.UNRESOLVED, module);
+ adaptor.publishModuleEvent(ModuleEvent.UNRESOLVED, module, module);
}
return refreshTriggers;
}
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleContainerAdaptor.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleContainerAdaptor.java
index e5fc30ad9..daec55e0c 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleContainerAdaptor.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleContainerAdaptor.java
@@ -30,7 +30,7 @@ public abstract class ModuleContainerAdaptor {
}
/**
- * Event types that may be {@link #publishEvent(ModuleEvent, Module) published} for a module
+ * Event types that may be {@link #publishModuleEvent(ModuleEvent, Module, Module) published} for a module
* indicating a {@link Module#getState() state} change has occurred for a module.
*/
public static enum ModuleEvent {
@@ -114,8 +114,12 @@ public abstract class ModuleContainerAdaptor {
* No locks are held by the container when this method is called
* @param type the event type to publish
* @param module the module the event is associated with
+ * @param origin the module which is the origin of the event. For the event
+ * type {@link ModuleEvent#INSTALLED}, this is the module whose context was used
+ * to install the module. Otherwise it is the module itself. May be null only
+ * when the event is not of type {@link ModuleEvent#INSTALLED}.
*/
- public abstract void publishEvent(ModuleEvent type, Module module);
+ public abstract void publishModuleEvent(ModuleEvent type, Module module, Module origin);
/**
* Returns the specified configuration property value
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxContainerAdaptor.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxContainerAdaptor.java
index 76d539b27..79a48267c 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxContainerAdaptor.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxContainerAdaptor.java
@@ -77,10 +77,10 @@ public class EquinoxContainerAdaptor extends ModuleContainerAdaptor {
}
@Override
- public void publishEvent(ModuleEvent type, Module module) {
+ public void publishModuleEvent(ModuleEvent type, Module module, Module origin) {
EquinoxEventPublisher publisher = container.getEventPublisher();
if (publisher != null) {
- publisher.publishBundleEvent(getType(type), module.getBundle());
+ publisher.publishBundleEvent(getType(type), module.getBundle(), origin.getBundle());
}
}
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxEventPublisher.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxEventPublisher.java
index 76077c1dc..3d12b4173 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxEventPublisher.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxEventPublisher.java
@@ -52,16 +52,22 @@ public class EquinoxEventPublisher {
}
/**
- * Deliver a BundleEvent to SynchronousBundleListeners (synchronous). and
+ * Deliver a BundleEvent to SynchronousBundleListeners (synchronous) and
* BundleListeners (asynchronous).
*
* @param type
* BundleEvent type.
* @param bundle
* Affected bundle or null.
+ * @param origin
+ * The origin of the event
*/
- public void publishBundleEvent(int type, Bundle bundle) {
- publishBundleEvent(new BundleEvent(type, bundle));
+ public void publishBundleEvent(int type, Bundle bundle, Bundle origin) {
+ if (origin != null) {
+ publishBundleEvent(new BundleEvent(type, bundle, origin));
+ } else {
+ publishBundleEvent(new BundleEvent(type, bundle));
+ }
}
private void publishBundleEvent(final BundleEvent event) {

Back to the top