Fix checkstyle violations in sal-binding-broker 45/69145/3
authorTom Pantelis <tompantelis@gmail.com>
Tue, 6 Mar 2018 15:14:07 +0000 (10:14 -0500)
committerMichael Vorburger <vorburger@redhat.com>
Fri, 9 Mar 2018 15:11:22 +0000 (15:11 +0000)
Change-Id: Ia5bcaa7073ff3fb4c004864649e8f5bc2bf23281
Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
70 files changed:
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/compat/AbstractNotificationListenerRegistration.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/compat/AggregatedNotificationListenerRegistration.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/compat/CompositeRoutedRpcRegistration.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/compat/DelegatedRootRpcRegistration.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/compat/FunctionalNotificationListenerAdapter.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/compat/HeliumNotificationProviderServiceAdapter.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/compat/HeliumNotificationProviderServiceWithInterestListeners.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/compat/HeliumNotificationServiceAdapter.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/compat/HeliumRpcProviderRegistry.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/compat/ListenerMapGeneration.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/compat/NotificationInvoker.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/compat/NotificationListenerRegistration.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/AbstractForwardedDataBroker.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/AbstractForwardedTransaction.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/AbstractReadWriteTransaction.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/AbstractWriteTransaction.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/BindingDOMAdapterLoader.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/BindingDOMDataBrokerAdapter.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/BindingDOMDataTreeChangeListenerAdapter.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/BindingDOMDataTreeChangeServiceAdapter.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/BindingDOMMountPointListenerAdapter.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/BindingDOMMountPointServiceAdapter.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/BindingDOMNotificationListenerAdapter.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/BindingDOMNotificationPublishServiceAdapter.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/BindingDOMNotificationServiceAdapter.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/BindingDOMReadTransactionAdapter.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/BindingDOMReadWriteTransactionAdapter.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/BindingDOMRpcAdapterRegistration.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/BindingDOMRpcImplementationAdapter.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/BindingDOMRpcProviderServiceAdapter.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/BindingDOMTransactionChainAdapter.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/BindingDOMWriteTransactionAdapter.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/BindingDataTreeChangeListenerRegistration.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/BindingMountPointAdapter.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/BindingRpcAdapterRegistration.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/BindingToNormalizedNodeCodec.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/BindingToNormalizedNodeCodecFactory.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/ContextReferenceExtractor.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/DirectGetterRouteContextExtractor.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/FutureSchema.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/GetValueRouteContextExtractor.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/LazyDataObjectModification.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/LazyDataTreeModification.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/LazySerializedContainerNode.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/LazySerializedDOMNotification.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/RpcServiceAdapter.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/spi/AdapterBuilder.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/spi/AdapterLoader.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/impl/SingletonHolder.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/RootBindingAwareBroker.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/BindingDOMDataTreeChangeServiceAdapterTest.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/BindingNormalizedCodecTest.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/ContextExtractorTest.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/BackwardsCompatibleNotificationBrokerTest.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/BindingDOMDataBrokerAdapterTest.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/Bug1125RegressionTest.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/Bug1333DataChangeListenerTest.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/Bug1418AugmentationTest.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/Bug2562DeserializedUnkeyedListTest.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/Bug3090MultiKeyList.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/DataTreeChangeListenerTest.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/ForwardedNotificationAdapterTest.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/WriteTransactionTest.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/test/AbstractDataBrokerTestCustomizer.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/test/AssertCollections.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/AugmentationVerifier.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/mock/ReferencableObject.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/mock/ReferencableObjectKey.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/util/BindingBrokerTestFactory.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/util/BindingTestContext.java

index 540c261..e327e6f 100644 (file)
@@ -7,21 +7,22 @@
  */
 package org.opendaylight.controller.md.sal.binding.compat;
 
+import com.google.common.base.Preconditions;
 import org.opendaylight.controller.sal.binding.api.NotificationListener;
 import org.opendaylight.yangtools.concepts.AbstractListenerRegistration;
 import org.opendaylight.yangtools.yang.binding.Notification;
 
-import com.google.common.base.Preconditions;
-
 /**
  * Abstract implementation of {@link NotificationListenerRegistration}.
  *
  * @param <T> Notification type
  */
