X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-restconf-broker%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Frestconf%2Fbroker%2Fimpl%2FNotificationServiceImpl.java;fp=opendaylight%2Fmd-sal%2Fsal-restconf-broker%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Frestconf%2Fbroker%2Fimpl%2FNotificationServiceImpl.java;h=0000000000000000000000000000000000000000;hp=192836e9fae825373096ae1f8327d93c2ccdd187;hb=89b8b59cd26fd4810293ff14386eb29a71da9fac;hpb=9ba2b4eca79bcc0e78099b133296801c8d45a6c4 diff --git a/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/impl/NotificationServiceImpl.java b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/impl/NotificationServiceImpl.java deleted file mode 100644 index 192836e9fa..0000000000 --- a/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/impl/NotificationServiceImpl.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2013 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.controller.sal.restconf.broker.impl; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.opendaylight.controller.sal.binding.api.NotificationListener; -import org.opendaylight.controller.sal.binding.api.NotificationService; -import org.opendaylight.controller.sal.restconf.broker.listeners.RemoteNotificationListener; -import org.opendaylight.controller.sal.restconf.broker.tools.RemoteStreamTools; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.remote.rev140114.QName; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.remote.rev140114.SalRemoteService; -import org.opendaylight.yangtools.concepts.AbstractListenerRegistration; -import org.opendaylight.yangtools.concepts.ListenerRegistration; -import org.opendaylight.yangtools.restconf.client.api.RestconfClientContext; -import org.opendaylight.yangtools.restconf.client.api.event.EventStreamInfo; -import org.opendaylight.yangtools.yang.binding.Notification; - -public class NotificationServiceImpl implements NotificationService { - private final SalRemoteService salRemoteService; - private final RestconfClientContext restconfClientContext; - - public NotificationServiceImpl(RestconfClientContext restconfClienetContext){ - this.restconfClientContext = restconfClienetContext; - this.salRemoteService = this.restconfClientContext.getRpcServiceContext(SalRemoteService.class).getRpcService(); - } - - @Override - public ListenerRegistration> registerNotificationListener(Class notificationType, NotificationListener listener) { - //TODO implementation using sal-remote - List notifications = new ArrayList(); - notifications.add(new QName(notificationType.toString())); - String notificationStreamName = RemoteStreamTools.createNotificationStream(salRemoteService, notifications); - final Map desiredEventStream = RemoteStreamTools.createEventStream(restconfClientContext, notificationStreamName); - RemoteNotificationListener remoteNotificationListener = new RemoteNotificationListener(listener); - - final ListenerRegistration listenerRegistration = restconfClientContext.getEventStreamContext(desiredEventStream.get(desiredEventStream.get(notificationStreamName))) - .registerNotificationListener(remoteNotificationListener); - - return new AbstractListenerRegistration>(listener) { - @Override - protected void removeRegistration() { - listenerRegistration.close(); - } - }; - } - - @Override - public ListenerRegistration registerNotificationListener(org.opendaylight.yangtools.yang.binding.NotificationListener listener) { - //TODO implementation using sal-remote - String notificationStreamName = RemoteStreamTools.createNotificationStream(salRemoteService, null); - final Map desiredEventStream = RemoteStreamTools.createEventStream(restconfClientContext, notificationStreamName); - return restconfClientContext.getEventStreamContext(desiredEventStream.get(desiredEventStream.get(notificationStreamName))).registerNotificationListener(listener); - } -}