Bug 2192 - Part2 - Move getProperty() to a common util module
[ovsdb.git] / plugin / src / main / java / org / opendaylight / ovsdb / plugin / api / OvsVswitchdSchemaConstants.java
index 3155ce614f336d5a68997e06af46e63e183e586b..022af289fe715523961921d1d80d1b3aafb5ac4c 100644 (file)
@@ -10,6 +10,8 @@
 
 package org.opendaylight.ovsdb.plugin.api;
 
+import org.opendaylight.ovsdb.utils.config.ConfigProperties;
+
 import java.util.Map;
 
 import com.google.common.collect.Maps;
@@ -44,8 +46,15 @@ public final class OvsVswitchdSchemaConstants {
         addParentColumnToMutate("Manager", "Open_vSwitch", "manager_options");
         addParentColumnToMutate("Controller", "Bridge", "controller");
         // Keep the default value if the property is not set
-        if (System.getProperty(OVSDB_AUTOCONFIGURECONTROLLER) != null)
-            autoConfigureController = Boolean.getBoolean(OVSDB_AUTOCONFIGURECONTROLLER);
+        final String autoConfigureControllerStr =
+                ConfigProperties.getProperty(OvsVswitchdSchemaConstants.class, OVSDB_AUTOCONFIGURECONTROLLER);
+        if (autoConfigureControllerStr != null) {
+            autoConfigureController = Boolean.getBoolean(autoConfigureControllerStr);
+        }
+    }
+
+    public static void setAutoConfigureController(boolean autoConfigure) {
+        autoConfigureController = autoConfigure;
     }
 
     public static boolean shouldConfigureController (String databaseName, String tableName) {