import javax.inject.Singleton;
import org.apache.aries.blueprint.annotation.service.Reference;
import org.opendaylight.mdsal.dom.api.DOMActionService;
+import org.opendaylight.mdsal.dom.api.DOMNotificationService;
import org.opendaylight.mdsal.dom.api.DOMRpcService;
import org.opendaylight.mdsal.dom.api.DOMSchemaService;
import org.opendaylight.restconf.nb.rfc8040.handlers.DOMDataBrokerHandler;
import org.opendaylight.restconf.nb.rfc8040.handlers.DOMMountPointServiceHandler;
-import org.opendaylight.restconf.nb.rfc8040.handlers.NotificationServiceHandler;
import org.opendaylight.restconf.nb.rfc8040.handlers.SchemaContextHandler;
import org.opendaylight.restconf.nb.rfc8040.handlers.TransactionChainHandler;
import org.opendaylight.restconf.nb.rfc8040.services.wrapper.ServicesNotifWrapper;
final TransactionChainHandler transactionChainHandler,
final DOMDataBrokerHandler domDataBrokerHandler, @Reference final DOMRpcService rpcService,
@Reference final DOMActionService actionService,
- final NotificationServiceHandler notificationServiceHandler,
+ @Reference final DOMNotificationService notificationService,
final SSEInitializer sseInit,
final Configuration configuration,
@Reference final DOMSchemaService domSchemaService) {
servicesWrapper = ServicesWrapper.newInstance(schemaCtxHandler, domMountPointServiceHandler,
- transactionChainHandler, domDataBrokerHandler, rpcService, actionService,
- notificationServiceHandler, domSchemaService, configuration);
+ transactionChainHandler, domDataBrokerHandler, rpcService, actionService, notificationService,
+ domSchemaService, configuration);
servicesNotifWrapper = ServicesNotifWrapper.newInstance(sseInit);
}
+++ /dev/null
-/*
- * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.restconf.nb.rfc8040.handlers;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-import org.apache.aries.blueprint.annotation.service.Reference;
-import org.opendaylight.mdsal.dom.api.DOMNotificationService;
-
-// FIXME: remove this class
-@Singleton
-public class NotificationServiceHandler {
- private final DOMNotificationService notificationService;
-
- /**
- * Set DOMNotificationService.
- *
- * @param notificationService
- * DOMNotificationService
- */
- @Inject
- public NotificationServiceHandler(final @Reference DOMNotificationService notificationService) {
- this.notificationService = notificationService;
- }
-
- public DOMNotificationService get() {
- return this.notificationService;
- }
-}
import org.opendaylight.restconf.common.context.NormalizedNodeContext;
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
import org.opendaylight.restconf.nb.rfc8040.handlers.DOMDataBrokerHandler;
-import org.opendaylight.restconf.nb.rfc8040.handlers.NotificationServiceHandler;
import org.opendaylight.restconf.nb.rfc8040.handlers.SchemaContextHandler;
import org.opendaylight.restconf.nb.rfc8040.handlers.TransactionChainHandler;
import org.opendaylight.restconf.nb.rfc8040.rests.services.api.RestconfStreamsSubscriptionService;
*
* @param domDataBrokerHandler
* handler of {@link DOMDataBroker}
- * @param notificationServiceHandler
+ * @param notificationService
* handler of {@link DOMNotificationService}
* @param schemaHandler
* handler of {@link SchemaContext}
* configuration for restconf {@link Configuration}}
*/
public RestconfStreamsSubscriptionServiceImpl(final DOMDataBrokerHandler domDataBrokerHandler,
- final NotificationServiceHandler notificationServiceHandler, final SchemaContextHandler schemaHandler,
+ final DOMNotificationService notificationService, final SchemaContextHandler schemaHandler,
final TransactionChainHandler transactionChainHandler, final Configuration configuration) {
- this.handlersHolder = new HandlersHolder(domDataBrokerHandler, notificationServiceHandler,
+ this.handlersHolder = new HandlersHolder(domDataBrokerHandler, notificationService,
transactionChainHandler, schemaHandler);
streamUtils = configuration.isUseSSE() ? SubscribeToStreamUtil.serverSentEvents()
: SubscribeToStreamUtil.webSockets();
/**
* Holder of all handlers for notifications.
*/
+ // FIXME: why do we even need this class?!
public static final class HandlersHolder {
-
private final DOMDataBrokerHandler domDataBrokerHandler;
- private final NotificationServiceHandler notificationServiceHandler;
+ private final DOMNotificationService notificationService;
private final TransactionChainHandler transactionChainHandler;
private final SchemaContextHandler schemaHandler;
private HandlersHolder(final DOMDataBrokerHandler domDataBrokerHandler,
- final NotificationServiceHandler notificationServiceHandler,
+ final DOMNotificationService notificationService,
final TransactionChainHandler transactionChainHandler, final SchemaContextHandler schemaHandler) {
this.domDataBrokerHandler = domDataBrokerHandler;
- this.notificationServiceHandler = notificationServiceHandler;
+ this.notificationService = notificationService;
this.transactionChainHandler = transactionChainHandler;
this.schemaHandler = schemaHandler;
}
}
/**
- * Get {@link NotificationServiceHandler}.
+ * Get {@link DOMNotificationService}.
*
- * @return the notificationServiceHandler
+ * @return the notificationService
*/
- public NotificationServiceHandler getNotificationServiceHandler() {
- return this.notificationServiceHandler;
+ public DOMNotificationService getNotificationServiceHandler() {
+ return this.notificationService;
}
/**
import org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier;
import org.opendaylight.mdsal.dom.api.DOMDataTreeReadWriteTransaction;
import org.opendaylight.mdsal.dom.api.DOMNotificationListener;
+import org.opendaylight.mdsal.dom.api.DOMNotificationService;
import org.opendaylight.mdsal.dom.api.DOMTransactionChain;
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag;
import org.opendaylight.restconf.common.errors.RestconfError.ErrorType;
import org.opendaylight.restconf.common.util.DataChangeScope;
import org.opendaylight.restconf.nb.rfc8040.Rfc8040.MonitoringModule;
-import org.opendaylight.restconf.nb.rfc8040.handlers.NotificationServiceHandler;
import org.opendaylight.restconf.nb.rfc8040.rests.services.impl.RestconfStreamsSubscriptionServiceImpl.HandlersHolder;
import org.opendaylight.restconf.nb.rfc8040.rests.services.impl.RestconfStreamsSubscriptionServiceImpl.NotificationQueryParams;
import org.opendaylight.restconf.nb.rfc8040.rests.utils.ResolveEnumUtil;
listener.setRegistration(registration);
}
+ // FIXME: this method should be in NotificationListenerAdapter
private static void registerToListenNotification(final NotificationListenerAdapter listener,
- final NotificationServiceHandler notificationServiceHandler) {
+ final DOMNotificationService notificationService) {
if (listener.isListening()) {
return;
}
final Absolute path = listener.getSchemaPath();
final ListenerRegistration<DOMNotificationListener> registration =
- notificationServiceHandler.get().registerNotificationListener(listener, path);
+ notificationService.registerNotificationListener(listener, path);
listener.setRegistration(registration);
}
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
import org.opendaylight.mdsal.dom.api.DOMActionService;
+import org.opendaylight.mdsal.dom.api.DOMNotificationService;
import org.opendaylight.mdsal.dom.api.DOMRpcService;
import org.opendaylight.mdsal.dom.api.DOMSchemaService;
import org.opendaylight.mdsal.dom.api.DOMYangTextSourceProvider;
import org.opendaylight.restconf.common.schema.SchemaExportContext;
import org.opendaylight.restconf.nb.rfc8040.handlers.DOMDataBrokerHandler;
import org.opendaylight.restconf.nb.rfc8040.handlers.DOMMountPointServiceHandler;
-import org.opendaylight.restconf.nb.rfc8040.handlers.NotificationServiceHandler;
import org.opendaylight.restconf.nb.rfc8040.handlers.SchemaContextHandler;
import org.opendaylight.restconf.nb.rfc8040.handlers.TransactionChainHandler;
import org.opendaylight.restconf.nb.rfc8040.rests.services.api.RestconfDataService;
final DOMMountPointServiceHandler domMountPointServiceHandler,
final TransactionChainHandler transactionChainHandler, final DOMDataBrokerHandler domDataBrokerHandler,
final DOMRpcService rpcService, final DOMActionService actionService,
- final NotificationServiceHandler notificationServiceHandler, final DOMSchemaService domSchemaService,
+ final DOMNotificationService notificationService, final DOMSchemaService domSchemaService,
final Configuration configuration) {
RestconfOperationsService restconfOpsService = new RestconfOperationsServiceImpl(schemaCtxHandler,
domMountPointServiceHandler);
RestconfSchemaService restconfSchemaService = new RestconfSchemaServiceImpl(schemaCtxHandler,
domMountPointServiceHandler, yangTextSourceProvider);
RestconfStreamsSubscriptionService restconfSubscrService = new RestconfStreamsSubscriptionServiceImpl(
- domDataBrokerHandler, notificationServiceHandler, schemaCtxHandler, transactionChainHandler,
+ domDataBrokerHandler, notificationService, schemaCtxHandler, transactionChainHandler,
configuration);
RestconfDataService restconfDataService = new RestconfDataServiceImpl(schemaCtxHandler, transactionChainHandler,
domMountPointServiceHandler, restconfSubscrService, actionService, configuration);
import org.opendaylight.mdsal.dom.api.DOMDataTreeChangeService;
import org.opendaylight.mdsal.dom.api.DOMDataTreeReadWriteTransaction;
import org.opendaylight.mdsal.dom.api.DOMDataTreeWriteTransaction;
+import org.opendaylight.mdsal.dom.api.DOMNotificationService;
import org.opendaylight.mdsal.dom.api.DOMSchemaService;
import org.opendaylight.mdsal.dom.api.DOMTransactionChain;
import org.opendaylight.restconf.common.context.NormalizedNodeContext;
import org.opendaylight.restconf.common.util.SimpleUriInfo;
import org.opendaylight.restconf.nb.rfc8040.TestRestconfUtils;
import org.opendaylight.restconf.nb.rfc8040.handlers.DOMDataBrokerHandler;
-import org.opendaylight.restconf.nb.rfc8040.handlers.NotificationServiceHandler;
import org.opendaylight.restconf.nb.rfc8040.handlers.SchemaContextHandler;
import org.opendaylight.restconf.nb.rfc8040.handlers.TransactionChainHandler;
import org.opendaylight.restconf.nb.rfc8040.streams.Configuration;
@Mock
private UriInfo uriInfo;
@Mock
- private NotificationServiceHandler notificationServiceHandler;
+ private DOMNotificationService notificationService;
private Configuration configurationWs;
private Configuration configurationSse;
}
private static class LocalUriInfo extends SimpleUriInfo {
-
LocalUriInfo() {
super("/");
}
"data-change-event-subscription/toaster:toaster/toasterStatus/datastore=OPERATIONAL/scope=ONE",
NotificationOutputType.XML);
final RestconfStreamsSubscriptionServiceImpl streamsSubscriptionService =
- new RestconfStreamsSubscriptionServiceImpl(this.dataBrokerHandler, this.notificationServiceHandler,
+ new RestconfStreamsSubscriptionServiceImpl(this.dataBrokerHandler, this.notificationService,
this.schemaHandler, this.transactionHandler, configurationSse);
final NormalizedNodeContext response = streamsSubscriptionService
.subscribeToStream(
"data-change-event-subscription/toaster:toaster/toasterStatus/datastore=OPERATIONAL/scope=ONE",
NotificationOutputType.XML);
final RestconfStreamsSubscriptionServiceImpl streamsSubscriptionService =
- new RestconfStreamsSubscriptionServiceImpl(this.dataBrokerHandler, this.notificationServiceHandler,
+ new RestconfStreamsSubscriptionServiceImpl(this.dataBrokerHandler, this.notificationService,
this.schemaHandler, this.transactionHandler, configurationWs);
final NormalizedNodeContext response = streamsSubscriptionService
.subscribeToStream(
@Test(expected = RestconfDocumentedException.class)
public void testSubscribeToStreamMissingDatastoreInPath() {
- final UriBuilder uriBuilder = UriBuilder.fromUri(URI);
final RestconfStreamsSubscriptionServiceImpl streamsSubscriptionService =
- new RestconfStreamsSubscriptionServiceImpl(this.dataBrokerHandler, this.notificationServiceHandler,
+ new RestconfStreamsSubscriptionServiceImpl(this.dataBrokerHandler, this.notificationService,
this.schemaHandler, this.transactionHandler, configurationWs);
streamsSubscriptionService.subscribeToStream("toaster:toaster/toasterStatus/scope=ONE", this.uriInfo);
}
@Test(expected = RestconfDocumentedException.class)
public void testSubscribeToStreamMissingScopeInPath() {
- final UriBuilder uriBuilder = UriBuilder.fromUri(URI);
final RestconfStreamsSubscriptionServiceImpl streamsSubscriptionService =
- new RestconfStreamsSubscriptionServiceImpl(this.dataBrokerHandler, this.notificationServiceHandler,
+ new RestconfStreamsSubscriptionServiceImpl(this.dataBrokerHandler, this.notificationService,
this.schemaHandler, this.transactionHandler, configurationWs);
streamsSubscriptionService.subscribeToStream("toaster:toaster/toasterStatus/datastore=OPERATIONAL",
this.uriInfo);
}
-
}