BUG-272: remove trailing whitespace from Java files
[controller.git] / opendaylight / md-sal / sal-rest-connector / src / main / java / org / opendaylight / controller / sal / streams / listeners / Notificator.java
index 36c9c67ffcd3281db279c858176291f4da571ef7..75e22ed88e63fd4043db211eb3d64d27cda82fb7 100644 (file)
@@ -1,6 +1,14 @@
+/*
+ * Copyright (c) 2014 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.streams.listeners;
 
 import java.util.Map;
+import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReentrantLock;
@@ -12,16 +20,24 @@ import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
  */
 public class Notificator {
 
-       private static Map<String, ListenerAdapter> listenersByStreamName = new ConcurrentHashMap<>();
+    private static Map<String, ListenerAdapter> listenersByStreamName = new ConcurrentHashMap<>();
        private static Map<InstanceIdentifier, ListenerAdapter> listenersByInstanceIdentifier = new ConcurrentHashMap<>();
        private static final Lock lock = new ReentrantLock();
 
        private Notificator() {
        }
 
+    /**
+     * Returns list of all stream names
+     */
+    public static Set<String> getStreamNames() {
+        return listenersByStreamName.keySet();
+    }
+
+
        /**
         * Gets {@link ListenerAdapter} specified by stream name.
-        * 
+        *
         * @param streamName
         *            The name of the stream.
         * @return {@link ListenerAdapter} specified by stream name.
@@ -33,7 +49,7 @@ public class Notificator {
        /**
         * Gets {@link ListenerAdapter} listener specified by
         * {@link InstanceIdentifier} path.
-        * 
+        *
         * @param path
         *            Path to data in data repository.
         * @return ListenerAdapter
@@ -45,7 +61,7 @@ public class Notificator {
        /**
         * Checks if the listener specified by {@link InstanceIdentifier} path
         * exist.
-        * 
+        *
         * @param path
         *            Path to data in data repository.
         * @return True if the listener exist, false otherwise.
@@ -57,7 +73,7 @@ public class Notificator {
        /**
         * Creates new {@link ListenerAdapter} listener from
         * {@link InstanceIdentifier} path and stream name.
-        * 
+        *
         * @param path
         *            Path to data in data repository.
         * @param streamName
@@ -81,7 +97,7 @@ public class Notificator {
        /**
         * Looks for listener determined by {@link InstanceIdentifier} path and
         * removes it.
-        * 
+        *
         * @param path
         *            InstanceIdentifier
         */
@@ -93,7 +109,7 @@ public class Notificator {
        /**
         * Creates String representation of stream name from URI. Removes slash from
         * URI in start and end position.
-        * 
+        *
         * @param uri
         *            URI for creation stream name.
         * @return String representation of stream name.
@@ -132,9 +148,9 @@ public class Notificator {
        }
 
        /**
-        * Checks if listener has at least one subscriber. In case it has any, delete
+        * Checks if listener has at least one subscriber. In case it doesn't have any, delete
         * listener.
-        * 
+        *
         * @param listener
         *            ListenerAdapter
         */
@@ -147,7 +163,7 @@ public class Notificator {
 
        /**
         * Delete {@link ListenerAdapter} listener specified in parameter.
-        * 
+        *
         * @param listener
         *            ListenerAdapter
         */
@@ -167,4 +183,4 @@ public class Notificator {
                }
        }
 
-}
\ No newline at end of file
+}