Madan Jampani

Added missing javadocs. Created a separate class for message subjects used by di…

…stribued device store
...@@ -37,7 +37,6 @@ import org.onlab.onos.store.Timestamp; ...@@ -37,7 +37,6 @@ import org.onlab.onos.store.Timestamp;
37 import org.onlab.onos.store.cluster.messaging.ClusterCommunicationService; 37 import org.onlab.onos.store.cluster.messaging.ClusterCommunicationService;
38 import org.onlab.onos.store.cluster.messaging.ClusterMessage; 38 import org.onlab.onos.store.cluster.messaging.ClusterMessage;
39 import org.onlab.onos.store.cluster.messaging.ClusterMessageHandler; 39 import org.onlab.onos.store.cluster.messaging.ClusterMessageHandler;
40 -import org.onlab.onos.store.cluster.messaging.MessageSubject;
41 import org.onlab.onos.store.common.impl.Timestamped; 40 import org.onlab.onos.store.common.impl.Timestamped;
42 import org.onlab.util.NewConcurrentHashMap; 41 import org.onlab.util.NewConcurrentHashMap;
43 import org.slf4j.Logger; 42 import org.slf4j.Logger;
...@@ -107,6 +106,12 @@ public class GossipDeviceStore ...@@ -107,6 +106,12 @@ public class GossipDeviceStore
107 106
108 @Activate 107 @Activate
109 public void activate() { 108 public void activate() {
109 + clusterCommunicator.addSubscriber(
110 + GossipDeviceStoreMessageSubjects.DEVICE_UPDATE, new InternalDeviceEventListener());
111 + clusterCommunicator.addSubscriber(
112 + GossipDeviceStoreMessageSubjects.PORT_UPDATE, new InternalPortEventListener());
113 + clusterCommunicator.addSubscriber(
114 + GossipDeviceStoreMessageSubjects.PORT_STATUS_UPDATE, new InternalPortStatusEventListener());
110 log.info("Started"); 115 log.info("Started");
111 } 116 }
112 117
...@@ -774,17 +779,17 @@ public class GossipDeviceStore ...@@ -774,17 +779,17 @@ public class GossipDeviceStore
774 } 779 }
775 780
776 private void notifyPeers(InternalDeviceEvent event) throws IOException { 781 private void notifyPeers(InternalDeviceEvent event) throws IOException {
777 - ClusterMessage message = new ClusterMessage(null, new MessageSubject("peer-device-updates"), event); 782 + ClusterMessage message = new ClusterMessage(null, GossipDeviceStoreMessageSubjects.DEVICE_UPDATE, event);
778 clusterCommunicator.broadcast(message); 783 clusterCommunicator.broadcast(message);
779 } 784 }
780 785
781 private void notifyPeers(InternalPortEvent event) throws IOException { 786 private void notifyPeers(InternalPortEvent event) throws IOException {
782 - ClusterMessage message = new ClusterMessage(null, new MessageSubject("peer-port-updates"), event); 787 + ClusterMessage message = new ClusterMessage(null, GossipDeviceStoreMessageSubjects.PORT_UPDATE, event);
783 clusterCommunicator.broadcast(message); 788 clusterCommunicator.broadcast(message);
784 } 789 }
785 790
786 private void notifyPeers(InternalPortStatusEvent event) throws IOException { 791 private void notifyPeers(InternalPortStatusEvent event) throws IOException {
787 - ClusterMessage message = new ClusterMessage(null, new MessageSubject("peer-port-status-updates"), event); 792 + ClusterMessage message = new ClusterMessage(null, GossipDeviceStoreMessageSubjects.PORT_STATUS_UPDATE, event);
788 clusterCommunicator.broadcast(message); 793 clusterCommunicator.broadcast(message);
789 } 794 }
790 795
......
1 +package org.onlab.onos.store.device.impl;
2 +
3 +import org.onlab.onos.store.cluster.messaging.MessageSubject;
4 +
5 +/**
6 + * MessageSubjects used by GossipDeviceStore.
7 + */
8 +public final class GossipDeviceStoreMessageSubjects {
9 +
10 + private GossipDeviceStoreMessageSubjects() {}
11 +
12 + public static final MessageSubject DEVICE_UPDATE = new MessageSubject("peer-device-update");
13 + public static final MessageSubject PORT_UPDATE = new MessageSubject("peer-port-update");
14 + public static final MessageSubject PORT_STATUS_UPDATE = new MessageSubject("peer-port-status-update");
15 +}
...@@ -5,6 +5,10 @@ import org.onlab.onos.net.device.DeviceDescription; ...@@ -5,6 +5,10 @@ import org.onlab.onos.net.device.DeviceDescription;
5 import org.onlab.onos.net.provider.ProviderId; 5 import org.onlab.onos.net.provider.ProviderId;
6 import org.onlab.onos.store.common.impl.Timestamped; 6 import org.onlab.onos.store.common.impl.Timestamped;
7 7
8 +/**
9 + * Information published by GossipDeviceStore to notify peers of a device
10 + * change event.
11 + */
8 public class InternalDeviceEvent { 12 public class InternalDeviceEvent {
9 13
10 private final ProviderId providerId; 14 private final ProviderId providerId;
......
...@@ -7,6 +7,10 @@ import org.onlab.onos.net.device.PortDescription; ...@@ -7,6 +7,10 @@ import org.onlab.onos.net.device.PortDescription;
7 import org.onlab.onos.net.provider.ProviderId; 7 import org.onlab.onos.net.provider.ProviderId;
8 import org.onlab.onos.store.common.impl.Timestamped; 8 import org.onlab.onos.store.common.impl.Timestamped;
9 9
10 +/**
11 + * Information published by GossipDeviceStore to notify peers of a port
12 + * change event.
13 + */
10 public class InternalPortEvent { 14 public class InternalPortEvent {
11 15
12 private final ProviderId providerId; 16 private final ProviderId providerId;
......
...@@ -5,6 +5,10 @@ import org.onlab.onos.net.device.PortDescription; ...@@ -5,6 +5,10 @@ import org.onlab.onos.net.device.PortDescription;
5 import org.onlab.onos.net.provider.ProviderId; 5 import org.onlab.onos.net.provider.ProviderId;
6 import org.onlab.onos.store.common.impl.Timestamped; 6 import org.onlab.onos.store.common.impl.Timestamped;
7 7
8 +/**
9 + * Information published by GossipDeviceStore to notify peers of a port
10 + * status change event.
11 + */
8 public class InternalPortStatusEvent { 12 public class InternalPortStatusEvent {
9 13
10 private final ProviderId providerId; 14 private final ProviderId providerId;
......