Work toward ONOS-1451: Separate Event Key space per instance

Misc changes and cleanup:
* Added new class OnosInstanceId
* Replace (as appropriate) the string controllerId (and associated methods)
  with the new class OnosInstanceId
* Renaming: Host -> Device
  - Method getDeviceID -> getHostID
  - Changed Host Key ID prefix 'D' to 'H'
  - Few renaming of Host -> Device inside Javadoc

Change-Id: I59c20d68277ecde2f7df4e7097a4a52d5786df1b
diff --git a/src/main/java/net/floodlightcontroller/core/internal/Controller.java b/src/main/java/net/floodlightcontroller/core/internal/Controller.java
index e34c958..a502711 100644
--- a/src/main/java/net/floodlightcontroller/core/internal/Controller.java
+++ b/src/main/java/net/floodlightcontroller/core/internal/Controller.java
@@ -68,6 +68,7 @@
 import net.onrc.onos.core.registry.IControllerRegistryService.ControlChangeCallback;
 import net.onrc.onos.core.registry.RegistryException;
 import net.onrc.onos.core.util.Dpid;
+import net.onrc.onos.core.util.OnosInstanceId;
 
 import org.jboss.netty.bootstrap.ServerBootstrap;
 import org.jboss.netty.buffer.ChannelBuffer;
@@ -180,7 +181,7 @@
     protected int workerThreads = 0;
     // The id for this controller node. Should be unique for each controller
     // node in a controller cluster.
-    protected String controllerId = "localhost";
+    private OnosInstanceId onosInstanceId = new OnosInstanceId("localhost");
 
     // The current role of the controller.
     // If the controller isn't configured to support roles, then this is null.
@@ -1648,8 +1649,8 @@
     }
 
     @Override
-    public String getControllerId() {
-        return controllerId;
+    public OnosInstanceId getOnosInstanceId() {
+        return onosInstanceId;
     }
 
     // **************
@@ -1814,18 +1815,18 @@
         log.debug("Number of worker threads set to {}", this.workerThreads);
         String controllerId = configParams.get("controllerid");
         if (controllerId != null) {
-            this.controllerId = controllerId;
+            this.onosInstanceId = new OnosInstanceId(controllerId);
         } else {
             //Try to get the hostname of the machine and use that for controller ID
             try {
                 String hostname = java.net.InetAddress.getLocalHost().getHostName();
-                this.controllerId = hostname;
+                this.onosInstanceId = new OnosInstanceId(hostname);
             } catch (UnknownHostException e) {
                 // Can't get hostname, we'll just use the default
             }
         }
 
-        log.debug("ControllerId set to {}", this.controllerId);
+        log.debug("ControllerId set to {}", this.onosInstanceId);
     }
 
     private void initVendorMessages() {
@@ -1880,7 +1881,7 @@
                     LogMessageDoc.CHECK_CONTROLLER)
     public void startupComponents() {
         try {
-            registryService.registerController(controllerId);
+            registryService.registerController(onosInstanceId.toString());
         } catch (RegistryException e) {
             log.warn("Registry service error: {}", e.getMessage());
         }