diff options
author | Thomas Watson | 2016-07-08 21:02:15 +0000 |
---|---|---|
committer | Thomas Watson | 2016-08-12 13:04:04 +0000 |
commit | a1e52d50c79e847281faecb823f089018944e9ac (patch) | |
tree | 5887b05c12ecc293718363818bf3ec2937ad617a /bundles | |
parent | 90a8f7255361798ed19fd41ab6c7df2e76b6630d (diff) | |
download | rt.equinox.framework-a1e52d50c79e847281faecb823f089018944e9ac.tar.gz rt.equinox.framework-a1e52d50c79e847281faecb823f089018944e9ac.tar.xz rt.equinox.framework-a1e52d50c79e847281faecb823f089018944e9ac.zip |
Bug 497576 - [equinox framework] augmenting bundle metadata
Container changes to allow a container adaptor to adapt a builder
before it is used by the container.
EquinoxContainerAdaptor changes to call StorageHook implementations to
adapt a builder for a generation.
Change-Id: I4597f98b6fc6c993fc601a615f61047a8299beae
Signed-off-by: Thomas Watson <tjwatson@us.ibm.com>
Diffstat (limited to 'bundles')
10 files changed, 201 insertions, 25 deletions
diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/storage.hooks.a/org/eclipse/osgi/tests/hooks/framework/storage/a/TestHookConfigurator.java b/bundles/org.eclipse.osgi.tests/bundles_src/storage.hooks.a/org/eclipse/osgi/tests/hooks/framework/storage/a/TestHookConfigurator.java index 6e8117f5c..57eb3e108 100644 --- a/bundles/org.eclipse.osgi.tests/bundles_src/storage.hooks.a/org/eclipse/osgi/tests/hooks/framework/storage/a/TestHookConfigurator.java +++ b/bundles/org.eclipse.osgi.tests/bundles_src/storage.hooks.a/org/eclipse/osgi/tests/hooks/framework/storage/a/TestHookConfigurator.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2013 IBM Corporation and others. + * Copyright (c) 2013, 2016 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -12,20 +12,29 @@ package org.eclipse.osgi.tests.hooks.framework.storage.a; import java.io.DataInputStream; import java.io.DataOutputStream; -import java.util.Dictionary; +import java.util.*; +import java.util.concurrent.atomic.AtomicInteger; +import org.eclipse.osgi.container.Module; +import org.eclipse.osgi.container.ModuleContainerAdaptor.ModuleEvent; +import org.eclipse.osgi.container.ModuleRevisionBuilder; import org.eclipse.osgi.internal.hookregistry.*; import org.eclipse.osgi.storage.BundleInfo.Generation; +import org.osgi.framework.Version; +import org.osgi.framework.namespace.BundleNamespace; +import org.osgi.framework.namespace.IdentityNamespace; public class TestHookConfigurator implements HookConfigurator { private static class TestStorageHookFactory extends StorageHookFactory<Object, Object, TestStorageHookFactory.TestStorageHook> { private static class TestStorageHook extends StorageHookFactory.StorageHook<Object, Object> { + private static AtomicInteger adaptCount = new AtomicInteger(1); + public TestStorageHook(Generation generation, Class clazz) { super(generation, clazz); } @Override public void initialize(Dictionary manifest) { - // Nothing. + // Nothing } @Override @@ -49,6 +58,28 @@ public class TestHookConfigurator implements HookConfigurator { public void deletingGeneration() { TestHookConfigurator.deletingGenerationCalled = true; } + + @Override + public ModuleRevisionBuilder adaptModuleRevisionBuilder(ModuleEvent operation, Module origin, ModuleRevisionBuilder builder) { + if (TestHookConfigurator.replaceModuleBuilder) { + ModuleRevisionBuilder replace = new ModuleRevisionBuilder(); + replace.setSymbolicName("replace"); + replace.setVersion(Version.parseVersion("1.1.1")); + replace.addCapability("replace", Collections.<String, String> emptyMap(), Collections.<String, Object> emptyMap()); + replace.addCapability(IdentityNamespace.IDENTITY_NAMESPACE, Collections.<String, String> emptyMap(), Collections.<String, Object> singletonMap(IdentityNamespace.IDENTITY_NAMESPACE, "replace")); + replace.addCapability(BundleNamespace.BUNDLE_NAMESPACE, Collections.<String, String> emptyMap(), Collections.<String, Object> singletonMap(BundleNamespace.BUNDLE_NAMESPACE, "replace")); + return replace; + } + if (TestHookConfigurator.adaptManifest) { + Map<String, String> dirs = Collections.emptyMap(); + Map<String, Object> attrs = new HashMap<String, Object>(); + attrs.put("test.file.path", getGeneration().getContent().getPath() + " - " + adaptCount.getAndIncrement()); + attrs.put("test.operation", operation.toString()); + attrs.put("test.origin", origin.getLocation()); + builder.addCapability("test.file.path", dirs, attrs); + } + return builder; + } } public TestStorageHookFactory() { @@ -74,6 +105,8 @@ public class TestHookConfigurator implements HookConfigurator { public static volatile boolean invalidFactoryClass; public static volatile boolean validateCalled; public static volatile boolean deletingGenerationCalled; + public static volatile boolean adaptManifest; + public static volatile boolean replaceModuleBuilder; public void addHooks(HookRegistry hookRegistry) { hookRegistry.addStorageHookFactory(new TestStorageHookFactory()); diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/StorageHookTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/StorageHookTests.java index 81373b768..67556d945 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/StorageHookTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/StorageHookTests.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2013 IBM Corporation and others. + * Copyright (c) 2013, 2016 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -10,14 +10,18 @@ *******************************************************************************/ package org.eclipse.osgi.tests.hooks.framework; +import static org.junit.Assert.assertNotEquals; + import java.io.File; import java.net.URL; -import java.util.HashMap; -import java.util.Map; +import java.util.*; +import org.eclipse.osgi.container.ModuleContainerAdaptor.ModuleEvent; import org.eclipse.osgi.internal.hookregistry.HookRegistry; import org.eclipse.osgi.tests.OSGiTestsActivator; import org.osgi.framework.*; import org.osgi.framework.launch.Framework; +import org.osgi.framework.wiring.BundleRevision; +import org.osgi.resource.Capability; public class StorageHookTests extends AbstractFrameworkHookTests { private static final String TEST_BUNDLE = "test"; @@ -28,6 +32,8 @@ public class StorageHookTests extends AbstractFrameworkHookTests { private static final String HOOK_CONFIGURATOR_FIELD_INVALID_FACTORY_CLASS = "invalidFactoryClass"; private static final String HOOK_CONFIGURATOR_FIELD_VALIDATE_CALLED = "validateCalled"; private static final String HOOK_CONFIGURATOR_FIELD_DELETING_CALLED = "deletingGenerationCalled"; + private static final String HOOK_CONFIGURATOR_FIELD_ADAPT_MANIFEST = "adaptManifest"; + private static final String HOOK_CONFIGURATOR_FIELD_REPLACE_BUILDER = "replaceModuleBuilder"; private Map<String, String> configuration; private Framework framework; @@ -135,6 +141,61 @@ public class StorageHookTests extends AbstractFrameworkHookTests { assertStorageHookDeletingGenerationCalled(); } + public void testAdaptModuleRevisionBuilder() throws Exception { + setFactoryClassAdaptManifest(true); + initAndStartFramework(); + + installBundle(); + Bundle b = framework.getBundleContext().getBundle(location); + assertNotNull("Missing test bundle.", b); + List<Capability> testCaps = b.adapt(BundleRevision.class).getCapabilities("test.file.path"); + assertEquals("Wrong number of test caps.", 1, testCaps.size()); + String path1 = (String) testCaps.get(0).getAttributes().get("test.file.path"); + assertNotNull("No path", path1); + String operation1 = (String) testCaps.get(0).getAttributes().get("test.operation"); + assertEquals("Wrong operation", ModuleEvent.INSTALLED.toString(), operation1); + String location1 = (String) testCaps.get(0).getAttributes().get("test.origin"); + assertEquals("Wrong origin", framework.getBundleContext().getBundle().getLocation(), location1); + + b.update(); + testCaps = b.adapt(BundleRevision.class).getCapabilities("test.file.path"); + assertEquals("Wrong number of test caps.", 1, testCaps.size()); + String path2 = (String) testCaps.get(0).getAttributes().get("test.file.path"); + assertNotNull("No path", path2); + String operation2 = (String) testCaps.get(0).getAttributes().get("test.operation"); + assertEquals("Wrong operation", ModuleEvent.UPDATED.toString(), operation2); + String location2 = (String) testCaps.get(0).getAttributes().get("test.origin"); + assertEquals("Wrong origin", location, location2); + + assertNotEquals("Path of updated bundle is the same.", path1, path2); + + framework.stop(); + framework.waitForStop(5000); + + // create new framework object to test loading of persistent capability. + framework = createFramework(configuration); + framework.start(); + b = framework.getBundleContext().getBundle(location); + testCaps = b.adapt(BundleRevision.class).getCapabilities("test.file.path"); + assertEquals("Wrong number of test caps.", 1, testCaps.size()); + path2 = (String) testCaps.get(0).getAttributes().get("test.file.path"); + assertNotNull("No path", path2); + operation2 = (String) testCaps.get(0).getAttributes().get("test.operation"); + assertEquals("Wrong operation", ModuleEvent.UPDATED.toString(), operation2); + location2 = (String) testCaps.get(0).getAttributes().get("test.origin"); + assertEquals("Wrong origin", location, location2); + + setFactoryClassAdaptManifest(false); + setFactoryClassReplaceBuilder(true); + b.uninstall(); + installBundle(); + b = framework.getBundleContext().getBundle(location); + assertNotNull("Missing test bundle.", b); + assertEquals("Wrong BSN.", "replace", b.getSymbolicName()); + testCaps = b.adapt(BundleRevision.class).getCapabilities("replace"); + assertEquals("Wrong number of capabilities.", 1, testCaps.size()); + } + protected void setUp() throws Exception { super.setUp(); String loc = bundleInstaller.getBundleLocation(HOOK_CONFIGURATOR_BUNDLE); @@ -200,6 +261,7 @@ public class StorageHookTests extends AbstractFrameworkHookTests { clazz.getField(HOOK_CONFIGURATOR_FIELD_VALIDATE_CALLED).set(null, false); clazz.getField(HOOK_CONFIGURATOR_FIELD_INVALID_FACTORY_CLASS).set(null, false); clazz.getField(HOOK_CONFIGURATOR_FIELD_DELETING_CALLED).set(null, false); + clazz.getField(HOOK_CONFIGURATOR_FIELD_ADAPT_MANIFEST).set(null, false); } private void restartFramework() throws Exception { @@ -216,6 +278,16 @@ public class StorageHookTests extends AbstractFrameworkHookTests { clazz.getField(HOOK_CONFIGURATOR_FIELD_INVALID).set(null, value); } + private void setFactoryClassAdaptManifest(boolean value) throws Exception { + Class<?> clazz = classLoader.loadClass(HOOK_CONFIGURATOR_CLASS); + clazz.getField(HOOK_CONFIGURATOR_FIELD_ADAPT_MANIFEST).set(null, value); + } + + private void setFactoryClassReplaceBuilder(boolean value) throws Exception { + Class<?> clazz = classLoader.loadClass(HOOK_CONFIGURATOR_CLASS); + clazz.getField(HOOK_CONFIGURATOR_FIELD_REPLACE_BUILDER).set(null, value); + } + private void updateBundle() throws Exception { framework.getBundleContext().getBundle(location).update(); } diff --git a/bundles/org.eclipse.osgi/META-INF/MANIFEST.MF b/bundles/org.eclipse.osgi/META-INF/MANIFEST.MF index a6a19b937..d2bf3b7ab 100644 --- a/bundles/org.eclipse.osgi/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.osgi/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Export-Package: org.eclipse.core.runtime.adaptor;x-friends:="org.eclipse.core.runtime", org.eclipse.core.runtime.internal.adaptor;x-internal:=true, org.eclipse.equinox.log;version="1.0", - org.eclipse.osgi.container;version="1.1", + org.eclipse.osgi.container;version="1.2", org.eclipse.osgi.container.builders;version="1.0", org.eclipse.osgi.container.namespaces;version="1.0", org.eclipse.osgi.framework.console;version="1.1", @@ -95,7 +95,7 @@ Bundle-Activator: org.eclipse.osgi.internal.framework.SystemBundleActivator Bundle-Description: %systemBundle Bundle-Copyright: %copyright Bundle-Vendor: %eclipse.org -Bundle-Version: 3.11.100.qualifier +Bundle-Version: 3.12.0.qualifier Bundle-Localization: systembundle Bundle-DocUrl: http://www.eclipse.org Eclipse-ExtensibleAPI: true 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 9470dceb9..a3c29c16f 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 @@ -196,6 +196,10 @@ public final class ModuleContainer implements DebugOptionsListener { * @throws BundleException if some error occurs installing the module */ public Module install(Module origin, String location, ModuleRevisionBuilder builder, Object revisionInfo) throws BundleException { + ModuleRevisionBuilder adaptBuilder = getAdaptor().adaptModuleRevisionBuilder(ModuleEvent.INSTALLED, origin, builder, revisionInfo); + if (adaptBuilder != null) { + builder = adaptBuilder; + } String name = builder.getSymbolicName(); boolean locationLocked = false; boolean nameLocked = false; @@ -284,6 +288,10 @@ public final class ModuleContainer implements DebugOptionsListener { * @throws BundleException if some error occurs updating the module */ public void update(Module module, ModuleRevisionBuilder builder, Object revisionInfo) throws BundleException { + ModuleRevisionBuilder adaptBuilder = getAdaptor().adaptModuleRevisionBuilder(ModuleEvent.UPDATED, module, builder, revisionInfo); + if (adaptBuilder != null) { + builder = adaptBuilder; + } checkAdminPermission(module.getBundle(), AdminPermission.LIFECYCLE); String name = builder.getSymbolicName(); boolean nameLocked = false; 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 567c20b98..31cce058c 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 @@ -294,4 +294,27 @@ public abstract class ModuleContainerAdaptor { } }; } + + /** + * Allows a builder to be modified before it is used by the container. This gets + * call when a new module is {@link ModuleContainer#install(Module, String, ModuleRevisionBuilder, Object) installed} + * into the container or when an existing module is {@link ModuleContainer#update(Module, ModuleRevisionBuilder, Object) updated} + * with a new revision. The container does not call any methods on the builder before calling this method. + * @param operation The lifecycle operation event that is in progress using the supplied builder. + * This will be either {@link ModuleEvent#INSTALLED installed} or {@link ModuleEvent#UPDATED updated}. + * @param origin The module which originated the lifecycle operation. The origin may be {@code null} for + * {@link ModuleEvent#INSTALLED installed} operations. This is the module + * passed to the {@link ModuleContainer#install(Module, String, ModuleRevisionBuilder, Object) install} or + * {@link ModuleContainer#update(Module, ModuleRevisionBuilder, Object) update} method. + * @param builder the builder that will be used to create a new {@link ModuleRevision}. + * @param revisionInfo the revision info that will be used for the new revision, may be {@code null}. + * @return The modified builder or a completely new builder to be used by the bundle. A {@code null} value + * indicates the original builder should be used, which may have been modified by adding requirements or + * capabilities. + * @since 3.12 + */ + public ModuleRevisionBuilder adaptModuleRevisionBuilder(ModuleEvent operation, Module origin, ModuleRevisionBuilder builder, Object revisionInfo) { + // do nothing by default + return null; + } } diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/namespaces/EquinoxModuleDataNamespace.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/namespaces/EquinoxModuleDataNamespace.java index ed100699b..a58618adc 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/namespaces/EquinoxModuleDataNamespace.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/namespaces/EquinoxModuleDataNamespace.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2013 IBM Corporation and others. + * Copyright (c) 2012, 2016 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -17,7 +17,7 @@ import org.osgi.resource.Namespace; * Equinox module data capability namespace. This namespace is used * to store immutable data about a module revision. This includes the following * <ul> - * <li>The activation policy as specified by the {@link Constants#BUNDLE_ACTIVATIONPOLICY} + * <li>The activation policy as specified by the {@link Constants#BUNDLE_ACTIVATIONPOLICY * Bundle-ActivationPolicy} header.</li> * <li>The activator as specified by the {@link Constants#BUNDLE_ACTIVATOR Bundle-Activator} * header.</li> @@ -25,15 +25,9 @@ import org.osgi.resource.Namespace; * header.</li> * <li>The bundle class loading policy. * </ul> - * Activation - * policy capability is provided for informational purposes and - * should not be considered as effective by the resolver. - * <p> - * For bundles, the attributes of this capability are extracted - * from the Bundle-ActivationPolicy header. The directives - * {@link Constants#EXCLUDE_DIRECTIVE} and {@link Constants#INCLUDE_DIRECTIVE} - * are converted to attributes of type {@code List<String>}. * + * This capability is provided for informational purposes and + * should not be considered as effective by the resolver. * <p> * This class defines the names for the attributes and directives for this * namespace. Capabilities in this namespace are not intended to be used to @@ -84,7 +78,7 @@ public class EquinoxModuleDataNamespace extends Namespace { public final static String EFFECTIVE_INFORMATION = "information"; //$NON-NLS-1$ /** - * The capability attribute contains the {@link Constants#BUNDLE_ACTIVATIONPOLICY + * The capability attribute contains the {@link Constants#BUNDLE_ACTIVATIONPOLICY * activation policy} for the providing module revision. The value of this * attribute must be of type {@code String}. When not specified then * the module revision uses an eager activation policy. @@ -92,8 +86,8 @@ public class EquinoxModuleDataNamespace extends Namespace { public final static String CAPABILITY_ACTIVATION_POLICY = "activation.policy"; //$NON-NLS-1$ /** - * An activation policy name indicating the lazy activation policy - * is used. + * An {@link #CAPABILITY_ACTIVATION_POLICY activation policy} attribute value + * indicating the lazy activation policy is used. */ public final static String CAPABILITY_ACTIVATION_POLICY_LAZY = "lazy"; //$NON-NLS-1$ 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 e0b0f85fb..84c8cbd42 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 @@ -333,4 +333,10 @@ public class EquinoxContainerAdaptor extends ModuleContainerAdaptor { ((ExecutorService) current).shutdown(); } } + + @Override + public ModuleRevisionBuilder adaptModuleRevisionBuilder(ModuleEvent operation, Module origin, ModuleRevisionBuilder builder, Object revisionInfo) { + Generation generation = (Generation) revisionInfo; + return generation.adaptModuleRevisionBuilder(operation, origin, builder); + } }
\ No newline at end of file diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/hookregistry/StorageHookFactory.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/hookregistry/StorageHookFactory.java index 4135de8b4..9c5ad2abc 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/hookregistry/StorageHookFactory.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/hookregistry/StorageHookFactory.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2013 IBM Corporation and others. + * Copyright (c) 2005, 2016 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -13,6 +13,8 @@ package org.eclipse.osgi.internal.hookregistry; import java.io.*; import java.util.Dictionary; +import org.eclipse.osgi.container.*; +import org.eclipse.osgi.container.ModuleContainerAdaptor.ModuleEvent; import org.eclipse.osgi.storage.BundleInfo.Generation; import org.osgi.framework.BundleException; @@ -124,6 +126,10 @@ public abstract class StorageHookFactory<S, L, H extends StorageHookFactory.Stor this.factoryClass = factoryClass; } + /** + * The generation associated with this hook. + * @return the generation associated with this hook. + */ public Generation getGeneration() { return generation; } @@ -137,6 +143,26 @@ public abstract class StorageHookFactory<S, L, H extends StorageHookFactory.Stor public abstract void initialize(Dictionary<String, String> manifest) throws BundleException; /** + * Allows a builder to be modified before it is used by the framework to create a {@link ModuleRevision revision} + * associated with the bundle {@link #getGeneration() generation} being installed or updated. + * @param operation The lifecycle operation event that is in progress using the supplied builder. + * This will be either {@link ModuleEvent#INSTALLED installed} or {@link ModuleEvent#UPDATED updated}. + * @param origin The module which originated the lifecycle operation. The origin may be {@code null} for + * {@link ModuleEvent#INSTALLED installed} operations. This is the module + * passed to the {@link ModuleContainer#install(Module, String, ModuleRevisionBuilder, Object) install} or + * {@link ModuleContainer#update(Module, ModuleRevisionBuilder, Object) update} method. + * @param builder the builder that will be used to create a new {@link ModuleRevision}. + * @return The modified builder or a completely new builder to be used by the bundle. A {@code null} value + * indicates the original builder should be used, which may have been modified by adding requirements or + * capabilities. + * @see ModuleContainerAdaptor#adaptModuleRevisionBuilder(ModuleEvent, Module, ModuleRevisionBuilder, Object) + */ + public ModuleRevisionBuilder adaptModuleRevisionBuilder(ModuleEvent operation, Module origin, ModuleRevisionBuilder builder) { + // do nothing + return null; + } + + /** * Loads the data from the specified * input stream into the storage hook. This method is called during startup to * load all the persistently installed bundles. <p> diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/BundleInfo.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/BundleInfo.java index 4ab00f0aa..cab25c713 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/BundleInfo.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/BundleInfo.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2013 IBM Corporation and others. + * Copyright (c) 2012, 2016 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -16,7 +16,8 @@ import java.net.URL; import java.security.ProtectionDomain; import java.util.*; import java.util.concurrent.TimeUnit; -import org.eclipse.osgi.container.ModuleRevision; +import org.eclipse.osgi.container.*; +import org.eclipse.osgi.container.ModuleContainerAdaptor.ModuleEvent; import org.eclipse.osgi.framework.log.FrameworkLogEntry; import org.eclipse.osgi.framework.util.Headers; import org.eclipse.osgi.internal.container.LockSet; @@ -352,6 +353,19 @@ public final class BundleInfo { return this.storageHooks; } } + + public ModuleRevisionBuilder adaptModuleRevisionBuilder(ModuleEvent operation, Module origin, ModuleRevisionBuilder builder) { + List<StorageHook<?, ?>> hooks = getStorageHooks(); + if (hooks != null) { + for (StorageHook<?, ?> hook : hooks) { + ModuleRevisionBuilder hookResult = hook.adaptModuleRevisionBuilder(operation, origin, builder); + if (hookResult != null) { + builder = hookResult; + } + } + } + return builder; + } } private final Storage storage; diff --git a/bundles/org.eclipse.osgi/pom.xml b/bundles/org.eclipse.osgi/pom.xml index 699e630d5..1d862f927 100644 --- a/bundles/org.eclipse.osgi/pom.xml +++ b/bundles/org.eclipse.osgi/pom.xml @@ -19,7 +19,7 @@ </parent> <groupId>org.eclipse.osgi</groupId> <artifactId>org.eclipse.osgi</artifactId> - <version>3.11.100-SNAPSHOT</version> + <version>3.12.0-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> <build> |