Bump versions to 2.0.0-SNAPSHOT
[netconf.git] / netconf / messagebus-netconf / src / main / java / org / opendaylight / netconf / messagebus / eventsources / netconf / NetconfEventSourceMount.java
index f25fed1f88b6176c4cf283e700a884a2bee2e173..5f99d1e370e06fb078617b49275a1c11186646e3 100644 (file)
@@ -28,6 +28,7 @@ import org.opendaylight.mdsal.dom.api.DOMNotificationListener;
 import org.opendaylight.mdsal.dom.api.DOMNotificationService;
 import org.opendaylight.mdsal.dom.api.DOMRpcResult;
 import org.opendaylight.mdsal.dom.api.DOMRpcService;
+import org.opendaylight.mdsal.dom.api.DOMSchemaService;
 import org.opendaylight.mdsal.dom.api.DOMService;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.notification._1._0.rev080714.CreateSubscriptionInput;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.notification._1._0.rev080714.CreateSubscriptionInputBuilder;
@@ -41,35 +42,35 @@ import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 
 /**
  * Facade of mounted netconf device.
  */
+@Deprecated(forRemoval = true)
 class NetconfEventSourceMount {
     private static final YangInstanceIdentifier STREAMS_PATH = YangInstanceIdentifier.builder().node(Netconf.QNAME)
             .node(Streams.QNAME).build();
-    private static final SchemaPath CREATE_SUBSCRIPTION = SchemaPath
-            .create(true, QName.create(CreateSubscriptionInput.QNAME, "create-subscription"));
+    private static final QName CREATE_SUBSCRIPTION = QName.create(CreateSubscriptionInput.QNAME, "create-subscription");
 
-    private final DOMMountPoint mountPoint;
     private final DOMRpcService rpcService;
     private final DOMNotificationService notificationService;
     private final DOMDataBroker dataBroker;
     private final Node node;
     private final String nodeId;
     private final BindingNormalizedNodeSerializer serializer;
+    private final DOMSchemaService schemaService;
 
     NetconfEventSourceMount(final BindingNormalizedNodeSerializer serializer, final Node node,
             final DOMMountPoint mountPoint) {
         this.serializer = requireNonNull(serializer);
-        this.mountPoint = mountPoint;
         this.node = node;
         this.nodeId = node.getNodeId().getValue();
         this.rpcService = getService(mountPoint, DOMRpcService.class);
         this.notificationService = getService(mountPoint, DOMNotificationService.class);
         this.dataBroker = getService(mountPoint, DOMDataBroker.class);
+        this.schemaService = getService(mountPoint, DOMSchemaService.class);
     }
 
     private static <T extends DOMService> T getService(final DOMMountPoint mountPoint, final Class<T> service) {
@@ -99,7 +100,7 @@ class NetconfEventSourceMount {
             final Optional<Instant> lastEventTime) {
         final CreateSubscriptionInputBuilder inputBuilder = new CreateSubscriptionInputBuilder()
                 .setStream(stream.getName());
-        if (lastEventTime.isPresent() && stream.isReplaySupport()) {
+        if (lastEventTime.isPresent() && stream.getReplaySupport()) {
             final ZonedDateTime dateTime = lastEventTime.get().atZone(ZoneId.systemDefault());
             final String formattedDate = DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(dateTime);
             inputBuilder.setStartTime(new DateAndTime(formattedDate));
@@ -138,8 +139,8 @@ class NetconfEventSourceMount {
         return Collections.emptyList();
     }
 
-    SchemaContext getSchemaContext() {
-        return mountPoint.getSchemaContext();
+    EffectiveModelContext getSchemaContext() {
+        return schemaService.getGlobalContext();
     }
 
     /**
@@ -152,7 +153,7 @@ class NetconfEventSourceMount {
      */
     ListenerRegistration<DOMNotificationListener> registerNotificationListener(final DOMNotificationListener listener,
                                                                                final SchemaPath notificationPath) {
-        return notificationService.registerNotificationListener(listener, notificationPath);
+        return notificationService.registerNotificationListener(listener, notificationPath.asAbsolute());
     }
 
 }