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

Change-Id: Ia32c51480913689339a766d9849e792d62f7d133
diff --git a/apps/proxyarp/src/main/java/org/onosproject/proxyarp/ProxyArp.java b/apps/proxyarp/src/main/java/org/onosproject/proxyarp/ProxyArp.java
index 82cdc31..6be06a5 100644
--- a/apps/proxyarp/src/main/java/org/onosproject/proxyarp/ProxyArp.java
+++ b/apps/proxyarp/src/main/java/org/onosproject/proxyarp/ProxyArp.java
@@ -15,8 +15,6 @@
  */
 package org.onosproject.proxyarp;
 
-import java.util.Dictionary;
-
 import org.apache.felix.scr.annotations.Activate;
 import org.apache.felix.scr.annotations.Component;
 import org.apache.felix.scr.annotations.Deactivate;
@@ -27,6 +25,7 @@
 import org.onlab.packet.Ethernet;
 import org.onlab.packet.ICMP6;
 import org.onlab.packet.IPv6;
+import org.onosproject.cfg.ComponentConfigService;
 import org.onosproject.core.ApplicationId;
 import org.onosproject.core.CoreService;
 import org.onosproject.net.flow.DefaultTrafficSelector;
@@ -39,6 +38,8 @@
 import org.osgi.service.component.ComponentContext;
 import org.slf4j.Logger;
 
+import java.util.Dictionary;
+
 import static com.google.common.base.Strings.isNullOrEmpty;
 import static org.slf4j.LoggerFactory.getLogger;
 
@@ -61,14 +62,18 @@
     @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
     protected CoreService coreService;
 
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected ComponentConfigService cfgService;
+
     private ApplicationId appId;
 
     @Property(name = "ipv6NeighborDiscovery", boolValue = false,
-              label = "Enable IPv6 Neighbor Discovery; default is false")
+            label = "Enable IPv6 Neighbor Discovery; default is false")
     private boolean ipv6NeighborDiscovery = false;
 
     @Activate
     public void activate(ComponentContext context) {
+        cfgService.registerProperties(getClass());
         appId = coreService.registerApplication("org.onosproject.proxyarp");
         readComponentConfiguration(context);
 
@@ -103,6 +108,7 @@
 
     @Deactivate
     public void deactivate() {
+        cfgService.unregisterProperties(getClass(), false);
         packetService.removeProcessor(processor);
         processor = null;
         log.info("Stopped");
@@ -125,7 +131,7 @@
         flag = isPropertyEnabled(properties, "ipv6NeighborDiscovery");
         if (flag == null) {
             log.info("IPv6 Neighbor Discovery is not configured, " +
-                     "using current value of {}", ipv6NeighborDiscovery);
+                             "using current value of {}", ipv6NeighborDiscovery);
         } else {
             ipv6NeighborDiscovery = flag;
             log.info("Configured. IPv6 Neighbor Discovery is {}",
@@ -136,7 +142,7 @@
     /**
      * Check property name is defined and set to true.
      *
-     * @param properties properties to be looked up
+     * @param properties   properties to be looked up
      * @param propertyName the name of the property to look up
      * @return value when the propertyName is defined or return null
      */