Convert blueprint ext classes to MDSAL APIs
[controller.git] / opendaylight / blueprint / src / main / java / org / opendaylight / controller / blueprint / ext / DataStoreAppConfigDefaultXMLReader.java
index ece690112a0d2b519f789dfd6bdd968cf5a04899..9b55b360d66bab09a531e0174c3ad5fa7166d2d2 100644 (file)
@@ -7,13 +7,13 @@
  */
 package org.opendaylight.controller.blueprint.ext;
 
-import com.google.common.base.Optional;
 import com.google.common.base.Strings;
 import com.google.common.io.Resources;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.URISyntaxException;
 import java.net.URL;
+import java.util.Optional;
 import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.stream.XMLStreamException;
 import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer;
@@ -112,8 +112,7 @@ public class DataStoreAppConfigDefaultXMLReader<T extends DataObject> {
 
         SchemaContext schemaContext = schemaService.getGlobalContext();
 
-        Module module = schemaContext.findModuleByNamespaceAndRevision(bindingContext.bindingQName.getNamespace(),
-                bindingContext.bindingQName.getRevision());
+        Module module = schemaContext.findModule(bindingContext.bindingQName.getModule()).orElse(null);
         checkNotNull(module, "%s: Could not obtain the module schema for namespace %s, revision %s",
                 logName, bindingContext.bindingQName.getNamespace(), bindingContext.bindingQName.getRevision());
 
@@ -138,13 +137,13 @@ public class DataStoreAppConfigDefaultXMLReader<T extends DataObject> {
         return (T) appConfig;
     }
 
-    private static void checkNotNull(Object reference, String errorMessageFormat, Object... formatArgs)
-            throws ConfigXMLReaderException {
+    private static void checkNotNull(final Object reference, final String errorMessageFormat,
+            final Object... formatArgs) throws ConfigXMLReaderException {
         checkCondition(reference != null, errorMessageFormat, formatArgs);
     }
 
-    private static void checkCondition(boolean expression, String errorMessageFormat, Object... formatArgs)
-            throws ConfigXMLReaderException {
+    private static void checkCondition(final boolean expression, final String errorMessageFormat,
+            final Object... formatArgs) throws ConfigXMLReaderException {
         if (!expression) {
             throw new ConfigXMLReaderException(String.format(errorMessageFormat, formatArgs));
         }