Fix raw Component{Factory,Instance} references
[mdsal.git] / dom / mdsal-dom-schema-osgi / src / main / java / org / opendaylight / mdsal / dom / schema / osgi / impl / RegularYangModuleInfoRegistry.java
index 09d922d4a9966f4ffcd90ec6dc260f17791c00d5..7f0e2835be255e0d7dedbca2e676a5a9ef099428 100644 (file)
@@ -13,11 +13,11 @@ import java.util.List;
 import java.util.NoSuchElementException;
 import org.checkerframework.checker.lock.qual.GuardedBy;
 import org.checkerframework.checker.lock.qual.Holding;
-import org.opendaylight.binding.runtime.api.ModuleInfoSnapshot;
-import org.opendaylight.binding.runtime.spi.ModuleInfoSnapshotBuilder;
+import org.opendaylight.mdsal.binding.runtime.api.ModuleInfoSnapshot;
+import org.opendaylight.mdsal.binding.runtime.spi.ModuleInfoSnapshotResolver;
 import org.opendaylight.yangtools.concepts.ObjectRegistration;
 import org.opendaylight.yangtools.yang.binding.YangModuleInfo;
-import org.opendaylight.yangtools.yang.model.parser.api.YangParserFactory;
+import org.opendaylight.yangtools.yang.parser.api.YangParserFactory;
 import org.osgi.service.component.ComponentFactory;
 import org.osgi.service.component.ComponentInstance;
 import org.slf4j.Logger;
@@ -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 ModuleInfoSnapshotBuilder moduleInfoRegistry;
+    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,9 +41,10 @@ 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 ModuleInfoSnapshotBuilder("binding-dom-codec", factory);
+        moduleInfoRegistry = new ModuleInfoSnapshotResolver("binding-dom-codec", factory);
     }
 
     // Invocation from scanner, we may want to ignore this in order to not process partial updates
@@ -85,7 +86,7 @@ final class RegularYangModuleInfoRegistry extends YangModuleInfoRegistry {
     private void updateService() {
         final ModuleInfoSnapshot newSnapshot;
         try {
-            newSnapshot = moduleInfoRegistry.build();
+            newSnapshot = moduleInfoRegistry.takeSnapshot();
         } catch (NoSuchElementException e) {
             LOG.debug("No snapshot available", e);
             return;
@@ -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();