Fix configuration file parsing 90/58190/1
authorLorand Jakab <lojakab@cisco.com>
Fri, 2 Jun 2017 22:19:24 +0000 (15:19 -0700)
committerLorand Jakab <lojakab@cisco.com>
Fri, 2 Jun 2017 22:19:24 +0000 (15:19 -0700)
Change-Id: Ifd747d1b5d5b39da80920bc088c7c9c0e5cb7111
Signed-off-by: Lorand Jakab <lojakab@cisco.com>
features/features-lispflowmapping/src/main/features/features.xml
mappingservice/config/src/main/java/org/opendaylight/lispflowmapping/config/ConfigIni.java

index e0de6c872f5098bdfe0ced74e687d5270caa6d52..73defac4a20ad0e67753ce2171aaa421da4f4ebe 100644 (file)
         <feature version='${project.version}'>odl-lispflowmapping-models</feature>
         <feature version="${project.version}">odl-lispflowmapping-inmemorydb</feature>
         <feature version="${project.version}">odl-lispflowmapping-southbound</feature>
+        <bundle>mvn:org.opendaylight.lispflowmapping/mappingservice.config/{{VERSION}}</bundle>
         <bundle>mvn:org.opendaylight.lispflowmapping/mappingservice.dsbackend/{{VERSION}}</bundle>
         <bundle>mvn:org.opendaylight.lispflowmapping/mappingservice.mapcache/{{VERSION}}</bundle>
         <bundle>mvn:org.opendaylight.lispflowmapping/mappingservice.implementation/{{VERSION}}</bundle>
-        <bundle>mvn:org.opendaylight.lispflowmapping/mappingservice.config/{{VERSION}}</bundle>
     </feature>
 
     <feature name="odl-lispflowmapping-mappingservice-shell" description="OpenDaylight :: LISP Flow Mapping :: Mappingservice Shell" version='${project.version}'>
         <feature version="${mdsal.version}">odl-mdsal-broker</feature>
         <feature version='${project.version}'>odl-lispflowmapping-models</feature>
         <feature version="${project.version}">odl-lispflowmapping-inmemorydb</feature>
+        <bundle>mvn:org.opendaylight.lispflowmapping/mappingservice.config/{{VERSION}}</bundle>
         <bundle>mvn:org.opendaylight.lispflowmapping/mappingservice.dsbackend/{{VERSION}}</bundle>
         <bundle>mvn:org.opendaylight.lispflowmapping/mappingservice.mapcache/{{VERSION}}</bundle>
         <bundle>mvn:org.opendaylight.lispflowmapping/mappingservice.southbound/{{VERSION}}</bundle>
-        <bundle>mvn:org.opendaylight.lispflowmapping/mappingservice.config/{{VERSION}}</bundle>
     </feature>
 
     <feature name="odl-lispflowmapping-neutron" description="OpenDaylight :: LISP Flow Mapping :: Neutron Integration" version='${project.version}'>
index ddd7806c8a3a74374247279843d64b6d71327688..32b08fc814808912d67b7ffead8dfaec47e2a2fa 100644 (file)
@@ -8,7 +8,6 @@
 package org.opendaylight.lispflowmapping.config;
 
 import java.util.concurrent.TimeUnit;
-
 import org.opendaylight.lispflowmapping.interfaces.mappingservice.IMappingService;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
@@ -62,8 +61,19 @@ public final class ConfigIni {
         BundleContext context = null;
         if (bundle != null) {
             context = bundle.getBundleContext();
+            if (context == null) {
+                LOG.warn("Couldn't get the BundleContext needed for reading the properties in the configuration file, "
+                        + "bundle state is '{}'", bundleStateToString(bundle.getState()));
+            }
+        } else {
+            LOG.warn("Couldn't get the Bundle object needed for reading the properties in the configuration file, "
+                    + "using built-in defaults");
         }
 
+        initConfigs(context);
+    }
+
+    private void initConfigs(BundleContext context) {
         initMappingMerge(context);
         initSmr(context);
         initElpPolicy(context);
@@ -75,6 +85,25 @@ public final class ConfigIni {
         initBucketNumber();
     }
 
+    private String bundleStateToString(int state) {
+        switch (state) {
+            case Bundle.ACTIVE:
+                return "Active";
+            case Bundle.INSTALLED:
+                return "Installed";
+            case Bundle.RESOLVED:
+                return "Resolved";
+            case Bundle.STARTING:
+                return "Starting";
+            case Bundle.STOPPING:
+                return "Stopping";
+            case Bundle.UNINSTALLED:
+                return "Uninstalled";
+            default:
+                return "_Unknown_";
+        }
+    }
+
     private void initRegisterValiditySb(BundleContext context) {
         // set the default value first
         this.registrationValiditySb = MIN_REGISTRATION_VALIDITY_SB;