Cluster scaling enchancements
	- Updated ConfigFileBasedClusterMetadataProvider to handle both file and http protocols.
	- Server open logic updated to handle joining an existing cluster.

Change-Id: Idbaa39733c7bf814510c94c4b21e3714b3f97f8f
diff --git a/core/net/src/main/java/org/onosproject/cluster/impl/ClusterMetadataManager.java b/core/net/src/main/java/org/onosproject/cluster/impl/ClusterMetadataManager.java
index 49a24db..f655fcc 100644
--- a/core/net/src/main/java/org/onosproject/cluster/impl/ClusterMetadataManager.java
+++ b/core/net/src/main/java/org/onosproject/cluster/impl/ClusterMetadataManager.java
@@ -19,10 +19,10 @@
 import static org.slf4j.LoggerFactory.getLogger;
 
 import java.net.InetAddress;
+import java.net.MalformedURLException;
 import java.net.NetworkInterface;
 import java.net.SocketException;
-import java.net.URI;
-import java.net.URISyntaxException;
+import java.net.URL;
 import java.util.Collection;
 import java.util.Enumeration;
 
@@ -47,8 +47,6 @@
 import org.onosproject.store.service.Versioned;
 import org.slf4j.Logger;
 
-import com.google.common.base.Throwables;
-
 /**
  * Implementation of ClusterMetadataService.
  */
@@ -126,11 +124,15 @@
      * @return primary cluster metadata provider
      */
     private ClusterMetadataProvider getPrimaryProvider() {
+        String metadataUri = System.getProperty("onos.cluster.metadata.uri");
         try {
-            URI uri = new URI(System.getProperty("onos.cluster.metadata.uri", "config:///cluster.json"));
-            return getProvider(uri.getScheme());
-        } catch (URISyntaxException e) {
-            Throwables.propagate(e);
+            String protocol = metadataUri == null ? null : new URL(metadataUri).getProtocol();
+            if (protocol != null && (!protocol.equals("file") && !protocol.equals("http"))) {
+                return getProvider(protocol);
+            }
+            // file provider supports both "file" and "http" uris
+            return getProvider("file");
+        } catch (MalformedURLException e) {
             return null;
         }
     }