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/onrc/onos/core/registry/StandaloneRegistry.java b/src/main/java/net/onrc/onos/core/registry/StandaloneRegistry.java
index 0b552f1..bec8bb4 100644
--- a/src/main/java/net/onrc/onos/core/registry/StandaloneRegistry.java
+++ b/src/main/java/net/onrc/onos/core/registry/StandaloneRegistry.java
@@ -15,6 +15,7 @@
 import net.floodlightcontroller.core.module.IFloodlightService;
 import net.floodlightcontroller.restserver.IRestApiService;
 import net.onrc.onos.core.registry.web.RegistryWebRoutable;
+import net.onrc.onos.core.util.OnosInstanceId;
 
 import org.apache.commons.lang.NotImplementedException;
 import org.openflow.util.HexString;
@@ -32,7 +33,7 @@
 
     private IRestApiService restApi;
 
-    private String registeredControllerId;
+    private OnosInstanceId onosInstanceId;
     private Map<String, ControlChangeCallback> switchCallbacks;
 
     private long blockTop;
@@ -46,7 +47,7 @@
     @Override
     public void requestControl(long dpid, ControlChangeCallback cb)
             throws RegistryException {
-        if (registeredControllerId == null) {
+        if (onosInstanceId == null) {
             throw new IllegalStateException(
                     "Must register a controller before calling requestControl");
         }
@@ -83,32 +84,32 @@
     }
 
     @Override
-    public String getControllerId() {
-        return registeredControllerId;
+    public OnosInstanceId getOnosInstanceId() {
+        return onosInstanceId;
     }
 
     @Override
     public void registerController(String controllerId)
             throws RegistryException {
-        if (registeredControllerId != null) {
+        if (onosInstanceId != null) {
             throw new RegistryException(
-                    "Controller already registered with id " + registeredControllerId);
+                    "Controller already registered with id " + onosInstanceId);
         }
-        registeredControllerId = controllerId;
+        onosInstanceId = new OnosInstanceId(controllerId);
     }
 
     @Override
     public Collection<String> getAllControllers() throws RegistryException {
-        //List<String> l = new ArrayList<String>();
-        //l.add(registeredControllerId);
-        //return l;
-        return Collections.singletonList(registeredControllerId);
+        if (onosInstanceId == null) {
+            return new ArrayList<String>();
+        }
+        return Collections.singletonList(onosInstanceId.toString());
     }
 
     @Override
     public String getControllerForSwitch(long dpid) throws RegistryException {
         return (switchCallbacks.get(HexString.toHexString(dpid)) == null)
-                ? null : registeredControllerId;
+            ? null : onosInstanceId.toString();
     }
 
     @Override
@@ -120,7 +121,7 @@
             log.debug("Switch _{}", strSwitch);
             List<ControllerRegistryEntry> list =
                     new ArrayList<ControllerRegistryEntry>();
-            list.add(new ControllerRegistryEntry(registeredControllerId, 0));
+            list.add(new ControllerRegistryEntry(onosInstanceId.toString(), 0));
 
             switches.put(strSwitch, list);
         }