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;
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")
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
private void updateService() {
final ModuleInfoSnapshot newSnapshot;
try {
- newSnapshot = moduleInfoRegistry.build();
+ newSnapshot = moduleInfoRegistry.takeSnapshot();
} catch (NoSuchElementException e) {
LOG.debug("No snapshot available", e);
return;
}
- final ComponentInstance newInstance = contextFactory.newInstance(
+ final ComponentInstance<OSGiModuleInfoSnapshotImpl> newInstance = contextFactory.newInstance(
OSGiModuleInfoSnapshotImpl.props(nextGeneration(), newSnapshot));
if (currentInstance != null) {
currentInstance.dispose();