The ConfigManagerActivator advertises its ModuleInfoBackedContext
as the ClassLoadingStrategy service but the CSS features are being
removed. Therefore advertise mdsal's ModuleInfoBackedContext instance.
Change-Id: Ie03a25db940d3ae17ae5250cafe9fcc32a5baac7
Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
<configuration>
<instructions>
<Bundle-Name>${project.groupId}.${project.artifactId}</Bundle-Name>
<configuration>
<instructions>
<Bundle-Name>${project.groupId}.${project.artifactId}</Bundle-Name>
- <Activator>org.opendaylight.mdsal.binding.dom.codec.osgi.impl.Activator</Activator>
+ <Bundle-Activator>org.opendaylight.mdsal.binding.dom.codec.osgi.impl.Activator</Bundle-Activator>
</instructions>
</configuration>
</plugin>
</instructions>
</configuration>
</plugin>
*/
package org.opendaylight.mdsal.binding.dom.codec.osgi.impl;
*/
package org.opendaylight.mdsal.binding.dom.codec.osgi.impl;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.Collection;
import org.opendaylight.mdsal.binding.dom.codec.osgi.BindingRuntimeContextService;
import org.opendaylight.mdsal.binding.dom.codec.osgi.BindingRuntimeContextService;
+import org.opendaylight.mdsal.binding.generator.api.ClassLoadingStrategy;
import org.opendaylight.mdsal.binding.generator.impl.ModuleInfoBackedContext;
import org.opendaylight.yangtools.concepts.ObjectRegistration;
import org.opendaylight.yangtools.yang.binding.YangModuleInfo;
import org.opendaylight.mdsal.binding.generator.impl.ModuleInfoBackedContext;
import org.opendaylight.yangtools.concepts.ObjectRegistration;
import org.opendaylight.yangtools.yang.binding.YangModuleInfo;
import org.osgi.util.tracker.BundleTracker;
public final class Activator implements BundleActivator {
import org.osgi.util.tracker.BundleTracker;
public final class Activator implements BundleActivator {
+ private final List<ServiceRegistration<?>> registrations = new ArrayList<>(2);
+
private BundleTracker<Collection<ObjectRegistration<YangModuleInfo>>> moduleInfoResolvedBundleTracker;
private SimpleBindingRuntimeContextService service;
private BundleTracker<Collection<ObjectRegistration<YangModuleInfo>>> moduleInfoResolvedBundleTracker;
private SimpleBindingRuntimeContextService service;
- private ServiceRegistration<?> registration;
@Override
public void start(final BundleContext context) {
@Override
public void start(final BundleContext context) {
service = new SimpleBindingRuntimeContextService(context, moduleInfoBackedContext, moduleInfoBackedContext);
final OsgiModuleInfoRegistry registry = new OsgiModuleInfoRegistry(moduleInfoBackedContext,
service = new SimpleBindingRuntimeContextService(context, moduleInfoBackedContext, moduleInfoBackedContext);
final OsgiModuleInfoRegistry registry = new OsgiModuleInfoRegistry(moduleInfoBackedContext,
- moduleInfoBackedContext, service);
+ moduleInfoBackedContext, service);
final ModuleInfoBundleTracker moduleInfoTracker = new ModuleInfoBundleTracker(registry);
moduleInfoResolvedBundleTracker = new BundleTracker<>(context, Bundle.RESOLVED | Bundle.STARTING
final ModuleInfoBundleTracker moduleInfoTracker = new ModuleInfoBundleTracker(registry);
moduleInfoResolvedBundleTracker = new BundleTracker<>(context, Bundle.RESOLVED | Bundle.STARTING
moduleInfoTracker.finishStart();
service.open();
moduleInfoTracker.finishStart();
service.open();
- registration = context.registerService(BindingRuntimeContextService.class, service, null);
+ registrations.add(context.registerService(BindingRuntimeContextService.class, service, null));
+ registrations.add(context.registerService(ClassLoadingStrategy.class, moduleInfoBackedContext, null));
}
@Override
public void stop(final BundleContext context) {
moduleInfoResolvedBundleTracker.close();
service.close();
}
@Override
public void stop(final BundleContext context) {
moduleInfoResolvedBundleTracker.close();
service.close();
- registration.unregister();
+ registrations.forEach(ServiceRegistration::unregister);
+ registrations.clear();