Add javadoc for messagebus-netconf 04/35204/2
authorAndrej Mak <andmak@cisco.com>
Mon, 22 Feb 2016 14:51:03 +0000 (15:51 +0100)
committerAndrej Mak <andmak@cisco.com>
Tue, 23 Feb 2016 06:33:33 +0000 (07:33 +0100)
Change-Id: I02d2e432f10ae52886ba186da5e5f3bd0aef5438
Signed-off-by: Andrej Mak <andmak@cisco.com>
netconf/messagebus-netconf/src/main/java/org/opendaylight/netconf/messagebus/eventsources/netconf/ConnectionNotificationTopicRegistration.java
netconf/messagebus-netconf/src/main/java/org/opendaylight/netconf/messagebus/eventsources/netconf/NetconfEventSource.java
netconf/messagebus-netconf/src/main/java/org/opendaylight/netconf/messagebus/eventsources/netconf/NetconfEventSourceManager.java
netconf/messagebus-netconf/src/main/java/org/opendaylight/netconf/messagebus/eventsources/netconf/NotificationTopicRegistration.java
netconf/messagebus-netconf/src/main/java/org/opendaylight/netconf/messagebus/eventsources/netconf/StreamNotificationTopicRegistration.java

index fd7d784669d9ee83dc7a484b827f889a056755d7..598a260459a96a2d7f69581eb8da9526f9eec176 100644 (file)
@@ -33,6 +33,9 @@ import org.slf4j.LoggerFactory;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
+/**
+ * Topic registration on event-source-status-notification.
+ */
 public class ConnectionNotificationTopicRegistration extends NotificationTopicRegistration {
 
     private static final Logger LOG = LoggerFactory.getLogger(ConnectionNotificationTopicRegistration.class);
index 138881944fc09a219ad4c9d83fcbd70ff1618ddf..a085088571229ec8700a74f14f397bb891bd7878 100644 (file)
@@ -73,6 +73,10 @@ import org.slf4j.LoggerFactory;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
+/**
+ * NetconfEventSource serves as proxy between nodes and messagebus. Subscribers can join topic stream from this source.
+ * Then they will receive notifications that matches pattern specified by topic.
+ */
 public class NetconfEventSource implements EventSource, DOMNotificationListener {
 
     private static final Logger LOG = LoggerFactory.getLogger(NetconfEventSource.class);
@@ -96,6 +100,14 @@ public class NetconfEventSource implements EventSource, DOMNotificationListener
     private final Map<String, String> urnPrefixToStreamMap; // key = urnPrefix, value = StreamName
     private final List<NotificationTopicRegistration> notificationTopicRegistrationList = new ArrayList<>();
 
+    /**
+     * Creates new NetconfEventSource for node. Topic notifications will be published via provided {@link DOMNotificationPublishService}
+     * @param node node
+     * @param streamMap netconf streams from device
+     * @param netconfMount
+     * @param mountPoint
+     * @param publishService publish service
+     */
     public NetconfEventSource(final Node node, final Map<String, String> streamMap, final DOMMountPoint netconfMount,
         final MountPoint mountPoint, final DOMNotificationPublishService publishService) {
         this.netconfMount = Preconditions.checkNotNull(netconfMount);
@@ -283,6 +295,11 @@ public class NetconfEventSource implements EventSource, DOMNotificationListener
         }
     }
 
+    /**
+     * Returns all available notification paths that matches given pattern.
+     * @param notificationPattern pattern
+     * @return notification paths
+     */
     private List<SchemaPath> getMatchingNotifications(NotificationPattern notificationPattern) {
         final String regex = notificationPattern.getValue();
 
index ae3ef9ea4d0db6eb4520ddbbfe61303433e5edc8..e8a02e112d9193657c2ac3ce382c5bbe917d0583 100644 (file)
@@ -36,6 +36,10 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+/**
+ * NetconfEventSourceManager implements DataChangeListener. On topology changes, it manages creation,
+ * updating and removing registrations of event sources.
+ */
 public final class NetconfEventSourceManager implements DataChangeListener, AutoCloseable {
 
     private static final Logger LOG = LoggerFactory.getLogger(NetconfEventSourceManager.class);
index cdee94b82e96037c0a507d1eb33a8c9c1a8f9983..07e2d3b564a56aa88776a800153b916c5b48b283 100644 (file)
@@ -13,6 +13,9 @@ import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+/**
+ * Notification topic registration.
+ */
 public abstract class NotificationTopicRegistration implements AutoCloseable {
 
     private static final Logger LOG = LoggerFactory.getLogger(NotificationTopicRegistration.class);
@@ -57,6 +60,11 @@ public abstract class NotificationTopicRegistration implements AutoCloseable {
         return notificationUrnPrefix;
     }
 
+    /**
+     * Checks, if notification is from namespace belonging to this registration.
+     * @param notificationPath path
+     * @return true, if notification belongs to registration namespace
+     */
     public boolean checkNotificationPath(SchemaPath notificationPath) {
         if (notificationPath == null) {
             return false;
@@ -73,10 +81,26 @@ public abstract class NotificationTopicRegistration implements AutoCloseable {
 
     abstract void reActivateNotificationSource();
 
+    /**
+     * Registers associated event source notification to topic.
+     * @param notificationPath notification path
+     * @param topicId topic id
+     * @return true, if successful
+     */
     abstract boolean registerNotificationTopic(SchemaPath notificationPath, TopicId topicId);
 
+    /**
+     * Registers associated event source notification to topic.
+     * @param topicId topic id
+     * @return true, if successful
+     */
     abstract void unRegisterNotificationTopic(TopicId topicId);
 
+    /**
+     * Returns registered topics for given path.
+     * @param notificationPath path
+     * @return topicIds
+     */
     abstract ArrayList<TopicId> getNotificationTopicIds(SchemaPath notificationPath);
 
     public boolean isReplaySupported() {
index 7031d7bee5f804f0e3013cace1565cbbede2ea73..b01a57e704535cd574ceb520ffb523d69d56a098 100644 (file)
@@ -32,6 +32,9 @@ import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+/**
+ * Topic registration for notification stream.
+ */
 public class StreamNotificationTopicRegistration extends NotificationTopicRegistration {
 
     private static final Logger LOG = LoggerFactory.getLogger(StreamNotificationTopicRegistration.class);
@@ -53,6 +56,12 @@ public class StreamNotificationTopicRegistration extends NotificationTopicRegist
     private ConcurrentHashMap<SchemaPath, ListenerRegistration<NetconfEventSource>> notificationRegistrationMap = new ConcurrentHashMap<>();
     private ConcurrentHashMap<SchemaPath, ArrayList<TopicId>> notificationTopicMap = new ConcurrentHashMap<>();
 
+    /**
+     * Creates registration to notification stream.
+     * @param stream stream
+     * @param notificationPrefix notifications namespace
+     * @param netconfEventSource event source
+     */
     public StreamNotificationTopicRegistration(final Stream stream, final String notificationPrefix,
         NetconfEventSource netconfEventSource) {
         super(NotificationSourceType.NetconfDeviceStream, stream.getName().getValue(), notificationPrefix);
@@ -66,6 +75,9 @@ public class StreamNotificationTopicRegistration extends NotificationTopicRegist
         LOG.info("StreamNotificationTopicRegistration initialized for {}", getStreamName());
     }
 
+    /**
+     * Subscribes to notification stream associated with this registration.
+     */
     void activateNotificationSource() {
         if (isActive() == false) {
             LOG.info("Stream {} is not active on node {}. Will subscribe.", this.getStreamName(), this.nodeId);
@@ -87,6 +99,10 @@ public class StreamNotificationTopicRegistration extends NotificationTopicRegist
         }
     }
 
+    /**
+     * Subscribes to notification stream associated with this registration. If replay is supported, notifications from last
+     * received event time will be requested.
+     */
     void reActivateNotificationSource() {
         if (isActive()) {
             LOG.info("Stream {} is reactivating on node {}.", this.getStreamName(), this.nodeId);