final EffectiveModelContext schemaContext = handlersHolder.getSchemaHandler().get();
final URI uri = prepareUriByStreamName(uriInfo, streamName);
+ notificationListenerAdapter.setQueryParams(notificationQueryParams);
notificationListenerAdapter.listen(handlersHolder.getNotificationServiceHandler());
- notificationListenerAdapter.setQueryParams(
- notificationQueryParams.startTime(),
- notificationQueryParams.stopTime(),
- notificationQueryParams.filter(),
- notificationQueryParams.leafNodesOnly(),
- notificationQueryParams.skipNotificationData());
final DOMDataBroker dataBroker = handlersHolder.getDataBroker();
notificationListenerAdapter.setCloseVars(dataBroker, handlersHolder.getSchemaHandler());
final MapEntryNode mapToStreams = RestconfMappingNodeUtil.mapYangNotificationStreamByIetfRestconfMonitoring(
final ListenerAdapter listener = ListenersBroker.getInstance().getDataChangeListenerFor(streamName)
.orElseThrow(() -> new RestconfDocumentedException("No listener found for stream " + streamName,
ErrorType.APPLICATION, ErrorTag.DATA_MISSING));
-
- listener.setQueryParams(
- notificationQueryParams.startTime(),
- notificationQueryParams.stopTime(),
- notificationQueryParams.filter(),
- notificationQueryParams.leafNodesOnly(),
- notificationQueryParams.skipNotificationData());
+ listener.setQueryParams(notificationQueryParams);
final DOMDataBroker dataBroker = handlersHolder.getDataBroker();
final SchemaContextHandler schemaHandler = handlersHolder.getSchemaHandler();
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
-import org.opendaylight.restconf.nb.rfc8040.FilterParam;
-import org.opendaylight.restconf.nb.rfc8040.LeafNodesOnlyParam;
-import org.opendaylight.restconf.nb.rfc8040.SkipNotificationDataParam;
-import org.opendaylight.restconf.nb.rfc8040.StartTimeParam;
-import org.opendaylight.restconf.nb.rfc8040.StopTimeParam;
+import org.opendaylight.restconf.nb.rfc8040.NotificationQueryParams;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime;
/**
/**
* Set query parameters for listener.
*
- * @param startTime Start-time of getting notification.
- * @param stopTime Stop-time of getting notification.
- * @param filter Indicates which subset of all possible events are of interest.
- * @param leafNodesOnly If TRUE, notifications will contain changes of leaf nodes only.
+ * @param params NotificationQueryParams to use.
*/
- @SuppressWarnings("checkstyle:hiddenField")
- public final void setQueryParams(final StartTimeParam startTime, final StopTimeParam stopTime,
- final FilterParam filter, final LeafNodesOnlyParam leafNodesOnly,
- final SkipNotificationDataParam skipNotificationData) {
+ public final void setQueryParams(final NotificationQueryParams params) {
+ final var startTime = params.startTime();
start = startTime == null ? Instant.now() : parseDateAndTime(startTime.value());
+
+ final var stopTime = params.stopTime();
stop = stopTime == null ? null : parseDateAndTime(stopTime.value());
- this.leafNodesOnly = leafNodesOnly == null ? false : leafNodesOnly.value();
- this.skipNotificationData = skipNotificationData == null ? false : skipNotificationData.value();
+ final var leafNodes = params.leafNodesOnly();
+ leafNodesOnly = leafNodes == null ? false : leafNodes.value();
+
+ final var skipData = params.skipNotificationData();
+ skipNotificationData = skipData == null ? false : skipData.value();
+
+ final var filter = params.filter();
if (filter != null) {
try {
setFilter(filter.paramValue());
import org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier;
import org.opendaylight.mdsal.dom.api.DOMSchemaService;
import org.opendaylight.restconf.nb.rfc8040.LeafNodesOnlyParam;
+import org.opendaylight.restconf.nb.rfc8040.NotificationQueryParams;
import org.opendaylight.restconf.nb.rfc8040.SkipNotificationDataParam;
import org.opendaylight.restconf.nb.rfc8040.StartTimeParam;
import org.opendaylight.restconf.nb.rfc8040.handlers.SchemaContextHandler;
import org.opendaylight.yang.gen.v1.instance.identifier.patch.module.rev151121.patch.cont.MyList1;
import org.opendaylight.yang.gen.v1.instance.identifier.patch.module.rev151121.patch.cont.MyList1Builder;
import org.opendaylight.yang.gen.v1.instance.identifier.patch.module.rev151121.patch.cont.MyList1Key;
-import org.opendaylight.yang.gen.v1.urn.sal.restconf.event.subscription.rev140708.NotificationOutputTypeGrouping;
+import org.opendaylight.yang.gen.v1.urn.sal.restconf.event.subscription.rev140708.NotificationOutputTypeGrouping.NotificationOutputType;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
private CountDownLatch notificationLatch = new CountDownLatch(1);
ListenerAdapterTester(final YangInstanceIdentifier path, final String streamName,
- final NotificationOutputTypeGrouping.NotificationOutputType outputType,
+ final NotificationOutputType outputType,
final boolean leafNodesOnly, final boolean skipNotificationData) {
super(path, streamName, outputType);
- setQueryParams(StartTimeParam.forUriValue("1970-01-01T00:00:00Z"), null, null,
- LeafNodesOnlyParam.of(leafNodesOnly), SkipNotificationDataParam.of(skipNotificationData));
+ setQueryParams(NotificationQueryParams.of(StartTimeParam.forUriValue("1970-01-01T00:00:00Z"), null, null,
+ LeafNodesOnlyParam.of(leafNodesOnly), SkipNotificationDataParam.of(skipNotificationData)));
}
@Override
@Test
public void testJsonNotifsLeaves() throws Exception {
- ListenerAdapterTester adapter = new ListenerAdapterTester(PATCH_CONT_YIID, "Casey",
- NotificationOutputTypeGrouping.NotificationOutputType.JSON, true, false);
+ ListenerAdapterTester adapter = new ListenerAdapterTester(PATCH_CONT_YIID, "Casey", NotificationOutputType.JSON,
+ true, false);
adapter.setCloseVars(domDataBroker, schemaContextHandler);
final DOMDataTreeChangeService changeService = domDataBroker.getExtensions()
@Test
public void testJsonNotifs() throws Exception {
- ListenerAdapterTester adapter = new ListenerAdapterTester(PATCH_CONT_YIID, "Casey",
- NotificationOutputTypeGrouping.NotificationOutputType.JSON, false, false);
+ ListenerAdapterTester adapter = new ListenerAdapterTester(PATCH_CONT_YIID, "Casey", NotificationOutputType.JSON,
+ false, false);
adapter.setCloseVars(domDataBroker, schemaContextHandler);
final DOMDataTreeChangeService changeService = domDataBroker.getExtensions()
@Test
public void testJsonNotifsWithoutData() throws Exception {
- ListenerAdapterTester adapter = new ListenerAdapterTester(PATCH_CONT_YIID, "Casey",
- NotificationOutputTypeGrouping.NotificationOutputType.JSON, false, true);
+ ListenerAdapterTester adapter = new ListenerAdapterTester(PATCH_CONT_YIID, "Casey", NotificationOutputType.JSON,
+ false, true);
adapter.setCloseVars(domDataBroker, schemaContextHandler);
DOMDataTreeChangeService changeService = domDataBroker.getExtensions()
@Test
public void testXmlNotifications() throws Exception {
- ListenerAdapterTester adapter = new ListenerAdapterTester(PATCH_CONT_YIID, "Casey",
- NotificationOutputTypeGrouping.NotificationOutputType.XML, false, false);
+ ListenerAdapterTester adapter = new ListenerAdapterTester(PATCH_CONT_YIID, "Casey", NotificationOutputType.XML,
+ false, false);
adapter.setCloseVars(domDataBroker, schemaContextHandler);
DOMDataTreeChangeService changeService = domDataBroker.getExtensions()
@Test
public void testXmlSkipData() throws Exception {
- ListenerAdapterTester adapter = new ListenerAdapterTester(PATCH_CONT_YIID, "Casey",
- NotificationOutputTypeGrouping.NotificationOutputType.XML, false, true);
+ ListenerAdapterTester adapter = new ListenerAdapterTester(PATCH_CONT_YIID, "Casey", NotificationOutputType.XML,
+ false, true);
adapter.setCloseVars(domDataBroker, schemaContextHandler);
DOMDataTreeChangeService changeService = domDataBroker.getExtensions()
@Test
public void testXmlLeavesOnly() throws Exception {
- ListenerAdapterTester adapter = new ListenerAdapterTester(PATCH_CONT_YIID, "Casey",
- NotificationOutputTypeGrouping.NotificationOutputType.XML, true, false);
+ ListenerAdapterTester adapter = new ListenerAdapterTester(PATCH_CONT_YIID, "Casey", NotificationOutputType.XML,
+ true, false);
adapter.setCloseVars(domDataBroker, schemaContextHandler);
DOMDataTreeChangeService changeService = domDataBroker.getExtensions()