Remove soft fail for registering an empty property set

- removed soft fail
- fixed property reference in DriverRegistryManager that had been refactored out
- fixed property references in FlowObjectiveManager so that property name and
  variable name match

Change-Id: I1324c0553e0f6945087b29794f0a06ae6dd8ab10
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 37dd878..42af52e 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
@@ -112,11 +112,6 @@
         String componentName = componentClass.getName();
         String resourceName = componentClass.getSimpleName() + RESOURCE_EXT;
         try (InputStream ris = componentClass.getResourceAsStream(resourceName)) {
-            // FIXME: Eliminate the following soft-fail after property refactoring is complete.
-            if (ris == null) {
-                log.info("Property definitions not found at resource {}; please fix this", resourceName);
-                return;
-            }
             checkArgument(ris != null, "Property definitions not found at resource %s",
                           resourceName);
 
diff --git a/core/net/src/main/java/org/onosproject/net/driver/impl/DriverRegistryManager.java b/core/net/src/main/java/org/onosproject/net/driver/impl/DriverRegistryManager.java
index bc2bc8d..f5bed89 100644
--- a/core/net/src/main/java/org/onosproject/net/driver/impl/DriverRegistryManager.java
+++ b/core/net/src/main/java/org/onosproject/net/driver/impl/DriverRegistryManager.java
@@ -18,13 +18,6 @@
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Maps;
 import com.google.common.collect.Sets;
-import org.onosproject.net.driver.DriverRegistry;
-import org.osgi.service.component.annotations.Activate;
-import org.osgi.service.component.annotations.Component;
-import org.osgi.service.component.annotations.Deactivate;
-import org.osgi.service.component.annotations.Modified;
-import org.osgi.service.component.annotations.Reference;
-import org.osgi.service.component.annotations.ReferenceCardinality;
 import org.onosproject.cfg.ComponentConfigService;
 import org.onosproject.component.ComponentService;
 import org.onosproject.event.EventDeliveryService;
@@ -37,7 +30,14 @@
 import org.onosproject.net.driver.DriverEvent;
 import org.onosproject.net.driver.DriverListener;
 import org.onosproject.net.driver.DriverProvider;
+import org.onosproject.net.driver.DriverRegistry;
 import org.osgi.service.component.ComponentContext;
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Deactivate;
+import org.osgi.service.component.annotations.Modified;
+import org.osgi.service.component.annotations.Reference;
+import org.osgi.service.component.annotations.ReferenceCardinality;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -52,6 +52,8 @@
 import static org.onlab.util.Tools.nullIsNotFound;
 import static org.onosproject.net.driver.DriverEvent.Type.DRIVER_ENHANCED;
 import static org.onosproject.net.driver.DriverEvent.Type.DRIVER_REDUCED;
+import static org.onosproject.net.driver.impl.OsgiPropertyConstants.REQUIRED_DRIVERS;
+import static org.onosproject.net.driver.impl.OsgiPropertyConstants.REQUIRED_DRIVERS_DEFAULT;
 import static org.onosproject.security.AppGuard.checkPermission;
 import static org.onosproject.security.AppPermission.Type.DRIVER_READ;
 
@@ -64,8 +66,11 @@
     service = {
         DriverAdminService.class,
         DriverRegistry.class
-    }
-)
+    },
+    property = {
+        REQUIRED_DRIVERS + "=" + REQUIRED_DRIVERS_DEFAULT,
+    })
+
 public class DriverRegistryManager extends DefaultDriverProvider implements DriverAdminService {
 
     private static final String DRIVER_COMPONENT = "org.onosproject.net.driver.impl.DriverManager";
@@ -89,8 +94,8 @@
     @Reference(cardinality = ReferenceCardinality.MANDATORY)
     protected EventDeliveryService eventDispatcher;
 
-    private static final String DEFAULT_REQUIRED_DRIVERS = "default";
-    private static String requiredDrivers = DEFAULT_REQUIRED_DRIVERS;
+    /** Comma-separated list of drivers that must be registered before starting driver subsystem. */
+    private static String requiredDrivers = REQUIRED_DRIVERS_DEFAULT;
     private Set<String> requiredDriverSet;
 
     private Set<DriverProvider> providers = Sets.newConcurrentHashSet();
@@ -125,7 +130,7 @@
     public void modified(ComponentContext context) {
         Dictionary<?, ?> properties = context != null ? context.getProperties() : new Properties();
         if (context != null) {
-            requiredDrivers = get(properties, "requiredDrivers");
+            requiredDrivers = get(properties, REQUIRED_DRIVERS);
         }
         requiredDriverSet = isNullOrEmpty(requiredDrivers) ?
                 ImmutableSet.of() : ImmutableSet.copyOf(requiredDrivers.split(COMMA));
diff --git a/core/net/src/main/java/org/onosproject/net/driver/impl/OsgiPropertyConstants.java b/core/net/src/main/java/org/onosproject/net/driver/impl/OsgiPropertyConstants.java
new file mode 100644
index 0000000..46c39c2
--- /dev/null
+++ b/core/net/src/main/java/org/onosproject/net/driver/impl/OsgiPropertyConstants.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2019-present Open Networking Foundation
+ *
+ * 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.
+ */
+
+package org.onosproject.net.driver.impl;
+
+public final class OsgiPropertyConstants {
+    private OsgiPropertyConstants() {
+    }
+
+    public static final String REQUIRED_DRIVERS = "requiredDrivers";
+    public static final String REQUIRED_DRIVERS_DEFAULT = "default";
+}
diff --git a/core/net/src/main/java/org/onosproject/net/flowobjective/impl/FlowObjectiveManager.java b/core/net/src/main/java/org/onosproject/net/flowobjective/impl/FlowObjectiveManager.java
index 58cb215..45e2e95 100644
--- a/core/net/src/main/java/org/onosproject/net/flowobjective/impl/FlowObjectiveManager.java
+++ b/core/net/src/main/java/org/onosproject/net/flowobjective/impl/FlowObjectiveManager.java
@@ -94,7 +94,6 @@
 
     private static final String WORKER_PATTERN = "objective-installer-%d";
     private static final String GROUP_THREAD_NAME = "onos/objective-installer";
-    private static final String NUM_THREAD = "numThreads";
 
     private final Logger log = LoggerFactory.getLogger(getClass());
 
@@ -154,7 +153,7 @@
 
     @Activate
     protected void activate() {
-        cfgService.registerProperties(getClass());
+        cfgService.registerProperties(FlowObjectiveManager.class);
         executorService = newFixedThreadPool(numThreads,
                                              groupedThreads(GROUP_THREAD_NAME, WORKER_PATTERN, log));
         flowObjectiveStore.setDelegate(delegate);
@@ -179,7 +178,7 @@
     @Modified
     protected void modified(ComponentContext context) {
         String propertyValue =
-                Tools.get(context.getProperties(), NUM_THREAD);
+                Tools.get(context.getProperties(), FOM_NUM_THREADS);
         int newNumThreads = isNullOrEmpty(propertyValue) ? numThreads : Integer.parseInt(propertyValue);
 
         if (newNumThreads != numThreads && newNumThreads > 0) {