Making number of components configurable using the central component configuration subsystem.

Change-Id: Ia32c51480913689339a766d9849e792d62f7d133
diff --git a/core/net/src/main/java/org/onosproject/cfg/impl/ComponentConfigManager.java b/core/net/src/main/java/org/onosproject/cfg/impl/ComponentConfigManager.java
index 25af7ff..1e0ca6b 100644
--- a/core/net/src/main/java/org/onosproject/cfg/impl/ComponentConfigManager.java
+++ b/core/net/src/main/java/org/onosproject/cfg/impl/ComponentConfigManager.java
@@ -203,9 +203,8 @@
 
     // Loads existing property values that may have been set.
     private void loadExistingValues(String componentName) {
-        // FIXME: implement this by talking to the config admin.
         try {
-            Configuration cfg = cfgAdmin.getConfiguration(componentName);
+            Configuration cfg = cfgAdmin.getConfiguration(componentName, null);
             Map<String, ConfigProperty> map = properties.get(componentName);
             Dictionary<String, Object> props = cfg.getProperties();
             if (props != null) {
@@ -229,7 +228,7 @@
     // after each other.
     private void triggerUpdate(String componentName) {
         try {
-            Configuration cfg = cfgAdmin.getConfiguration(componentName);
+            Configuration cfg = cfgAdmin.getConfiguration(componentName, null);
             Map<String, ConfigProperty> map = properties.get(componentName);
             Dictionary<String, Object> props = new Hashtable<>();
             map.values().forEach(p -> props.put(p.name(), p.value()));
diff --git a/core/net/src/main/java/org/onosproject/net/topology/impl/DefaultTopologyProvider.java b/core/net/src/main/java/org/onosproject/net/topology/impl/DefaultTopologyProvider.java
index 03a7169..956102c 100644
--- a/core/net/src/main/java/org/onosproject/net/topology/impl/DefaultTopologyProvider.java
+++ b/core/net/src/main/java/org/onosproject/net/topology/impl/DefaultTopologyProvider.java
@@ -17,6 +17,7 @@
 
 import static com.google.common.base.Strings.isNullOrEmpty;
 import static java.util.concurrent.Executors.newFixedThreadPool;
+import static org.onlab.util.Tools.get;
 import static org.onlab.util.Tools.groupedThreads;
 import static org.onosproject.core.CoreService.CORE_PROVIDER_ID;
 import static org.onosproject.net.device.DeviceEvent.Type.DEVICE_ADDED;
@@ -162,16 +163,16 @@
             return;
         }
 
-        Dictionary properties = context.getProperties();
+        Dictionary<?, ?> properties = context.getProperties();
         int newMaxEvents, newMaxBatchMs, newMaxIdleMs;
         try {
-            String s = (String) properties.get("maxEvents");
+            String s = get(properties, "maxEvents");
             newMaxEvents = isNullOrEmpty(s) ? maxEvents : Integer.parseInt(s.trim());
 
-            s = (String) properties.get("maxBatchMs");
+            s = get(properties, "maxBatchMs");
             newMaxBatchMs = isNullOrEmpty(s) ? maxBatchMs : Integer.parseInt(s.trim());
 
-            s = (String) properties.get("maxIdleMs");
+            s = get(properties, "maxIdleMs");
             newMaxIdleMs = isNullOrEmpty(s) ? maxIdleMs : Integer.parseInt(s.trim());
 
         } catch (NumberFormatException | ClassCastException e) {
diff --git a/core/net/src/main/resources/org/onosproject/net/topology/impl/DefaultTopologyProvider.cfgdef b/core/net/src/main/resources/org/onosproject/net/topology/impl/DefaultTopologyProvider.cfgdef
index f7819dd..c380f70 100644
--- a/core/net/src/main/resources/org/onosproject/net/topology/impl/DefaultTopologyProvider.cfgdef
+++ b/core/net/src/main/resources/org/onosproject/net/topology/impl/DefaultTopologyProvider.cfgdef
@@ -1,20 +1,4 @@
-#
-# Copyright 2015 Open Networking Laboratory                                
-#                                                                          
-# Licensed under the Apache License, Version 2.0 (the "License");          
-# you may not use this file except in compliance with the License.         
-# You may obtain a copy of the License at                                  
-#                                                                          
-#     http://www.apache.org/licenses/LICENSE-2.0                           
-#                                                                          
-# Unless required by applicable law or agreed to in writing, software      
-# distributed under the License is distributed on an "AS IS" BASIS,        
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
-# See the License for the specific language governing permissions and      
-# limitations under the License.
-#
-
-# This is for temporary provision for testing purposes and will be auto-generated.
+# Temporary: to be auto-generated in near future
 maxEvents|INTEGER|1000|Maximum number of events to accumulate
 maxIdleMs|INTEGER|10|Maximum number of millis between events
 maxBatchMs|INTEGER|50|Maximum number of millis for whole batch