GUI -- Rename UIMessageHandlerTwo => UIMessageHandler. Also, make bindHandlers() private.

Change-Id: Id36e220c1285b88b8b4db0e106ef063bd8b9bfd1
diff --git a/apps/test/intent-perf/src/main/java/org/onosproject/intentperf/IntentPerfUi.java b/apps/test/intent-perf/src/main/java/org/onosproject/intentperf/IntentPerfUi.java
index b3280c8..7118ee1 100644
--- a/apps/test/intent-perf/src/main/java/org/onosproject/intentperf/IntentPerfUi.java
+++ b/apps/test/intent-perf/src/main/java/org/onosproject/intentperf/IntentPerfUi.java
@@ -31,7 +31,7 @@
 import org.onosproject.ui.UiConnection;
 import org.onosproject.ui.UiExtension;
 import org.onosproject.ui.UiExtensionService;
-import org.onosproject.ui.UiMessageHandlerTwo;
+import org.onosproject.ui.UiMessageHandler;
 import org.onosproject.ui.UiView;
 
 import java.util.Collection;
@@ -97,13 +97,13 @@
     }
 
     // Creates and returns session specific message handler.
-    private Collection<UiMessageHandlerTwo> newHandlers() {
+    private Collection<UiMessageHandler> newHandlers() {
         return ImmutableList.of(new StreamingControl());
     }
 
 
     // UI Message handlers for turning on/off reporting to a session.
-    private class StreamingControl extends UiMessageHandlerTwo {
+    private class StreamingControl extends UiMessageHandler {
 
         private boolean streamingEnabled = false;
 
diff --git a/core/api/src/main/java/org/onosproject/ui/RequestHandler.java b/core/api/src/main/java/org/onosproject/ui/RequestHandler.java
index 7231dcf..51a803a 100644
--- a/core/api/src/main/java/org/onosproject/ui/RequestHandler.java
+++ b/core/api/src/main/java/org/onosproject/ui/RequestHandler.java
@@ -22,14 +22,14 @@
  * Abstraction of an entity that handles a specific request from the
  * user interface client.
  *
- * @see UiMessageHandlerTwo
+ * @see UiMessageHandler
  */
 public abstract class RequestHandler {
 
     protected static final ObjectMapper MAPPER = new ObjectMapper();
 
     private final String eventType;
-    private UiMessageHandlerTwo parent;
+    private UiMessageHandler parent;
 
 
     public RequestHandler(String eventType) {
@@ -37,7 +37,7 @@
     }
 
     // package private
-    void setParent(UiMessageHandlerTwo parent) {
+    void setParent(UiMessageHandler parent) {
         this.parent = parent;
     }
 
diff --git a/core/api/src/main/java/org/onosproject/ui/UiMessageHandlerTwo.java b/core/api/src/main/java/org/onosproject/ui/UiMessageHandler.java
similarity index 96%
rename from core/api/src/main/java/org/onosproject/ui/UiMessageHandlerTwo.java
rename to core/api/src/main/java/org/onosproject/ui/UiMessageHandler.java
index 915bcaf..2f70780 100644
--- a/core/api/src/main/java/org/onosproject/ui/UiMessageHandlerTwo.java
+++ b/core/api/src/main/java/org/onosproject/ui/UiMessageHandler.java
@@ -44,7 +44,7 @@
  * }
  * </pre>
  */
-public abstract class UiMessageHandlerTwo {
+public abstract class UiMessageHandler {
 
     private final Map<String, RequestHandler> handlerMap = new HashMap<>();
 
@@ -56,20 +56,6 @@
      */
     protected final ObjectMapper mapper = new ObjectMapper();
 
-    /**
-     * Binds the handlers returned from {@link #getHandlers()} to this
-     * instance.
-     */
-    void bindHandlers() {
-        Collection<RequestHandler> handlers = getHandlers();
-        checkNotNull(handlers, "Handlers cannot be null");
-        checkArgument(!handlers.isEmpty(), "Handlers cannot be empty");
-
-        for (RequestHandler h : handlers) {
-            h.setParent(this);
-            handlerMap.put(h.eventType(), h);
-        }
-    }
 
     /**
      * Subclasses must return the collection of handlers for the
@@ -115,6 +101,17 @@
         }
     }
 
+    private void bindHandlers() {
+        Collection<RequestHandler> handlers = getHandlers();
+        checkNotNull(handlers, "Handlers cannot be null");
+        checkArgument(!handlers.isEmpty(), "Handlers cannot be empty");
+
+        for (RequestHandler h : handlers) {
+            h.setParent(this);
+            handlerMap.put(h.eventType(), h);
+        }
+    }
+
     /**
      * Initializes the handler with the user interface connection and
      * service directory context.
diff --git a/core/api/src/main/java/org/onosproject/ui/UiMessageHandlerFactory.java b/core/api/src/main/java/org/onosproject/ui/UiMessageHandlerFactory.java
index 23bd5d4..522daa8 100644
--- a/core/api/src/main/java/org/onosproject/ui/UiMessageHandlerFactory.java
+++ b/core/api/src/main/java/org/onosproject/ui/UiMessageHandlerFactory.java
@@ -28,6 +28,6 @@
      *
      * @return collection of new handlers
      */
-    Collection<UiMessageHandlerTwo> newHandlers();
+    Collection<UiMessageHandler> newHandlers();
 
 }
diff --git a/web/gui/src/main/java/org/onosproject/ui/impl/ApplicationViewMessageHandler.java b/web/gui/src/main/java/org/onosproject/ui/impl/ApplicationViewMessageHandler.java
index 2924c8b..f7124e1 100644
--- a/web/gui/src/main/java/org/onosproject/ui/impl/ApplicationViewMessageHandler.java
+++ b/web/gui/src/main/java/org/onosproject/ui/impl/ApplicationViewMessageHandler.java
@@ -23,7 +23,7 @@
 import org.onosproject.core.Application;
 import org.onosproject.core.ApplicationId;
 import org.onosproject.ui.RequestHandler;
-import org.onosproject.ui.UiMessageHandlerTwo;
+import org.onosproject.ui.UiMessageHandler;
 import org.onosproject.ui.table.AbstractTableRow;
 import org.onosproject.ui.table.RowComparator;
 import org.onosproject.ui.table.TableRow;
@@ -39,7 +39,7 @@
 /**
  * Message handler for application view related messages.
  */
-public class ApplicationViewMessageHandler extends UiMessageHandlerTwo {
+public class ApplicationViewMessageHandler extends UiMessageHandler {
 
     private static final String APP_DATA_REQ = "appDataRequest";
     private static final String APP_MGMT_REQ = "appManagementRequest";
diff --git a/web/gui/src/main/java/org/onosproject/ui/impl/ClusterViewMessageHandler.java b/web/gui/src/main/java/org/onosproject/ui/impl/ClusterViewMessageHandler.java
index ee2dcd5..209b98e 100644
--- a/web/gui/src/main/java/org/onosproject/ui/impl/ClusterViewMessageHandler.java
+++ b/web/gui/src/main/java/org/onosproject/ui/impl/ClusterViewMessageHandler.java
@@ -24,7 +24,7 @@
 import org.onosproject.cluster.ControllerNode;
 import org.onosproject.cluster.NodeId;
 import org.onosproject.ui.RequestHandler;
-import org.onosproject.ui.UiMessageHandlerTwo;
+import org.onosproject.ui.UiMessageHandler;
 import org.onosproject.ui.table.AbstractTableRow;
 import org.onosproject.ui.table.RowComparator;
 import org.onosproject.ui.table.TableRow;
@@ -39,7 +39,7 @@
 /**
  * Message handler for cluster view related messages.
  */
-public class ClusterViewMessageHandler extends UiMessageHandlerTwo {
+public class ClusterViewMessageHandler extends UiMessageHandler {
 
     private static final String CLUSTER_DATA_REQ = "clusterDataRequest";
 
diff --git a/web/gui/src/main/java/org/onosproject/ui/impl/DeviceViewMessageHandler.java b/web/gui/src/main/java/org/onosproject/ui/impl/DeviceViewMessageHandler.java
index 302863b..2e8336c 100644
--- a/web/gui/src/main/java/org/onosproject/ui/impl/DeviceViewMessageHandler.java
+++ b/web/gui/src/main/java/org/onosproject/ui/impl/DeviceViewMessageHandler.java
@@ -28,7 +28,7 @@
 import org.onosproject.net.device.DeviceService;
 import org.onosproject.net.link.LinkService;
 import org.onosproject.ui.RequestHandler;
-import org.onosproject.ui.UiMessageHandlerTwo;
+import org.onosproject.ui.UiMessageHandler;
 import org.onosproject.ui.table.AbstractTableRow;
 import org.onosproject.ui.table.RowComparator;
 import org.onosproject.ui.table.TableRow;
@@ -44,7 +44,7 @@
 /**
  * Message handler for device view related messages.
  */
-public class DeviceViewMessageHandler extends UiMessageHandlerTwo {
+public class DeviceViewMessageHandler extends UiMessageHandler {
 
     private static final String DEV_DATA_REQ = "deviceDataRequest";
     private static final String DEV_DETAIL_REQ = "deviceDetailRequest";
diff --git a/web/gui/src/main/java/org/onosproject/ui/impl/FlowViewMessageHandler.java b/web/gui/src/main/java/org/onosproject/ui/impl/FlowViewMessageHandler.java
index 0ad1d70..dc9e898 100644
--- a/web/gui/src/main/java/org/onosproject/ui/impl/FlowViewMessageHandler.java
+++ b/web/gui/src/main/java/org/onosproject/ui/impl/FlowViewMessageHandler.java
@@ -27,7 +27,7 @@
 import org.onosproject.net.flow.criteria.Criterion;
 import org.onosproject.net.flow.instructions.Instruction;
 import org.onosproject.ui.RequestHandler;
-import org.onosproject.ui.UiMessageHandlerTwo;
+import org.onosproject.ui.UiMessageHandler;
 import org.onosproject.ui.table.AbstractTableRow;
 import org.onosproject.ui.table.RowComparator;
 import org.onosproject.ui.table.TableRow;
@@ -43,7 +43,7 @@
 /**
  * Message handler for flow view related messages.
  */
-public class FlowViewMessageHandler extends UiMessageHandlerTwo {
+public class FlowViewMessageHandler extends UiMessageHandler {
 
     private static final String FLOW_DATA_REQ = "flowDataRequest";
 
diff --git a/web/gui/src/main/java/org/onosproject/ui/impl/HostViewMessageHandler.java b/web/gui/src/main/java/org/onosproject/ui/impl/HostViewMessageHandler.java
index a4127e0..42d7a1e 100644
--- a/web/gui/src/main/java/org/onosproject/ui/impl/HostViewMessageHandler.java
+++ b/web/gui/src/main/java/org/onosproject/ui/impl/HostViewMessageHandler.java
@@ -22,7 +22,7 @@
 import org.onosproject.net.HostLocation;
 import org.onosproject.net.host.HostService;
 import org.onosproject.ui.RequestHandler;
-import org.onosproject.ui.UiMessageHandlerTwo;
+import org.onosproject.ui.UiMessageHandler;
 import org.onosproject.ui.table.AbstractTableRow;
 import org.onosproject.ui.table.RowComparator;
 import org.onosproject.ui.table.TableRow;
@@ -38,7 +38,7 @@
 /**
  * Message handler for host view related messages.
  */
-public class HostViewMessageHandler extends UiMessageHandlerTwo {
+public class HostViewMessageHandler extends UiMessageHandler {
 
     private static final String HOST_DATA_REQ = "hostDataRequest";
 
diff --git a/web/gui/src/main/java/org/onosproject/ui/impl/IntentViewMessageHandler.java b/web/gui/src/main/java/org/onosproject/ui/impl/IntentViewMessageHandler.java
index 539430a..356b8b0 100644
--- a/web/gui/src/main/java/org/onosproject/ui/impl/IntentViewMessageHandler.java
+++ b/web/gui/src/main/java/org/onosproject/ui/impl/IntentViewMessageHandler.java
@@ -32,7 +32,7 @@
 import org.onosproject.net.intent.PointToPointIntent;
 import org.onosproject.net.intent.SinglePointToMultiPointIntent;
 import org.onosproject.ui.RequestHandler;
-import org.onosproject.ui.UiMessageHandlerTwo;
+import org.onosproject.ui.UiMessageHandler;
 import org.onosproject.ui.table.AbstractTableRow;
 import org.onosproject.ui.table.RowComparator;
 import org.onosproject.ui.table.TableRow;
@@ -47,7 +47,7 @@
 /**
  * Message handler for intent view related messages.
  */
-public class IntentViewMessageHandler extends UiMessageHandlerTwo {
+public class IntentViewMessageHandler extends UiMessageHandler {
 
     private static final String INTENT_DATA_REQ = "intentDataRequest";
 
diff --git a/web/gui/src/main/java/org/onosproject/ui/impl/LinkViewMessageHandler.java b/web/gui/src/main/java/org/onosproject/ui/impl/LinkViewMessageHandler.java
index 55291c4..06349b4 100644
--- a/web/gui/src/main/java/org/onosproject/ui/impl/LinkViewMessageHandler.java
+++ b/web/gui/src/main/java/org/onosproject/ui/impl/LinkViewMessageHandler.java
@@ -24,7 +24,7 @@
 import org.onosproject.net.LinkKey;
 import org.onosproject.net.link.LinkService;
 import org.onosproject.ui.RequestHandler;
-import org.onosproject.ui.UiMessageHandlerTwo;
+import org.onosproject.ui.UiMessageHandler;
 import org.onosproject.ui.impl.TopologyViewMessageHandlerBase.BiLink;
 import org.onosproject.ui.table.AbstractTableRow;
 import org.onosproject.ui.table.RowComparator;
@@ -42,7 +42,7 @@
 /**
  * Message handler for link view related messages.
  */
-public class LinkViewMessageHandler extends UiMessageHandlerTwo {
+public class LinkViewMessageHandler extends UiMessageHandler {
 
     private static final String LINK_DATA_REQ = "linkDataRequest";
 
diff --git a/web/gui/src/main/java/org/onosproject/ui/impl/TopologyViewMessageHandlerBase.java b/web/gui/src/main/java/org/onosproject/ui/impl/TopologyViewMessageHandlerBase.java
index e0a9164..6f72dcb 100644
--- a/web/gui/src/main/java/org/onosproject/ui/impl/TopologyViewMessageHandlerBase.java
+++ b/web/gui/src/main/java/org/onosproject/ui/impl/TopologyViewMessageHandlerBase.java
@@ -65,7 +65,7 @@
 import org.onosproject.net.topology.TopologyService;
 import org.onosproject.ui.JsonUtils;
 import org.onosproject.ui.UiConnection;
-import org.onosproject.ui.UiMessageHandlerTwo;
+import org.onosproject.ui.UiMessageHandler;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -101,7 +101,7 @@
 /**
  * Facility for creating messages bound for the topology viewer.
  */
-public abstract class TopologyViewMessageHandlerBase extends UiMessageHandlerTwo {
+public abstract class TopologyViewMessageHandlerBase extends UiMessageHandler {
 
     protected static final Logger log =
             LoggerFactory.getLogger(TopologyViewMessageHandlerBase.class);
@@ -420,15 +420,15 @@
     protected ObjectNode summmaryMessage(long sid) {
         Topology topology = topologyService.currentTopology();
         return JsonUtils.envelope("showSummary", sid,
-                        json("ONOS Summary", "node",
-                             new Prop("Devices", format(topology.deviceCount())),
-                             new Prop("Links", format(topology.linkCount())),
-                             new Prop("Hosts", format(hostService.getHostCount())),
-                             new Prop("Topology SCCs", format(topology.clusterCount())),
-                             new Separator(),
-                             new Prop("Intents", format(intentService.getIntentCount())),
-                             new Prop("Flows", format(flowService.getFlowRuleCount())),
-                             new Prop("Version", version)));
+                                  json("ONOS Summary", "node",
+                                       new Prop("Devices", format(topology.deviceCount())),
+                                       new Prop("Links", format(topology.linkCount())),
+                                       new Prop("Hosts", format(hostService.getHostCount())),
+                                       new Prop("Topology SCCs", format(topology.clusterCount())),
+                                       new Separator(),
+                                       new Prop("Intents", format(intentService.getIntentCount())),
+                                       new Prop("Flows", format(flowService.getFlowRuleCount())),
+                                       new Prop("Version", version)));
     }
 
     // Returns device details response.
@@ -439,21 +439,21 @@
         int portCount = deviceService.getPorts(deviceId).size();
         int flowCount = getFlowCount(deviceId);
         return JsonUtils.envelope("showDetails", sid,
-                        json(isNullOrEmpty(name) ? deviceId.toString() : name,
-                             device.type().toString().toLowerCase(),
-                             new Prop("URI", deviceId.toString()),
-                             new Prop("Vendor", device.manufacturer()),
-                             new Prop("H/W Version", device.hwVersion()),
-                             new Prop("S/W Version", device.swVersion()),
-                             new Prop("Serial Number", device.serialNumber()),
-                             new Prop("Protocol", annot.value(AnnotationKeys.PROTOCOL)),
-                             new Separator(),
-                             new Prop("Master", master(deviceId)),
-                             new Prop("Latitude", annot.value(AnnotationKeys.LATITUDE)),
-                             new Prop("Longitude", annot.value(AnnotationKeys.LONGITUDE)),
-                             new Separator(),
-                             new Prop("Ports", Integer.toString(portCount)),
-                             new Prop("Flows", Integer.toString(flowCount))));
+                                  json(isNullOrEmpty(name) ? deviceId.toString() : name,
+                                       device.type().toString().toLowerCase(),
+                                       new Prop("URI", deviceId.toString()),
+                                       new Prop("Vendor", device.manufacturer()),
+                                       new Prop("H/W Version", device.hwVersion()),
+                                       new Prop("S/W Version", device.swVersion()),
+                                       new Prop("Serial Number", device.serialNumber()),
+                                       new Prop("Protocol", annot.value(AnnotationKeys.PROTOCOL)),
+                                       new Separator(),
+                                       new Prop("Master", master(deviceId)),
+                                       new Prop("Latitude", annot.value(AnnotationKeys.LATITUDE)),
+                                       new Prop("Longitude", annot.value(AnnotationKeys.LONGITUDE)),
+                                       new Separator(),
+                                       new Prop("Ports", Integer.toString(portCount)),
+                                       new Prop("Flows", Integer.toString(flowCount))));
     }
 
     protected int getFlowCount(DeviceId deviceId) {
@@ -517,14 +517,14 @@
         String name = annot.value(AnnotationKeys.NAME);
         String vlan = host.vlan().toString();
         return JsonUtils.envelope("showDetails", sid,
-                        json(isNullOrEmpty(name) ? hostId.toString() : name,
-                             isNullOrEmpty(type) ? "endstation" : type,
-                             new Prop("MAC", host.mac().toString()),
-                             new Prop("IP", host.ipAddresses().toString().replaceAll("[\\[\\]]", "")),
-                             new Prop("VLAN", vlan.equals("-1") ? "none" : vlan),
-                             new Separator(),
-                             new Prop("Latitude", annot.value(AnnotationKeys.LATITUDE)),
-                             new Prop("Longitude", annot.value(AnnotationKeys.LONGITUDE))));
+                                  json(isNullOrEmpty(name) ? hostId.toString() : name,
+                                       isNullOrEmpty(type) ? "endstation" : type,
+                                       new Prop("MAC", host.mac().toString()),
+                                       new Prop("IP", host.ipAddresses().toString().replaceAll("[\\[\\]]", "")),
+                                       new Prop("VLAN", vlan.equals("-1") ? "none" : vlan),
+                                       new Separator(),
+                                       new Prop("Latitude", annot.value(AnnotationKeys.LATITUDE)),
+                                       new Prop("Longitude", annot.value(AnnotationKeys.LONGITUDE))));
     }
 
 
diff --git a/web/gui/src/main/java/org/onosproject/ui/impl/UiWebSocket.java b/web/gui/src/main/java/org/onosproject/ui/impl/UiWebSocket.java
index d756da0..3295b9e 100644
--- a/web/gui/src/main/java/org/onosproject/ui/impl/UiWebSocket.java
+++ b/web/gui/src/main/java/org/onosproject/ui/impl/UiWebSocket.java
@@ -25,7 +25,7 @@
 import org.onosproject.ui.UiConnection;
 import org.onosproject.ui.UiExtensionService;
 import org.onosproject.ui.UiMessageHandlerFactory;
-import org.onosproject.ui.UiMessageHandlerTwo;
+import org.onosproject.ui.UiMessageHandler;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -56,7 +56,7 @@
 
     private long lastActive = System.currentTimeMillis();
 
-    private Map<String, UiMessageHandlerTwo> handlers;
+    private Map<String, UiMessageHandler> handlers;
 
     /**
      * Creates a new web-socket for serving data to GUI.
@@ -123,7 +123,7 @@
         try {
             ObjectNode message = (ObjectNode) mapper.reader().readTree(data);
             String type = message.path("event").asText("unknown");
-            UiMessageHandlerTwo handler = handlers.get(type);
+            UiMessageHandler handler = handlers.get(type);
             if (handler != null) {
                 handler.process(message);
             } else {