2 * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.restconf.nb.rfc8040.streams.listeners;
10 import io.netty.channel.Channel;
12 import org.opendaylight.yangtools.concepts.ListenerRegistration;
15 * Base interface for both listeners({@link ListenerAdapter}, {@link NotificationListenerAdapter}).
17 public interface BaseListenerInterface extends AutoCloseable {
20 * Return all subscribers of listener.
22 * @return Set of all subscribers.
24 Set<Channel> getSubscribers();
27 * Checks if exists at least one {@link Channel} subscriber.
29 * @return {@code true} if exist at least one {@link Channel} subscriber, {@code false} otherwise.
31 boolean hasSubscribers();
36 * @return Stream name.
38 String getStreamName();
43 * @return Output type (JSON or XML).
45 String getOutputType();
48 * Registers {@link Channel} subscriber.
50 * @param subscriber Web-socket channel.
52 void addSubscriber(Channel subscriber);
55 * Removes {@link Channel} subscriber.
57 * @param subscriber Subscriber channel.
59 void removeSubscriber(Channel subscriber);
62 * Sets {@link ListenerRegistration} registration.
64 * @param registration DOMDataChangeListener registration.
66 void setRegistration(ListenerRegistration<?> registration);
69 * Checks if {@link ListenerRegistration} registration exists.
71 * @return {@code true} if exists, {@code false} otherwise.
73 boolean isListening();