Merge "Wired ClusteredDataStore with Configuration Subsytem"
authorEd Warnicke <eaw@cisco.com>
Sun, 1 Dec 2013 18:13:32 +0000 (18:13 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Sun, 1 Dec 2013 18:13:32 +0000 (18:13 +0000)
14 files changed:
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/BindingBrokerImplModule.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/BindingBrokerImplModuleFactory.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/DataBrokerImplModuleFactory.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/NotificationBrokerImplModule.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/NotificationBrokerImplModuleFactory.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/RpcBrokerImplModule.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/RpcBrokerImplModuleFactory.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/RuntimeMappingModule.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/RuntimeMappingModuleFactory.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/dom/serializer/impl/CodecMapping.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/dom/serializer/impl/LazyGeneratedCodecRegistry.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/dom/serializer/impl/RuntimeGeneratedMappingServiceImpl.xtend
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/connect/dom/BindingIndependentDataServiceConnector.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/util/ClassLoaderUtils.java

index c3fe5f70f1b4b99ec9a7d14e061579d5b8d04932..bce1f61cf5a20bfa936c0adac55f5c159533eed3 100644 (file)
@@ -15,8 +15,7 @@ import org.osgi.framework.BundleContext;
 /**
 *
 */
-public final class BindingBrokerImplModule extends org.opendaylight.controller.config.yang.md.sal.binding.impl.AbstractBindingBrokerImplModule
-{
+public final class BindingBrokerImplModule extends org.opendaylight.controller.config.yang.md.sal.binding.impl.AbstractBindingBrokerImplModule {
 
     private BundleContext bundleContext;
 
index 53902510be77bc5f13950bdc2cf3eb7542158395..1c03c3e7b088c611fd41bbcf07d87c6c10ec3c58 100644 (file)
@@ -17,8 +17,7 @@ import org.osgi.framework.BundleContext;
 /**
 *
 */
-public class BindingBrokerImplModuleFactory extends org.opendaylight.controller.config.yang.md.sal.binding.impl.AbstractBindingBrokerImplModuleFactory
-{
+public class BindingBrokerImplModuleFactory extends org.opendaylight.controller.config.yang.md.sal.binding.impl.AbstractBindingBrokerImplModuleFactory {
 
     
     @Override
index 4022dd44ef6216738a6f030fa516c39bbac3e345..60c8156a56c11daeb49b119dc3b24cfc6c900830 100644 (file)
@@ -1,12 +1,12 @@
 /**
-* Generated file
+ * Generated file
 
-* Generated from: yang module name: opendaylight-sal-binding-broker-impl  yang module local name: binding-data-broker
-* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
-* Generated at: Wed Nov 20 17:33:01 CET 2013
-*
-* Do not modify this file unless it is present under src/main directory
-*/
+ * Generated from: yang module name: opendaylight-sal-binding-broker-impl  yang module local name: binding-data-broker
+ * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+ * Generated at: Wed Nov 20 17:33:01 CET 2013
+ *
+ * Do not modify this file unless it is present under src/main directory
+ */
 package org.opendaylight.controller.config.yang.md.sal.binding.impl;
 
 import org.opendaylight.controller.config.api.DependencyResolver;
@@ -17,20 +17,22 @@ import org.osgi.framework.BundleContext;
 /**
 *
 */
-public class DataBrokerImplModuleFactory extends org.opendaylight.controller.config.yang.md.sal.binding.impl.AbstractDataBrokerImplModuleFactory
-{
+public class DataBrokerImplModuleFactory extends
+        org.opendaylight.controller.config.yang.md.sal.binding.impl.AbstractDataBrokerImplModuleFactory {
 
     @Override
     public Module createModule(String instanceName, DependencyResolver dependencyResolver, BundleContext bundleContext) {
-        DataBrokerImplModule module = (DataBrokerImplModule) super.createModule(instanceName, dependencyResolver, bundleContext);
+        DataBrokerImplModule module = (DataBrokerImplModule) super.createModule(instanceName, dependencyResolver,
+                bundleContext);
         module.setBundleContext(bundleContext);
         return module;
     }
-    
+
     @Override
     public Module createModule(String instanceName, DependencyResolver dependencyResolver,
             DynamicMBeanWithInstance old, BundleContext bundleContext) throws Exception {
-        DataBrokerImplModule module = (DataBrokerImplModule) super.createModule(instanceName, dependencyResolver, old, bundleContext);
+        DataBrokerImplModule module = (DataBrokerImplModule) super.createModule(instanceName, dependencyResolver, old,
+                bundleContext);
         module.setBundleContext(bundleContext);
         return module;
     }
index 72231d17d1b0b98b77bbdaedfbc8cc33b2cd07b1..e4f74deb4b3487e31f080186315bc14dc4f9d9d5 100644 (file)
@@ -1,12 +1,12 @@
 /**
-* Generated file
-
-* Generated from: yang module name: opendaylight-sal-binding-broker-impl  yang module local name: binding-notification-broker
-* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
-* Generated at: Wed Nov 20 17:33:01 CET 2013
-*
-* Do not modify this file unless it is present under src/main directory
-*/
+ * Generated file
+
+ * Generated from: yang module name: opendaylight-sal-binding-broker-impl  yang module local name: binding-notification-broker
+ * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+ * Generated at: Wed Nov 20 17:33:01 CET 2013
+ *
+ * Do not modify this file unless it is present under src/main directory
+ */
 package org.opendaylight.controller.config.yang.md.sal.binding.impl;
 
 import java.util.concurrent.ExecutorService;
@@ -21,19 +21,22 @@ import com.google.common.util.concurrent.MoreExecutors;
 /**
 *
 */
-public final class NotificationBrokerImplModule extends org.opendaylight.controller.config.yang.md.sal.binding.impl.AbstractNotificationBrokerImplModule
-{
+public final class NotificationBrokerImplModule extends
+        org.opendaylight.controller.config.yang.md.sal.binding.impl.AbstractNotificationBrokerImplModule {
 
-    public NotificationBrokerImplModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+    public NotificationBrokerImplModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
+            org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
         super(identifier, dependencyResolver);
     }
 
-    public NotificationBrokerImplModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, NotificationBrokerImplModule oldModule, java.lang.AutoCloseable oldInstance) {
+    public NotificationBrokerImplModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
+            org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
+            NotificationBrokerImplModule oldModule, java.lang.AutoCloseable oldInstance) {
         super(identifier, dependencyResolver, oldModule, oldInstance);
     }
 
     @Override
-    public void validate(){
+    public void validate() {
         super.validate();
         // Add custom validation for module attributes here.
     }
index 24ca0bbfaac1fecc5e98b2b97f587b06d1cd314f..31613a7433272882349d1308f7b952f0363a7a29 100644 (file)
@@ -1,19 +1,18 @@
 /**
-* Generated file
+ * Generated file
 
-* Generated from: yang module name: opendaylight-sal-binding-broker-impl  yang module local name: binding-notification-broker
-* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
-* Generated at: Wed Nov 20 17:33:01 CET 2013
-*
-* Do not modify this file unless it is present under src/main directory
-*/
+ * Generated from: yang module name: opendaylight-sal-binding-broker-impl  yang module local name: binding-notification-broker
+ * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+ * Generated at: Wed Nov 20 17:33:01 CET 2013
+ *
+ * Do not modify this file unless it is present under src/main directory
+ */
 package org.opendaylight.controller.config.yang.md.sal.binding.impl;
 
 /**
 *
 */
-public class NotificationBrokerImplModuleFactory extends org.opendaylight.controller.config.yang.md.sal.binding.impl.AbstractNotificationBrokerImplModuleFactory
-{
-
+public class NotificationBrokerImplModuleFactory extends
+        org.opendaylight.controller.config.yang.md.sal.binding.impl.AbstractNotificationBrokerImplModuleFactory {
 
 }
index 7824da8939576bc9b87e0a11ab1c6c2109bf4624..b0d3f7a73009a16845ec135f097ab2be84e6dcf6 100644 (file)
@@ -1,37 +1,40 @@
 /**
-* Generated file
+ * Generated file
 
-* Generated from: yang module name: opendaylight-sal-binding-broker-impl  yang module local name: binding-rpc-broker
-* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
-* Generated at: Wed Nov 20 17:33:01 CET 2013
-*
-* Do not modify this file unless it is present under src/main directory
-*/
+ * Generated from: yang module name: opendaylight-sal-binding-broker-impl  yang module local name: binding-rpc-broker
+ * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+ * Generated at: Wed Nov 20 17:33:01 CET 2013
+ *
+ * Do not modify this file unless it is present under src/main directory
+ */
 package org.opendaylight.controller.config.yang.md.sal.binding.impl;
 
 /**
 *
 */
-public final class RpcBrokerImplModule extends org.opendaylight.controller.config.yang.md.sal.binding.impl.AbstractRpcBrokerImplModule
-{
+public final class RpcBrokerImplModule extends
+        org.opendaylight.controller.config.yang.md.sal.binding.impl.AbstractRpcBrokerImplModule {
 
-    public RpcBrokerImplModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+    public RpcBrokerImplModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
+            org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
         super(identifier, dependencyResolver);
     }
 
-    public RpcBrokerImplModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, RpcBrokerImplModule oldModule, java.lang.AutoCloseable oldInstance) {
+    public RpcBrokerImplModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
+            org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
+            RpcBrokerImplModule oldModule, java.lang.AutoCloseable oldInstance) {
         super(identifier, dependencyResolver, oldModule, oldInstance);
     }
 
     @Override
-    public void validate(){
+    public void validate() {
         super.validate();
         // Add custom validation for module attributes here.
     }
 
     @Override
     public java.lang.AutoCloseable createInstance() {
-        //TODO:implement
+        // TODO:implement
         throw new java.lang.UnsupportedOperationException("Unimplemented stub method");
     }
 }
index 61c7364a435281d54aa25bd113bb8fab870cf120..ed3371a5cce3a15f8ed6483dcab7c3602b02609e 100644 (file)
@@ -1,19 +1,18 @@
 /**
-* Generated file
+ * Generated file
 
-* Generated from: yang module name: opendaylight-sal-binding-broker-impl  yang module local name: binding-rpc-broker
-* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
-* Generated at: Wed Nov 20 17:33:01 CET 2013
-*
-* Do not modify this file unless it is present under src/main directory
-*/
+ * Generated from: yang module name: opendaylight-sal-binding-broker-impl  yang module local name: binding-rpc-broker
+ * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+ * Generated at: Wed Nov 20 17:33:01 CET 2013
+ *
+ * Do not modify this file unless it is present under src/main directory
+ */
 package org.opendaylight.controller.config.yang.md.sal.binding.impl;
 
 /**
 *
 */
-public class RpcBrokerImplModuleFactory extends org.opendaylight.controller.config.yang.md.sal.binding.impl.AbstractRpcBrokerImplModuleFactory
-{
-
+public class RpcBrokerImplModuleFactory extends
+        org.opendaylight.controller.config.yang.md.sal.binding.impl.AbstractRpcBrokerImplModuleFactory {
 
 }
index 6537b4c64d3a956f13a6dde7e52eb90959dbf6a7..1bf15c182f5f93196fe0c3d27fc0438295df2812 100644 (file)
@@ -1,12 +1,12 @@
 /**
-* Generated file
+ * Generated file
 
-* Generated from: yang module name: opendaylight-sal-binding-broker-impl  yang module local name: runtime-generated-mapping
-* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
-* Generated at: Wed Nov 20 18:20:19 CET 2013
-*
-* Do not modify this file unless it is present under src/main directory
-*/
+ * Generated from: yang module name: opendaylight-sal-binding-broker-impl  yang module local name: runtime-generated-mapping
+ * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+ * Generated at: Wed Nov 20 18:20:19 CET 2013
+ *
+ * Do not modify this file unless it is present under src/main directory
+ */
 package org.opendaylight.controller.config.yang.md.sal.binding.impl;
 
 import javassist.ClassPool;
@@ -19,26 +19,29 @@ import com.google.common.base.Preconditions;
 /**
 *
 */
-public final class RuntimeMappingModule extends org.opendaylight.controller.config.yang.md.sal.binding.impl.AbstractRuntimeMappingModule
-{
+public final class RuntimeMappingModule extends
+        org.opendaylight.controller.config.yang.md.sal.binding.impl.AbstractRuntimeMappingModule {
 
     private BundleContext bundleContext;
 
-    public RuntimeMappingModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+    public RuntimeMappingModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
+            org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
         super(identifier, dependencyResolver);
     }
 
-    public RuntimeMappingModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, RuntimeMappingModule oldModule, java.lang.AutoCloseable oldInstance) {
+    public RuntimeMappingModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
+            org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
+            RuntimeMappingModule oldModule, java.lang.AutoCloseable oldInstance) {
         super(identifier, dependencyResolver, oldModule, oldInstance);
     }
 
     @Override
-    public void validate(){
+    public void validate() {
         super.validate();
         Preconditions.checkNotNull(bundleContext);
         // Add custom validation for module attributes here.
     }
-    
+
     @Override
     public boolean canReuseInstance(AbstractRuntimeMappingModule oldModule) {
         return true;
index f104c73ba3da10516c61bfe8ff89fd5c9f988921..6344ae981f0215baf8c7895025e07c41f248ca96 100644 (file)
@@ -1,12 +1,12 @@
 /**
-* Generated file
+ * Generated file
 
-* Generated from: yang module name: opendaylight-sal-binding-broker-impl  yang module local name: runtime-generated-mapping
-* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
-* Generated at: Wed Nov 20 18:20:19 CET 2013
-*
-* Do not modify this file unless it is present under src/main directory
-*/
+ * Generated from: yang module name: opendaylight-sal-binding-broker-impl  yang module local name: runtime-generated-mapping
+ * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+ * Generated at: Wed Nov 20 18:20:19 CET 2013
+ *
+ * Do not modify this file unless it is present under src/main directory
+ */
 package org.opendaylight.controller.config.yang.md.sal.binding.impl;
 
 import java.util.Collections;
@@ -22,36 +22,35 @@ import org.osgi.framework.BundleContext;
 /**
 *
 */
-public class RuntimeMappingModuleFactory extends org.opendaylight.controller.config.yang.md.sal.binding.impl.AbstractRuntimeMappingModuleFactory
-{
+public class RuntimeMappingModuleFactory extends
+        org.opendaylight.controller.config.yang.md.sal.binding.impl.AbstractRuntimeMappingModuleFactory {
 
-    
-    private static  RuntimeMappingModule SINGLETON = null;
+    private static RuntimeMappingModule SINGLETON = null;
     private static ModuleIdentifier IDENTIFIER = new ModuleIdentifier(NAME, "runtime-mapping-singleton");
 
     @Override
     public Module createModule(String instanceName, DependencyResolver dependencyResolver, BundleContext bundleContext) {
         throw new UnsupportedOperationException("Only default instance supported");
     }
-    
+
     @Override
     public Module createModule(String instanceName, DependencyResolver dependencyResolver,
             DynamicMBeanWithInstance old, BundleContext bundleContext) throws Exception {
-        RuntimeMappingModule module = (RuntimeMappingModule) super.createModule(instanceName, dependencyResolver, old, bundleContext);
+        RuntimeMappingModule module = (RuntimeMappingModule) super.createModule(instanceName, dependencyResolver, old,
+                bundleContext);
         module.setBundleContext(bundleContext);
         return module;
     }
-    
+
     @Override
     public Set<RuntimeMappingModule> getDefaultModules(DependencyResolverFactory dependencyResolverFactory,
             BundleContext bundleContext) {
-        if(SINGLETON == null) {
+        if (SINGLETON == null) {
             DependencyResolver dependencyResolver = dependencyResolverFactory.createDependencyResolver(IDENTIFIER);
-            SINGLETON = new RuntimeMappingModule(IDENTIFIER , dependencyResolver);
+            SINGLETON = new RuntimeMappingModule(IDENTIFIER, dependencyResolver);
             SINGLETON.setBundleContext(bundleContext);
         }
-        
-        
+
         return Collections.singleton(SINGLETON);
     }
 
index d05967c2c8ccdde885d595a26331f01be3127ff3..79a11ce278cc057c33b72feadd9272ec74b066b1 100644 (file)
@@ -7,9 +7,13 @@ import org.opendaylight.controller.sal.binding.dom.serializer.api.InstanceIdenti
 import org.opendaylight.yangtools.yang.binding.BindingCodec;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class CodecMapping {
 
+    private static final Logger LOG = LoggerFactory.getLogger(CodecMapping.class);
+    
     public static final String INSTANCE_IDENTIFIER_CODEC = "INSTANCE_IDENTIFIER_CODEC";
     public static final String CLASS_TO_CASE_MAP = "CLASS_TO_CASE";
     public static final String COMPOSITE_TO_CASE = "COMPOSITE_TO_CASE";
@@ -19,13 +23,13 @@ public class CodecMapping {
         Field instanceIdField;
         try {
             instanceIdField = obj.getField(INSTANCE_IDENTIFIER_CODEC);
-            instanceIdField.set(null, codec);
+            if(obj != null) {
+                instanceIdField.set(null, codec);
+            }
         } catch (NoSuchFieldException e) {
-           // NOOP
-        } catch (SecurityException e) {
-            // NOOP
-        } catch (IllegalAccessException e) {
-            // NOOp
+           LOG.debug("Instance identifier codec is not needed for {}",obj.getName(),e);
+        } catch (SecurityException | IllegalAccessException e) {
+            LOG.error("Instance identifier could not be set for {}",obj.getName(),e);
         }
     }
 
@@ -36,14 +40,10 @@ public class CodecMapping {
             instanceIdField = codec.getField(CLASS_TO_CASE_MAP);
             instanceIdField.set(null, classToCaseRawCodec);
         } catch (NoSuchFieldException e) {
-           // NOOP
-        } catch (SecurityException e) {
-            // NOOP
-        } catch (IllegalAccessException e) {
-            // NOOp
+            LOG.debug("BUG: Class to case mappping is not needed for {}",codec.getName(),e);
+        } catch (SecurityException | IllegalAccessException e) {
+            LOG.error("Class to case mappping could not be set for {}",codec.getName(),e);
         }
-        
-        
     }
 
     public static void setCompositeNodeToCaseMap(Class<? extends BindingCodec<?,?>> codec,
@@ -53,11 +53,9 @@ public class CodecMapping {
             instanceIdField = codec.getField(COMPOSITE_TO_CASE);
             instanceIdField.set(null, compositeToCase);
         } catch (NoSuchFieldException e) {
-           // NOOP
-        } catch (SecurityException e) {
-            // NOOP
-        } catch (IllegalAccessException e) {
-            // NOOp
+            LOG.debug("BUG: Class to case mappping is not needed for {}",codec.getName(),e);
+        } catch (SecurityException | IllegalAccessException e) {
+            LOG.error("Composite node to case mappping could not be set for {}",codec.getName(),e);
         }
     }
 
@@ -68,11 +66,9 @@ public class CodecMapping {
                 instanceIdField = dataCodec.getField(AUGMENTATION_CODEC);
                 instanceIdField.set(null, augmentableCodec);
             } catch (NoSuchFieldException e) {
-               // NOOP
-            } catch (SecurityException e) {
-                // NOOP
-            } catch (IllegalAccessException e) {
-                // NOOp
+                LOG.debug("BUG: Augmentation codec is not needed for {}",dataCodec.getName(),e);
+            } catch (SecurityException | IllegalAccessException e) {
+                LOG.error("Augmentation codec could not be set for {}",dataCodec.getName(),e);
             }
     }
 }
index a55d4b9276731f3ede54036272d07ddf762f3cab..961cb2eb598bf7f8aaa0c45bbb9dbe2d5d303839 100644 (file)
@@ -478,7 +478,7 @@ public class LazyGeneratedCodecRegistry implements //
 
         @Override
         public boolean isAcceptable(Node<?> input) {
-            if (false == (input instanceof CompositeNode)) {
+            if (!(input instanceof CompositeNode)) {
                 if (augmenting) {
                     return checkAugmenting((CompositeNode) input);
                 } else {
@@ -492,10 +492,7 @@ public class LazyGeneratedCodecRegistry implements //
             QName parent = input.getNodeType();
             for (Node<?> childNode : input.getChildren()) {
                 QName child = childNode.getNodeType();
-                if (false == Objects.equals(parent.getNamespace(), child.getNamespace())) {
-                    continue;
-                }
-                if (false == Objects.equals(parent.getRevision(), child.getRevision())) {
+                if (!Objects.equals(parent.getNamespace(), child.getNamespace()) || Objects.equals(parent.getRevision(), child.getRevision())) {
                     continue;
                 }
                 if (validNames.contains(child.getLocalName())) {
@@ -558,7 +555,7 @@ public class LazyGeneratedCodecRegistry implements //
 
         @Override
         public Set<java.util.Map.Entry<Class, BindingCodec<Object, Object>>> entrySet() {
-            return null;
+            return Collections.emptySet();
         }
 
         @Override
@@ -584,7 +581,7 @@ public class LazyGeneratedCodecRegistry implements //
 
         @Override
         public BindingCodec get(Object key) {
-            if (false == (key instanceof CompositeNode)) {
+            if (!(key instanceof CompositeNode)) {
                 return null;
             }
             for (java.util.Map.Entry<Class, ChoiceCaseCodecImpl<?>> entry : choiceCases.entrySet()) {
@@ -636,7 +633,7 @@ public class LazyGeneratedCodecRegistry implements //
 
         @Override
         public Collection<BindingCodec<?, ?>> values() {
-            return null;
+            return Collections.emptySet();
         }
 
         private UnsupportedOperationException notModifiable() {
@@ -660,18 +657,17 @@ public class LazyGeneratedCodecRegistry implements //
 
         @Override
         public boolean isEmpty() {
-            return false;
+            return true;
         }
 
         @Override
         public Set<T> keySet() {
-            return null;
+            return Collections.emptySet();
         }
 
         @Override
         public Set<java.util.Map.Entry<T, BindingCodec<?, ?>>> entrySet() {
-            // TODO Auto-generated method stub
-            return null;
+            return Collections.emptySet();
         }
 
         @Override
@@ -709,15 +705,9 @@ public class LazyGeneratedCodecRegistry implements //
                 augmentationField.setAccessible(true);
                 Map<Class, Augmentation> augMap = (Map<Class, Augmentation>) augmentationField.get(input);
                 return augMap;
-            } catch (NoSuchFieldException e) {
-
-            } catch (SecurityException e) {
-
-            } catch (IllegalArgumentException e) {
-
-            } catch (IllegalAccessException e) {
-
-            }
+            } catch (IllegalArgumentException | IllegalAccessException |NoSuchFieldException | SecurityException e) {
+                LOG.debug("Could not read augmentations for {}",input,e);
+            } 
             return Collections.emptyMap();
         }
 
@@ -742,9 +732,9 @@ public class LazyGeneratedCodecRegistry implements //
                 rawAugmentationCodecs.put(key, ret);
                 return ret;
             } catch (InstantiationException e) {
-
+                LOG.error("Can not instantiate raw augmentation codec {}",key.getSimpleName(),e);
             } catch (IllegalAccessException e) {
-
+                LOG.debug("BUG: Constructor for {} is not accessible.",key.getSimpleName(),e);
             }
             return null;
         }
index ec69fd3b68c8ee84c39edde4e58207adb771b5bd..0da7aec480e2c4f3d470cc9b02ad4c386f8f101f 100644 (file)
@@ -149,6 +149,7 @@ class RuntimeGeneratedMappingServiceImpl implements BindingIndependentMappingSer
         try {
             deserializationBlock.call()
         } catch (Exception e) {
+
             // FIXME: Make this block providing more information.
             throw new DeserializationException(e);
         }
index 7a72afc88550b3871ea72286f5b791b4a90f568c..864c048a9133a71350d339ff3b62daae109bc44f 100644 (file)
@@ -191,7 +191,6 @@ public class BindingIndependentDataServiceConnector implements //
 
     @Override
     public void close() throws Exception {
-
         if (baCommitHandlerRegistration != null) {
             baCommitHandlerRegistration.close();
         }
index 6478a03bbc025f8a7fa1f6ec937270a80d807797..cb3206a3b30f8709fda36137ebd218edb8d4e06e 100644 (file)
@@ -1,7 +1,5 @@
 package org.opendaylight.controller.sal.binding.impl.util;
 
-
-
 import java.util.concurrent.Callable;
 import java.util.concurrent.locks.Lock;
 
@@ -10,50 +8,55 @@ import static com.google.common.base.Preconditions.*;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
 import java.util.ArrayList;
+import java.util.List;
 
 import com.google.common.base.Optional;
 
-public class ClassLoaderUtils {
-    
-    public static <V> V withClassLoader(ClassLoader cls,Callable<V> function) throws Exception {
-        return withClassLoaderAndLock(cls, Optional.<Lock>absent(), function);
+public final class ClassLoaderUtils {
+
+    private ClassLoaderUtils() {
+        throw new UnsupportedOperationException("Utility class");
+    }
+
+    public static <V> V withClassLoader(ClassLoader cls, Callable<V> function) throws Exception {
+        return withClassLoaderAndLock(cls, Optional.<Lock> absent(), function);
     }
-    
-    public static <V> V withClassLoaderAndLock(ClassLoader cls,Lock lock,Callable<V> function) throws Exception {
-        checkNotNull(lock,"Lock should not be null");
+
+    public static <V> V withClassLoaderAndLock(ClassLoader cls, Lock lock, Callable<V> function) throws Exception {
+        checkNotNull(lock, "Lock should not be null");
         return withClassLoaderAndLock(cls, Optional.of(lock), function);
     }
-    
-    public static <V> V withClassLoaderAndLock(ClassLoader cls,Optional<Lock> lock,Callable<V> function) throws Exception {
+
+    public static <V> V withClassLoaderAndLock(ClassLoader cls, Optional<Lock> lock, Callable<V> function)
+            throws Exception {
         checkNotNull(cls, "Classloader should not be null");
-        checkNotNull(function,"Function should not be null");
-        if(lock.isPresent()) {
+        checkNotNull(function, "Function should not be null");
+        if (lock.isPresent()) {
             lock.get().lock();
         }
         ClassLoader oldCls = Thread.currentThread().getContextClassLoader();
         try {
             Thread.currentThread().setContextClassLoader(cls);
-            V result = function.call();
-            return result;
-        }  finally {
+            return function.call();
+        } finally {
             Thread.currentThread().setContextClassLoader(oldCls);
-            if(lock.isPresent()) {
+            if (lock.isPresent()) {
                 lock.get().unlock();
             }
         }
     }
 
-    public static Object construct(Constructor<? extends Object> constructor, ArrayList<Object> objects) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
-    Object[] initargs = objects.toArray(new Object[]{});
-    return constructor.newInstance(initargs);
+    public static Object construct(Constructor<? extends Object> constructor, List<Object> objects)
+            throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+        Object[] initargs = objects.toArray(new Object[] {});
+        return constructor.newInstance(initargs);
     }
-    
-    
+
     public static Class<?> loadClassWithTCCL(String name) throws ClassNotFoundException {
-        if("byte[]".equals(name)) {
+        if ("byte[]".equals(name)) {
             return byte[].class;
         }
-        
+
         return Thread.currentThread().getContextClassLoader().loadClass(name);
     }
 }
\ No newline at end of file