/**
*
*/
-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;
/**
*
*/
-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
/**
-* 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;
/**
*
*/
-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;
}
/**
-* 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;
/**
*
*/
-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.
}
/**
-* 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 {
}
/**
-* 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");
}
}
/**
-* 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 {
}
/**
-* 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;
/**
*
*/
-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;
/**
-* 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;
/**
*
*/
-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);
}
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";
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);
}
}
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,
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);
}
}
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);
}
}
}
@Override
public boolean isAcceptable(Node<?> input) {
- if (false == (input instanceof CompositeNode)) {
+ if (!(input instanceof CompositeNode)) {
if (augmenting) {
return checkAugmenting((CompositeNode) input);
} else {
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())) {
@Override
public Set<java.util.Map.Entry<Class, BindingCodec<Object, Object>>> entrySet() {
- return null;
+ return Collections.emptySet();
}
@Override
@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()) {
@Override
public Collection<BindingCodec<?, ?>> values() {
- return null;
+ return Collections.emptySet();
}
private UnsupportedOperationException notModifiable() {
@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
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();
}
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;
}
try {
deserializationBlock.call()
} catch (Exception e) {
+
// FIXME: Make this block providing more information.
throw new DeserializationException(e);
}
@Override
public void close() throws Exception {
-
if (baCommitHandlerRegistration != null) {
baCommitHandlerRegistration.close();
}
package org.opendaylight.controller.sal.binding.impl.util;
-
-
import java.util.concurrent.Callable;
import java.util.concurrent.locks.Lock;
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