Fix raw Component{Factory,Instance} references 45/97545/2
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 20 Sep 2021 14:47:51 +0000 (16:47 +0200)
committerRobert Varga <nite@hq.sk>
Mon, 20 Sep 2021 20:01:52 +0000 (20:01 +0000)
These interfaces are now properly generic, bind them to their
corresponding component.

Change-Id: Ib03ec6cfeee4c10fbbfc5e6e0950d1dd035cecfe
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
dom/mdsal-dom-schema-osgi/src/main/java/org/opendaylight/mdsal/dom/schema/osgi/impl/OSGiModelRuntime.java
dom/mdsal-dom-schema-osgi/src/main/java/org/opendaylight/mdsal/dom/schema/osgi/impl/RegularYangModuleInfoRegistry.java
dom/mdsal-dom-schema-osgi/src/main/java/org/opendaylight/mdsal/dom/schema/osgi/impl/YangModuleInfoRegistry.java

index af0cc25008a59d07f03ce1bf7d6db145c7ff1ef0..6e54af51f4a5ebb2b09f2ee9cddbe47d323bbe87 100644 (file)
@@ -24,7 +24,7 @@ public final class OSGiModelRuntime {
     @Reference
     YangParserFactory parserFactory = null;
     @Reference(target = "(component.factory=" + OSGiModuleInfoSnapshotImpl.FACTORY_NAME + ")")
-    ComponentFactory contextFactory = null;
+    ComponentFactory<OSGiModuleInfoSnapshotImpl> contextFactory = null;
 
     private YangModuleInfoScanner bundleTracker = null;
     private YangModuleInfoRegistry moduleRegistry = null;
index 244fddd64145052d3d5925e6b2cf237fd46c5092..7f0e2835be255e0d7dedbca2e676a5a9ef099428 100644 (file)
@@ -29,11 +29,11 @@ import org.slf4j.LoggerFactory;
 final class RegularYangModuleInfoRegistry extends YangModuleInfoRegistry {
     private static final Logger LOG = LoggerFactory.getLogger(RegularYangModuleInfoRegistry.class);
 
-    private final ComponentFactory contextFactory;
+    private final ComponentFactory<OSGiModuleInfoSnapshotImpl> contextFactory;
     private final ModuleInfoSnapshotResolver moduleInfoRegistry;
 
     @GuardedBy("this")
-    private ComponentInstance currentInstance;
+    private ComponentInstance<OSGiModuleInfoSnapshotImpl> currentInstance;
     @GuardedBy("this")
     private ModuleInfoSnapshot currentSnapshot;
     @GuardedBy("this")
@@ -41,7 +41,8 @@ final class RegularYangModuleInfoRegistry extends YangModuleInfoRegistry {
 
     private volatile boolean ignoreScanner = true;
 
-    RegularYangModuleInfoRegistry(final ComponentFactory contextFactory, final YangParserFactory factory) {
+    RegularYangModuleInfoRegistry(final ComponentFactory<OSGiModuleInfoSnapshotImpl> contextFactory,
+            final YangParserFactory factory) {
         this.contextFactory = requireNonNull(contextFactory);
         moduleInfoRegistry = new ModuleInfoSnapshotResolver("binding-dom-codec", factory);
     }
@@ -96,7 +97,7 @@ final class RegularYangModuleInfoRegistry extends YangModuleInfoRegistry {
         }
 
 
-        final ComponentInstance newInstance = contextFactory.newInstance(
+        final ComponentInstance<OSGiModuleInfoSnapshotImpl> newInstance = contextFactory.newInstance(
             OSGiModuleInfoSnapshotImpl.props(nextGeneration(), newSnapshot));
         if (currentInstance != null) {
             currentInstance.dispose();
index 6a4d1e132010df4f3a1b34d6c99c373b4a912af9..d4d5b4f179741fe29a9025e7e531ef9c4c58eedc 100644 (file)
@@ -19,8 +19,8 @@ import org.osgi.service.component.ComponentFactory;
  * Update SchemaContext service in Service Registry each time new YangModuleInfo is added or removed.
  */
 abstract class YangModuleInfoRegistry {
-    static @NonNull YangModuleInfoRegistry create(final BundleContext ctx, final ComponentFactory contextFactory,
-            final YangParserFactory factory) {
+    static @NonNull YangModuleInfoRegistry create(final BundleContext ctx,
+            final ComponentFactory<OSGiModuleInfoSnapshotImpl> contextFactory, final YangParserFactory factory) {
         return KarafFeaturesSupport.wrap(ctx, new RegularYangModuleInfoRegistry(contextFactory, factory));
     }