-abstract class AbstractNotificationListenerRegistration<T extends Notification> extends AbstractListenerRegistration<NotificationListener<T>> implements NotificationListenerRegistration<T> {
+abstract class AbstractNotificationListenerRegistration<T extends Notification>
+        extends AbstractListenerRegistration<NotificationListener<T>> implements NotificationListenerRegistration<T> {
     private final Class<? extends Notification> type;
 
-    protected AbstractNotificationListenerRegistration(final Class<? extends Notification> type, final NotificationListener<T> listener) {
+    protected AbstractNotificationListenerRegistration(final Class<? extends Notification> type,
+            final NotificationListener<T> listener) {
         super(listener);
         this.type = Preconditions.checkNotNull(type);
     }
index e93109d..339ad68 100644 (file)
@@ -16,16 +16,19 @@ import org.opendaylight.yangtools.yang.binding.Notification;
  * interfaces at the same time. In order to support correct delivery, we need to maintain per-type registrations
  * which get squashed if a notification which implements multiple interfaces is encountered.
  *
+ * <p>
  * We take care of that by implementing alternate {@link #hashCode()}/{@link #equals(Object)}, which resolve
  * to the backing aggregator.
  *
  * @param <N> Notification type
  * @param <A> Aggregator type
  */
-abstract class AggregatedNotificationListenerRegistration<N extends Notification, A> extends AbstractNotificationListenerRegistration<N> {
+abstract class AggregatedNotificationListenerRegistration<N extends Notification, A>
+        extends AbstractNotificationListenerRegistration<N> {
     private final A aggregator;
 
-    protected AggregatedNotificationListenerRegistration(final Class<? extends Notification> type, final NotificationListener<N> listener, final A aggregator) {
+    protected AggregatedNotificationListenerRegistration(final Class<? extends Notification> type,
+            final NotificationListener<N> listener, final A aggregator) {
         super(type, listener);
         this.aggregator = Preconditions.checkNotNull(aggregator);
     }
index bb6c2e7..1a405e0 100644 (file)
@@ -7,7 +7,6 @@
  */
 package org.opendaylight.controller.md.sal.binding.compat;
 
-import com.google.common.base.Throwables;
 import com.google.common.collect.ImmutableSet;
 import java.util.HashMap;
 import java.util.Map;
@@ -25,7 +24,8 @@ final class CompositeRoutedRpcRegistration<T extends RpcService> implements Rout
     private final BindingDOMRpcProviderServiceAdapter adapter;
     private final Map<InstanceIdentifier<?>, ObjectRegistration<T>> registrations = new HashMap<>(2);
 
-    CompositeRoutedRpcRegistration(final Class<T> type, final T impl, final BindingDOMRpcProviderServiceAdapter providerAdapter) {
+    CompositeRoutedRpcRegistration(final Class<T> type, final T impl,
+            final BindingDOMRpcProviderServiceAdapter providerAdapter) {
         this.type = type;
         this.instance = impl;
         this.adapter = providerAdapter;
@@ -48,9 +48,11 @@ final class CompositeRoutedRpcRegistration<T extends RpcService> implements Rout
     }
 
     @Override
-    public synchronized void registerPath(final Class<? extends BaseIdentity> context, final InstanceIdentifier<?> path) {
-        if(!registrations.containsKey(path)) {
-            registrations.put(path, adapter.registerRpcImplementation(type, instance, ImmutableSet.<InstanceIdentifier<?>>of(path)));
+    public synchronized void registerPath(final Class<? extends BaseIdentity> context,
+            final InstanceIdentifier<?> path) {
+        if (!registrations.containsKey(path)) {
+            registrations.put(path,
+                    adapter.registerRpcImplementation(type, instance, ImmutableSet.<InstanceIdentifier<?>>of(path)));
         }
     }
 
@@ -62,27 +64,18 @@ final class CompositeRoutedRpcRegistration<T extends RpcService> implements Rout
     }
 
     @Override
-    public synchronized  void unregisterPath(final Class<? extends BaseIdentity> context, final InstanceIdentifier<?> path) {
+    public synchronized  void unregisterPath(final Class<? extends BaseIdentity> context,
+            final InstanceIdentifier<?> path) {
         final ObjectRegistration<T> reg = registrations.remove(path);
-        if(reg != null) {
-            try {
-                reg.close();
-            } catch (final Exception e) {
-                // FIXME: Once we have proper subclass of ObjectRegistrationo
-                throw Throwables.propagate(e);
-            }
+        if (reg != null) {
+            reg.close();
         }
     }
 
     @Override
     public synchronized void close() {
-        try {
-            for(final ObjectRegistration<T> reg : registrations.values()) {
-                    reg.close();
-            }
-        } catch (final Exception e) {
-            throw Throwables.propagate(e);
+        for (final ObjectRegistration<T> reg : registrations.values()) {
+            reg.close();
         }
     }
-
 }
index 1c3e6d8..aa94e21 100644 (file)
@@ -7,7 +7,6 @@
  */
 package org.opendaylight.controller.md.sal.binding.compat;
 
-import com.google.common.base.Throwables;
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration;
 import org.opendaylight.yangtools.concepts.ObjectRegistration;
 import org.opendaylight.yangtools.yang.binding.RpcService;
@@ -17,7 +16,7 @@ final class DelegatedRootRpcRegistration<T extends RpcService> implements RpcReg
     private final ObjectRegistration<T> delegate;
     private final Class<T> type;
 
-    public DelegatedRootRpcRegistration(final Class<T> type,final ObjectRegistration<T> impl) {
+    DelegatedRootRpcRegistration(final Class<T> type, final ObjectRegistration<T> impl) {
         this.delegate = impl;
         this.type = type;
     }
@@ -25,12 +24,7 @@ final class DelegatedRootRpcRegistration<T extends RpcService> implements RpcReg
 
     @Override
     public void close() {
-        try {
-            // FIXME: Should use more specific registration object.
-            delegate.close();
-        } catch (final Exception e) {
-            throw Throwables.propagate(e);
-        }
+        delegate.close();
     }
 
     @Override
@@ -42,5 +36,4 @@ final class DelegatedRootRpcRegistration<T extends RpcService> implements RpcReg
     public Class<T> getServiceType() {
         return type;
     }
-
 }
index 0d85ef9..5189e8f 100644 (file)
@@ -21,7 +21,8 @@ final class FunctionalNotificationListenerAdapter<N extends Notification> implem
     private final NotificationListener<N> delegate;
     private final Class<N> type;
 
-    public FunctionalNotificationListenerAdapter(final BindingNormalizedNodeSerializer codec, final Class<N> type, final NotificationListener<N> delegate) {
+    FunctionalNotificationListenerAdapter(final BindingNormalizedNodeSerializer codec, final Class<N> type,
+            final NotificationListener<N> delegate) {
         this.codec = codec;
         this.type = type;
         this.delegate = delegate;
@@ -29,11 +30,11 @@ final class FunctionalNotificationListenerAdapter<N extends Notification> implem
 
     @Override
     public void onNotification(@Nonnull final DOMNotification notification) {
-        delegate.onNotification( type.cast(deserialize(notification)));
+        delegate.onNotification(type.cast(deserialize(notification)));
     }
 
     private Notification deserialize(final DOMNotification notification) {
-        if(notification instanceof LazySerializedDOMNotification) {
+        if (notification instanceof LazySerializedDOMNotification) {
             return ((LazySerializedDOMNotification) notification).getBindingData();
         }
         return codec.fromNormalizedNodeNotification(notification.getType(), notification.getBody());
index 24376d6..a65d490 100644 (file)
@@ -16,7 +16,8 @@ import org.opendaylight.yangtools.yang.binding.Notification;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class HeliumNotificationProviderServiceAdapter extends HeliumNotificationServiceAdapter implements NotificationProviderService, AutoCloseable {
+public class HeliumNotificationProviderServiceAdapter extends HeliumNotificationServiceAdapter
+        implements NotificationProviderService, AutoCloseable {
     private static final Logger LOG = LoggerFactory.getLogger(HeliumNotificationProviderServiceAdapter.class);
 
     private final NotificationPublishService notificationPublishService;
@@ -53,7 +54,5 @@ public class HeliumNotificationProviderServiceAdapter extends HeliumNotification
 
     @Override
     public void close() throws Exception {
-
     }
-
 }
index 1eb421d..6181b0e 100644 (file)
@@ -29,7 +29,8 @@ import org.slf4j.LoggerFactory;
 
 public class HeliumNotificationProviderServiceWithInterestListeners extends HeliumNotificationProviderServiceAdapter {
 
-    private static final Logger LOG = LoggerFactory.getLogger(HeliumNotificationProviderServiceWithInterestListeners.class);
+    private static final Logger LOG = LoggerFactory.getLogger(
+            HeliumNotificationProviderServiceWithInterestListeners.class);
 
     private final ListenerRegistry<NotificationInterestListener> interestListeners = ListenerRegistry.create();
     private final ListenerRegistration<Listener> domListener;
@@ -37,7 +38,9 @@ public class HeliumNotificationProviderServiceWithInterestListeners extends Heli
     private final BindingToNormalizedNodeCodec codec;
 
     public HeliumNotificationProviderServiceWithInterestListeners(
-            final BindingDOMNotificationPublishServiceAdapter publishService, final BindingDOMNotificationServiceAdapter listenService, final DOMNotificationSubscriptionListenerRegistry registry) {
+            final BindingDOMNotificationPublishServiceAdapter publishService,
+            final BindingDOMNotificationServiceAdapter listenService,
+            final DOMNotificationSubscriptionListenerRegistry registry) {
         super(publishService, listenService);
         this.codec = publishService.getCodecRegistry();
         this.domListener = registry.registerSubscriptionListener(new Listener());
@@ -55,16 +58,17 @@ public class HeliumNotificationProviderServiceWithInterestListeners extends Heli
         return codec.getNotificationClasses(added);
     }
 
+    @SuppressWarnings("checkstyle:IllegalCatch")
     private void notifyAllListeners(final Set<SchemaPath> added) {
         final Iterator<ListenerRegistration<NotificationInterestListener>> listeners = interestListeners.iterator();
-        if(listeners.hasNext()) {
+        if (listeners.hasNext()) {
             final Set<Class<? extends Notification>> baEvent = translate(added);
-            while(listeners.hasNext()) {
+            while (listeners.hasNext()) {
                 final NotificationInterestListener listenerRef = listeners.next().getInstance();
                 try {
-                    notifyListener(listenerRef,baEvent);
-                } catch (final Exception e) {
-                    LOG.warn("Unhandled exception during invoking listener {}",e, listenerRef);
+                    notifyListener(listenerRef, baEvent);
+                } catch (RuntimeException  e) {
+                    LOG.warn("Unhandled exception during invoking listener {}", e, listenerRef);
                 }
             }
         }
@@ -74,7 +78,8 @@ public class HeliumNotificationProviderServiceWithInterestListeners extends Heli
     public <T extends Notification> ListenerRegistration<NotificationListener<T>> registerNotificationListener(
             final Class<T> type, final NotificationListener<T> listener) {
 
-        final FunctionalNotificationListenerAdapter<T> adapter = new FunctionalNotificationListenerAdapter<>(codec, type, listener);
+        final FunctionalNotificationListenerAdapter<T> adapter =
+                new FunctionalNotificationListenerAdapter<>(codec, type, listener);
         final SchemaPath domType = SchemaPath.create(true, BindingReflections.findQName(type));
         final ListenerRegistration<?> domReg = domService.registerNotificationListener(adapter, domType);
         return new AbstractListenerRegistration<NotificationListener<T>>(listener) {
@@ -82,12 +87,12 @@ public class HeliumNotificationProviderServiceWithInterestListeners extends Heli
             protected void removeRegistration() {
                 domReg.close();
             }
-
         };
     }
 
-    private void notifyListener(final NotificationInterestListener listener, final Set<Class<? extends Notification>> baEvent) {
-        for(final Class<? extends Notification> event: baEvent) {
+    private void notifyListener(final NotificationInterestListener listener,
+            final Set<Class<? extends Notification>> baEvent) {
+        for (final Class<? extends Notification> event: baEvent) {
             listener.onNotificationSubscribtion(event);
         }
     }
index 68daa45..f4c1020 100644 (file)
@@ -12,7 +12,8 @@ import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.binding.Notification;
 import org.opendaylight.yangtools.yang.binding.NotificationListener;
 
-public class HeliumNotificationServiceAdapter implements org.opendaylight.controller.sal.binding.api.NotificationService, AutoCloseable {
+public class HeliumNotificationServiceAdapter
+        implements org.opendaylight.controller.sal.binding.api.NotificationService, AutoCloseable {
 
     private final NotificationService notificationService;
 
@@ -21,8 +22,10 @@ public class HeliumNotificationServiceAdapter implements org.opendaylight.contro
     }
 
     @Override
-    public <T extends Notification> ListenerRegistration<org.opendaylight.controller.sal.binding.api.NotificationListener<T>> registerNotificationListener(
-            final Class<T> notificationType, final org.opendaylight.controller.sal.binding.api.NotificationListener<T> listener) {
+    public <T extends Notification> ListenerRegistration<
+            org.opendaylight.controller.sal.binding.api.NotificationListener<T>> registerNotificationListener(
+            final Class<T> notificationType,
+            final org.opendaylight.controller.sal.binding.api.NotificationListener<T> listener) {
         throw new UnsupportedOperationException("Not supported type of listener.");
     }
 
@@ -34,6 +37,5 @@ public class HeliumNotificationServiceAdapter implements org.opendaylight.contro
 
     @Override
     public void close() throws Exception {
-
     }
 }
index 555c96e..34f71e9 100644 (file)
@@ -49,10 +49,9 @@ public class HeliumRpcProviderRegistry implements RpcProviderRegistry {
     }
 
     @Override
-    public <L extends RouteChangeListener<RpcContextIdentifier, InstanceIdentifier<?>>> ListenerRegistration<L> registerRouteChangeListener(
-            final L arg0) {
+    public <L extends RouteChangeListener<RpcContextIdentifier, InstanceIdentifier<?>>> ListenerRegistration<L>
+            registerRouteChangeListener(final L listener) {
         // FIXME: Implement this only if necessary
         return null;
     }
-
 }
index 7ca35aa..e2cf3d7 100644 (file)
@@ -7,20 +7,18 @@
  */
 package org.opendaylight.controller.md.sal.binding.compat;
 
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-
-import java.util.stream.Collectors;
-import org.opendaylight.yangtools.yang.binding.Notification;
-
 import com.google.common.cache.CacheBuilder;
 import com.google.common.cache.CacheLoader;
 import com.google.common.cache.LoadingCache;
 import com.google.common.collect.ImmutableMultimap;
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Multimap;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.stream.Collectors;
+import org.opendaylight.yangtools.yang.binding.Notification;
 
 /**
  * An immutable view of the current generation of listeners.
@@ -48,7 +46,8 @@ final class ListenerMapGeneration {
 
                     for (final Class<?> type : getNotificationTypes(key)) {
                         @SuppressWarnings("unchecked")
-                        final Collection<NotificationListenerRegistration<?>> l = typeToListeners.get((Class<? extends Notification>) type);
+                        final Collection<NotificationListenerRegistration<?>> l =
+                                typeToListeners.get((Class<? extends Notification>) type);
                         if (l != null) {
                             regs.addAll(l);
                         }
@@ -62,7 +61,8 @@ final class ListenerMapGeneration {
         typeToListeners = ImmutableMultimap.of();
     }
 
-    ListenerMapGeneration(final Multimap<Class<? extends Notification>, NotificationListenerRegistration<?>> listeners) {
+    ListenerMapGeneration(final Multimap<Class<? extends Notification>,
+            NotificationListenerRegistration<?>> listeners) {
         this.typeToListeners = ImmutableMultimap.copyOf(listeners);
     }
 
@@ -96,4 +96,4 @@ final class ListenerMapGeneration {
                 .filter(input -> !Notification.class.equals(input) && Notification.class.isAssignableFrom(input))
                 .collect(Collectors.toList());
     }
-}
\ No newline at end of file
+}
index f98c8b8..b803c96 100644 (file)
@@ -20,7 +20,8 @@ import org.opendaylight.yangtools.yang.binding.util.BindingReflections;
 import org.opendaylight.yangtools.yang.binding.util.NotificationListenerInvoker;
 import org.opendaylight.yangtools.yang.common.QName;
 
-final class NotificationInvoker implements org.opendaylight.controller.sal.binding.api.NotificationListener<Notification> {
+final class NotificationInvoker
+        implements org.opendaylight.controller.sal.binding.api.NotificationListener<Notification> {
 
     private final NotificationListener delegate;
     private final Map<Class<? extends Notification>,InvokerContext> invokers;
@@ -29,14 +30,15 @@ final class NotificationInvoker implements org.opendaylight.controller.sal.bindi
     private NotificationInvoker(final NotificationListener listener) {
         delegate = listener;
         final Map<Class<? extends Notification>, InvokerContext> builder = new HashMap<>();
-        for(final TypeToken<?> ifaceToken : TypeToken.of(listener.getClass()).getTypes().interfaces()) {
+        for (final TypeToken<?> ifaceToken : TypeToken.of(listener.getClass()).getTypes().interfaces()) {
             final Class<?> iface = ifaceToken.getRawType();
-            if(NotificationListener.class.isAssignableFrom(iface) && BindingReflections.isBindingClass(iface)) {
+            if (NotificationListener.class.isAssignableFrom(iface) && BindingReflections.isBindingClass(iface)) {
                 @SuppressWarnings("unchecked")
-                final Class<? extends NotificationListener> listenerType = (Class<? extends NotificationListener>) iface;
+                final Class<? extends NotificationListener> listenerType =
+                        (Class<? extends NotificationListener>) iface;
                 final NotificationListenerInvoker invoker = NotificationListenerInvoker.from(listenerType);
-                for(final Class<? extends Notification> type : getNotificationTypes(listenerType)) {
-                    builder.put(type, new InvokerContext(BindingReflections.findQName(type) , invoker));
+                for (final Class<? extends Notification> type : getNotificationTypes(listenerType)) {
+                    builder.put(type, new InvokerContext(BindingReflections.findQName(type), invoker));
                 }
             }
         }
@@ -61,13 +63,15 @@ final class NotificationInvoker implements org.opendaylight.controller.sal.bindi
     }
 
     @SuppressWarnings("unchecked")
-    private static Set<Class<? extends Notification>> getNotificationTypes(final Class<? extends org.opendaylight.yangtools.yang.binding.NotificationListener> type) {
+    private static Set<Class<? extends Notification>> getNotificationTypes(
+            final Class<? extends org.opendaylight.yangtools.yang.binding.NotificationListener> type) {
         // TODO: Investigate possibility and performance impact if we cache this or expose
         // it from NotificationListenerInvoker
         final Set<Class<? extends Notification>> ret = new HashSet<>();
-        for(final Method method : type.getMethods()) {
-            if(BindingReflections.isNotificationCallback(method)) {
-                final Class<? extends Notification> notification = (Class<? extends Notification>) method.getParameterTypes()[0];
+        for (final Method method : type.getMethods()) {
+            if (BindingReflections.isNotificationCallback(method)) {
+                final Class<? extends Notification> notification =
+                        (Class<? extends Notification>) method.getParameterTypes()[0];
                 ret.add(notification);
             }
         }
@@ -87,7 +91,5 @@ final class NotificationInvoker implements org.opendaylight.controller.sal.bindi
         public void invoke(final Notification notification) {
             invoker.invokeNotification(delegate, name, notification);
         }
-
     }
-
 }
index 81183c9..c6af237 100644 (file)
@@ -18,7 +18,8 @@ import org.opendaylight.yangtools.yang.binding.Notification;
  *
  * @param <T> Type of notification
  */
-interface NotificationListenerRegistration<T extends Notification> extends ListenerRegistration<NotificationListener<T>> {
+interface NotificationListenerRegistration<T extends Notification>
+        extends ListenerRegistration<NotificationListener<T>> {
     /**
      * Return the interface class of the notification type.
      *
index 82cbf08..da9cb2e 100644 (file)
@@ -64,18 +64,19 @@ public abstract class AbstractForwardedDataBroker implements Delegator<DOMDataBr
     }
 
     public ListenerRegistration<DataChangeListener> registerDataChangeListener(final LogicalDatastoreType store,
-            final InstanceIdentifier<?> path, final DataChangeListener listener, final DataChangeScope triggeringScope) {
+            final InstanceIdentifier<?> path, final DataChangeListener listener,
+            final DataChangeScope triggeringScope) {
         final DOMDataChangeListener domDataChangeListener;
 
-        if(listener instanceof ClusteredDataChangeListener) {
+        if (listener instanceof ClusteredDataChangeListener) {
             domDataChangeListener = new TranslatingClusteredDataChangeInvoker(store, path, listener, triggeringScope);
         } else {
             domDataChangeListener = new TranslatingDataChangeInvoker(store, path, listener,
                 triggeringScope);
         }
         final YangInstanceIdentifier domPath = codec.toYangInstanceIdentifierBlocking(path);
-        final ListenerRegistration<DOMDataChangeListener> domRegistration = domDataBroker.registerDataChangeListener(store,
-                domPath, domDataChangeListener, triggeringScope);
+        final ListenerRegistration<DOMDataChangeListener> domRegistration =
+                domDataBroker.registerDataChangeListener(store, domPath, domDataChangeListener, triggeringScope);
         return new ListenerRegistrationImpl(listener, domRegistration);
     }
 
@@ -85,7 +86,8 @@ public abstract class AbstractForwardedDataBroker implements Delegator<DOMDataBr
 
         for (final Map.Entry<YangInstanceIdentifier, ? extends NormalizedNode<?, ?>> entry : normalized.entrySet()) {
             try {
-                final Optional<Entry<InstanceIdentifier<? extends DataObject>, DataObject>> potential = getCodec().toBinding(entry);
+                final Optional<Entry<InstanceIdentifier<? extends DataObject>, DataObject>> potential =
+                        getCodec().toBinding(entry);
                 if (potential.isPresent()) {
                     final Entry<InstanceIdentifier<? extends DataObject>, DataObject> binding = potential.get();
                     newMap.put(binding.getKey(), binding.getValue());
@@ -102,11 +104,13 @@ public abstract class AbstractForwardedDataBroker implements Delegator<DOMDataBr
         final Set<InstanceIdentifier<?>> hashSet = new HashSet<>();
         for (final YangInstanceIdentifier normalizedPath : normalized) {
             try {
-                final Optional<InstanceIdentifier<? extends DataObject>> potential = getCodec().toBinding(normalizedPath);
+                final Optional<InstanceIdentifier<? extends DataObject>> potential =
+                        getCodec().toBinding(normalizedPath);
                 if (potential.isPresent()) {
                     final InstanceIdentifier<? extends DataObject> binding = potential.get();
                     hashSet.add(binding);
-                } else if (normalizedPath.getLastPathArgument() instanceof YangInstanceIdentifier.AugmentationIdentifier) {
+                } else if (normalizedPath.getLastPathArgument()
+                        instanceof YangInstanceIdentifier.AugmentationIdentifier) {
                     hashSet.add(path);
                 }
             } catch (final DeserializationException e) {
@@ -120,7 +124,8 @@ public abstract class AbstractForwardedDataBroker implements Delegator<DOMDataBr
         if (path.isWildcarded()) {
             return Optional.absent();
         }
-        return (Optional<DataObject>) getCodec().deserializeFunction(path).apply(Optional.<NormalizedNode<?, ?>> of(data));
+        return (Optional<DataObject>) getCodec().deserializeFunction(path)
+                .apply(Optional.<NormalizedNode<?, ?>>of(data));
     }
 
     private class TranslatingDataChangeInvoker implements DOMDataChangeListener {
@@ -129,7 +134,7 @@ public abstract class AbstractForwardedDataBroker implements Delegator<DOMDataBr
         private final InstanceIdentifier<?> path;
         private final DataChangeScope triggeringScope;
 
-        public TranslatingDataChangeInvoker(final LogicalDatastoreType store, final InstanceIdentifier<?> path,
+        TranslatingDataChangeInvoker(final LogicalDatastoreType store, final InstanceIdentifier<?> path,
                 final DataChangeListener bindingDataChangeListener, final DataChangeScope triggeringScope) {
             this.store = store;
             this.path = path;
@@ -149,15 +154,13 @@ public abstract class AbstractForwardedDataBroker implements Delegator<DOMDataBr
     }
 
     /**
-     * Translator for ClusteredDataChangeListener
+     * Translator for ClusteredDataChangeListener.
      */
-
     private class TranslatingClusteredDataChangeInvoker extends TranslatingDataChangeInvoker implements
         ClusteredDOMDataChangeListener {
 
-        public TranslatingClusteredDataChangeInvoker(final LogicalDatastoreType store, final InstanceIdentifier<?> path,
-                                                     final DataChangeListener bindingDataChangeListener,
-                                                     final DataChangeScope triggeringScope) {
+        TranslatingClusteredDataChangeInvoker(final LogicalDatastoreType store, final InstanceIdentifier<?> path,
+                final DataChangeListener bindingDataChangeListener, final DataChangeScope triggeringScope) {
             super(store, path, bindingDataChangeListener, triggeringScope);
         }
     }
@@ -173,7 +176,7 @@ public abstract class AbstractForwardedDataBroker implements Delegator<DOMDataBr
         private Optional<DataObject> originalDataCache;
         private Optional<DataObject> updatedDataCache;
 
-        public TranslatedDataChangeEvent(
+        TranslatedDataChangeEvent(
                 final AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change,
                 final InstanceIdentifier<?> path) {
             this.domEvent = change;
@@ -252,7 +255,7 @@ public abstract class AbstractForwardedDataBroker implements Delegator<DOMDataBr
     private static class ListenerRegistrationImpl extends AbstractListenerRegistration<DataChangeListener> {
         private final ListenerRegistration<DOMDataChangeListener> registration;
 
-        public ListenerRegistrationImpl(final DataChangeListener listener,
+        ListenerRegistrationImpl(final DataChangeListener listener,
                 final ListenerRegistration<DOMDataChangeListener> registration) {
             super(listener);
             this.registration = registration;
@@ -267,5 +270,4 @@ public abstract class AbstractForwardedDataBroker implements Delegator<DOMDataBr
     @Override
     public void close() {
     }
-
 }
index 1184d39..ad8b605 100644 (file)
@@ -29,7 +29,7 @@ abstract class AbstractForwardedTransaction<T extends AsyncTransaction<YangInsta
     private final T delegate;
     private final BindingToNormalizedNodeCodec codec;
 
-    public AbstractForwardedTransaction(final T delegateTx, final BindingToNormalizedNodeCodec codec) {
+    AbstractForwardedTransaction(final T delegateTx, final BindingToNormalizedNodeCodec codec) {
         this.delegate = Preconditions.checkNotNull(delegateTx, "Delegate must not be null");
         this.codec = Preconditions.checkNotNull(codec, "Codec must not be null");
     }
@@ -46,7 +46,8 @@ abstract class AbstractForwardedTransaction<T extends AsyncTransaction<YangInsta
     }
 
     @SuppressWarnings("unchecked")
-    protected final <S extends AsyncTransaction<YangInstanceIdentifier, NormalizedNode<?, ?>>> S getDelegateChecked(final Class<S> txType) {
+    protected final <S extends AsyncTransaction<YangInstanceIdentifier, NormalizedNode<?, ?>>>
+            S getDelegateChecked(final Class<S> txType) {
         Preconditions.checkState(txType.isInstance(delegate));
         return (S) delegate;
     }
index 8fbc118..c4ec8e4 100644 (file)
@@ -7,6 +7,9 @@
  */
 package org.opendaylight.controller.md.sal.binding.impl;
 
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
 import org.opendaylight.controller.md.sal.common.impl.util.compat.DataNormalizationException;
@@ -17,15 +20,12 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgum
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
 public class AbstractReadWriteTransaction extends AbstractWriteTransaction<DOMDataReadWriteTransaction> {
 
     private static final Logger LOG = LoggerFactory.getLogger(AbstractReadWriteTransaction.class);
 
-    public AbstractReadWriteTransaction(final DOMDataReadWriteTransaction delegate, final BindingToNormalizedNodeCodec codec) {
+    public AbstractReadWriteTransaction(final DOMDataReadWriteTransaction delegate,
+            final BindingToNormalizedNodeCodec codec) {
         super(delegate, codec);
     }
 
@@ -44,8 +44,8 @@ public class AbstractReadWriteTransaction extends AbstractWriteTransaction<DOMDa
                 throw new IllegalArgumentException(String.format("Invalid child encountered in path %s", path), e);
             }
             currentArguments.add(currentArg);
-            org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier currentPath = org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.create(
-                    currentArguments);
+            org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier currentPath =
+                    org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.create(currentArguments);
 
             final Boolean exists;
             try {
@@ -60,6 +60,4 @@ public class AbstractReadWriteTransaction extends AbstractWriteTransaction<DOMDa
             }
         }
     }
-
-
 }
index 1e3e419..eebd836 100644 (file)
@@ -21,9 +21,7 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
 /**
- *
- * Abstract Base Transaction for transactions which are backed by
- * {@link DOMDataWriteTransaction}
+ * Abstract Base Transaction for transactions which are backed by {@link DOMDataWriteTransaction}.
  */
 public abstract class AbstractWriteTransaction<T extends DOMDataWriteTransaction> extends
         AbstractForwardedTransaction<T> {
@@ -61,7 +59,6 @@ public abstract class AbstractWriteTransaction<T extends DOMDataWriteTransaction
     }
 
     /**
-     *
      * Ensures list parent if item is list, otherwise noop.
      *
      * <p>
@@ -83,7 +80,7 @@ public abstract class AbstractWriteTransaction<T extends DOMDataWriteTransaction
      * put("/nodes/node/node[key]",domNode);
      * </pre>
      *
-     *
+     * <p>
      * In order to allow that to be inserted if necessary, if we know
      * item is list item, we will try to merge empty MapNode or OrderedNodeMap
      * to ensure list exists.
@@ -104,6 +101,8 @@ public abstract class AbstractWriteTransaction<T extends DOMDataWriteTransaction
     }
 
     /**
+     * Deprecated.
+     *
      * @deprecated Use {@link YangInstanceIdentifier#getParent()} instead.
      */
     @Deprecated
@@ -114,10 +113,6 @@ public abstract class AbstractWriteTransaction<T extends DOMDataWriteTransaction
     /**
      * Subclasses of this class are required to implement creation of parent
      * nodes based on behaviour of their underlying transaction.
-     *
-     * @param store
-     * @param key
-     * @param path
      */
     protected abstract void ensureParentsByMerge(LogicalDatastoreType store,
             YangInstanceIdentifier key, InstanceIdentifier<?> path);
@@ -137,5 +132,4 @@ public abstract class AbstractWriteTransaction<T extends DOMDataWriteTransaction
     protected final boolean doCancel() {
         return getDelegate().cancel();
     }
-
 }
index d8afdeb..531f84a 100644 (file)
@@ -21,9 +21,8 @@ import org.opendaylight.controller.md.sal.dom.api.DOMService;
 import org.opendaylight.controller.sal.binding.api.RpcConsumerRegistry;
 
 public abstract class BindingDOMAdapterLoader extends AdapterLoader<BindingService, DOMService> {
-
-
-    private static final Map<Class<?>,BindingDOMAdapterBuilder.Factory<?>> FACTORIES = ImmutableMap.<Class<?>,BindingDOMAdapterBuilder.Factory<?>>builder()
+    private static final Map<Class<?>,BindingDOMAdapterBuilder.Factory<?>> FACTORIES =
+        ImmutableMap.<Class<?>,BindingDOMAdapterBuilder.Factory<?>>builder()
             .put(NotificationService.class,BindingDOMNotificationServiceAdapter.BUILDER_FACTORY)
             .put(NotificationPublishService.class,BindingDOMNotificationPublishServiceAdapter.BUILDER_FACTORY)
             .put(DataBroker.class,BindingDOMDataBrokerAdapter.BUILDER_FACTORY)
@@ -37,7 +36,8 @@ public abstract class BindingDOMAdapterLoader extends AdapterLoader<BindingServi
     }
 
     @Override
-    protected final AdapterBuilder<? extends BindingService, DOMService> createBuilder(final Class<? extends BindingService> key) {
+    protected final AdapterBuilder<? extends BindingService, DOMService> createBuilder(
+            final Class<? extends BindingService> key) {
         final Factory<?> factory = FACTORIES.get(key);
         Preconditions.checkArgument(factory != null, "Unsupported service type %s", key);
         final BindingDOMAdapterBuilder<?> builder = factory.newBuilder();
index c78db4b..7b4c549 100644 (file)
@@ -7,7 +7,6 @@
  */
 package org.opendaylight.controller.md.sal.binding.impl;
 
-
 import com.google.common.collect.ClassToInstanceMap;
 import com.google.common.collect.ImmutableSet;
 import java.util.Set;
@@ -32,21 +31,20 @@ import org.opendaylight.yangtools.yang.binding.DataObject;
  * All transactions and listener registrations are wrapped by the DataBrokerImpl
  * to allow binding aware components to use the DataBroker transparently.
  *
+ * <p>
  * Besides this the DataBrokerImpl and it's collaborators also cache data that
  * is already transformed from the binding independent to binding aware format
- *
-
  */
-public class BindingDOMDataBrokerAdapter extends AbstractForwardedDataBroker implements DataBroker, DataTreeChangeService {
-
-
+public class BindingDOMDataBrokerAdapter extends AbstractForwardedDataBroker
+        implements DataBroker, DataTreeChangeService {
     static final Factory<DataBroker> BUILDER_FACTORY = Builder::new;
     private final DataTreeChangeService treeChangeService;
 
     public BindingDOMDataBrokerAdapter(final DOMDataBroker domDataBroker, final BindingToNormalizedNodeCodec codec) {
         super(domDataBroker, codec);
-        final DOMDataTreeChangeService domTreeChange = (DOMDataTreeChangeService) domDataBroker.getSupportedExtensions().get(DOMDataTreeChangeService.class);
-        if(domTreeChange != null) {
+        final DOMDataTreeChangeService domTreeChange = (DOMDataTreeChangeService) domDataBroker
+                .getSupportedExtensions().get(DOMDataTreeChangeService.class);
+        if (domTreeChange != null) {
             treeChangeService = BindingDOMDataTreeChangeServiceAdapter.create(codec, domTreeChange);
         } else {
             treeChangeService = null;
@@ -96,12 +94,11 @@ public class BindingDOMDataBrokerAdapter extends AbstractForwardedDataBroker imp
     }
 
     @Override
-    public <T extends DataObject, L extends DataTreeChangeListener<T>> ListenerRegistration<L> registerDataTreeChangeListener(
-            final DataTreeIdentifier<T> treeId, final L listener) {
-        if(treeChangeService == null) {
+    public <T extends DataObject, L extends DataTreeChangeListener<T>> ListenerRegistration<L>
+            registerDataTreeChangeListener(final DataTreeIdentifier<T> treeId, final L listener) {
+        if (treeChangeService == null) {
             throw new UnsupportedOperationException("Underlying data broker does not expose DOMDataTreeChangeService.");
         }
         return treeChangeService.registerDataTreeChangeListener(treeId, listener);
     }
-
 }
index e0cd69b..fa748f9 100644 (file)
@@ -28,8 +28,8 @@ class BindingDOMDataTreeChangeListenerAdapter<T extends DataObject> implements D
     private final DataTreeChangeListener<T> listener;
     private final LogicalDatastoreType store;
 
-    BindingDOMDataTreeChangeListenerAdapter(final BindingToNormalizedNodeCodec codec, final DataTreeChangeListener<T> listener,
-            final LogicalDatastoreType store) {
+    BindingDOMDataTreeChangeListenerAdapter(final BindingToNormalizedNodeCodec codec,
+            final DataTreeChangeListener<T> listener, final LogicalDatastoreType store) {
         this.codec = Preconditions.checkNotNull(codec);
         this.listener = Preconditions.checkNotNull(listener);
         this.store = Preconditions.checkNotNull(store);
@@ -37,7 +37,8 @@ class BindingDOMDataTreeChangeListenerAdapter<T extends DataObject> implements D
 
     @Override
     public void onDataTreeChanged(final Collection<DataTreeCandidate> domChanges) {
-        final Collection<DataTreeModification<T>> bindingChanges = LazyDataTreeModification.from(codec, domChanges, store);
+        final Collection<DataTreeModification<T>> bindingChanges =
+                LazyDataTreeModification.from(codec, domChanges, store);
         listener.onDataTreeChanged(bindingChanges);
     }
 
index 28ca144..13b09d1 100644 (file)
@@ -20,12 +20,12 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 
 
 /**
- *
  * Adapter exposing Binding {@link DataTreeChangeService} and wrapping
  * {@link DOMDataTreeChangeService} and is responsible for translation
  * and instantiation of {@link BindingDOMDataTreeChangeListenerAdapter}
  * adapters.
  *
+ * <p>
  * Each registered {@link DataTreeChangeListener} is wrapped using
  * adapter and registered directly to DOM service.
  */
@@ -46,16 +46,16 @@ final class BindingDOMDataTreeChangeServiceAdapter implements DataTreeChangeServ
     }
 
     @Override
-    public <T extends DataObject, L extends DataTreeChangeListener<T>> ListenerRegistration<L> registerDataTreeChangeListener(
-            final DataTreeIdentifier<T> treeId, final L listener) {
+    public <T extends DataObject, L extends DataTreeChangeListener<T>> ListenerRegistration<L>
+            registerDataTreeChangeListener(final DataTreeIdentifier<T> treeId, final L listener) {
         final DOMDataTreeIdentifier domIdentifier = toDomTreeIdentifier(treeId);
 
         @SuppressWarnings({ "rawtypes", "unchecked" })
         final BindingDOMDataTreeChangeListenerAdapter<T> domListener =
-                listener instanceof ClusteredDataTreeChangeListener ?
-                        new BindingClusteredDOMDataTreeChangeListenerAdapter<>(
-                                codec, (ClusteredDataTreeChangeListener) listener, treeId.getDatastoreType()) :
-                        new BindingDOMDataTreeChangeListenerAdapter<>(codec, listener, treeId.getDatastoreType());
+                listener instanceof ClusteredDataTreeChangeListener
+                        new BindingClusteredDOMDataTreeChangeListenerAdapter<>(
+                                codec, (ClusteredDataTreeChangeListener) listener, treeId.getDatastoreType())
+                        new BindingDOMDataTreeChangeListenerAdapter<>(codec, listener, treeId.getDatastoreType());
 
         final ListenerRegistration<BindingDOMDataTreeChangeListenerAdapter<T>> domReg =
                 dataTreeChangeService.registerDataTreeChangeListener(domIdentifier, domListener);
index f331482..6861ff9 100644 (file)
@@ -17,13 +17,15 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.impl.codec.DeserializationException;
 
-final class BindingDOMMountPointListenerAdapter<T extends MountPointListener> implements ListenerRegistration<T>, MountProvisionListener {
+final class BindingDOMMountPointListenerAdapter<T extends MountPointListener>
+        implements ListenerRegistration<T>, MountProvisionListener {
 
     private final T listener;
     private final ListenerRegistration<MountProvisionListener> registration;
     private final BindingToNormalizedNodeCodec codec;
 
-    public BindingDOMMountPointListenerAdapter(final T listener, final BindingToNormalizedNodeCodec codec, final DOMMountPointService mountService) {
+    BindingDOMMountPointListenerAdapter(final T listener, final BindingToNormalizedNodeCodec codec,
+            final DOMMountPointService mountService) {
         this.listener = listener;
         this.codec = codec;
         this.registration = mountService.registerProvisionListener(this);
@@ -45,14 +47,16 @@ final class BindingDOMMountPointListenerAdapter<T extends MountPointListener> im
             final InstanceIdentifier<? extends DataObject> bindingPath = toBinding(path);
             listener.onMountPointCreated(bindingPath);
         } catch (final DeserializationException e) {
-            BindingDOMMountPointServiceAdapter.LOG.error("Unable to translate mountPoint path {}. Omitting event.",path,e);
+            BindingDOMMountPointServiceAdapter.LOG.error("Unable to translate mountPoint path {}. Omitting event.",
+                    path, e);
         }
 
     }
 
-    private InstanceIdentifier<? extends DataObject> toBinding(final YangInstanceIdentifier path) throws DeserializationException {
+    private InstanceIdentifier<? extends DataObject> toBinding(final YangInstanceIdentifier path)
+            throws DeserializationException {
         final Optional<InstanceIdentifier<? extends DataObject>> instanceIdentifierOptional = codec.toBinding(path);
-        if(instanceIdentifierOptional.isPresent()) {
+        if (instanceIdentifierOptional.isPresent()) {
             return instanceIdentifierOptional.get();
         } else {
             throw new DeserializationException("Deserialization unsuccessful, " + instanceIdentifierOptional);
@@ -65,7 +69,8 @@ final class BindingDOMMountPointListenerAdapter<T extends MountPointListener> im
             final InstanceIdentifier<? extends DataObject> bindingPath = toBinding(path);
             listener.onMountPointRemoved(bindingPath);
         } catch (final DeserializationException e) {
-            BindingDOMMountPointServiceAdapter.LOG.error("Unable to translate mountPoint path {}. Omitting event.",path,e);
+            BindingDOMMountPointServiceAdapter.LOG.error("Unable to translate mountPoint path {}. Omitting event.",
+                    path, e);
         }
     }
-}
\ No newline at end of file
+}
index 8b88f0f..174f973 100644 (file)
@@ -21,9 +21,7 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-
 public class BindingDOMMountPointServiceAdapter implements MountPointService {
-
     public static final Logger LOG = LoggerFactory.getLogger(BindingDOMMountPointServiceAdapter.class);
 
     private final BindingToNormalizedNodeCodec codec;
@@ -47,7 +45,7 @@ public class BindingDOMMountPointServiceAdapter implements MountPointService {
 
         YangInstanceIdentifier domPath = codec.toYangInstanceIdentifierBlocking(mountPoint);
         Optional<DOMMountPoint> domMount = mountService.getMountPoint(domPath);
-        if(domMount.isPresent()) {
+        if (domMount.isPresent()) {
             return Optional.<MountPoint>fromNullable(bindingMountpoints.getUnchecked(domMount.get()));
         }
         return Optional.absent();
@@ -58,5 +56,4 @@ public class BindingDOMMountPointServiceAdapter implements MountPointService {
             T listener) {
         return new BindingDOMMountPointListenerAdapter<>(listener, codec, mountService);
     }
-
 }
index e6414c4..744c1c8 100644 (file)
@@ -31,7 +31,8 @@ class BindingDOMNotificationListenerAdapter implements DOMNotificationListener {
     private final NotificationListener delegate;
     private final Map<SchemaPath,NotificationListenerInvoker> invokers;
 
-    public BindingDOMNotificationListenerAdapter(final BindingNormalizedNodeSerializer codec, final NotificationListener delegate) {
+    BindingDOMNotificationListenerAdapter(final BindingNormalizedNodeSerializer codec,
+            final NotificationListener delegate) {
         this.codec = codec;
         this.delegate = delegate;
         this.invokers = createInvokerMapFor(delegate.getClass());
@@ -45,7 +46,7 @@ class BindingDOMNotificationListenerAdapter implements DOMNotificationListener {
     }
 
     private Notification deserialize(final DOMNotification notification) {
-        if(notification instanceof LazySerializedDOMNotification) {
+        if (notification instanceof LazySerializedDOMNotification) {
             return ((LazySerializedDOMNotification) notification).getBindingData();
         }
         return codec.fromNormalizedNodeNotification(notification.getType(), notification.getBody());
@@ -59,15 +60,17 @@ class BindingDOMNotificationListenerAdapter implements DOMNotificationListener {
         return invokers.keySet();
     }
 
-    public static Map<SchemaPath, NotificationListenerInvoker> createInvokerMapFor(final Class<? extends NotificationListener> implClz) {
+    public static Map<SchemaPath, NotificationListenerInvoker> createInvokerMapFor(
+            final Class<? extends NotificationListener> implClz) {
         final Map<SchemaPath, NotificationListenerInvoker> builder = new HashMap<>();
-        for(final TypeToken<?> ifaceToken : TypeToken.of(implClz).getTypes().interfaces()) {
+        for (final TypeToken<?> ifaceToken : TypeToken.of(implClz).getTypes().interfaces()) {
             Class<?> iface = ifaceToken.getRawType();
-            if(NotificationListener.class.isAssignableFrom(iface) && BindingReflections.isBindingClass(iface)) {
+            if (NotificationListener.class.isAssignableFrom(iface) && BindingReflections.isBindingClass(iface)) {
                 @SuppressWarnings("unchecked")
-                final Class<? extends NotificationListener> listenerType = (Class<? extends NotificationListener>) iface;
+                final Class<? extends NotificationListener> listenerType =
+                        (Class<? extends NotificationListener>) iface;
                 final NotificationListenerInvoker invoker = NotificationListenerInvoker.from(listenerType);
-                for(final SchemaPath path : getNotificationTypes(listenerType)) {
+                for (final SchemaPath path : getNotificationTypes(listenerType)) {
                     builder.put(path, invoker);
                 }
             }
@@ -79,8 +82,8 @@ class BindingDOMNotificationListenerAdapter implements DOMNotificationListener {
         // TODO: Investigate possibility and performance impact if we cache this or expose
         // it from NotificationListenerInvoker
         final Set<SchemaPath> ret = new HashSet<>();
-        for(final Method method : type.getMethods()) {
-            if(BindingReflections.isNotificationCallback(method)) {
+        for (final Method method : type.getMethods()) {
+            if (BindingReflections.isNotificationCallback(method)) {
                 final Class<?> notification = method.getParameterTypes()[0];
                 final QName name = BindingReflections.findQName(notification);
                 ret.add(SchemaPath.create(true, name));
index 6f7e9e2..ae3b5d5 100644 (file)
@@ -26,7 +26,8 @@ public class BindingDOMNotificationPublishServiceAdapter implements Notification
     private final BindingToNormalizedNodeCodec codecRegistry;
     private final DOMNotificationPublishService domPublishService;
 
-    public BindingDOMNotificationPublishServiceAdapter(final BindingToNormalizedNodeCodec codec, final DOMNotificationPublishService domPublishService) {
+    public BindingDOMNotificationPublishServiceAdapter(final BindingToNormalizedNodeCodec codec,
+            final DOMNotificationPublishService domPublishService) {
         this.codecRegistry = codec;
         this.domPublishService = domPublishService;
     }
@@ -53,8 +54,10 @@ public class BindingDOMNotificationPublishServiceAdapter implements Notification
     }
 
     @Override
-    public ListenableFuture<?> offerNotification(final Notification notification, final int timeout, final TimeUnit unit) throws InterruptedException {
-        ListenableFuture<?> offerResult = domPublishService.offerNotification(toDomNotification(notification), timeout, unit);
+    public ListenableFuture<?> offerNotification(final Notification notification, final int timeout,
+            final TimeUnit unit) throws InterruptedException {
+        ListenableFuture<?> offerResult = domPublishService.offerNotification(toDomNotification(notification),
+                timeout, unit);
         return DOMNotificationPublishService.REJECTED.equals(offerResult)
                 ? NotificationPublishService.REJECTED
                 : offerResult;
@@ -82,6 +85,5 @@ public class BindingDOMNotificationPublishServiceAdapter implements Notification
             final DOMNotificationPublishService domPublish = delegates.getInstance(DOMNotificationPublishService.class);
             return new BindingDOMNotificationPublishServiceAdapter(codec, domPublish);
         }
-
     }
 }
index 78a22f8..64ccef3 100644 (file)
@@ -25,14 +25,16 @@ public class BindingDOMNotificationServiceAdapter implements NotificationService
     private final BindingNormalizedNodeSerializer codec;
     private final DOMNotificationService domNotifService;
 
-    public BindingDOMNotificationServiceAdapter(final BindingNormalizedNodeSerializer codec, final DOMNotificationService domNotifService) {
+    public BindingDOMNotificationServiceAdapter(final BindingNormalizedNodeSerializer codec,
+            final DOMNotificationService domNotifService) {
         this.codec = codec;
         this.domNotifService = domNotifService;
     }
 
     @Override
     public <T extends NotificationListener> ListenerRegistration<T> registerNotificationListener(final T listener) {
-        final BindingDOMNotificationListenerAdapter domListener = new BindingDOMNotificationListenerAdapter(codec, listener);
+        final BindingDOMNotificationListenerAdapter domListener =
+                new BindingDOMNotificationListenerAdapter(codec, listener);
         final ListenerRegistration<BindingDOMNotificationListenerAdapter> domRegistration =
                 domNotifService.registerNotificationListener(domListener, domListener.getSupportedNotifications());
         return new ListenerRegistrationImpl<>(listener, domRegistration);
@@ -43,10 +45,11 @@ public class BindingDOMNotificationServiceAdapter implements NotificationService
 
     }
 
-    private static class ListenerRegistrationImpl<T extends NotificationListener> extends AbstractListenerRegistration<T> {
+    private static class ListenerRegistrationImpl<T extends NotificationListener>
+            extends AbstractListenerRegistration<T> {
         private final ListenerRegistration<?> listenerRegistration;
 
-        public ListenerRegistrationImpl(final T listener, final ListenerRegistration<?> listenerRegistration) {
+        ListenerRegistrationImpl(final T listener, final ListenerRegistration<?> listenerRegistration) {
             super(listener);
             this.listenerRegistration = listenerRegistration;
         }
index 0e8a043..1d69322 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.controller.md.sal.binding.impl;
 
+import com.google.common.base.Optional;
+import com.google.common.util.concurrent.CheckedFuture;
 import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
@@ -14,9 +16,6 @@ import org.opendaylight.controller.md.sal.dom.api.DOMDataReadOnlyTransaction;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
-import com.google.common.base.Optional;
-import com.google.common.util.concurrent.CheckedFuture;
-
 class BindingDOMReadTransactionAdapter extends AbstractForwardedTransaction<DOMDataReadOnlyTransaction> implements
         ReadOnlyTransaction {
 
@@ -35,5 +34,4 @@ class BindingDOMReadTransactionAdapter extends AbstractForwardedTransaction<DOMD
     public void close() {
         getDelegate().close();
     }
-
-}
\ No newline at end of file
+}
index e9c4efa..bebed4d 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.controller.md.sal.binding.impl;
 
+import com.google.common.base.Optional;
+import com.google.common.util.concurrent.CheckedFuture;
 import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
@@ -14,9 +16,6 @@ import org.opendaylight.controller.md.sal.dom.api.DOMDataReadWriteTransaction;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
-import com.google.common.base.Optional;
-import com.google.common.util.concurrent.CheckedFuture;
-
 class BindingDOMReadWriteTransactionAdapter extends
         BindingDOMWriteTransactionAdapter<DOMDataReadWriteTransaction> implements ReadWriteTransaction {
 
@@ -30,4 +29,4 @@ class BindingDOMReadWriteTransactionAdapter extends
             final LogicalDatastoreType store, final InstanceIdentifier<T> path) {
         return doRead(getDelegate(), store, path);
     }
-}
\ No newline at end of file
+}
index c971fc6..fa45b8e 100644 (file)
@@ -11,11 +11,11 @@ import org.opendaylight.controller.md.sal.dom.api.DOMRpcImplementationRegistrati
 import org.opendaylight.yangtools.concepts.AbstractObjectRegistration;
 import org.opendaylight.yangtools.yang.binding.RpcService;
 
-class BindingDOMRpcAdapterRegistration<T extends RpcService> extends AbstractObjectRegistration<T>{
+class BindingDOMRpcAdapterRegistration<T extends RpcService> extends AbstractObjectRegistration<T> {
 
     private final DOMRpcImplementationRegistration<?> reg;
 
-    public BindingDOMRpcAdapterRegistration(T instance, DOMRpcImplementationRegistration<?> reg) {
+    BindingDOMRpcAdapterRegistration(T instance, DOMRpcImplementationRegistration<?> reg) {
         super(instance);
         this.reg = reg;
     }
index e67fba8..1554f11 100644 (file)
@@ -36,14 +36,16 @@ import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 
 public class BindingDOMRpcImplementationAdapter implements DOMRpcImplementation {
 
-    private static final Cache<Class<?>, RpcServiceInvoker> SERVICE_INVOKERS = CacheBuilder.newBuilder().weakKeys().build();
+    private static final Cache<Class<?>, RpcServiceInvoker> SERVICE_INVOKERS =
+            CacheBuilder.newBuilder().weakKeys().build();
 
     private final BindingNormalizedNodeSerializer codec;
     private final RpcServiceInvoker invoker;
     private final RpcService delegate;
     private final QName inputQname;
 
-    <T extends RpcService> BindingDOMRpcImplementationAdapter(final BindingNormalizedNodeSerializer codec, final Class<T> type, final Map<SchemaPath, Method> localNameToMethod, final T delegate) {
+    <T extends RpcService> BindingDOMRpcImplementationAdapter(final BindingNormalizedNodeSerializer codec,
+            final Class<T> type, final Map<SchemaPath, Method> localNameToMethod, final T delegate) {
         try {
             this.invoker = SERVICE_INVOKERS.get(type, () -> {
                 final Map<QName, Method> map = new HashMap<>();
@@ -64,7 +66,8 @@ public class BindingDOMRpcImplementationAdapter implements DOMRpcImplementation
 
     @Nonnull
     @Override
-    public CheckedFuture<DOMRpcResult, DOMRpcException> invokeRpc(@Nonnull final DOMRpcIdentifier rpc, final NormalizedNode<?, ?> input) {
+    public CheckedFuture<DOMRpcResult, DOMRpcException> invokeRpc(@Nonnull final DOMRpcIdentifier rpc,
+            final NormalizedNode<?, ?> input) {
         final SchemaPath schemaPath = rpc.getType();
         final DataObject bindingInput = input != null ? deserialize(rpc.getType(), input) : null;
         final ListenableFuture<RpcResult<?>> bindingResult = invoke(schemaPath, bindingInput);
@@ -83,7 +86,8 @@ public class BindingDOMRpcImplementationAdapter implements DOMRpcImplementation
         return JdkFutureAdapters.listenInPoolThread(invoker.invokeRpc(delegate, schemaPath.getLastComponent(), input));
     }
 
-    private CheckedFuture<DOMRpcResult, DOMRpcException> transformResult(final ListenableFuture<RpcResult<?>> bindingResult) {
+    private CheckedFuture<DOMRpcResult, DOMRpcException> transformResult(
+            final ListenableFuture<RpcResult<?>> bindingResult) {
         return LazyDOMRpcResultFuture.create(codec, bindingResult);
     }
 
index 1232035..252a17f 100644 (file)
@@ -29,7 +29,8 @@ public class BindingDOMRpcProviderServiceAdapter {
     private final BindingToNormalizedNodeCodec codec;
     private final DOMRpcProviderService domRpcRegistry;
 
-    public BindingDOMRpcProviderServiceAdapter(final DOMRpcProviderService domRpcRegistry, final BindingToNormalizedNodeCodec codec) {
+    public BindingDOMRpcProviderServiceAdapter(final DOMRpcProviderService domRpcRegistry,
+            final BindingToNormalizedNodeCodec codec) {
         this.codec = codec;
         this.domRpcRegistry = domRpcRegistry;
     }
@@ -44,16 +45,19 @@ public class BindingDOMRpcProviderServiceAdapter {
         return register(type, implementation, toYangInstanceIdentifiers(paths));
     }
 
-    private <S extends RpcService, T extends S> ObjectRegistration<T> register(final Class<S> type, final T implementation, final Collection<YangInstanceIdentifier> rpcContextPaths) {
+    private <S extends RpcService, T extends S> ObjectRegistration<T> register(final Class<S> type,
+            final T implementation, final Collection<YangInstanceIdentifier> rpcContextPaths) {
         final Map<SchemaPath, Method> rpcs = codec.getRpcMethodToSchemaPath(type).inverse();
 
-        final BindingDOMRpcImplementationAdapter adapter = new BindingDOMRpcImplementationAdapter(codec.getCodecRegistry(), type, rpcs, implementation);
+        final BindingDOMRpcImplementationAdapter adapter = new BindingDOMRpcImplementationAdapter(
+                codec.getCodecRegistry(), type, rpcs, implementation);
         final Set<DOMRpcIdentifier> domRpcs = createDomRpcIdentifiers(rpcs.keySet(), rpcContextPaths);
         final DOMRpcImplementationRegistration<?> domReg = domRpcRegistry.registerRpcImplementation(adapter, domRpcs);
         return new BindingRpcAdapterRegistration<>(implementation, domReg);
     }
 
-    private static Set<DOMRpcIdentifier> createDomRpcIdentifiers(final Set<SchemaPath> rpcs, final Collection<YangInstanceIdentifier> paths) {
+    private static Set<DOMRpcIdentifier> createDomRpcIdentifiers(final Set<SchemaPath> rpcs,
+            final Collection<YangInstanceIdentifier> paths) {
         final Set<DOMRpcIdentifier> ret = new HashSet<>();
         for (final YangInstanceIdentifier path : paths) {
             for (final SchemaPath rpc : rpcs) {
index 4dc55d2..7955dcd 100644 (file)
@@ -11,6 +11,7 @@ import com.google.common.base.Preconditions;
 import com.google.common.util.concurrent.CheckedFuture;
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.MoreExecutors;
 import org.opendaylight.controller.md.sal.binding.api.BindingTransactionChain;
 import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
 import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
@@ -37,7 +38,7 @@ final class BindingDOMTransactionChainAdapter implements BindingTransactionChain
     private final DelegateChainListener domListener;
     private final TransactionChainListener bindingListener;
 
-    public BindingDOMTransactionChainAdapter(final DOMDataBroker chainFactory,
+    BindingDOMTransactionChainAdapter(final DOMDataBroker chainFactory,
             final BindingToNormalizedNodeCodec codec, final TransactionChainListener listener) {
         Preconditions.checkNotNull(chainFactory, "DOM Transaction chain factory must not be null");
         this.domListener = new DelegateChainListener();
@@ -87,27 +88,27 @@ final class BindingDOMTransactionChainAdapter implements BindingTransactionChain
             final WriteTransaction tx, final CheckedFuture<Void, TransactionCommitFailedException> future) {
         Futures.addCallback(future, new FutureCallback<Void>() {
             @Override
-            public void onFailure(final Throwable t) {
-                failTransactionChain(tx,t);
+            public void onFailure(final Throwable ex) {
+                failTransactionChain(tx,ex);
             }
 
             @Override
             public void onSuccess(final Void result) {
                 // Intentionally NOOP
             }
-        });
+        }, MoreExecutors.directExecutor());
 
         return future;
     }
 
-    private void failTransactionChain(final WriteTransaction tx, final Throwable t) {
+    private void failTransactionChain(final WriteTransaction tx, final Throwable ex) {
         /*
          *  We asume correct state change for underlaying transaction
          *
          * chain, so we are not changing any of our internal state
          * to mark that we failed.
          */
-        this.bindingListener.onTransactionChainFailed(this, tx, t);
+        this.bindingListener.onTransactionChainFailed(this, tx, ex);
     }
 
     @Override
index c0a7154..6540ad9 100644 (file)
@@ -7,9 +7,10 @@
  */
 package org.opendaylight.controller.md.sal.binding.impl;
 
+import com.google.common.util.concurrent.CheckedFuture;
+import com.google.common.util.concurrent.ListenableFuture;
 import java.util.ArrayList;
 import java.util.List;
-
 import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
 import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
@@ -24,9 +25,6 @@ import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
 
-import com.google.common.util.concurrent.CheckedFuture;
-import com.google.common.util.concurrent.ListenableFuture;
-
 class BindingDOMWriteTransactionAdapter<T extends DOMDataWriteTransaction> extends
         AbstractWriteTransaction<T> implements WriteTransaction {
 
@@ -49,7 +47,8 @@ class BindingDOMWriteTransactionAdapter<T extends DOMDataWriteTransaction> exten
 
     @Override
     protected void ensureParentsByMerge(final LogicalDatastoreType store,
-            final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier normalizedPath, final InstanceIdentifier<?> path) {
+            final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier normalizedPath,
+            final InstanceIdentifier<?> path) {
         List<PathArgument> currentArguments = new ArrayList<>();
         DataNormalizationOperation<?> currentOp = getCodec().getDataNormalizer().getRootOperation();
         for (PathArgument currentArg : normalizedPath.getPathArguments()) {
@@ -68,7 +67,7 @@ class BindingDOMWriteTransactionAdapter<T extends DOMDataWriteTransaction> exten
 
     @Override
     public void delete(final LogicalDatastoreType store, final InstanceIdentifier<?> path) {
-        doDelete( store, path);
+        doDelete(store, path);
     }
 
     @Override
@@ -85,4 +84,4 @@ class BindingDOMWriteTransactionAdapter<T extends DOMDataWriteTransaction> exten
     public boolean cancel() {
         return doCancel();
     }
-}
\ No newline at end of file
+}
index 8a92e5f..c176e2d 100644 (file)
@@ -12,7 +12,8 @@ import org.opendaylight.controller.md.sal.binding.api.DataTreeChangeListener;
 import org.opendaylight.yangtools.concepts.AbstractListenerRegistration;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 
-class BindingDataTreeChangeListenerRegistration<L extends DataTreeChangeListener<?>> extends AbstractListenerRegistration<L> {
+class BindingDataTreeChangeListenerRegistration<L extends DataTreeChangeListener<?>>
+        extends AbstractListenerRegistration<L> {
 
     private final ListenerRegistration<?> domReg;
 
index 372771f..ebcfcc6 100644 (file)
@@ -40,7 +40,7 @@ public class BindingMountPointAdapter implements MountPoint {
     @Override
     public <T extends BindingService> Optional<T> getService(Class<T> service) {
         Optional<BindingService> potential = services.getUnchecked(service);
-        if(potential.isPresent()) {
+        if (potential.isPresent()) {
             return Optional.of(service.cast(potential.get()));
         }
         return Optional.absent();
index 5fade2c..7285d9c 100644 (file)
@@ -11,11 +11,11 @@ import org.opendaylight.controller.md.sal.dom.api.DOMRpcImplementationRegistrati
 import org.opendaylight.yangtools.concepts.AbstractObjectRegistration;
 import org.opendaylight.yangtools.yang.binding.RpcService;
 
-class BindingRpcAdapterRegistration<T extends RpcService> extends AbstractObjectRegistration<T>{
+class BindingRpcAdapterRegistration<T extends RpcService> extends AbstractObjectRegistration<T> {
 
     private final DOMRpcImplementationRegistration<?> reg;
 
-    public BindingRpcAdapterRegistration(T instance, DOMRpcImplementationRegistration<?> reg) {
+    BindingRpcAdapterRegistration(T instance, DOMRpcImplementationRegistration<?> reg) {
         super(instance);
         this.reg = reg;
     }
index 2d4d9b8..e341a04 100644 (file)
@@ -137,6 +137,7 @@ public class BindingToNormalizedNodeCodec
     /**
      * Converts Binding Map.Entry to DOM Map.Entry
      *
+     * <p>
      * Same as {@link #toNormalizedNode(InstanceIdentifier, DataObject)}.
      *
      * @param binding Map Entry with InstanceIdentifier as key and DataObject as value.
@@ -180,11 +181,15 @@ public class BindingToNormalizedNodeCodec
         return this.codecRegistry.toNormalizedNodeRpcData(data);
     }
 
+    public DataNormalizer getDataNormalizer() {
+        return this.legacyToNormalized;
+    }
+
     /**
-     *
      * Returns a Binding-Aware instance identifier from normalized
      * instance-identifier if it is possible to create representation.
      *
+     * <p>
      * Returns Optional.absent for cases where target is mixin node except
      * augmentation.
      *
@@ -199,10 +204,6 @@ public class BindingToNormalizedNodeCodec
         }
     }
 
-    public DataNormalizer getDataNormalizer() {
-        return this.legacyToNormalized;
-    }
-
     public Optional<Entry<InstanceIdentifier<? extends DataObject>, DataObject>> toBinding(
             @Nonnull final Entry<YangInstanceIdentifier, ? extends NormalizedNode<?, ?>> normalized)
             throws DeserializationException {
@@ -315,14 +316,14 @@ public class BindingToNormalizedNodeCodec
         return module;
     }
 
-    private void waitForSchema(final Collection<Class<?>> binding, final MissingSchemaException e) {
+    private void waitForSchema(final Collection<Class<?>> binding, final MissingSchemaException ex) {
         LOG.warn("Blocking thread to wait for schema convergence updates for {} {}", this.futureSchema.getDuration(),
                 this.futureSchema.getUnit());
         if (this.futureSchema.waitForSchema(binding)) {
             return;
         }
 
-        throw e;
+        throw ex;
     }
 
     private Method findRpcMethod(final Class<? extends RpcService> key, final RpcDefinition rpcDef)
index 97fcc07..f24eda2 100644 (file)
@@ -20,11 +20,14 @@ import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
  *
  * @author Thomas Pantelis
  */
-public class BindingToNormalizedNodeCodecFactory {
+public final class BindingToNormalizedNodeCodecFactory {
+    private BindingToNormalizedNodeCodecFactory() {
+    }
+
     /**
      * Creates a new BindingToNormalizedNodeCodec instance.
      *
-     * @param classLoadingStrategy
+     * @param classLoadingStrategy the ClassLoadingStrategy
      * @return the BindingToNormalizedNodeCodec instance
      */
     public static BindingToNormalizedNodeCodec newInstance(final ClassLoadingStrategy classLoadingStrategy) {
@@ -40,8 +43,8 @@ public class BindingToNormalizedNodeCodecFactory {
      * @param schemaService the SchemaService.
      * @return the ListenerRegistration
      */
-    public static ListenerRegistration<SchemaContextListener> registerInstance(final BindingToNormalizedNodeCodec instance,
-            final DOMSchemaService schemaService) {
+    public static ListenerRegistration<SchemaContextListener> registerInstance(
+            final BindingToNormalizedNodeCodec instance, final DOMSchemaService schemaService) {
         return schemaService.registerSchemaContextListener(instance);
     }
 }
index 84f1244..a639bb9 100644 (file)
@@ -20,9 +20,7 @@ import org.opendaylight.yangtools.yang.binding.annotations.RoutingContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-
 abstract class ContextReferenceExtractor {
-
     private static final Logger LOG = LoggerFactory.getLogger(ContextReferenceExtractor.class);
     private static final ContextReferenceExtractor NULL_EXTRACTOR = new ContextReferenceExtractor() {
 
@@ -32,7 +30,6 @@ abstract class ContextReferenceExtractor {
         }
     };
 
-
     private static final LoadingCache<Class<?>, ContextReferenceExtractor> EXTRACTORS = CacheBuilder.newBuilder()
             .weakKeys().build(new CacheLoader<Class<?>, ContextReferenceExtractor>() {
 
@@ -53,11 +50,10 @@ abstract class ContextReferenceExtractor {
      * Extract context-reference (Instance Identifier) from
      * Binding DataObject.
      *
-     * @param obj DataObject from which context reference
-     * should be extracted.
+     * @param obj DataObject from which context reference should be extracted.
      *
-     * @return Instance Identifier representing context reference
-     * or null, if data object does not contain context reference.
+     * @return Instance Identifier representing context reference or null, if data object does not contain
+     *     context reference.
      */
     abstract @Nullable InstanceIdentifier<?> extract(DataObject obj);
 
@@ -88,7 +84,7 @@ abstract class ContextReferenceExtractor {
     private static Method findGetValueMethod(final Class<?> type, final Class<?> returnType) {
         try {
             final Method method = type.getMethod(GET_VALUE_NAME);
-            if(returnType.equals(method.getReturnType())) {
+            if (returnType.equals(method.getReturnType())) {
                 return method;
             }
         } catch (final NoSuchMethodException e) {
@@ -105,7 +101,4 @@ abstract class ContextReferenceExtractor {
         }
         return null;
     }
-
-
-
 }
index 599dfcc..cb02bfd 100644 (file)
@@ -19,25 +19,25 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
 final class DirectGetterRouteContextExtractor extends ContextReferenceExtractor {
 
-    private final static Lookup PUBLIC_LOOKUP = MethodHandles.publicLookup();
+    private static final Lookup PUBLIC_LOOKUP = MethodHandles.publicLookup();
     private final MethodHandle handle;
 
     private DirectGetterRouteContextExtractor(final MethodHandle rawHandle) {
         handle = rawHandle.asType(MethodType.methodType(InstanceIdentifier.class, DataObject.class));
     }
 
-    static final ContextReferenceExtractor create(final Method getterMethod) throws IllegalAccessException {
+    static ContextReferenceExtractor create(final Method getterMethod) throws IllegalAccessException {
         final MethodHandle getterHandle = PUBLIC_LOOKUP.unreflect(getterMethod);
         return new DirectGetterRouteContextExtractor(getterHandle);
     }
 
     @Override
+    @SuppressWarnings("checkstyle:IllegalCatch")
     InstanceIdentifier<?> extract(final DataObject obj) {
         try {
             return (InstanceIdentifier<?>) handle.invokeExact(obj);
-        } catch (final Throwable e) {
+        } catch (Throwable e) {
             throw Throwables.propagate(e);
         }
     }
-
 }
index 0c316e8..0c37839 100644 (file)
@@ -25,7 +25,7 @@ import org.opendaylight.yangtools.yang.common.QNameModule;
 
 class FutureSchema implements AutoCloseable {
 
-    @GuardedBy(value="postponedOperations")
+    @GuardedBy(value = "postponedOperations")
     private final Set<FutureSchemaPredicate> postponedOperations = new LinkedHashSet<>();
     private final long duration;
     private final TimeUnit unit;
@@ -40,11 +40,11 @@ class FutureSchema implements AutoCloseable {
 
     BindingRuntimeContext runtimeContext() {
         final BindingRuntimeContext localRuntimeContext = this.runtimeContext;
-        if(localRuntimeContext != null) {
+        if (localRuntimeContext != null) {
             return localRuntimeContext;
         }
 
-        if(waitForSchema(Collections.emptyList())) {
+        if (waitForSchema(Collections.emptyList())) {
             return this.runtimeContext;
         }
 
@@ -52,7 +52,7 @@ class FutureSchema implements AutoCloseable {
     }
 
     void onRuntimeContextUpdated(final BindingRuntimeContext context) {
-        synchronized(this.postponedOperations) {
+        synchronized (this.postponedOperations) {
             this.runtimeContext = context;
             for (final FutureSchemaPredicate op : this.postponedOperations) {
                 op.unlockIfPossible(context);
@@ -70,7 +70,7 @@ class FutureSchema implements AutoCloseable {
 
     @Override
     public void close() {
-        synchronized(this.postponedOperations) {
+        synchronized (this.postponedOperations) {
             for (final FutureSchemaPredicate op : this.postponedOperations) {
                 op.cancel();
             }
@@ -111,16 +111,16 @@ class FutureSchema implements AutoCloseable {
     }
 
     private boolean addPostponedOpAndWait(final FutureSchemaPredicate postponedOp) {
-        if(!this.waitEnabled) {
+        if (!this.waitEnabled) {
             return false;
         }
 
         final BindingRuntimeContext localRuntimeContext = this.runtimeContext;
-        synchronized(this.postponedOperations) {
+        synchronized (this.postponedOperations) {
             this.postponedOperations.add(postponedOp);
 
             // If the runtimeContext changed, this op may now be satisfied so check it.
-            if(localRuntimeContext != this.runtimeContext) {
+            if (localRuntimeContext != this.runtimeContext) {
                 postponedOp.unlockIfPossible(this.runtimeContext);
             }
         }
@@ -139,7 +139,7 @@ class FutureSchema implements AutoCloseable {
             } catch (final TimeoutException e) {
                 return false;
             } finally {
-                synchronized(FutureSchema.this.postponedOperations) {
+                synchronized (FutureSchema.this.postponedOperations) {
                     FutureSchema.this.postponedOperations.remove(this);
                 }
             }
@@ -157,5 +157,4 @@ class FutureSchema implements AutoCloseable {
 
         private final SettableFuture<?> schemaPromise = SettableFuture.create();
     }
-
 }
index 05725a1..f436c5e 100644 (file)
@@ -19,7 +19,7 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
 final class GetValueRouteContextExtractor extends ContextReferenceExtractor {
 
-    private final static Lookup PUBLIC_LOOKUP = MethodHandles.publicLookup();
+    private static final Lookup PUBLIC_LOOKUP = MethodHandles.publicLookup();
     private final MethodHandle contextHandle;
     private final MethodHandle valueHandle;
 
@@ -36,6 +36,7 @@ final class GetValueRouteContextExtractor extends ContextReferenceExtractor {
     }
 
     @Override
+    @SuppressWarnings("checkstyle:IllegalCatch")
     InstanceIdentifier<?> extract(final DataObject obj) {
         try {
             final Object ctx = contextHandle.invokeExact(obj);
@@ -43,10 +44,8 @@ final class GetValueRouteContextExtractor extends ContextReferenceExtractor {
                 return (InstanceIdentifier<?>) valueHandle.invokeExact(ctx);
             }
             return null;
-        } catch (final Throwable e) {
+        } catch (Throwable e) {
             throw Throwables.propagate(e);
         }
     }
-
-
 }
index 525ea4e..d12ec53 100644 (file)
@@ -40,7 +40,7 @@ import org.slf4j.LoggerFactory;
  */
 final class LazyDataObjectModification<T extends DataObject> implements DataObjectModification<T> {
 
-    private final static Logger LOG = LoggerFactory.getLogger(LazyDataObjectModification.class);
+    private static final Logger LOG = LoggerFactory.getLogger(LazyDataObjectModification.class);
 
     private final BindingCodecTreeNode<T> codec;
     private final DataTreeCandidateNode domData;
@@ -60,8 +60,8 @@ final class LazyDataObjectModification<T extends DataObject> implements DataObje
         return new LazyDataObjectModification<>(codec,domData);
     }
 
-    private static Collection<DataObjectModification<? extends DataObject>> from(final BindingCodecTreeNode<?> parentCodec,
-            final Collection<DataTreeCandidateNode> domChildNodes) {
+    private static Collection<DataObjectModification<? extends DataObject>> from(
+            final BindingCodecTreeNode<?> parentCodec, final Collection<DataTreeCandidateNode> domChildNodes) {
         final List<DataObjectModification<? extends DataObject>> result = new ArrayList<>(domChildNodes.size());
         populateList(result, parentCodec, domChildNodes);
         return result;
@@ -106,6 +106,7 @@ final class LazyDataObjectModification<T extends DataObject> implements DataObje
             case UNKNOWN:
             case VISIBLE_CONTAINER:
                 result.add(create(childCodec, domChildNode));
+                break;
             default:
                 break;
         }
@@ -220,9 +221,10 @@ final class LazyDataObjectModification<T extends DataObject> implements DataObje
 
     @Override
     @SuppressWarnings("unchecked")
-    public <C extends Identifiable<K> & ChildOf<? super T>, K extends Identifier<C>> DataObjectModification<C> getModifiedChildListItem(
-            final Class<C> listItem, final K listKey) {
-        return (DataObjectModification<C>) getModifiedChild(new InstanceIdentifier.IdentifiableItem<>(listItem, listKey));
+    public <C extends Identifiable<K> & ChildOf<? super T>, K extends Identifier<C>> DataObjectModification<C>
+            getModifiedChildListItem(final Class<C> listItem, final K listKey) {
+        return (DataObjectModification<C>) getModifiedChild(new InstanceIdentifier.IdentifiableItem<>(
+                listItem, listKey));
     }
 
     @Override
index 5e9038e..3b14012 100644 (file)
@@ -33,7 +33,8 @@ class LazyDataTreeModification<T extends DataObject> implements DataTreeModifica
     private final DataTreeIdentifier<T> path;
     private final DataObjectModification<T> rootNode;
 
-    LazyDataTreeModification(final LogicalDatastoreType datastoreType, final InstanceIdentifier<T> path, final BindingCodecTreeNode<T> codec, final DataTreeCandidate domChange) {
+    LazyDataTreeModification(final LogicalDatastoreType datastoreType, final InstanceIdentifier<T> path,
+            final BindingCodecTreeNode<T> codec, final DataTreeCandidate domChange) {
         this.path = new DataTreeIdentifier<>(datastoreType, path);
         this.rootNode = LazyDataObjectModification.create(codec, domChange.getRootNode());
     }
@@ -49,8 +50,8 @@ class LazyDataTreeModification<T extends DataObject> implements DataTreeModifica
     }
 
     @SuppressWarnings({"unchecked", "rawtypes"})
-    static <T extends DataObject> DataTreeModification<T> create(final BindingToNormalizedNodeCodec codec, final DataTreeCandidate domChange,
-            final LogicalDatastoreType datastoreType) {
+    static <T extends DataObject> DataTreeModification<T> create(final BindingToNormalizedNodeCodec codec,
+            final DataTreeCandidate domChange, final LogicalDatastoreType datastoreType) {
         final Entry<InstanceIdentifier<?>, BindingCodecTreeNode<?>> codecCtx =
                 codec.getSubtreeCodec(domChange.getRootPath());
         return new LazyDataTreeModification(datastoreType, codecCtx.getKey(), codecCtx.getValue(), domChange);
index 8185446..5066ed5 100644 (file)
@@ -22,11 +22,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 
-/**
- *
- * FIXME: Should be this moved to binding-data-codec?
- *
- */
+ // FIXME: Should be this moved to binding-data-codec?
 class LazySerializedContainerNode implements ContainerNode {
 
     private final NodeIdentifier identifier;
index ffab566..093bcdd 100644 (file)
@@ -17,6 +17,7 @@ import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 /**
  * Lazy serialized implementation of DOM Notification.
  *
+ * <p>
  * This implementation performs serialization of data, only if receiver
  * of notification actually accessed data from notification.
  *
@@ -29,7 +30,8 @@ public final class LazySerializedDOMNotification implements DOMNotification {
 
     private ContainerNode domBody;
 
-    private LazySerializedDOMNotification(final BindingNormalizedNodeSerializer codec, final Notification data, final SchemaPath type) {
+    private LazySerializedDOMNotification(final BindingNormalizedNodeSerializer codec, final Notification data,
+            final SchemaPath type) {
         this.codec = codec;
         this.data = data;
         this.type = type;
index c6ea9db..c023229 100644 (file)
@@ -14,6 +14,7 @@ import com.google.common.collect.ImmutableMap;
 import com.google.common.util.concurrent.CheckedFuture;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.MoreExecutors;
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.Method;
 import java.lang.reflect.Proxy;
@@ -63,7 +64,7 @@ class RpcServiceAdapter implements InvocationHandler {
 
     private ListenableFuture<RpcResult<?>> invoke0(final SchemaPath schemaPath, final NormalizedNode<?, ?> input) {
         final CheckedFuture<DOMRpcResult, DOMRpcException> result = delegate.invokeRpc(schemaPath, input);
-        if(result instanceof LazyDOMRpcResultFuture) {
+        if (result instanceof LazyDOMRpcResultFuture) {
             return ((LazyDOMRpcResultFuture) result).getBindingFuture();
         }
 
@@ -83,7 +84,7 @@ class RpcServiceAdapter implements InvocationHandler {
     }
 
     @Override
-    public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {
+    public Object invoke(final Object proxyObj, final Method method, final Object[] args) throws Throwable {
 
         final RpcInvocationStrategy rpc = rpcNames.get(method);
         if (rpc != null) {
@@ -97,33 +98,33 @@ class RpcServiceAdapter implements InvocationHandler {
         }
 
         if (isObjectMethod(method)) {
-            return callObjectMethod(proxy, method, args);
+            return callObjectMethod(proxyObj, method, args);
         }
         throw new UnsupportedOperationException("Method " + method.toString() + "is unsupported.");
     }
 
-    private static boolean isObjectMethod(final Method m) {
-        switch (m.getName()) {
+    private static boolean isObjectMethod(final Method method) {
+        switch (method.getName()) {
             case "toString":
-                return (m.getReturnType().equals(String.class) && m.getParameterTypes().length == 0);
+                return method.getReturnType().equals(String.class) && method.getParameterTypes().length == 0;
             case "hashCode":
-                return (m.getReturnType().equals(int.class) && m.getParameterTypes().length == 0);
+                return method.getReturnType().equals(int.class) && method.getParameterTypes().length == 0;
             case "equals":
-                return (m.getReturnType().equals(boolean.class) && m.getParameterTypes().length == 1 && m
-                        .getParameterTypes()[0] == Object.class);
+                return method.getReturnType().equals(boolean.class) && method.getParameterTypes().length == 1 && method
+                        .getParameterTypes()[0] == Object.class;
             default:
                 return false;
         }
     }
 
-    private Object callObjectMethod(final Object self, final Method m, final Object[] args) {
-        switch (m.getName()) {
+    private Object callObjectMethod(final Object self, final Method method, final Object[] args) {
+        switch (method.getName()) {
             case "toString":
                 return type.getName() + "$Adapter{delegate=" + delegate.toString() + "}";
             case "hashCode":
                 return System.identityHashCode(self);
             case "equals":
-                return (self == args[0]);
+                return self == args[0];
             default:
                 return null;
         }
@@ -141,7 +142,7 @@ class RpcServiceAdapter implements InvocationHandler {
                 bindingResult = null;
             }
             return RpcResult.class.cast(RpcResultBuilder.success(bindingResult).build());
-        });
+        }, MoreExecutors.directExecutor());
     }
 
     private abstract class RpcInvocationStrategy {
@@ -165,7 +166,6 @@ class RpcServiceAdapter implements InvocationHandler {
         final SchemaPath getRpcName() {
             return rpcName;
         }
-
     }
 
     private final class NonRoutedStrategy extends RpcInvocationStrategy {
@@ -178,7 +178,6 @@ class RpcServiceAdapter implements InvocationHandler {
         NormalizedNode<?, ?> serialize(final DataObject input) {
             return LazySerializedContainerNode.create(getRpcName(), input, codec.getCodecRegistry());
         }
-
     }
 
     private final class RoutedStrategy extends RpcInvocationStrategy {
@@ -204,6 +203,5 @@ class RpcServiceAdapter implements InvocationHandler {
             }
             return LazySerializedContainerNode.create(getRpcName(), input, codec.getCodecRegistry());
         }
-
     }
 }
index 655a176..8fc838b 100644 (file)
@@ -7,7 +7,6 @@
  */
 package org.opendaylight.controller.md.sal.binding.spi;
 
-
 import com.google.common.base.Preconditions;
 import com.google.common.collect.ClassToInstanceMap;
 import com.google.common.collect.ImmutableClassToInstanceMap;
@@ -21,15 +20,15 @@ public abstract class AdapterBuilder<T,D> implements Builder<T> {
 
     public abstract Set<? extends Class<? extends D>> getRequiredDelegates();
 
-    protected abstract T createInstance(ClassToInstanceMap<D> delegates);
+    protected abstract T createInstance(ClassToInstanceMap<D> classToInstanceMap);
 
     private void checkAllRequiredServices() {
-        for(final Class<? extends D> type : getRequiredDelegates()) {
+        for (final Class<? extends D> type : getRequiredDelegates()) {
             Preconditions.checkState(delegates.get(type) != null, "Requires service %s is not defined.",type);
         }
     }
 
-    public final <V extends D>void addDelegate(final Class<V> type,final D impl) {
+    public final <V extends D> void addDelegate(final Class<V> type,final D impl) {
         delegates.put(type,impl);
     }
 
@@ -38,5 +37,4 @@ public abstract class AdapterBuilder<T,D> implements Builder<T> {
         checkAllRequiredServices();
         return createInstance(ImmutableClassToInstanceMap.<D,D>copyOf(delegates));
     }
-
 }
index 7919a8f..ea3888e 100644 (file)
@@ -18,10 +18,10 @@ public abstract class AdapterLoader<T, D> extends CacheLoader<Class<? extends T>
     public Optional<T> load(final Class<? extends T> key) {
 
         final AdapterBuilder<? extends T, D> builder = createBuilder(key);
-        for(final Class<? extends D> reqDeleg : builder.getRequiredDelegates()) {
+        for (final Class<? extends D> reqDeleg : builder.getRequiredDelegates()) {
             final D deleg = getDelegate(reqDeleg);
-            if(deleg != null) {
-                builder.addDelegate(reqDeleg,deleg);
+            if (deleg != null) {
+                builder.addDelegate(reqDeleg, deleg);
             } else {
                 return Optional.absent();
             }
@@ -34,5 +34,4 @@ public abstract class AdapterLoader<T, D> extends CacheLoader<Class<? extends T>
 
     @Nonnull
     protected abstract AdapterBuilder<? extends T, D> createBuilder(Class<? extends T> key);
-
 }
index cdf29f6..6098684 100644 (file)
@@ -19,13 +19,13 @@ import java.util.concurrent.RejectedExecutionException;
 import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.ThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
+import javassist.ClassPool;
 import org.apache.commons.lang3.StringUtils;
 import org.opendaylight.mdsal.binding.generator.util.JavassistUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import javassist.ClassPool;
 
-public class SingletonHolder {
+public final class SingletonHolder {
     private static final Logger LOG = LoggerFactory.getLogger(SingletonHolder.class);
 
     public static final ClassPool CLASS_POOL = ClassPool.getDefault();
@@ -42,7 +42,12 @@ public class SingletonHolder {
     private static ListeningExecutorService COMMIT_EXECUTOR = null;
     private static ListeningExecutorService CHANGE_EVENT_EXECUTOR = null;
 
+    private SingletonHolder() {
+    }
+
     /**
+     * Deprecated.
+     *
      * @deprecated This method is only used from configuration modules and thus callers of it
      *             should use service injection to make the executor configurable.
      */
@@ -74,28 +79,26 @@ public class SingletonHolder {
                 }
 
                 @Override
-                public boolean offer(final Runnable r) {
+                public boolean offer(final Runnable runnrunnableable) {
                     // ThreadPoolExecutor will spawn a new thread after core size is reached only
                     // if the queue.offer returns false.
                     return false;
                 }
             };
 
-            final ThreadFactory factory = new ThreadFactoryBuilder()
-            .setDaemon(true)
-            .setNameFormat("md-sal-binding-notification-%d")
-            .build();
-
-            final ThreadPoolExecutor executor = new ThreadPoolExecutor(CORE_NOTIFICATION_THREADS, MAX_NOTIFICATION_THREADS,
-                    NOTIFICATION_THREAD_LIFE, TimeUnit.SECONDS, queue, factory,
-                    // if the max threads are met, then it will raise a rejectedExecution. We then push to the queue.
-                    (r, executor1) -> {
-                        try {
-                            executor1.getQueue().put(r);
-                        } catch (final InterruptedException e) {
-                            throw new RejectedExecutionException("Interrupted while waiting on the queue", e);
-                        }
-                    });
+            final ThreadFactory factory = new ThreadFactoryBuilder().setDaemon(true)
+                    .setNameFormat("md-sal-binding-notification-%d").build();
+
+            final ThreadPoolExecutor executor = new ThreadPoolExecutor(CORE_NOTIFICATION_THREADS,
+                MAX_NOTIFICATION_THREADS, NOTIFICATION_THREAD_LIFE, TimeUnit.SECONDS, queue, factory,
+                // if the max threads are met, then it will raise a rejectedExecution. We then push to the queue.
+                (runnable, executor1) -> {
+                    try {
+                        executor1.getQueue().put(runnable);
+                    } catch (final InterruptedException e) {
+                        throw new RejectedExecutionException("Interrupted while waiting on the queue", e);
+                    }
+                });
 
             NOTIFICATION_EXECUTOR = MoreExecutors.listeningDecorator(executor);
         }
@@ -104,13 +107,16 @@ public class SingletonHolder {
     }
 
     /**
+     * Deprecated.
+     *
      * @deprecated This method is only used from configuration modules and thus callers of it
      *             should use service injection to make the executor configurable.
      */
     @Deprecated
     public static synchronized ListeningExecutorService getDefaultCommitExecutor() {
         if (COMMIT_EXECUTOR == null) {
-            final ThreadFactory factory = new ThreadFactoryBuilder().setDaemon(true).setNameFormat("md-sal-binding-commit-%d").build();
+            final ThreadFactory factory = new ThreadFactoryBuilder().setDaemon(true)
+                    .setNameFormat("md-sal-binding-commit-%d").build();
             /*
              * FIXME: this used to be newCacheThreadPool(), but MD-SAL does not have transaction
              *        ordering guarantees, which means that using a concurrent threadpool results
@@ -127,7 +133,8 @@ public class SingletonHolder {
 
     public static ExecutorService getDefaultChangeEventExecutor() {
         if (CHANGE_EVENT_EXECUTOR == null) {
-            final ThreadFactory factory = new ThreadFactoryBuilder().setDaemon(true).setNameFormat("md-sal-binding-change-%d").build();
+            final ThreadFactory factory = new ThreadFactoryBuilder().setDaemon(true)
+                    .setNameFormat("md-sal-binding-change-%d").build();
             /*
              * FIXME: this used to be newCacheThreadPool(), but MD-SAL does not have transaction
              *        ordering guarantees, which means that using a concurrent threadpool results
index d917371..f5f2b76 100644 (file)
@@ -37,7 +37,7 @@ import org.slf4j.LoggerFactory;
 public class RootBindingAwareBroker implements Mutable, Identifiable<String>, BindingAwareBroker, AutoCloseable,
         RpcProviderRegistry {
 
-    private final static Logger LOG = LoggerFactory.getLogger(RootBindingAwareBroker.class);
+    private static final Logger LOG = LoggerFactory.getLogger(RootBindingAwareBroker.class);
 
     RootSalInstance controllerRoot;
 
@@ -143,17 +143,17 @@ public class RootBindingAwareBroker implements Mutable, Identifiable<String>, Bi
         return registerConsumer(consumer);
     }
 
-    @Override
-    public ProviderContext registerProvider(final BindingAwareProvider provider, final BundleContext ctx) {
-        return registerProvider(provider);
-    }
-
     @Override
     public ConsumerContext registerConsumer(final BindingAwareConsumer consumer) {
         checkState(supportedConsumerServices != null, "Broker is not initialized.");
         return BindingContextUtils.createConsumerContextAndInitialize(consumer, supportedConsumerServices);
     }
 
+    @Override
+    public ProviderContext registerProvider(final BindingAwareProvider provider, final BundleContext ctx) {
+        return registerProvider(provider);
+    }
+
     @Override
     public ProviderContext registerProvider(final BindingAwareProvider provider) {
         checkState(supportedProviderServices != null, "Broker is not initialized.");
@@ -183,9 +183,9 @@ public class RootBindingAwareBroker implements Mutable, Identifiable<String>, Bi
     }
 
     @Override
-    public <L extends RouteChangeListener<RpcContextIdentifier, InstanceIdentifier<?>>> ListenerRegistration<L> registerRouteChangeListener(
-            final L arg0) {
-        return getRoot().registerRouteChangeListener(arg0);
+    public <L extends RouteChangeListener<RpcContextIdentifier, InstanceIdentifier<?>>> ListenerRegistration<L>
+            registerRouteChangeListener(final L listener) {
+        return getRoot().registerRouteChangeListener(listener);
     }
 
     public class RootSalInstance extends
@@ -196,5 +196,4 @@ public class RootBindingAwareBroker implements Mutable, Identifiable<String>, Bi
             super(rpcRegistry, notificationBroker);
         }
     }
-
 }
index 8c280e3..a3d9348 100644 (file)
@@ -13,6 +13,7 @@ import static org.mockito.Matchers.isA;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.reset;
 import static org.mockito.Mockito.verify;
+
 import java.util.Collection;
 import org.hamcrest.Description;
 import org.junit.Before;
@@ -31,8 +32,8 @@ import org.opendaylight.controller.md.sal.dom.api.ClusteredDOMDataTreeChangeList
 import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeListener;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeService;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeIdentifier;
-import org.opendaylight.mdsal.binding.generator.impl.GeneratedClassLoadingStrategy;
 import org.opendaylight.mdsal.binding.dom.codec.impl.BindingNormalizedNodeCodecRegistry;
+import org.opendaylight.mdsal.binding.generator.impl.GeneratedClassLoadingStrategy;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.Top;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
@@ -70,11 +71,13 @@ public class BindingDOMDataTreeChangeServiceAdapterTest {
 
     @Test
     public void testRegisterDataTreeChangeListener() {
-        final BindingToNormalizedNodeCodec codec = new BindingToNormalizedNodeCodec(this.classLoadingStrategy, this.codecRegistry);
+        final BindingToNormalizedNodeCodec codec =
+                new BindingToNormalizedNodeCodec(this.classLoadingStrategy, this.codecRegistry);
 
         final DataTreeChangeService service = BindingDOMDataTreeChangeServiceAdapter.create(codec, this.mockDOMService);
 
-        doReturn(this.mockDOMReg).when(this.mockDOMService).registerDataTreeChangeListener(domDataTreeIdentifier(this.mockYangID),
+        doReturn(this.mockDOMReg).when(this.mockDOMService).registerDataTreeChangeListener(
+                domDataTreeIdentifier(this.mockYangID),
                 any(DOMDataTreeChangeListener.class));
         final DataTreeIdentifier<Top> treeId = new DataTreeIdentifier<>(LogicalDatastoreType.CONFIGURATION, TOP_PATH);
         final TestClusteredDataTreeChangeListener mockClusteredListener = new TestClusteredDataTreeChangeListener();
@@ -84,8 +87,8 @@ public class BindingDOMDataTreeChangeServiceAdapterTest {
                 isA(ClusteredDOMDataTreeChangeListener.class));
 
         reset(this.mockDOMService);
-        doReturn(this.mockDOMReg).when(this.mockDOMService).registerDataTreeChangeListener(domDataTreeIdentifier(this.mockYangID),
-                any(DOMDataTreeChangeListener.class));
+        doReturn(this.mockDOMReg).when(this.mockDOMService).registerDataTreeChangeListener(
+                domDataTreeIdentifier(this.mockYangID), any(DOMDataTreeChangeListener.class));
         final TestDataTreeChangeListener mockNonClusteredListener = new TestDataTreeChangeListener();
         service.registerDataTreeChangeListener(treeId , mockNonClusteredListener);
 
@@ -98,8 +101,8 @@ public class BindingDOMDataTreeChangeServiceAdapterTest {
             @Override
             public boolean matches(final Object argument) {
                 final DOMDataTreeIdentifier treeId = (DOMDataTreeIdentifier) argument;
-                return (treeId.getDatastoreType() == LogicalDatastoreType.CONFIGURATION) &&
-                        yangID.equals(treeId.getRootIdentifier());
+                return treeId.getDatastoreType() == LogicalDatastoreType.CONFIGURATION
+                        && yangID.equals(treeId.getRootIdentifier());
             }
 
             @Override
index b05e88b..a72eba5 100644 (file)
@@ -55,12 +55,14 @@ public class BindingNormalizedCodecTest extends AbstractSchemaAwareTest {
     private static final TopLevelListKey TOP_FOO_KEY = new TopLevelListKey("foo");
     private static final InstanceIdentifier<TopLevelList> BA_TOP_LEVEL_LIST = InstanceIdentifier
             .builder(Top.class).child(TopLevelList.class, TOP_FOO_KEY).build();
-    private static final InstanceIdentifier<TreeLeafOnlyAugment> BA_TREE_LEAF_ONLY = BA_TOP_LEVEL_LIST.augmentation(TreeLeafOnlyAugment.class);
-    private static final InstanceIdentifier<TreeComplexUsesAugment> BA_TREE_COMPLEX_USES = BA_TOP_LEVEL_LIST.augmentation(TreeComplexUsesAugment.class);
+    private static final InstanceIdentifier<TreeLeafOnlyAugment> BA_TREE_LEAF_ONLY =
+            BA_TOP_LEVEL_LIST.augmentation(TreeLeafOnlyAugment.class);
+    private static final InstanceIdentifier<TreeComplexUsesAugment> BA_TREE_COMPLEX_USES =
+            BA_TOP_LEVEL_LIST.augmentation(TreeComplexUsesAugment.class);
     private static final QName SIMPLE_VALUE_QNAME = QName.create(TreeComplexUsesAugment.QNAME, "simple-value");
     private static final QName NAME_QNAME = QName.create(Top.QNAME, "name");
-    private static final YangInstanceIdentifier BI_TOP_LEVEL_LIST = YangInstanceIdentifier.builder().
-            node(Top.QNAME).node(TopLevelList.QNAME).nodeWithKey(
+    private static final YangInstanceIdentifier BI_TOP_LEVEL_LIST = YangInstanceIdentifier.builder()
+            .node(Top.QNAME).node(TopLevelList.QNAME).nodeWithKey(
                     TopLevelList.QNAME, NAME_QNAME, TOP_FOO_KEY.getName()).build();
 
 
@@ -68,11 +70,13 @@ public class BindingNormalizedCodecTest extends AbstractSchemaAwareTest {
     private SchemaContext context;
 
     @Override
-    protected void setupWithSchema(final SchemaContext context) {
-        this.context = context;
-        final DataObjectSerializerGenerator streamWriter = StreamWriterGenerator.create(JavassistUtils.forClassPool(ClassPool.getDefault()));
+    protected void setupWithSchema(final SchemaContext schemaContext) {
+        this.context = schemaContext;
+        final DataObjectSerializerGenerator streamWriter = StreamWriterGenerator
+                .create(JavassistUtils.forClassPool(ClassPool.getDefault()));
         final BindingNormalizedNodeCodecRegistry registry = new BindingNormalizedNodeCodecRegistry(streamWriter);
-        this.codec = new BindingToNormalizedNodeCodec(GeneratedClassLoadingStrategy.getTCCLClassLoadingStrategy(), registry, true);
+        this.codec = new BindingToNormalizedNodeCodec(GeneratedClassLoadingStrategy.getTCCLClassLoadingStrategy(),
+                registry, true);
     }
 
     @Test
@@ -86,22 +90,25 @@ public class BindingNormalizedCodecTest extends AbstractSchemaAwareTest {
     @Test
     public void testLeafOnlyAugmentationSerialization() {
         this.codec.onGlobalContextUpdated(this.context);
-        final PathArgument leafOnlyLastArg = this.codec.toYangInstanceIdentifier(BA_TREE_LEAF_ONLY).getLastPathArgument();
+        final PathArgument leafOnlyLastArg = this.codec.toYangInstanceIdentifier(BA_TREE_LEAF_ONLY)
+                .getLastPathArgument();
         assertTrue(leafOnlyLastArg instanceof AugmentationIdentifier);
         assertTrue(((AugmentationIdentifier) leafOnlyLastArg).getPossibleChildNames().contains(SIMPLE_VALUE_QNAME));
     }
 
     @Test
+    @SuppressWarnings("checkstyle:IllegalCatch")
     public void testToYangInstanceIdentifierBlocking() {
         this.codec.onGlobalContextUpdated(new EmptySchemaContext());
 
         final CountDownLatch done = new CountDownLatch(1);
         final AtomicReference<YangInstanceIdentifier> yangId = new AtomicReference<>();
         final AtomicReference<RuntimeException> error = new AtomicReference<>();
+
         new Thread(() -> {
             try {
                 yangId.set(BindingNormalizedCodecTest.this.codec.toYangInstanceIdentifierBlocking(BA_TOP_LEVEL_LIST));
-            } catch(final RuntimeException e) {
+            } catch (RuntimeException e) {
                 error.set(e);
             } finally {
                 done.countDown();
@@ -113,7 +120,7 @@ public class BindingNormalizedCodecTest extends AbstractSchemaAwareTest {
 
         assertEquals("toYangInstanceIdentifierBlocking completed", true,
                 Uninterruptibles.awaitUninterruptibly(done, 3, TimeUnit.SECONDS));
-        if(error.get() != null) {
+        if (error.get() != null) {
             throw error.get();
         }
 
@@ -131,14 +138,16 @@ public class BindingNormalizedCodecTest extends AbstractSchemaAwareTest {
         testGetRpcMethodToSchemaPath();
     }
 
+    @SuppressWarnings("checkstyle:IllegalCatch")
     private void testGetRpcMethodToSchemaPath() {
         final CountDownLatch done = new CountDownLatch(1);
         final AtomicReference<ImmutableBiMap<Method, SchemaPath>> retMap = new AtomicReference<>();
         final AtomicReference<RuntimeException> error = new AtomicReference<>();
         new Thread(() -> {
             try {
-                retMap.set(BindingNormalizedCodecTest.this.codec.getRpcMethodToSchemaPath(OpendaylightTestRpcServiceService.class));
-            } catch(final RuntimeException e) {
+                retMap.set(BindingNormalizedCodecTest.this.codec.getRpcMethodToSchemaPath(
+                        OpendaylightTestRpcServiceService.class));
+            } catch (RuntimeException e) {
                 error.set(e);
             } finally {
                 done.countDown();
@@ -150,12 +159,12 @@ public class BindingNormalizedCodecTest extends AbstractSchemaAwareTest {
 
         assertEquals("getRpcMethodToSchemaPath completed", true,
                 Uninterruptibles.awaitUninterruptibly(done, 3, TimeUnit.SECONDS));
-        if(error.get() != null) {
+        if (error.get() != null) {
             throw error.get();
         }
 
-        for(final Method method: retMap.get().keySet()) {
-            if(method.getName().equals("rockTheHouse")) {
+        for (final Method method: retMap.get().keySet()) {
+            if (method.getName().equals("rockTheHouse")) {
                 return;
             }
         }
index f43352d..dd434b8 100644 (file)
@@ -10,17 +10,16 @@ package org.opendaylight.controller.md.sal.binding.impl.test;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
-import java.util.concurrent.TimeUnit;
-import org.opendaylight.controller.md.sal.binding.compat.HeliumNotificationProviderServiceAdapter;
-
 import com.google.common.collect.ImmutableList;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
 import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
 import org.opendaylight.controller.md.sal.binding.api.NotificationService;
+import org.opendaylight.controller.md.sal.binding.compat.HeliumNotificationProviderServiceAdapter;
 import org.opendaylight.controller.md.sal.binding.test.AbstractNotificationBrokerTest;
 import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.OpendaylightMdsalListTestListener;
@@ -39,7 +38,8 @@ public class BackwardsCompatibleNotificationBrokerTest extends AbstractNotificat
     public void initTest() {
         final NotificationService notificationService = getNotificationService();
         final NotificationPublishService notificationPublishService = getNotificationPublishService();
-        notificationProviderService = new HeliumNotificationProviderServiceAdapter(notificationPublishService, notificationService);
+        notificationProviderService = new HeliumNotificationProviderServiceAdapter(notificationPublishService,
+                notificationService);
     }
 
     private TwoLevelListChanged createTestData() {
@@ -66,15 +66,16 @@ public class BackwardsCompatibleNotificationBrokerTest extends AbstractNotificat
 
     private static class NotifTestListenerChild extends  NotifTestListener {
 
-        public NotifTestListenerChild(final CountDownLatch latch) {
+        NotifTestListenerChild(final CountDownLatch latch) {
             super(latch);
         }
     }
+
     private static class NotifTestListener implements OpendaylightMdsalListTestListener {
-        private List<TwoLevelListChanged> receivedNotifications = new ArrayList<>();
-        private CountDownLatch latch;
+        private final List<TwoLevelListChanged> receivedNotifications = new ArrayList<>();
+        private final CountDownLatch latch;
 
-        public NotifTestListener(CountDownLatch latch) {
+        NotifTestListener(CountDownLatch latch) {
             this.latch = latch;
         }
 
@@ -88,5 +89,4 @@ public class BackwardsCompatibleNotificationBrokerTest extends AbstractNotificat
             return receivedNotifications;
         }
     }
-
 }
index 09a128b..3506f4b 100644 (file)
@@ -55,7 +55,8 @@ public class BindingDOMDataBrokerAdapterTest {
     @Test
     public void testClusteredDataChangeListernerRegisteration() {
 
-        final BindingToNormalizedNodeCodec codec = new BindingToNormalizedNodeCodec(this.classLoadingStrategy, this.codecRegistry);
+        final BindingToNormalizedNodeCodec codec =
+                new BindingToNormalizedNodeCodec(this.classLoadingStrategy, this.codecRegistry);
 
         try (BindingDOMDataBrokerAdapter bindingDOMDataBrokerAdapter = new BindingDOMDataBrokerAdapter(this.dataBroker,
                 codec)) {
@@ -67,7 +68,7 @@ public class BindingDOMDataBrokerAdapterTest {
                     .forClass(LogicalDatastoreType.class);
             final ArgumentCaptor<AsyncDataBroker.DataChangeScope> dataChangeScope = ArgumentCaptor
                     .forClass(AsyncDataBroker.DataChangeScope.class);
-            final ArgumentCaptor<YangInstanceIdentifier> yangInstanceIdentifier = ArgumentCaptor
+            final ArgumentCaptor<YangInstanceIdentifier> yangIidCapture = ArgumentCaptor
                     .forClass(YangInstanceIdentifier.class);
 
             final TestListener listener = new TestListener();
@@ -75,7 +76,7 @@ public class BindingDOMDataBrokerAdapterTest {
             bindingDOMDataBrokerAdapter.registerDataChangeListener(LogicalDatastoreType.OPERATIONAL, TOP_PATH,
                     listener, AsyncDataBroker.DataChangeScope.BASE);
             Mockito.verify(this.dataBroker).registerDataChangeListener(logicalDatastoreType.capture(),
-                    yangInstanceIdentifier.capture(), clusteredDOMListener.capture(), dataChangeScope.capture());
+                    yangIidCapture.capture(), clusteredDOMListener.capture(), dataChangeScope.capture());
         }
 
     }
index 9f92769..41c3375 100644 (file)
@@ -31,7 +31,7 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
 /**
  * Regression test suite for Bug 1125 - Can't detect switch disconnection
- * https://bugs.opendaylight.org/show_bug.cgi?id=1125
+ * https://bugs.opendaylight.org/show_bug.cgi?id=1125.
  */
 public class Bug1125RegressionTest extends AbstractDataChangeListenerTest {
 
index e7b03d9..177aa6b 100644 (file)
@@ -32,15 +32,13 @@ import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
 /**
- *
  * This testsuite tries to replicate bug 1333 and tests regresion of it
  * using test-model with similar construction as one reported.
  *
- *
+ * <p>
  * See  https://bugs.opendaylight.org/show_bug.cgi?id=1333 for Bug Description
- *
  */
-public class Bug1333DataChangeListenerTest extends AbstractDataChangeListenerTest{
+public class Bug1333DataChangeListenerTest extends AbstractDataChangeListenerTest {
 
     private static final InstanceIdentifier<Top> TOP_PATH = InstanceIdentifier.create(Top.class);
 
@@ -139,5 +137,4 @@ public class Bug1333DataChangeListenerTest extends AbstractDataChangeListenerTes
 
         assertContains(event.getRemovedPaths(), deletePath);
     }
-
 }
index 4393dcc..ca6c78f 100644 (file)
@@ -32,7 +32,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controll
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
-public class Bug1418AugmentationTest extends AbstractDataChangeListenerTest{
+public class Bug1418AugmentationTest extends AbstractDataChangeListenerTest {
     private static final InstanceIdentifier<Top> TOP = InstanceIdentifier.create(Top.class);
     private static final InstanceIdentifier<TopLevelList> TOP_FOO = TOP.child(TopLevelList.class, TOP_FOO_KEY);
     private static final InstanceIdentifier<TreeLeafOnlyUsesAugment> SIMPLE_AUGMENT =
@@ -46,7 +46,7 @@ public class Bug1418AugmentationTest extends AbstractDataChangeListenerTest{
 
     @Test
     public void leafOnlyAugmentationCreatedTest() {
-        TestListener listener = createListener(LogicalDatastoreType.CONFIGURATION, SIMPLE_AUGMENT,
+        final TestListener listener = createListener(LogicalDatastoreType.CONFIGURATION, SIMPLE_AUGMENT,
                 AsyncDataBroker.DataChangeScope.SUBTREE, false);
         WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
         writeTx.put(LogicalDatastoreType.CONFIGURATION, TOP, top());
@@ -67,7 +67,7 @@ public class Bug1418AugmentationTest extends AbstractDataChangeListenerTest{
         writeTx.put(LogicalDatastoreType.CONFIGURATION, TOP_FOO, topLevelList(new TopLevelListKey(TOP_FOO_KEY)));
         writeTx.put(LogicalDatastoreType.CONFIGURATION, SIMPLE_AUGMENT, leafOnlyUsesAugment("test leaf"));
         assertCommit(writeTx.submit());
-        TestListener listener = createListener(LogicalDatastoreType.CONFIGURATION, SIMPLE_AUGMENT,
+        final TestListener listener = createListener(LogicalDatastoreType.CONFIGURATION, SIMPLE_AUGMENT,
                 AsyncDataBroker.DataChangeScope.SUBTREE);
         writeTx = getDataBroker().newWriteOnlyTransaction();
         writeTx.put(LogicalDatastoreType.CONFIGURATION, SIMPLE_AUGMENT, leafOnlyUsesAugment("test leaf changed"));
@@ -86,7 +86,7 @@ public class Bug1418AugmentationTest extends AbstractDataChangeListenerTest{
         writeTx.put(LogicalDatastoreType.CONFIGURATION, TOP_FOO, topLevelList(new TopLevelListKey(TOP_FOO_KEY)));
         writeTx.put(LogicalDatastoreType.CONFIGURATION, SIMPLE_AUGMENT, leafOnlyUsesAugment("test leaf"));
         assertCommit(writeTx.submit());
-        TestListener listener = createListener(LogicalDatastoreType.CONFIGURATION, SIMPLE_AUGMENT,
+        final TestListener listener = createListener(LogicalDatastoreType.CONFIGURATION, SIMPLE_AUGMENT,
                 AsyncDataBroker.DataChangeScope.SUBTREE);
         writeTx = getDataBroker().newWriteOnlyTransaction();
         writeTx.delete(LogicalDatastoreType.CONFIGURATION, SIMPLE_AUGMENT);
@@ -100,7 +100,7 @@ public class Bug1418AugmentationTest extends AbstractDataChangeListenerTest{
 
     @Test
     public void complexAugmentationCreatedTest() {
-        TestListener listener = createListener(LogicalDatastoreType.CONFIGURATION, COMPLEX_AUGMENT,
+        final TestListener listener = createListener(LogicalDatastoreType.CONFIGURATION, COMPLEX_AUGMENT,
                 AsyncDataBroker.DataChangeScope.SUBTREE, false);
         WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
         writeTx.put(LogicalDatastoreType.CONFIGURATION, TOP, top());
@@ -122,7 +122,7 @@ public class Bug1418AugmentationTest extends AbstractDataChangeListenerTest{
         writeTx.put(LogicalDatastoreType.CONFIGURATION, TOP_FOO, topLevelList(new TopLevelListKey(TOP_FOO_KEY)));
         writeTx.put(LogicalDatastoreType.CONFIGURATION, COMPLEX_AUGMENT, complexUsesAugment(LIST_VIA_USES_KEY));
         assertCommit(writeTx.submit());
-        TestListener listener = createListener(LogicalDatastoreType.CONFIGURATION, COMPLEX_AUGMENT,
+        final TestListener listener = createListener(LogicalDatastoreType.CONFIGURATION, COMPLEX_AUGMENT,
                 AsyncDataBroker.DataChangeScope.SUBTREE);
         writeTx = getDataBroker().newWriteOnlyTransaction();
         writeTx.put(LogicalDatastoreType.CONFIGURATION, COMPLEX_AUGMENT, complexUsesAugment(LIST_VIA_USES_KEY_MOD));
index 94d7272..57d390b 100644 (file)
@@ -35,10 +35,10 @@ public class Bug2562DeserializedUnkeyedListTest extends AbstractDataChangeListen
     private void writeRoot(final LogicalDatastoreType store) {
         final ReadWriteTransaction readWriteTransaction = getDataBroker().newReadWriteTransaction();
         final Barroot barRoot = new BarrootBuilder().setType(2).setValue(2).setKey(new BarrootKey(2)).build();
-        final ArrayList barRootList = new ArrayList();
+        final ArrayList<Barroot> barRootList = new ArrayList<>();
         barRootList.add(barRoot);
         final Fooroot fooRoot = new FoorootBuilder().setBarroot(barRootList).build();
-        final ArrayList fooRootList = new ArrayList();
+        final ArrayList<Fooroot> fooRootList = new ArrayList<>();
         fooRootList.add(fooRoot);
         final Root root = new RootBuilder().setFooroot(fooRootList).build();
 
@@ -48,8 +48,8 @@ public class Bug2562DeserializedUnkeyedListTest extends AbstractDataChangeListen
 
     @Test
     public void writeListToList2562Root() {
-        final AbstractDataChangeListenerTest.TestListener listenerRoot = createListener(LogicalDatastoreType.CONFIGURATION,
-                ROOT_PATH, AsyncDataBroker.DataChangeScope.ONE, false);
+        final AbstractDataChangeListenerTest.TestListener listenerRoot =
+            createListener(LogicalDatastoreType.CONFIGURATION, ROOT_PATH, AsyncDataBroker.DataChangeScope.ONE, false);
         writeRoot(LogicalDatastoreType.CONFIGURATION);
         final AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> eventRoot = listenerRoot.event();
 
index 1efa3a7..3b883b4 100644 (file)
@@ -26,7 +26,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.opendaylight.
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
-public class Bug3090MultiKeyList extends AbstractDataChangeListenerTest{
+public class Bug3090MultiKeyList extends AbstractDataChangeListenerTest {
     private static final InstanceIdentifier<Root> ROOT_PATH = InstanceIdentifier.create(Root.class);
 
     private void write(final LogicalDatastoreType store) {
index 071c9bc..234cb95 100644 (file)
@@ -75,8 +75,8 @@ public class DataTreeChangeListenerTest extends AbstractConcurrentDataBrokerTest
         private SettableFuture<Collection<DataTreeModification<T>>> changes = SettableFuture.create();
 
         @Override
-        public void onDataTreeChanged(final Collection<DataTreeModification<T>> changes) {
-            this.changes.set(changes);
+        public void onDataTreeChanged(final Collection<DataTreeModification<T>> modification) {
+            this.changes.set(modification);
 
         }
 
@@ -85,7 +85,6 @@ public class DataTreeChangeListenerTest extends AbstractConcurrentDataBrokerTest
             changes = SettableFuture.create();
             return result;
         }
-
     }
 
     @Override
@@ -109,23 +108,28 @@ public class DataTreeChangeListenerTest extends AbstractConcurrentDataBrokerTest
         createAndVerifyTop(listener);
 
         putTx(BAR_PATH, BAR_DATA).submit().checkedGet();
-        final DataObjectModification<Top> afterBarPutEvent = Iterables.getOnlyElement(listener.nextEvent()).getRootNode();
+        final DataObjectModification<Top> afterBarPutEvent = Iterables.getOnlyElement(listener.nextEvent())
+                .getRootNode();
         verifyModification(afterBarPutEvent, TOP_ARGUMENT, ModificationType.SUBTREE_MODIFIED);
-        final DataObjectModification<TopLevelList> barPutMod = afterBarPutEvent.getModifiedChildListItem(TopLevelList.class, TOP_BAR_KEY);
+        final DataObjectModification<TopLevelList> barPutMod = afterBarPutEvent
+                .getModifiedChildListItem(TopLevelList.class, TOP_BAR_KEY);
         assertNotNull(barPutMod);
         verifyModification(barPutMod, BAR_ARGUMENT, ModificationType.WRITE);
 
         deleteTx(BAR_PATH).submit().checkedGet();
-        final DataObjectModification<Top> afterBarDeleteEvent = Iterables.getOnlyElement(listener.nextEvent()).getRootNode();
+        final DataObjectModification<Top> afterBarDeleteEvent = Iterables.getOnlyElement(listener.nextEvent())
+                .getRootNode();
         verifyModification(afterBarDeleteEvent, TOP_ARGUMENT, ModificationType.SUBTREE_MODIFIED);
-        final DataObjectModification<TopLevelList> barDeleteMod = afterBarDeleteEvent.getModifiedChildListItem(TopLevelList.class, TOP_BAR_KEY);
+        final DataObjectModification<TopLevelList> barDeleteMod = afterBarDeleteEvent
+                .getModifiedChildListItem(TopLevelList.class, TOP_BAR_KEY);
         verifyModification(barDeleteMod, BAR_ARGUMENT, ModificationType.DELETE);
     }
 
     @Test
     public void testWildcardedListListener() throws Exception {
         final EventCapturingListener<TopLevelList> listener = new EventCapturingListener<>();
-        final DataTreeIdentifier<TopLevelList> wildcard = new DataTreeIdentifier<>(LogicalDatastoreType.OPERATIONAL, TOP_PATH.child(TopLevelList.class));
+        final DataTreeIdentifier<TopLevelList> wildcard = new DataTreeIdentifier<>(LogicalDatastoreType.OPERATIONAL,
+                TOP_PATH.child(TopLevelList.class));
         dataBrokerImpl.registerDataTreeChangeListener(wildcard, listener);
 
         putTx(TOP_PATH, TOP_INITIAL_DATA).submit().checkedGet();
@@ -179,8 +183,8 @@ public class DataTreeChangeListenerTest extends AbstractConcurrentDataBrokerTest
         assertEquals(TOP_INITIAL_DATA, initialNode.getDataAfter());
     }
 
-    private void verifyModification(final DataObjectModification<? extends DataObject> barWrite, final PathArgument pathArg,
-            final ModificationType eventType) {
+    private void verifyModification(final DataObjectModification<? extends DataObject> barWrite,
+            final PathArgument pathArg, final ModificationType eventType) {
         assertEquals(pathArg.getType(), barWrite.getDataType());
         assertEquals(eventType,barWrite.getModificationType());
         assertEquals(pathArg, barWrite.getIdentifier());
index cf7ad16..1687705 100644 (file)
@@ -108,10 +108,10 @@ public class ForwardedNotificationAdapterTest extends AbstractNotificationBroker
     }
 
     private static class TestNotifListener implements OpendaylightMdsalListTestListener {
-        private List<TwoLevelListChanged> receivedNotifications = new ArrayList<>();
-        private CountDownLatch latch;
+        private final List<TwoLevelListChanged> receivedNotifications = new ArrayList<>();
+        private final CountDownLatch latch;
 
-        public TestNotifListener(CountDownLatch latch) {
+        TestNotifListener(CountDownLatch latch) {
             this.latch = latch;
         }
 
index 5d19d04..9885146 100644 (file)
@@ -9,8 +9,8 @@ package org.opendaylight.controller.md.sal.binding.impl.test;
 
 import static org.junit.Assert.assertTrue;
 
+import com.google.common.base.Optional;
 import java.util.concurrent.ExecutionException;
-
 import org.junit.Test;
 import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
 import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
@@ -24,9 +24,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controll
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.two.level.list.TopLevelListKey;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
-import com.google.common.base.Optional;
-
-
 public class WriteTransactionTest extends AbstractConcurrentDataBrokerTest {
 
     private static final InstanceIdentifier<Top> TOP_PATH = InstanceIdentifier.create(Top.class);
@@ -43,7 +40,8 @@ public class WriteTransactionTest extends AbstractConcurrentDataBrokerTest {
     }
 
     @Test
-    public void testPutCreateParentsSuccess() throws TransactionCommitFailedException, InterruptedException, ExecutionException {
+    public void testPutCreateParentsSuccess()
+            throws TransactionCommitFailedException, InterruptedException, ExecutionException {
         WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
         writeTx.put(LogicalDatastoreType.OPERATIONAL, NODE_PATH, NODE,true);
         writeTx.submit().checkedGet();
@@ -56,7 +54,8 @@ public class WriteTransactionTest extends AbstractConcurrentDataBrokerTest {
     }
 
     @Test
-    public void testMergeCreateParentsSuccess() throws TransactionCommitFailedException, InterruptedException, ExecutionException {
+    public void testMergeCreateParentsSuccess()
+            throws TransactionCommitFailedException, InterruptedException, ExecutionException {
         WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
         writeTx.merge(LogicalDatastoreType.OPERATIONAL, NODE_PATH, NODE,true);
         writeTx.submit().checkedGet();
@@ -67,5 +66,4 @@ public class WriteTransactionTest extends AbstractConcurrentDataBrokerTest {
         Optional<TopLevelList> listNode = readTx.read(LogicalDatastoreType.OPERATIONAL, NODE_PATH).get();
         assertTrue("List node must exists after commit",listNode.isPresent());
     }
-
 }
index 9dbf443..784fea8 100644 (file)
@@ -76,7 +76,8 @@ public abstract class AbstractDataBrokerTestCustomizer {
     }
 
     public NotificationService createNotificationService() {
-        return new BindingDOMNotificationServiceAdapter(this.bindingToNormalized.getCodecRegistry(), this.domNotificationRouter);
+        return new BindingDOMNotificationServiceAdapter(this.bindingToNormalized.getCodecRegistry(),
+                this.domNotificationRouter);
     }
 
     public NotificationPublishService createNotificationPublishService() {
index d96ebff..f1619d0 100644 (file)
@@ -10,10 +10,11 @@ package org.opendaylight.controller.md.sal.binding.test;
 
 import java.util.Collection;
 import java.util.Map;
-
 import org.junit.Assert;
 
-public class AssertCollections {
+public final class AssertCollections {
+    private AssertCollections() {
+    }
 
     public static void assertEmpty(final Collection<?> set) {
         Assert.assertTrue(set.isEmpty());
@@ -30,15 +31,15 @@ public class AssertCollections {
 
     }
 
-    public static void assertNotContains(final Collection<?> set, final Object... values) {
+    public static void assertContains(final Map<?,?> map, final Object... values) {
         for (Object key : values) {
-            Assert.assertFalse(set.contains(key));
+            Assert.assertTrue(map.containsKey(key));
         }
     }
 
-    public static void assertContains(final Map<?,?> map, final Object... values) {
+    public static void assertNotContains(final Collection<?> set, final Object... values) {
         for (Object key : values) {
-            Assert.assertTrue(map.containsKey(key));
+            Assert.assertFalse(set.contains(key));
         }
     }
 
index 3df048b..939349c 100644 (file)
@@ -8,12 +8,13 @@
 package org.opendaylight.controller.sal.binding.test;
 
 import static org.junit.Assert.assertNotNull;
+
 import org.opendaylight.yangtools.yang.binding.Augmentable;
 import org.opendaylight.yangtools.yang.binding.Augmentation;
 
 public class AugmentationVerifier<T extends Augmentable<T>> {
 
-    private T object;
+    private final T object;
 
     public AugmentationVerifier(T objectToVerify) {
         this.object = objectToVerify;
@@ -27,11 +28,11 @@ public class AugmentationVerifier<T extends Augmentable<T>> {
     public static <T extends Augmentable<T>> void assertHasAugmentation(T object,
             Class<? extends Augmentation<T>> augmentation) {
         assertNotNull(object);
-        assertNotNull("Augmentation " + augmentation.getSimpleName() + " is not present.", object.getAugmentation(augmentation));
+        assertNotNull("Augmentation " + augmentation.getSimpleName() + " is not present.",
+                object.getAugmentation(augmentation));
     }
 
     public static <T extends Augmentable<T>> AugmentationVerifier<T> from(T obj) {
         return new AugmentationVerifier<>(obj);
     }
-
 }
index fa56507..a8ff31c 100644 (file)
@@ -12,7 +12,5 @@ import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.DataRoot;
 import org.opendaylight.yangtools.yang.binding.Identifiable;
 
-public interface ReferencableObject extends DataObject,
-    Identifiable<ReferencableObjectKey>,ChildOf<DataRoot>{
-
+public interface ReferencableObject extends DataObject, Identifiable<ReferencableObjectKey>,ChildOf<DataRoot> {
 }
index 68d7f6c..412f1bf 100644 (file)
@@ -13,32 +13,37 @@ public class ReferencableObjectKey implements Identifier<ReferencableObject> {
     private static final long serialVersionUID = 1L;
     final Integer value;
 
-    public ReferencableObjectKey(Integer _value) {
-        this.value = _value;
+    public ReferencableObjectKey(Integer value) {
+        this.value = value;
     }
 
     @Override
     public int hashCode() {
         final int prime = 31;
         int result = 1;
-        result = prime * result + ((value == null) ? 0 : value.hashCode());
+        result = prime * result + (value == null ? 0 : value.hashCode());
         return result;
     }
 
     @Override
     public boolean equals(Object obj) {
-        if (this == obj)
+        if (this == obj) {
             return true;
-        if (obj == null)
+        }
+        if (obj == null) {
             return false;
-        if (getClass() != obj.getClass())
+        }
+        if (getClass() != obj.getClass()) {
             return false;
+        }
         ReferencableObjectKey other = (ReferencableObjectKey) obj;
         if (value == null) {
-            if (other.value != null)
+            if (other.value != null) {
                 return false;
-        } else if (!value.equals(other.value))
+            }
+        } else if (!value.equals(other.value)) {
             return false;
+        }
         return true;
     }
 
index c58e258..16c065b 100644 (file)
@@ -7,14 +7,12 @@
  */
 package org.opendaylight.controller.sal.binding.test.util;
 
-import java.util.concurrent.ExecutorService;
-
-import javassist.ClassPool;
-
 import com.google.common.annotations.Beta;
 import com.google.common.base.Preconditions;
 import com.google.common.util.concurrent.ListeningExecutorService;
 import com.google.common.util.concurrent.MoreExecutors;
+import java.util.concurrent.ExecutorService;
+import javassist.ClassPool;
 
 @Beta
 public class BindingBrokerTestFactory {
@@ -49,7 +47,7 @@ public class BindingBrokerTestFactory {
     }
 
     public ClassPool getClassPool() {
-        if(classPool == null) {
+        if (classPool == null) {
             return CLASS_POOL;
         }
 
@@ -59,5 +57,4 @@ public class BindingBrokerTestFactory {
     public void setClassPool(final ClassPool classPool) {
         this.classPool = classPool;
     }
-
 }
index 0d32816..a5b55a3 100644 (file)
@@ -60,8 +60,6 @@ import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 
 @Beta
 public class BindingTestContext implements AutoCloseable {
-
-
     private BindingToNormalizedNodeCodec codec;
 
     private RootBindingAwareBroker baBrokerImpl;
@@ -109,7 +107,8 @@ public class BindingTestContext implements AutoCloseable {
         return this.codec;
     }
 
-    protected BindingTestContext(final ListeningExecutorService executor, final ClassPool classPool, final boolean startWithSchema) {
+    protected BindingTestContext(final ListeningExecutorService executor, final ClassPool classPool,
+            final boolean startWithSchema) {
         this.executor = executor;
         this.classPool = classPool;
         this.startWithSchema = startWithSchema;
@@ -168,7 +167,8 @@ public class BindingTestContext implements AutoCloseable {
     public void startBindingToDomMappingService() {
         checkState(this.classPool != null, "ClassPool needs to be present");
 
-        final DataObjectSerializerGenerator generator = StreamWriterGenerator.create(JavassistUtils.forClassPool(this.classPool));
+        final DataObjectSerializerGenerator generator = StreamWriterGenerator.create(
+                JavassistUtils.forClassPool(this.classPool));
         final BindingNormalizedNodeCodecRegistry codecRegistry = new BindingNormalizedNodeCodecRegistry(generator);
         final GeneratedClassLoadingStrategy loading = GeneratedClassLoadingStrategy.getTCCLClassLoadingStrategy();
         this.codec = new BindingToNormalizedNodeCodec(loading,  codecRegistry);
@@ -262,6 +262,4 @@ public class BindingTestContext implements AutoCloseable {
     public DataBroker getDataBroker() {
         return this.dataBroker;
     }
-
-
 }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.