Change target to ${project.build.target} in a bunch of pom file.
[controller.git] / opendaylight / md-sal / sal-dom-broker / src / main / java / org / opendaylight / controller / sal / dom / broker / SchemaServiceImpl.java
index efbd81c615f8d8218a6a8ad2a2c422db91c85a30..8afa1eeb5f0e475cfe65fb43936967a6f35bb0f3 100644 (file)
@@ -27,6 +27,7 @@ import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.concepts.util.ListenerRegistry;
 import org.opendaylight.controller.sal.core.api.model.SchemaService;
 import org.opendaylight.controller.sal.core.api.model.SchemaServiceListener;
+import org.opendaylight.controller.sal.dom.broker.impl.SchemaContextProvider;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -41,6 +42,7 @@ import com.google.common.collect.Sets;
 import static com.google.common.base.Preconditions.*;
 
 public class SchemaServiceImpl implements //
+        SchemaContextProvider, //
         SchemaService, //
         ServiceTrackerCustomizer<SchemaServiceListener, SchemaServiceListener>, //
         AutoCloseable {
@@ -100,6 +102,12 @@ public class SchemaServiceImpl implements //
         listenerTracker.open();
     }
 
+    
+    @Override
+    public SchemaContext getSchemaContext() {
+        return getGlobalContext();
+    }
+    
     public SchemaContext getGlobalContext() {
         return getSchemaContextSnapshot();
     }
@@ -146,7 +154,7 @@ public class SchemaServiceImpl implements //
 
     private synchronized boolean tryToUpdateState(Collection<URL> changedURLs, Multimap<Bundle, URL> proposedNewState,
             boolean adding) {
-        Preconditions.checkArgument(changedURLs.size() > 0, "No change can occur when no URLs are changed");
+        Preconditions.checkArgument(!changedURLs.isEmpty(), "No change can occur when no URLs are changed");
 
         try {
             // consistent state
@@ -165,8 +173,8 @@ public class SchemaServiceImpl implements //
         } catch (Exception e) {
             // inconsistent state
             logger.debug(
-                    "SchemaService is falling back on last consistent state containing {}, inconsistent yang files {}, reason {}",
-                    consistentBundlesToYangURLs, inconsistentBundlesToYangURLs, e.toString());
+                    "SchemaService is falling back on last consistent state containing {}, inconsistent yang files {}",
+                    consistentBundlesToYangURLs, inconsistentBundlesToYangURLs, e);
             return false;
         }
     }
@@ -224,8 +232,9 @@ public class SchemaServiceImpl implements //
             // system bundle might have config-api on classpath &&
             // config-api contains yang files =>
             // system bundle might contain yang files from that bundle
-            if (bundle.getBundleId() == 0)
+            if (bundle.getBundleId() == 0) {
                 return bundle;
+            }
 
             Enumeration<URL> enumeration = bundle.findEntries("META-INF/yang", "*.yang", false);
             if (enumeration != null && enumeration.hasMoreElements()) {