Bug 6859 - Binding generator v1 refactoring 70/52170/12
authorJakub Toth <jatoth@cisco.com>
Wed, 22 Feb 2017 12:53:39 +0000 (13:53 +0100)
committerRobert Varga <rovarga@cisco.com>
Mon, 6 Mar 2017 19:48:40 +0000 (20:48 +0100)
Based on transfer of Binding generator v1 from
Yangtools project to MDSAL in past, we need to finalize
this process by refactoring package naming:
org.opendaylight.yangtools       -> org.mdsal.binding
org.opendaylight.yangtools.sal -> org.mdsal.binding

Refactoring changes in MDSAL, see:
https://git.opendaylight.org/gerrit/#/c/52107

By using of Binding generator v1, this change needs to be addressed in
Controller project.

- refactoring itself
- add META-INF to gitignore

Change-Id: Ib7ec1b39466c0c814459bcbc2adce437b2a0ca64
Signed-off-by: Jakub Toth <jatoth@cisco.com>
Signed-off-by: Robert Varga <rovarga@cisco.com>
42 files changed:
.gitignore
opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/osgi/YangStoreActivator.java
opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/osgi/YangStoreService.java
opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/osgi/YangStoreSnapshot.java
opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/dependencyresolver/DependencyResolverImpl.java
opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/osgi/ConfigManagerActivator.java
opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/osgi/mapping/BindingContextProvider.java
opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/osgi/mapping/RefreshingSCPModuleInfoRegistry.java
opendaylight/config/config-manager/src/test/java/org/opendaylight/controller/config/manager/impl/AbstractConfigTest.java
opendaylight/config/config-manager/src/test/java/org/opendaylight/controller/config/manager/impl/osgi/RefreshingSCPModuleInfoRegistryTest.java
opendaylight/config/yang-jmx-generator-plugin/src/main/java/org/opendaylight/controller/config/yangjmxgenerator/plugin/JMXGenerator.java
opendaylight/config/yang-jmx-generator-plugin/src/main/java/org/opendaylight/controller/config/yangjmxgenerator/plugin/ftl/TemplateFactory.java
opendaylight/config/yang-jmx-generator-plugin/src/test/java/org/opendaylight/controller/config/yangjmxgenerator/plugin/ModuleMXBeanEntryTemplatesTest.java
opendaylight/config/yang-jmx-generator/src/main/java/org/opendaylight/controller/config/yangjmxgenerator/PackageTranslator.java
opendaylight/config/yang-jmx-generator/src/main/java/org/opendaylight/controller/config/yangjmxgenerator/TypeProviderWrapper.java
opendaylight/config/yang-jmx-generator/src/main/java/org/opendaylight/controller/config/yangjmxgenerator/attribute/DependencyAttribute.java
opendaylight/config/yang-jmx-generator/src/main/java/org/opendaylight/controller/config/yangjmxgenerator/attribute/JavaAttribute.java
opendaylight/config/yang-jmx-generator/src/main/java/org/opendaylight/controller/config/yangjmxgenerator/attribute/ListAttribute.java
opendaylight/config/yang-jmx-generator/src/main/java/org/opendaylight/controller/config/yangjmxgenerator/attribute/ListDependenciesAttribute.java
opendaylight/config/yang-jmx-generator/src/main/java/org/opendaylight/controller/config/yangjmxgenerator/attribute/SimpleTypeResolver.java
opendaylight/config/yang-jmx-generator/src/main/java/org/opendaylight/controller/config/yangjmxgenerator/attribute/TOAttribute.java
opendaylight/config/yang-jmx-generator/src/main/java/org/opendaylight/controller/config/yangjmxgenerator/attribute/TypedAttribute.java
opendaylight/config/yang-jmx-generator/src/test/java/org/opendaylight/controller/config/yangjmxgenerator/AbstractYangTest.java
opendaylight/config/yang-jmx-generator/src/test/java/org/opendaylight/controller/config/yangjmxgenerator/ModuleMXBeanEntryNameConflictTest.java
opendaylight/config/yang-jmx-generator/src/test/java/org/opendaylight/controller/config/yangjmxgenerator/ModuleMXBeanEntryTest.java
opendaylight/config/yang-jmx-generator/src/test/java/org/opendaylight/controller/config/yangjmxgenerator/RuntimeBeanEntryTest.java
opendaylight/config/yang-jmx-generator/src/test/java/org/opendaylight/controller/config/yangjmxgenerator/RuntimeRegistratorTest.java
opendaylight/config/yang-test/src/test/java/org/opendaylight/controller/config/yang/test/impl/NetconfTestImplModuleTest.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/FutureSchema.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/resources/org/opendaylight/blueprint/binding-broker.xml
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/test/BindingDOMDataBrokerAdapterTest.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/AbstractSchemaAwareTest.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/util/BindingTestContext.java
opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/AbstractDataChangeListenerTest.java
opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/SchemaUpdateForTransactionTest.java
opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/MdsalLowLevelTestProvider.java

index 9c5ee23714bcff7cd27a77cc71343deac8733732..735f29f704a32fa4309131b94b539f0dc3d83338 100644 (file)
@@ -32,3 +32,4 @@ opendaylight/md-sal/sal-distributed-datastore/journal
 .factorypath
 maven-metadata-local.xml
 .fbExcludeFilterFile
+META-INF
index 4c5674a57a7b0d277522294f21db3c9ec311ba4b..8c95a183831a1f91117bc933f9ed81f6833bdd25 100644 (file)
@@ -15,7 +15,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
 import javax.management.MBeanServer;
 import org.opendaylight.controller.config.facade.xml.ConfigSubsystemFacadeFactory;
 import org.opendaylight.controller.config.util.ConfigRegistryJMXClient;
-import org.opendaylight.yangtools.sal.binding.generator.util.BindingRuntimeContext;
+import org.opendaylight.mdsal.binding.generator.util.BindingRuntimeContext;
 import org.opendaylight.yangtools.yang.model.api.SchemaContextProvider;
 import org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource;
 import org.opendaylight.yangtools.yang.model.repo.spi.SchemaSourceProvider;
@@ -47,25 +47,25 @@ public class YangStoreActivator implements BundleActivator {
         LOG.debug("ConfigPersister starting");
         this.context = context;
 
-        ServiceTrackerCustomizer<SchemaContextProvider, YangStoreService> schemaServiceTrackerCustomizer = new ServiceTrackerCustomizer<SchemaContextProvider, YangStoreService>() {
+        final ServiceTrackerCustomizer<SchemaContextProvider, YangStoreService> schemaServiceTrackerCustomizer = new ServiceTrackerCustomizer<SchemaContextProvider, YangStoreService>() {
 
             private final AtomicBoolean alreadyStarted = new AtomicBoolean(false);
 
             @Override
-            public YangStoreService addingService(ServiceReference<SchemaContextProvider> reference) {
+            public YangStoreService addingService(final ServiceReference<SchemaContextProvider> reference) {
                 LOG.debug("Got addingService(SchemaContextProvider) event");
-                if(reference.getProperty(SchemaSourceProvider.class.getName()) == null &&
-                    reference.getProperty(BindingRuntimeContext.class.getName()) == null) {
+                if((reference.getProperty(SchemaSourceProvider.class.getName()) == null) &&
+                    (reference.getProperty(BindingRuntimeContext.class.getName()) == null)) {
                     LOG.debug("SchemaContextProvider not from config-manager. Ignoring");
                     return null;
                 }
 
                 // Yang store service should not be registered multiple times
-                if(!alreadyStarted.compareAndSet(false, true)) {
+                if(!this.alreadyStarted.compareAndSet(false, true)) {
                     LOG.warn("Starting yang store service multiple times. Received new service {}", reference);
                     throw new RuntimeException("Starting yang store service multiple times");
                 }
-                SchemaContextProvider schemaContextProvider = reference.getBundle().getBundleContext().getService(reference);
+                final SchemaContextProvider schemaContextProvider = reference.getBundle().getBundleContext().getService(reference);
                 final Object sourceProvider = Preconditions.checkNotNull(
                     reference.getProperty(SchemaSourceProvider.class.getName()), "Source provider not found");
                 Preconditions.checkArgument(sourceProvider instanceof SchemaSourceProvider);
@@ -81,15 +81,15 @@ public class YangStoreActivator implements BundleActivator {
                     yangStoreService.refresh(runtimeContext);
                 }
 
-                yangStoreServiceServiceRegistration = context.registerService(YangStoreService.class, yangStoreService,
+                YangStoreActivator.this.yangStoreServiceServiceRegistration = context.registerService(YangStoreService.class, yangStoreService,
                         new Hashtable<>());
-                configRegistryLookup = new ConfigRegistryLookupThread(yangStoreService);
-                configRegistryLookup.start();
+                YangStoreActivator.this.configRegistryLookup = new ConfigRegistryLookupThread(yangStoreService);
+                YangStoreActivator.this.configRegistryLookup.start();
                 return yangStoreService;
             }
 
             @Override
-            public void modifiedService(ServiceReference<SchemaContextProvider> reference, YangStoreService service) {
+            public void modifiedService(final ServiceReference<SchemaContextProvider> reference, final YangStoreService service) {
                 if (service == null) {
                     return;
                 }
@@ -102,35 +102,35 @@ public class YangStoreActivator implements BundleActivator {
             }
 
             @Override
-            public void removedService(ServiceReference<SchemaContextProvider> reference, YangStoreService service) {
+            public void removedService(final ServiceReference<SchemaContextProvider> reference, final YangStoreService service) {
                 if(service == null) {
                     return;
                 }
 
                 LOG.debug("Got removedService(SchemaContextProvider) event");
-                alreadyStarted.set(false);
-                configRegistryLookup.interrupt();
-                yangStoreServiceServiceRegistration.unregister();
-                yangStoreServiceServiceRegistration = null;
+                this.alreadyStarted.set(false);
+                YangStoreActivator.this.configRegistryLookup.interrupt();
+                YangStoreActivator.this.yangStoreServiceServiceRegistration.unregister();
+                YangStoreActivator.this.yangStoreServiceServiceRegistration = null;
             }
         };
 
-        ServiceTracker<SchemaContextProvider, YangStoreService> schemaContextProviderServiceTracker =
+        final ServiceTracker<SchemaContextProvider, YangStoreService> schemaContextProviderServiceTracker =
                 new ServiceTracker<>(context, SchemaContextProvider.class, schemaServiceTrackerCustomizer);
         schemaContextProviderServiceTracker.open();
     }
 
     @Override
-    public void stop(BundleContext context) throws Exception {
-        if(configRegistryLookup != null) {
-            configRegistryLookup.interrupt();
+    public void stop(final BundleContext context) throws Exception {
+        if(this.configRegistryLookup != null) {
+            this.configRegistryLookup.interrupt();
         }
-        if(osgiRegistrayion != null) {
-            osgiRegistrayion.unregister();
+        if(this.osgiRegistrayion != null) {
+            this.osgiRegistrayion.unregister();
         }
-        if (yangStoreServiceServiceRegistration != null) {
-            yangStoreServiceServiceRegistration.unregister();
-            yangStoreServiceServiceRegistration = null;
+        if (this.yangStoreServiceServiceRegistration != null) {
+            this.yangStoreServiceServiceRegistration.unregister();
+            this.yangStoreServiceServiceRegistration = null;
         }
     }
 
@@ -143,7 +143,7 @@ public class YangStoreActivator implements BundleActivator {
 
         private final YangStoreService yangStoreService;
 
-        private ConfigRegistryLookupThread(YangStoreService yangStoreService) {
+        private ConfigRegistryLookupThread(final YangStoreService yangStoreService) {
             super("config-registry-lookup");
             this.yangStoreService = yangStoreService;
         }
@@ -158,10 +158,10 @@ public class YangStoreActivator implements BundleActivator {
             while(true) {
 
                 try {
-                    configRegistryJMXClient = new ConfigRegistryJMXClient(configMBeanServer);
-                    configRegistryJMXClientNoNotifications = ConfigRegistryJMXClient.createWithoutNotifications(configMBeanServer);
+                    configRegistryJMXClient = new ConfigRegistryJMXClient(YangStoreActivator.this.configMBeanServer);
+                    configRegistryJMXClientNoNotifications = ConfigRegistryJMXClient.createWithoutNotifications(YangStoreActivator.this.configMBeanServer);
                     break;
-                } catch (IllegalStateException e) {
+                } catch (final IllegalStateException e) {
                     ++i;
                     if (i > SILENT_ATTEMPTS) {
                         LOG.info("JMX client not created after {} attempts, still trying", i, e);
@@ -170,7 +170,7 @@ public class YangStoreActivator implements BundleActivator {
                     }
                     try {
                         Thread.sleep(ATTEMPT_TIMEOUT_MS);
-                    } catch (InterruptedException e1) {
+                    } catch (final InterruptedException e1) {
                         Thread.currentThread().interrupt();
                         throw new IllegalStateException("Interrupted while reattempting connection", e1);
                     }
@@ -186,8 +186,8 @@ public class YangStoreActivator implements BundleActivator {
             }
 
             final ConfigSubsystemFacadeFactory configSubsystemFacade =
-                    new ConfigSubsystemFacadeFactory(jmxClient, jmxClientNoNotifications, yangStoreService);
-            osgiRegistrayion = context.registerService(ConfigSubsystemFacadeFactory.class, configSubsystemFacade,
+                    new ConfigSubsystemFacadeFactory(jmxClient, jmxClientNoNotifications, this.yangStoreService);
+            YangStoreActivator.this.osgiRegistrayion = YangStoreActivator.this.context.registerService(ConfigSubsystemFacadeFactory.class, configSubsystemFacade,
                     new Hashtable<>());
         }
     }
index f89d26b0cd1b426e6fb765b2e962ca4e7bdd05ee..cd316611f6d4cb6736ba04a2a3374fe110777884 100644 (file)
@@ -24,7 +24,7 @@ import org.opendaylight.controller.config.util.capability.Capability;
 import org.opendaylight.controller.config.util.capability.ModuleListener;
 import org.opendaylight.controller.config.util.capability.YangModuleCapability;
 import org.opendaylight.controller.config.yangjmxgenerator.ModuleMXBeanEntry;
-import org.opendaylight.yangtools.sal.binding.generator.util.BindingRuntimeContext;
+import org.opendaylight.mdsal.binding.generator.util.BindingRuntimeContext;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.ModuleIdentifier;
@@ -58,7 +58,7 @@ public class YangStoreService implements YangStoreContext {
     }
 
     public YangStoreContext getCurrentSnapshot() {
-        return snap;
+        return this.snap;
     }
 
     @Deprecated
@@ -68,9 +68,9 @@ public class YangStoreService implements YangStoreContext {
         YangStoreSnapshot snapshot;
 
         do {
-            snapshot = snap;
+            snapshot = this.snap;
             ret = snapshot.getModuleMXBeanEntryMap();
-        } while (!snapshot.equals(snap));
+        } while (!snapshot.equals(this.snap));
 
         return ret;
     }
@@ -81,33 +81,33 @@ public class YangStoreService implements YangStoreContext {
         YangStoreSnapshot snapshot;
 
         do {
-            snapshot = snap;
+            snapshot = this.snap;
             ret = snapshot.getQNamesToIdentitiesToModuleMXBeanEntries();
-        } while (!snapshot.equals(snap));
+        } while (!snapshot.equals(this.snap));
 
         return ret;
     }
 
     @Override
     public Set<Module> getModules() {
-        return snap.getModules();
+        return this.snap.getModules();
     }
 
     @Override
     public String getModuleSource(final ModuleIdentifier moduleIdentifier) {
-        return snap.getModuleSource(moduleIdentifier);
+        return this.snap.getModuleSource(moduleIdentifier);
     }
 
     @Override
     public EnumResolver getEnumResolver() {
-        return snap.getEnumResolver();
+        return this.snap.getEnumResolver();
     }
 
     public void refresh(final BindingRuntimeContext runtimeContext) {
-        final YangStoreSnapshot next = new YangStoreSnapshot(runtimeContext, sourceProvider);
-        final YangStoreSnapshot previous = snap;
-        snap = next;
-        notificationExecutor.submit(new Runnable() {
+        final YangStoreSnapshot next = new YangStoreSnapshot(runtimeContext, this.sourceProvider);
+        final YangStoreSnapshot previous = this.snap;
+        this.snap = next;
+        this.notificationExecutor.submit(new Runnable() {
             @Override
             public void run() {
                 notifyListeners(previous, next);
@@ -116,9 +116,9 @@ public class YangStoreService implements YangStoreContext {
     }
 
     public AutoCloseable registerModuleListener(final ModuleListener listener) {
-        final YangStoreContext context = snap;
+        final YangStoreContext context = this.snap;
 
-        synchronized (listeners) {
+        synchronized (this.listeners) {
             if (context != null) {
                 listener.onCapabilitiesChanged(toCapabilities(context.getModules(), context), Collections.<Capability>emptySet());
             }
@@ -128,8 +128,8 @@ public class YangStoreService implements YangStoreContext {
         return new AutoCloseable() {
             @Override
             public void close() {
-                synchronized (listeners) {
-                    listeners.remove(listener);
+                synchronized (YangStoreService.this.listeners) {
+                    YangStoreService.this.listeners.remove(listener);
                 }
             }
         };
@@ -144,8 +144,8 @@ public class YangStoreService implements YangStoreContext {
         final Set<Capability> addedCaps = toCapabilities(added, current);
         final Set<Capability> removedCaps = toCapabilities(removed, current);
 
-        synchronized (listeners) {
-            for (final ModuleListener listener : listeners) {
+        synchronized (this.listeners) {
+            for (final ModuleListener listener : this.listeners) {
                 listener.onCapabilitiesChanged(addedCaps, removedCaps);
             }
         }
index c819339afcb30dfec02727eeec77182eef6264ad..36f32087103f0078f14eebd08a08216ca3e811a5 100644 (file)
@@ -29,8 +29,8 @@ import org.opendaylight.controller.config.yangjmxgenerator.ModuleMXBeanEntry;
 import org.opendaylight.controller.config.yangjmxgenerator.PackageTranslator;
 import org.opendaylight.controller.config.yangjmxgenerator.ServiceInterfaceEntry;
 import org.opendaylight.controller.config.yangjmxgenerator.TypeProviderWrapper;
-import org.opendaylight.yangtools.sal.binding.generator.util.BindingRuntimeContext;
-import org.opendaylight.yangtools.sal.binding.yang.types.TypeProviderImpl;
+import org.opendaylight.mdsal.binding.generator.util.BindingRuntimeContext;
+import org.opendaylight.mdsal.binding.yang.types.TypeProviderImpl;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.IdentitySchemaNode;
 import org.opendaylight.yangtools.yang.model.api.Module;
@@ -52,16 +52,16 @@ final class YangStoreSnapshot implements YangStoreContext, EnumResolver {
             LOG.trace("Resolved modules:{}", schemaContext.getModules());
 
             // JMX generator
-            Map<String, String> namespaceToPackageMapping = Maps.newHashMap();
-            PackageTranslator packageTranslator = new PackageTranslator(namespaceToPackageMapping);
-            Map<QName, ServiceInterfaceEntry> qNamesToSIEs = new HashMap<>();
-            Map<IdentitySchemaNode, ServiceInterfaceEntry> knownSEITracker = new HashMap<>();
+            final Map<String, String> namespaceToPackageMapping = Maps.newHashMap();
+            final PackageTranslator packageTranslator = new PackageTranslator(namespaceToPackageMapping);
+            final Map<QName, ServiceInterfaceEntry> qNamesToSIEs = new HashMap<>();
+            final Map<IdentitySchemaNode, ServiceInterfaceEntry> knownSEITracker = new HashMap<>();
             // create SIE structure qNamesToSIEs
-            for (Module module : schemaContext.getModules()) {
-                String packageName = packageTranslator.getPackageName(module);
-                Map<QName, ServiceInterfaceEntry> namesToSIEntries = ServiceInterfaceEntry
+            for (final Module module : schemaContext.getModules()) {
+                final String packageName = packageTranslator.getPackageName(module);
+                final Map<QName, ServiceInterfaceEntry> namesToSIEntries = ServiceInterfaceEntry
                         .create(module, packageName, knownSEITracker);
-                for (Entry<QName, ServiceInterfaceEntry> sieEntry : namesToSIEntries.entrySet()) {
+                for (final Entry<QName, ServiceInterfaceEntry> sieEntry : namesToSIEntries.entrySet()) {
                     // merge value into qNamesToSIEs
                     if (qNamesToSIEs.containsKey(sieEntry.getKey()) == false) {
                         qNamesToSIEs.put(sieEntry.getKey(), sieEntry.getValue());
@@ -72,19 +72,19 @@ final class YangStoreSnapshot implements YangStoreContext, EnumResolver {
                 }
             }
 
-            Map<String, Map<String, ModuleMXBeanEntry>> moduleMXBeanEntryMap = Maps.newHashMap();
+            final Map<String, Map<String, ModuleMXBeanEntry>> moduleMXBeanEntryMap = Maps.newHashMap();
 
-            Map<QName, Map<String /* identity local name */, ModuleMXBeanEntry>> qNamesToIdentitiesToModuleMXBeanEntries = new HashMap<>();
+            final Map<QName, Map<String /* identity local name */, ModuleMXBeanEntry>> qNamesToIdentitiesToModuleMXBeanEntries = new HashMap<>();
 
 
-            for (Module module : schemaContext.getModules()) {
-                String packageName = packageTranslator.getPackageName(module);
-                TypeProviderWrapper typeProviderWrapper = new TypeProviderWrapper(
+            for (final Module module : schemaContext.getModules()) {
+                final String packageName = packageTranslator.getPackageName(module);
+                final TypeProviderWrapper typeProviderWrapper = new TypeProviderWrapper(
                         new TypeProviderImpl(schemaContext));
 
-                QName qName = QName.create(module.getNamespace(), module.getRevision(), module.getName());
+                final QName qName = QName.create(module.getNamespace(), module.getRevision(), module.getName());
 
-                Map<String /* MB identity local name */, ModuleMXBeanEntry> namesToMBEs =
+                final Map<String /* MB identity local name */, ModuleMXBeanEntry> namesToMBEs =
                         Collections.unmodifiableMap(ModuleMXBeanEntry.create(module, qNamesToSIEs, schemaContext,
                                 typeProviderWrapper, packageName));
                 moduleMXBeanEntryMap.put(module.getNamespace().toString(), namesToMBEs);
@@ -114,14 +114,14 @@ final class YangStoreSnapshot implements YangStoreContext, EnumResolver {
     }
 
     private MXBeans getMXBeans() {
-        MXBeans mxBean = ref.get();
+        MXBeans mxBean = this.ref.get();
 
         if (mxBean == null) {
             synchronized (this) {
-                mxBean = ref.get();
+                mxBean = this.ref.get();
                 if (mxBean == null) {
-                    mxBean = new MXBeans(bindingContextProvider.getSchemaContext());
-                    ref = new SoftReference<>(mxBean);
+                    mxBean = new MXBeans(this.bindingContextProvider.getSchemaContext());
+                    this.ref = new SoftReference<>(mxBean);
                 }
             }
         }
@@ -141,8 +141,8 @@ final class YangStoreSnapshot implements YangStoreContext, EnumResolver {
 
     @Override
     public Set<Module> getModules() {
-        final Set<Module> modules = Sets.newHashSet(bindingContextProvider.getSchemaContext().getModules());
-        for (final Module module : bindingContextProvider.getSchemaContext().getModules()) {
+        final Set<Module> modules = Sets.newHashSet(this.bindingContextProvider.getSchemaContext().getModules());
+        for (final Module module : this.bindingContextProvider.getSchemaContext().getModules()) {
             modules.addAll(module.getSubmodules());
         }
         return modules;
@@ -150,7 +150,7 @@ final class YangStoreSnapshot implements YangStoreContext, EnumResolver {
 
     @Override
     public String getModuleSource(final org.opendaylight.yangtools.yang.model.api.ModuleIdentifier moduleIdentifier) {
-        final CheckedFuture<? extends YangTextSchemaSource, SchemaSourceException> source = sourceProvider.getSource(
+        final CheckedFuture<? extends YangTextSchemaSource, SchemaSourceException> source = this.sourceProvider.getSource(
             SourceIdentifier.create(moduleIdentifier.getName(), Optional.fromNullable(
                 QName.formattedRevision(moduleIdentifier.getRevision()))));
 
@@ -180,26 +180,26 @@ final class YangStoreSnapshot implements YangStoreContext, EnumResolver {
         }
 
         final YangStoreSnapshot other = (YangStoreSnapshot) obj;
-        return Objects.equals(bindingContextProvider, other.bindingContextProvider);
+        return Objects.equals(this.bindingContextProvider, other.bindingContextProvider);
     }
 
     @Override
     public int hashCode() {
-        return Objects.hashCode(bindingContextProvider);
+        return Objects.hashCode(this.bindingContextProvider);
     }
 
     @Override
     public String fromYang(final String enumClass, final String enumYangValue) {
-        Preconditions.checkState(bindingContextProvider != null, "Binding context provider was not set yet");
-        final BiMap<String, String> enumMapping = bindingContextProvider.getEnumMapping(enumClass);
+        Preconditions.checkState(this.bindingContextProvider != null, "Binding context provider was not set yet");
+        final BiMap<String, String> enumMapping = this.bindingContextProvider.getEnumMapping(enumClass);
         final String javaName = enumMapping.get(enumYangValue);
         return Preconditions.checkNotNull(javaName, "Unable to resolve enum value %s for enum class %s with assumed enum mapping: %s", enumYangValue, enumClass, enumMapping);
     }
 
     @Override
     public String toYang(final String enumClass, final String enumJavaValue) {
-        Preconditions.checkState(bindingContextProvider != null, "Binding context provider was not set yet");
-        final BiMap<String, String> enumMapping = bindingContextProvider.getEnumMapping(enumClass);
+        Preconditions.checkState(this.bindingContextProvider != null, "Binding context provider was not set yet");
+        final BiMap<String, String> enumMapping = this.bindingContextProvider.getEnumMapping(enumClass);
         final String javaName = enumMapping.inverse().get(enumJavaValue);
         return Preconditions.checkNotNull(javaName,
             "Unable to map enum value %s for enum class %s with assumed enum mapping: %s", enumJavaValue, enumClass,
index d667f13ec601e23d6b0cb77447dba63a13c9ec56..eb3676ccebff5625db2f68b64b9f834488433ea2 100644 (file)
@@ -56,10 +56,10 @@ final class DependencyResolverImpl implements DependencyResolver,
     private final MBeanServer mBeanServer;
     private Integer maxDependencyDepth;
 
-    DependencyResolverImpl(ModuleIdentifier currentModule,
-                           TransactionStatus transactionStatus, ModulesHolder modulesHolder,
-                           ServiceReferenceReadableRegistry readableRegistry, BindingContextProvider bindingContextProvider,
-                           String transactionName, MBeanServer mBeanServer) {
+    DependencyResolverImpl(final ModuleIdentifier currentModule,
+                           final TransactionStatus transactionStatus, final ModulesHolder modulesHolder,
+                           final ServiceReferenceReadableRegistry readableRegistry, final BindingContextProvider bindingContextProvider,
+                           final String transactionName, final MBeanServer mBeanServer) {
         this.bindingContextProvider = bindingContextProvider;
         this.name = currentModule;
         this.transactionStatus = transactionStatus;
@@ -75,10 +75,10 @@ final class DependencyResolverImpl implements DependencyResolver,
     //TODO: check for cycles
     @Override
     public void validateDependency(
-            Class<? extends AbstractServiceInterface> expectedServiceInterface,
-            ObjectName dependentReadOnlyON, JmxAttribute jmxAttribute) {
+            final Class<? extends AbstractServiceInterface> expectedServiceInterface,
+            final ObjectName dependentReadOnlyON, final JmxAttribute jmxAttribute) {
 
-        transactionStatus.checkNotCommitted();
+        this.transactionStatus.checkNotCommitted();
         if (expectedServiceInterface == null) {
             throw new NullPointerException(
                     "Parameter 'expectedServiceInterface' is null");
@@ -96,7 +96,7 @@ final class DependencyResolverImpl implements DependencyResolver,
         // check that objectName belongs to this transaction - this should be
         // stripped
         // in DynamicWritableWrapper
-        boolean hasTransaction = ObjectNameUtil
+        final boolean hasTransaction = ObjectNameUtil
                 .getTransactionName(dependentReadOnlyON) != null;
         JmxAttributeValidationException.checkCondition(
                 !hasTransaction,
@@ -106,17 +106,17 @@ final class DependencyResolverImpl implements DependencyResolver,
             ), jmxAttribute
         );
 
-        ObjectName newDependentReadOnlyON = translateServiceRefIfPossible(dependentReadOnlyON);
+        final ObjectName newDependentReadOnlyON = translateServiceRefIfPossible(dependentReadOnlyON);
 
-        ModuleIdentifier moduleIdentifier = ObjectNameUtil.fromON(newDependentReadOnlyON, ObjectNameUtil
+        final ModuleIdentifier moduleIdentifier = ObjectNameUtil.fromON(newDependentReadOnlyON, ObjectNameUtil
                 .TYPE_MODULE);
 
-        ModuleFactory foundFactory = modulesHolder.findModuleFactory(moduleIdentifier, jmxAttribute);
+        final ModuleFactory foundFactory = this.modulesHolder.findModuleFactory(moduleIdentifier, jmxAttribute);
 
-        boolean implementsSI = foundFactory
+        final boolean implementsSI = foundFactory
                 .isModuleImplementingServiceInterface(expectedServiceInterface);
         if (!implementsSI) {
-            String message = String.format(
+            final String message = String.format(
                     "Found module factory does not expose expected service interface. "
                             + "Module name is %s : %s, expected service interface %s, dependent module ON %s , "
                             + "attribute %s",
@@ -127,18 +127,18 @@ final class DependencyResolverImpl implements DependencyResolver,
             throw new JmxAttributeValidationException(message, jmxAttribute);
         }
         synchronized (this) {
-            dependencies.add(moduleIdentifier);
+            this.dependencies.add(moduleIdentifier);
         }
     }
 
     // translate from serviceref to module ON
-    private ObjectName translateServiceRefIfPossible(ObjectName dependentReadOnlyON) {
+    private ObjectName translateServiceRefIfPossible(final ObjectName dependentReadOnlyON) {
         ObjectName translatedDependentReadOnlyON = dependentReadOnlyON;
         if (ObjectNameUtil.isServiceReference(translatedDependentReadOnlyON)) {
-            String serviceQName = ObjectNameUtil.getServiceQName(translatedDependentReadOnlyON);
-            String refName = ObjectNameUtil.getReferenceName(translatedDependentReadOnlyON);
+            final String serviceQName = ObjectNameUtil.getServiceQName(translatedDependentReadOnlyON);
+            final String refName = ObjectNameUtil.getReferenceName(translatedDependentReadOnlyON);
             translatedDependentReadOnlyON = ObjectNameUtil.withoutTransactionName( // strip again of transaction name
-                    readableRegistry.lookupConfigBeanByServiceInterfaceName(serviceQName, refName));
+                    this.readableRegistry.lookupConfigBeanByServiceInterfaceName(serviceQName, refName));
         }
         return translatedDependentReadOnlyON;
     }
@@ -148,26 +148,26 @@ final class DependencyResolverImpl implements DependencyResolver,
      */
     //TODO: check for cycles
     @Override
-    public <T> T resolveInstance(Class<T> expectedType, ObjectName dependentReadOnlyON,
-                                 JmxAttribute jmxAttribute) {
-        Module module = resolveModuleInstance(dependentReadOnlyON, jmxAttribute);
+    public <T> T resolveInstance(final Class<T> expectedType, final ObjectName dependentReadOnlyON,
+                                 final JmxAttribute jmxAttribute) {
+        final Module module = resolveModuleInstance(dependentReadOnlyON, jmxAttribute);
 
         synchronized (this) {
-            dependencies.add(module.getIdentifier());
+            this.dependencies.add(module.getIdentifier());
         }
-        AutoCloseable instance = module.getInstance();
+        final AutoCloseable instance = module.getInstance();
         if (instance == null) {
-            String message = String.format(
+            final String message = String.format(
                     "Error while %s resolving instance %s. getInstance() returned null. "
-                            + "Expected type %s , attribute %s", name,
+                            + "Expected type %s , attribute %s", this.name,
                     module.getIdentifier(), expectedType, jmxAttribute
             );
             throw new JmxAttributeValidationException(message, jmxAttribute);
         }
         try {
             return expectedType.cast(instance);
-        } catch (ClassCastException e) {
-            String message = String.format(
+        } catch (final ClassCastException e) {
+            final String message = String.format(
                     "Instance cannot be cast to expected type. Instance class is %s , "
                             + "expected type %s , attribute %s",
                     instance.getClass(), expectedType, jmxAttribute
@@ -176,43 +176,43 @@ final class DependencyResolverImpl implements DependencyResolver,
         }
     }
 
-    private Module resolveModuleInstance(ObjectName dependentReadOnlyON,
-                                 JmxAttribute jmxAttribute) {
+    private Module resolveModuleInstance(final ObjectName dependentReadOnlyON,
+                                 final JmxAttribute jmxAttribute) {
         Preconditions.checkArgument(dependentReadOnlyON != null ,"dependentReadOnlyON");
         Preconditions.checkArgument(jmxAttribute != null, "jmxAttribute");
-        ObjectName translatedDependentReadOnlyON = translateServiceRefIfPossible(dependentReadOnlyON);
-        transactionStatus.checkCommitStarted();
-        transactionStatus.checkNotCommitted();
+        final ObjectName translatedDependentReadOnlyON = translateServiceRefIfPossible(dependentReadOnlyON);
+        this.transactionStatus.checkCommitStarted();
+        this.transactionStatus.checkNotCommitted();
 
-        ModuleIdentifier dependentModuleIdentifier = ObjectNameUtil.fromON(
+        final ModuleIdentifier dependentModuleIdentifier = ObjectNameUtil.fromON(
                 translatedDependentReadOnlyON, ObjectNameUtil.TYPE_MODULE);
 
-        return Preconditions.checkNotNull(modulesHolder.findModule(dependentModuleIdentifier, jmxAttribute));
+        return Preconditions.checkNotNull(this.modulesHolder.findModule(dependentModuleIdentifier, jmxAttribute));
     }
 
     @Override
-    public boolean canReuseDependency(ObjectName objectName, JmxAttribute jmxAttribute) {
+    public boolean canReuseDependency(final ObjectName objectName, final JmxAttribute jmxAttribute) {
         Preconditions.checkNotNull(objectName);
         Preconditions.checkNotNull(jmxAttribute);
 
-        Module currentModule = resolveModuleInstance(objectName, jmxAttribute);
-        ModuleIdentifier identifier = currentModule.getIdentifier();
-        ModuleInternalTransactionalInfo moduleInternalTransactionalInfo = modulesHolder.findModuleInternalTransactionalInfo(identifier);
+        final Module currentModule = resolveModuleInstance(objectName, jmxAttribute);
+        final ModuleIdentifier identifier = currentModule.getIdentifier();
+        final ModuleInternalTransactionalInfo moduleInternalTransactionalInfo = this.modulesHolder.findModuleInternalTransactionalInfo(identifier);
 
         if(moduleInternalTransactionalInfo.hasOldModule()) {
-            Module oldModule = moduleInternalTransactionalInfo.getOldInternalInfo().getReadableModule().getModule();
+            final Module oldModule = moduleInternalTransactionalInfo.getOldInternalInfo().getReadableModule().getModule();
             return currentModule.canReuse(oldModule);
         }
         return false;
     }
 
     @Override
-    public <T extends BaseIdentity> Class<? extends T> resolveIdentity(IdentityAttributeRef identityRef, Class<T> expectedBaseClass) {
+    public <T extends BaseIdentity> Class<? extends T> resolveIdentity(final IdentityAttributeRef identityRef, final Class<T> expectedBaseClass) {
         final QName qName = QName.create(identityRef.getqNameOfIdentity());
-        Class<?> deserialized  = bindingContextProvider.getBindingContext().getIdentityClass(qName);
+        final Class<?> deserialized  = this.bindingContextProvider.getBindingContext().getIdentityClass(qName);
         if (deserialized == null) {
             throw new IllegalStateException("Unable to retrieve identity class for " + qName + ", null response from "
-                    + bindingContextProvider.getBindingContext());
+                    + this.bindingContextProvider.getBindingContext());
         }
         if (expectedBaseClass.isAssignableFrom(deserialized)) {
             return (Class<T>) deserialized;
@@ -224,49 +224,49 @@ final class DependencyResolverImpl implements DependencyResolver,
     }
 
     @Override
-    public <T extends BaseIdentity> void validateIdentity(IdentityAttributeRef identityRef, Class<T> expectedBaseClass, JmxAttribute jmxAttribute) {
+    public <T extends BaseIdentity> void validateIdentity(final IdentityAttributeRef identityRef, final Class<T> expectedBaseClass, final JmxAttribute jmxAttribute) {
         try {
             resolveIdentity(identityRef, expectedBaseClass);
-        } catch (Exception e) {
+        } catch (final Exception e) {
             throw JmxAttributeValidationException.wrap(e, jmxAttribute);
         }
     }
 
     @Override
-    public int compareTo(DependencyResolverImpl o) {
-        transactionStatus.checkCommitStarted();
+    public int compareTo(final DependencyResolverImpl o) {
+        this.transactionStatus.checkCommitStarted();
         return Integer.compare(getMaxDependencyDepth(),
                 o.getMaxDependencyDepth());
     }
 
     int getMaxDependencyDepth() {
-        if (maxDependencyDepth == null) {
+        if (this.maxDependencyDepth == null) {
             throw new IllegalStateException("Dependency depth was not computed");
         }
-        return maxDependencyDepth;
+        return this.maxDependencyDepth;
     }
 
-    void countMaxDependencyDepth(DependencyResolverManager manager) {
+    void countMaxDependencyDepth(final DependencyResolverManager manager) {
         // We can calculate the dependency after second phase commit was started
         // Second phase commit starts after validation and validation adds the dependencies into the dependency resolver, which are necessary for the calculation
         // FIXME generated code for abstract module declares validate method as non-final
         // Overriding the validate would cause recreate every time instead of reuse + also possibly wrong close order if there is another module depending
-        transactionStatus.checkCommitStarted();
-        if (maxDependencyDepth == null) {
-            maxDependencyDepth = getMaxDepth(this, manager,
+        this.transactionStatus.checkCommitStarted();
+        if (this.maxDependencyDepth == null) {
+            this.maxDependencyDepth = getMaxDepth(this, manager,
                     new LinkedHashSet<>());
         }
     }
 
-    private static int getMaxDepth(DependencyResolverImpl impl,
-                                   DependencyResolverManager manager,
-                                   LinkedHashSet<ModuleIdentifier> chainForDetectingCycles) {
+    private static int getMaxDepth(final DependencyResolverImpl impl,
+                                   final DependencyResolverManager manager,
+                                   final LinkedHashSet<ModuleIdentifier> chainForDetectingCycles) {
         int maxDepth = 0;
-        LinkedHashSet<ModuleIdentifier> chainForDetectingCycles2 = new LinkedHashSet<>(
+        final LinkedHashSet<ModuleIdentifier> chainForDetectingCycles2 = new LinkedHashSet<>(
                 chainForDetectingCycles);
         chainForDetectingCycles2.add(impl.getIdentifier());
-        for (ModuleIdentifier dependencyName : impl.dependencies) {
-            DependencyResolverImpl dependentDRI = manager
+        for (final ModuleIdentifier dependencyName : impl.dependencies) {
+            final DependencyResolverImpl dependentDRI = manager
                     .getOrCreate(dependencyName);
             if (chainForDetectingCycles2.contains(dependencyName)) {
                 throw new IllegalStateException(String.format(
@@ -281,7 +281,7 @@ final class DependencyResolverImpl implements DependencyResolver,
                         chainForDetectingCycles2);
                 dependentDRI.maxDependencyDepth = subDepth;
             }
-            if (subDepth + 1 > maxDepth) {
+            if ((subDepth + 1) > maxDepth) {
                 maxDepth = subDepth + 1;
             }
         }
@@ -291,23 +291,23 @@ final class DependencyResolverImpl implements DependencyResolver,
 
     @Override
     public ModuleIdentifier getIdentifier() {
-        return name;
+        return this.name;
     }
 
     @Override
-    public Object getAttribute(ObjectName name, String attribute)
+    public Object getAttribute(final ObjectName name, final String attribute)
             throws MBeanException, AttributeNotFoundException, InstanceNotFoundException, ReflectionException {
         ObjectName newName = translateServiceRefIfPossible(name);
         // add transaction name
-        newName = ObjectNameUtil.withTransactionName(newName, transactionName);
-        return mBeanServer.getAttribute(newName, attribute);
+        newName = ObjectNameUtil.withTransactionName(newName, this.transactionName);
+        return this.mBeanServer.getAttribute(newName, attribute);
     }
 
     @Override
-    public <T> T newMXBeanProxy(ObjectName name, Class<T> interfaceClass) {
+    public <T> T newMXBeanProxy(final ObjectName name, final Class<T> interfaceClass) {
         ObjectName newName = translateServiceRefIfPossible(name);
         // add transaction name
-        newName = ObjectNameUtil.withTransactionName(newName, transactionName);
-        return JMX.newMXBeanProxy(mBeanServer, newName, interfaceClass);
+        newName = ObjectNameUtil.withTransactionName(newName, this.transactionName);
+        return JMX.newMXBeanProxy(this.mBeanServer, newName, interfaceClass);
     }
 }
index b2f7a6dd20e299190ffd51af6422f668d5e8f316..1d8c3bbc30bff75a5f41d51dd5af2e06ca919dff 100644 (file)
@@ -23,9 +23,9 @@ import org.opendaylight.controller.config.manager.impl.osgi.mapping.ModuleInfoBu
 import org.opendaylight.controller.config.manager.impl.osgi.mapping.RefreshingSCPModuleInfoRegistry;
 import org.opendaylight.controller.config.manager.impl.util.OsgiRegistrationUtil;
 import org.opendaylight.controller.config.spi.ModuleFactory;
+import org.opendaylight.mdsal.binding.generator.api.ClassLoadingStrategy;
+import org.opendaylight.mdsal.binding.generator.impl.ModuleInfoBackedContext;
 import org.opendaylight.yangtools.concepts.ObjectRegistration;
-import org.opendaylight.yangtools.sal.binding.generator.api.ClassLoadingStrategy;
-import org.opendaylight.yangtools.sal.binding.generator.impl.ModuleInfoBackedContext;
 import org.opendaylight.yangtools.yang.binding.YangModuleInfo;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleActivator;
@@ -53,28 +53,28 @@ public class ConfigManagerActivator implements BundleActivator, SynchronousBundl
     public void start(final BundleContext context) {
         try {
             // the inner strategy is backed by thread context cl?
-            ModuleInfoBackedContext moduleInfoBackedContext = ModuleInfoBackedContext.create();
+            final ModuleInfoBackedContext moduleInfoBackedContext = ModuleInfoBackedContext.create();
 
-            BindingContextProvider bindingContextProvider = new BindingContextProvider();
+            final BindingContextProvider bindingContextProvider = new BindingContextProvider();
 
-            RefreshingSCPModuleInfoRegistry moduleInfoRegistryWrapper = new RefreshingSCPModuleInfoRegistry(
+            final RefreshingSCPModuleInfoRegistry moduleInfoRegistryWrapper = new RefreshingSCPModuleInfoRegistry(
                     moduleInfoBackedContext, moduleInfoBackedContext, moduleInfoBackedContext, moduleInfoBackedContext, bindingContextProvider, context);
 
-            ModuleInfoBundleTracker moduleInfoBundleTracker = new ModuleInfoBundleTracker(context, moduleInfoRegistryWrapper);
+            final ModuleInfoBundleTracker moduleInfoBundleTracker = new ModuleInfoBundleTracker(context, moduleInfoRegistryWrapper);
 
             // start config registry
-            BundleContextBackedModuleFactoriesResolver bundleContextBackedModuleFactoriesResolver = new BundleContextBackedModuleFactoriesResolver(
+            final BundleContextBackedModuleFactoriesResolver bundleContextBackedModuleFactoriesResolver = new BundleContextBackedModuleFactoriesResolver(
                     context);
-            configRegistry = new ConfigRegistryImpl(bundleContextBackedModuleFactoriesResolver, configMBeanServer,
+            this.configRegistry = new ConfigRegistryImpl(bundleContextBackedModuleFactoriesResolver, this.configMBeanServer,
                     bindingContextProvider);
 
             // track bundles containing factories
-            BlankTransactionServiceTracker blankTransactionServiceTracker = new BlankTransactionServiceTracker(
-                    configRegistry);
-            ModuleFactoryBundleTracker moduleFactoryTracker = new ModuleFactoryBundleTracker(
+            final BlankTransactionServiceTracker blankTransactionServiceTracker = new BlankTransactionServiceTracker(
+                    this.configRegistry);
+            final ModuleFactoryBundleTracker moduleFactoryTracker = new ModuleFactoryBundleTracker(
                     blankTransactionServiceTracker);
 
-            boolean scanResolvedBundlesForModuleInfo = true;
+            final boolean scanResolvedBundlesForModuleInfo = true;
             BundleTracker<Collection<ObjectRegistration<YangModuleInfo>>> moduleInfoResolvedBundleTracker = null;
             ExtensibleBundleTracker<?> moduleFactoryBundleTracker;
             if(scanResolvedBundlesForModuleInfo) {
@@ -93,48 +93,48 @@ public class ConfigManagerActivator implements BundleActivator, SynchronousBundl
 
             // Wrap config registry with JMX notification publishing adapter
             final JMXNotifierConfigRegistry notifyingConfigRegistry =
-                    new JMXNotifierConfigRegistry(configRegistry, configMBeanServer);
+                    new JMXNotifierConfigRegistry(this.configRegistry, this.configMBeanServer);
 
             // register config registry to OSGi
-            AutoCloseable clsReg = OsgiRegistrationUtil.registerService(context, moduleInfoBackedContext, ClassLoadingStrategy.class);
-            AutoCloseable configRegReg = OsgiRegistrationUtil.registerService(context, notifyingConfigRegistry, ConfigRegistry.class);
+            final AutoCloseable clsReg = OsgiRegistrationUtil.registerService(context, moduleInfoBackedContext, ClassLoadingStrategy.class);
+            final AutoCloseable configRegReg = OsgiRegistrationUtil.registerService(context, notifyingConfigRegistry, ConfigRegistry.class);
 
             // register config registry to jmx
-            ConfigRegistryJMXRegistrator configRegistryJMXRegistrator = new ConfigRegistryJMXRegistrator(configMBeanServer);
+            final ConfigRegistryJMXRegistrator configRegistryJMXRegistrator = new ConfigRegistryJMXRegistrator(this.configMBeanServer);
             try {
-                configRegistryJMXRegistrator.registerToJMXNoNotifications(configRegistry);
-            } catch (InstanceAlreadyExistsException e) {
+                configRegistryJMXRegistrator.registerToJMXNoNotifications(this.configRegistry);
+            } catch (final InstanceAlreadyExistsException e) {
                 configRegistryJMXRegistrator.close();
                 throw new IllegalStateException("Config Registry was already registered to JMX", e);
             }
 
             // register config registry to jmx
-            final ConfigRegistryJMXRegistrator configRegistryJMXRegistratorWithNotifications = new ConfigRegistryJMXRegistrator(configMBeanServer);
+            final ConfigRegistryJMXRegistrator configRegistryJMXRegistratorWithNotifications = new ConfigRegistryJMXRegistrator(this.configMBeanServer);
             try {
                 configRegistryJMXRegistrator.registerToJMX(notifyingConfigRegistry);
-            } catch (InstanceAlreadyExistsException e) {
+            } catch (final InstanceAlreadyExistsException e) {
                 configRegistryJMXRegistrator.close();
                 configRegistryJMXRegistratorWithNotifications.close();
                 throw new IllegalStateException("Config Registry was already registered to JMX", e);
             }
 
             // TODO wire directly via moduleInfoBundleTracker
-            ServiceTracker<ModuleFactory, Object> serviceTracker = new ServiceTracker<>(context, ModuleFactory.class,
+            final ServiceTracker<ModuleFactory, Object> serviceTracker = new ServiceTracker<>(context, ModuleFactory.class,
                     blankTransactionServiceTracker);
             serviceTracker.open();
 
-            AutoCloseable configMgrReg = OsgiRegistrationUtil.registerService(context, this, ConfigSystemService.class);
+            final AutoCloseable configMgrReg = OsgiRegistrationUtil.registerService(context, this, ConfigSystemService.class);
 
-            List<AutoCloseable> list = Arrays.asList(bindingContextProvider, clsReg,
+            final List<AutoCloseable> list = Arrays.asList(bindingContextProvider, clsReg,
                     OsgiRegistrationUtil.wrap(moduleFactoryBundleTracker), moduleInfoBundleTracker,
                     configRegReg, configRegistryJMXRegistrator, configRegistryJMXRegistratorWithNotifications,
                     OsgiRegistrationUtil.wrap(serviceTracker), moduleInfoRegistryWrapper, notifyingConfigRegistry, configMgrReg);
-            autoCloseable = OsgiRegistrationUtil.aggregate(list);
+            this.autoCloseable = OsgiRegistrationUtil.aggregate(list);
 
             context.addBundleListener(this);
-        } catch(Exception e) {
+        } catch(final Exception e) {
             LOG.warn("Error starting config manager", e);
-        } catch(Error e) {
+        } catch(final Error e) {
             // Log JVM Error and re-throw. The OSGi container may silently fail the bundle and not always log
             // the exception. This has been seen on initial feature install.
             LOG.error("Error starting config manager", e);
@@ -145,26 +145,26 @@ public class ConfigManagerActivator implements BundleActivator, SynchronousBundl
     @Override
     public void stop(final BundleContext context) throws Exception {
         context.removeBundleListener(this);
-        autoCloseable.close();
+        this.autoCloseable.close();
     }
 
     @Override
-    public void bundleChanged(BundleEvent event) {
-        if(configRegistry == null) {
+    public void bundleChanged(final BundleEvent event) {
+        if(this.configRegistry == null) {
             return;
         }
 
         // If the system bundle (id 0) is stopping close the ConfigRegistry so it destroys all modules. On
         // shutdown the system bundle is stopped first.
-        if(event.getBundle().getBundleId() == SYSTEM_BUNDLE_ID && event.getType() == BundleEvent.STOPPING) {
-            configRegistry.close();
+        if((event.getBundle().getBundleId() == SYSTEM_BUNDLE_ID) && (event.getType() == BundleEvent.STOPPING)) {
+            this.configRegistry.close();
         }
     }
 
     @Override
     public void closeAllConfigModules() {
-        if(configRegistry != null) {
-            configRegistry.close();
+        if(this.configRegistry != null) {
+            this.configRegistry.close();
         }
     }
 }
index f3963c92789128f6f647ac347d8bd09ca0655489..472510f1bbbfc0d2fe040c72e982f7ee10a90bd9 100644 (file)
@@ -8,8 +8,8 @@
 package org.opendaylight.controller.config.manager.impl.osgi.mapping;
 
 import com.google.common.base.Preconditions;
-import org.opendaylight.yangtools.sal.binding.generator.api.ClassLoadingStrategy;
-import org.opendaylight.yangtools.sal.binding.generator.util.BindingRuntimeContext;
+import org.opendaylight.mdsal.binding.generator.api.ClassLoadingStrategy;
+import org.opendaylight.mdsal.binding.generator.util.BindingRuntimeContext;
 import org.opendaylight.yangtools.yang.model.api.SchemaContextProvider;
 
 /**
index 59c4d9fa3d5851cb71fd0f352bc0aab4a070740e..6217476fa9f0b3da97c1c39c829c24016233317e 100644 (file)
@@ -10,10 +10,10 @@ package org.opendaylight.controller.config.manager.impl.osgi.mapping;
 
 import java.util.Dictionary;
 import java.util.Hashtable;
+import org.opendaylight.mdsal.binding.generator.api.ClassLoadingStrategy;
+import org.opendaylight.mdsal.binding.generator.api.ModuleInfoRegistry;
+import org.opendaylight.mdsal.binding.generator.util.BindingRuntimeContext;
 import org.opendaylight.yangtools.concepts.ObjectRegistration;
-import org.opendaylight.yangtools.sal.binding.generator.api.ClassLoadingStrategy;
-import org.opendaylight.yangtools.sal.binding.generator.api.ModuleInfoRegistry;
-import org.opendaylight.yangtools.sal.binding.generator.util.BindingRuntimeContext;
 import org.opendaylight.yangtools.yang.binding.YangModuleInfo;
 import org.opendaylight.yangtools.yang.model.api.SchemaContextProvider;
 import org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource;
@@ -47,21 +47,21 @@ public class RefreshingSCPModuleInfoRegistry implements ModuleInfoRegistry, Auto
         this.classLoadingStrat = classLoadingStrat;
         this.sourceProvider = sourceProvider;
         this.bindingContextProvider = bindingContextProvider;
-        osgiReg = bundleContext
+        this.osgiReg = bundleContext
             .registerService(SchemaContextProvider.class, schemaContextProvider, new Hashtable<String, String>());
     }
 
     public void updateService() {
-        if(osgiReg != null) {
+        if(this.osgiReg != null) {
             try {
-                bindingContextProvider.update(classLoadingStrat, schemaContextProvider);
+                this.bindingContextProvider.update(this.classLoadingStrat, this.schemaContextProvider);
 
                 final Dictionary<String, Object> props = new Hashtable<>();
-                props.put(BindingRuntimeContext.class.getName(), bindingContextProvider.getBindingContext());
-                props.put(SchemaSourceProvider.class.getName(), sourceProvider);
+                props.put(BindingRuntimeContext.class.getName(), this.bindingContextProvider.getBindingContext());
+                props.put(SchemaSourceProvider.class.getName(), this.sourceProvider);
                 // send modifiedService event
-                osgiReg.setProperties(props);
-            } catch (RuntimeException e) {
+                this.osgiReg.setProperties(props);
+            } catch (final RuntimeException e) {
                 // The ModuleInfoBackedContext throws a RuntimeException if it can't create the schema context.
                 LOG.warn("Error updating the BindingContextProvider", e);
             }
@@ -70,17 +70,17 @@ public class RefreshingSCPModuleInfoRegistry implements ModuleInfoRegistry, Auto
 
     @Override
     public ObjectRegistration<YangModuleInfo> registerModuleInfo(final YangModuleInfo yangModuleInfo) {
-        ObjectRegistration<YangModuleInfo> yangModuleInfoObjectRegistration = moduleInfoRegistry.registerModuleInfo(yangModuleInfo);
+        final ObjectRegistration<YangModuleInfo> yangModuleInfoObjectRegistration = this.moduleInfoRegistry.registerModuleInfo(yangModuleInfo);
         return new ObjectRegistrationWrapper(yangModuleInfoObjectRegistration);
     }
 
     @Override
     public void close() throws Exception {
-        if(osgiReg != null) {
-            osgiReg.unregister();
+        if(this.osgiReg != null) {
+            this.osgiReg.unregister();
         }
 
-        osgiReg = null;
+        this.osgiReg = null;
     }
 
     private class ObjectRegistrationWrapper implements ObjectRegistration<YangModuleInfo> {
@@ -92,19 +92,19 @@ public class RefreshingSCPModuleInfoRegistry implements ModuleInfoRegistry, Auto
 
         @Override
         public YangModuleInfo getInstance() {
-            return inner.getInstance();
+            return this.inner.getInstance();
         }
 
         @Override
         public void close() throws Exception {
-            inner.close();
+            this.inner.close();
             // send modify event when a bundle disappears
             updateService();
         }
 
         @Override
         public String toString() {
-            return inner.toString();
+            return this.inner.toString();
         }
     }
 }
index d65133c783e4bf31ba97c90a8e71fef2a561938a..919aeda5ae299ae465db50f2ca073a9a53c602ed 100644 (file)
@@ -46,8 +46,8 @@ import org.opendaylight.controller.config.manager.testingservices.threadpool.Tes
 import org.opendaylight.controller.config.spi.Module;
 import org.opendaylight.controller.config.util.ConfigRegistryJMXClient;
 import org.opendaylight.controller.config.util.ConfigTransactionJMXClient;
-import org.opendaylight.yangtools.sal.binding.generator.api.ClassLoadingStrategy;
-import org.opendaylight.yangtools.sal.binding.generator.util.BindingRuntimeContext;
+import org.opendaylight.mdsal.binding.generator.api.ClassLoadingStrategy;
+import org.opendaylight.mdsal.binding.generator.util.BindingRuntimeContext;
 import org.opendaylight.yangtools.yang.model.api.SchemaContextProvider;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceRegistration;
@@ -83,11 +83,11 @@ public abstract class AbstractConfigTest extends AbstractLockedPlatformMBeanServ
         private final List<RegistrationHolder> registrations = new LinkedList<>();
         @Override
         public void handleServiceRegistration(final Class<?> clazz, final Object serviceInstance, final Dictionary<String, ?> props) {
-            registrations.add(new RegistrationHolder(clazz, serviceInstance, props));
+            this.registrations.add(new RegistrationHolder(clazz, serviceInstance, props));
         }
 
         public List<RegistrationHolder> getRegistrations() {
-            return registrations;
+            return this.registrations;
         }
 
         protected static class RegistrationHolder {
@@ -104,7 +104,7 @@ public abstract class AbstractConfigTest extends AbstractLockedPlatformMBeanServ
     }
 
     protected BundleContextServiceRegistrationHandler getBundleContextServiceRegistrationHandler(final Class<?> serviceType) {
-        return currentBundleContextServiceRegistrationHandler;
+        return this.currentBundleContextServiceRegistrationHandler;
     }
 
     // this method should be called in @Before
@@ -112,12 +112,12 @@ public abstract class AbstractConfigTest extends AbstractLockedPlatformMBeanServ
 
         final MBeanServer platformMBeanServer = ManagementFactory.getPlatformMBeanServer();
 
-        configRegistryJMXRegistrator = new ConfigRegistryJMXRegistrator(platformMBeanServer);
+        this.configRegistryJMXRegistrator = new ConfigRegistryJMXRegistrator(platformMBeanServer);
         initBundleContext();
 
-        baseJmxRegistrator = new BaseJMXRegistrator(platformMBeanServer);
+        this.baseJmxRegistrator = new BaseJMXRegistrator(platformMBeanServer);
 
-        configRegistry = new ConfigRegistryImpl(resolver, platformMBeanServer, baseJmxRegistrator, new BindingContextProvider() {
+        this.configRegistry = new ConfigRegistryImpl(resolver, platformMBeanServer, this.baseJmxRegistrator, new BindingContextProvider() {
             @Override
             public synchronized void update(final ClassLoadingStrategy classLoadingStrategy, final SchemaContextProvider ctxProvider) {
                 // NOOP
@@ -128,30 +128,30 @@ public abstract class AbstractConfigTest extends AbstractLockedPlatformMBeanServ
                 return getBindingRuntimeContext();
             }
         });
-        notifyingConfigRegistry = new JMXNotifierConfigRegistry(this.configRegistry, platformMBeanServer);
+        this.notifyingConfigRegistry = new JMXNotifierConfigRegistry(this.configRegistry, platformMBeanServer);
 
         try {
-            configRegistryJMXRegistrator.registerToJMXNoNotifications(configRegistry);
-            configRegistryJMXRegistrator.registerToJMX(notifyingConfigRegistry);
-        } catch (InstanceAlreadyExistsException e) {
+            this.configRegistryJMXRegistrator.registerToJMXNoNotifications(this.configRegistry);
+            this.configRegistryJMXRegistrator.registerToJMX(this.notifyingConfigRegistry);
+        } catch (final InstanceAlreadyExistsException e) {
             throw new RuntimeException(e);
         }
-        configRegistryClient = new ConfigRegistryJMXClient(platformMBeanServer);
-        currentBundleContextServiceRegistrationHandler = new RecordingBundleContextServiceRegistrationHandler();
+        this.configRegistryClient = new ConfigRegistryJMXClient(platformMBeanServer);
+        this.currentBundleContextServiceRegistrationHandler = new RecordingBundleContextServiceRegistrationHandler();
     }
 
     private void initBundleContext() {
-        doNothing().when(mockedServiceRegistration).unregister();
-        RegisterServiceAnswer answer = new RegisterServiceAnswer();
-        doAnswer(answer).when(mockedContext).registerService(Matchers.<String>any(), any(), Matchers.<Dictionary<String, ?>>any());
-        doAnswer(answer).when(mockedContext).registerService(Matchers.<Class>any(), any(), Matchers.<Dictionary<String, ?>>any());
+        doNothing().when(this.mockedServiceRegistration).unregister();
+        final RegisterServiceAnswer answer = new RegisterServiceAnswer();
+        doAnswer(answer).when(this.mockedContext).registerService(Matchers.<String>any(), any(), Matchers.<Dictionary<String, ?>>any());
+        doAnswer(answer).when(this.mockedContext).registerService(Matchers.<Class>any(), any(), Matchers.<Dictionary<String, ?>>any());
     }
 
     @After
     public final void cleanUpConfigTransactionManagerImpl() {
-        configRegistryJMXRegistrator.close();
-        notifyingConfigRegistry.close();
-        configRegistry.close();
+        this.configRegistryJMXRegistrator.close();
+        this.notifyingConfigRegistry.close();
+        this.configRegistry.close();
         TestingFixedThreadPool.cleanUp();
         TestingScheduledThreadPoolImpl.cleanUp();
     }
@@ -161,7 +161,7 @@ public abstract class AbstractConfigTest extends AbstractLockedPlatformMBeanServ
      * would be discarded by closing config beans in this method
      */
     protected void destroyAllConfigBeans() throws Exception {
-        ConfigTransactionJMXClient transaction = configRegistryClient
+        final ConfigTransactionJMXClient transaction = this.configRegistryClient
                 .createTransaction();
         Set<ObjectName> all = transaction.lookupConfigBeans();
         // workaround for getting same Module more times
@@ -183,7 +183,7 @@ public abstract class AbstractConfigTest extends AbstractLockedPlatformMBeanServ
 
 
     protected void assertBeanCount(final int i, final String configMXBeanName) {
-        assertEquals(i, configRegistry.lookupConfigBeans(configMXBeanName).size());
+        assertEquals(i, this.configRegistry.lookupConfigBeans(configMXBeanName).size());
     }
 
     /**
@@ -210,20 +210,21 @@ public abstract class AbstractConfigTest extends AbstractLockedPlatformMBeanServ
     private class RegisterServiceAnswer implements Answer<ServiceRegistration<?>> {
         @Override
         public ServiceRegistration<?> answer(final InvocationOnMock invocation) throws Throwable {
-            Object[] args = invocation.getArguments();
+            final Object[] args = invocation.getArguments();
 
             Preconditions.checkArgument(args.length == 3, "Unexpected arguments size (expected 3 was %s)", args.length);
 
-            Object serviceTypeRaw = args[0];
-            Object serviceInstance = args[1];
+            final Object serviceTypeRaw = args[0];
+            final Object serviceInstance = args[1];
             @SuppressWarnings("unchecked")
+            final
             Dictionary<String, ?> props = (Dictionary<String, ?>) args[2];
 
             if (serviceTypeRaw instanceof Class) {
-                Class<?> serviceType = (Class<?>) serviceTypeRaw;
+                final Class<?> serviceType = (Class<?>) serviceTypeRaw;
                 invokeServiceHandler(serviceInstance, serviceType, props);
             } else if (serviceTypeRaw instanceof String[]) {
-                for (String className : (String[]) serviceTypeRaw) {
+                for (final String className : (String[]) serviceTypeRaw) {
                     invokeServiceHandler(serviceInstance, className, props);
                 }
             } else if (serviceTypeRaw instanceof String) {
@@ -232,20 +233,20 @@ public abstract class AbstractConfigTest extends AbstractLockedPlatformMBeanServ
                 throw new IllegalStateException("Not handling service registration of type, Unknown type" +  serviceTypeRaw);
             }
 
-            return mockedServiceRegistration;
+            return AbstractConfigTest.this.mockedServiceRegistration;
         }
 
         public void invokeServiceHandler(final Object serviceInstance, final String className, final Dictionary<String, ?> props) {
             try {
-                Class<?> serviceType = Class.forName(className);
+                final Class<?> serviceType = Class.forName(className);
                 invokeServiceHandler(serviceInstance, serviceType, props);
-            } catch (ClassNotFoundException e) {
+            } catch (final ClassNotFoundException e) {
                 throw new IllegalStateException("Not handling service registration of type " +  className, e);
             }
         }
 
         private void invokeServiceHandler(final Object serviceInstance, final Class<?> serviceType, final Dictionary<String, ?> props) {
-            BundleContextServiceRegistrationHandler serviceRegistrationHandler = getBundleContextServiceRegistrationHandler(serviceType);
+            final BundleContextServiceRegistrationHandler serviceRegistrationHandler = getBundleContextServiceRegistrationHandler(serviceType);
 
             if (serviceRegistrationHandler != null) {
                 serviceRegistrationHandler.handleServiceRegistration(serviceType, serviceInstance, props);
@@ -266,10 +267,10 @@ public abstract class AbstractConfigTest extends AbstractLockedPlatformMBeanServ
                         public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {
                             try {
                                 return method.invoke(innerObject, args);
-                            } catch (InvocationTargetException e) {
+                            } catch (final InvocationTargetException e) {
                                 try {
                                     throw e.getTargetException();
-                                } catch (RuntimeMBeanException e2) {
+                                } catch (final RuntimeMBeanException e2) {
                                     throw e2.getTargetException();
                                 }
                             }
@@ -294,7 +295,7 @@ public abstract class AbstractConfigTest extends AbstractLockedPlatformMBeanServ
             throw new IOException("Failed to list contents of " + dir);
         }
 
-        for (File file : files) {
+        for (final File file : files) {
             if (file.isDirectory()) {
                 cleanDirectory(dir);
             }
index 565e9bb3a51beb42d9ee76d6ca66d120842e6717..d0df7a7104847e2aae4c13b5e4468e06edfc59d9 100644 (file)
@@ -21,10 +21,10 @@ import org.mockito.Mockito;
 import org.mockito.MockitoAnnotations;
 import org.opendaylight.controller.config.manager.impl.osgi.mapping.BindingContextProvider;
 import org.opendaylight.controller.config.manager.impl.osgi.mapping.RefreshingSCPModuleInfoRegistry;
+import org.opendaylight.mdsal.binding.generator.api.ClassLoadingStrategy;
+import org.opendaylight.mdsal.binding.generator.api.ModuleInfoRegistry;
+import org.opendaylight.mdsal.binding.generator.util.BindingRuntimeContext;
 import org.opendaylight.yangtools.concepts.ObjectRegistration;
-import org.opendaylight.yangtools.sal.binding.generator.api.ClassLoadingStrategy;
-import org.opendaylight.yangtools.sal.binding.generator.api.ModuleInfoRegistry;
-import org.opendaylight.yangtools.sal.binding.generator.util.BindingRuntimeContext;
 import org.opendaylight.yangtools.yang.binding.YangModuleInfo;
 import org.opendaylight.yangtools.yang.model.api.SchemaContextProvider;
 import org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource;
@@ -43,11 +43,11 @@ public class RefreshingSCPModuleInfoRegistryTest {
 
     @Test
     public void testConstructor() throws Exception {
-        ModuleInfoRegistry reg = mock(ModuleInfoRegistry.class);
-        SchemaContextProvider prov = mock(SchemaContextProvider.class);
+        final ModuleInfoRegistry reg = mock(ModuleInfoRegistry.class);
+        final SchemaContextProvider prov = mock(SchemaContextProvider.class);
         doReturn("string").when(prov).toString();
-        BundleContext ctxt = mock(BundleContext.class);
-        ServiceRegistration<?> servReg = mock(ServiceRegistration.class);
+        final BundleContext ctxt = mock(BundleContext.class);
+        final ServiceRegistration<?> servReg = mock(ServiceRegistration.class);
         doReturn(servReg).when(ctxt).registerService(any(Class.class), any(SchemaContextProvider.class), any(Dictionary.class));
         doReturn(servReg).when(ctxt).registerService(Mockito.anyString(), any(Object.class), any(Dictionary.class));
         doNothing().when(servReg).setProperties(any(Dictionary.class));
@@ -59,13 +59,13 @@ public class RefreshingSCPModuleInfoRegistryTest {
         doReturn("B-runtime-context").when(bindingRuntimeContext).toString();
         doReturn(bindingRuntimeContext).when(codecRegistryProvider).getBindingContext();
 
-        RefreshingSCPModuleInfoRegistry scpreg = new RefreshingSCPModuleInfoRegistry(reg, prov, classLoadingStrat, sourceProvider, codecRegistryProvider, ctxt);
+        final RefreshingSCPModuleInfoRegistry scpreg = new RefreshingSCPModuleInfoRegistry(reg, prov, classLoadingStrat, this.sourceProvider, codecRegistryProvider, ctxt);
 
         doNothing().when(servReg).unregister();
 
-        YangModuleInfo modInfo = mock(YangModuleInfo.class);
+        final YangModuleInfo modInfo = mock(YangModuleInfo.class);
         doReturn("").when(modInfo).toString();
-        ObjectRegistration<YangModuleInfo> ymi = mock(ObjectRegistration.class);
+        final ObjectRegistration<YangModuleInfo> ymi = mock(ObjectRegistration.class);
         doReturn(ymi).when(reg).registerModuleInfo(modInfo);
 
         scpreg.registerModuleInfo(modInfo);
index ae0962b9e74c1ddd49f90b4c4e115354d76417e5..34480b9d1086e77a0bc99295f199781f4767c9ff 100644 (file)
@@ -30,7 +30,7 @@ import org.opendaylight.controller.config.yangjmxgenerator.ModuleMXBeanEntry;
 import org.opendaylight.controller.config.yangjmxgenerator.PackageTranslator;
 import org.opendaylight.controller.config.yangjmxgenerator.ServiceInterfaceEntry;
 import org.opendaylight.controller.config.yangjmxgenerator.TypeProviderWrapper;
-import org.opendaylight.yangtools.sal.binding.yang.types.TypeProviderImpl;
+import org.opendaylight.mdsal.binding.yang.types.TypeProviderImpl;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.IdentitySchemaNode;
 import org.opendaylight.yangtools.yang.model.api.Module;
@@ -88,27 +88,27 @@ public class JMXGenerator implements BasicCodeGenerator, MavenProjectAware {
                 "Null outputBaseDir received");
 
         Preconditions
-                .checkArgument(namespaceToPackageMapping != null && !namespaceToPackageMapping.isEmpty(),
+                .checkArgument((this.namespaceToPackageMapping != null) && !this.namespaceToPackageMapping.isEmpty(),
                         "No namespace to package mapping provided in additionalConfiguration");
 
-        PackageTranslator packageTranslator = new PackageTranslator(namespaceToPackageMapping);
+        final PackageTranslator packageTranslator = new PackageTranslator(this.namespaceToPackageMapping);
 
         if (!outputBaseDir.exists()) {
             outputBaseDir.mkdirs();
         }
 
-        GeneratedFilesTracker generatedFiles = new GeneratedFilesTracker();
+        final GeneratedFilesTracker generatedFiles = new GeneratedFilesTracker();
         // create SIE structure qNamesToSIEs
-        Map<QName, ServiceInterfaceEntry> qNamesToSIEs = new HashMap<>();
+        final Map<QName, ServiceInterfaceEntry> qNamesToSIEs = new HashMap<>();
 
 
-        Map<IdentitySchemaNode, ServiceInterfaceEntry> knownSEITracker = new HashMap<>();
-        for (Module module : context.getModules()) {
-            String packageName = packageTranslator.getPackageName(module);
-            Map<QName, ServiceInterfaceEntry> namesToSIEntries = ServiceInterfaceEntry
+        final Map<IdentitySchemaNode, ServiceInterfaceEntry> knownSEITracker = new HashMap<>();
+        for (final Module module : context.getModules()) {
+            final String packageName = packageTranslator.getPackageName(module);
+            final Map<QName, ServiceInterfaceEntry> namesToSIEntries = ServiceInterfaceEntry
                     .create(module, packageName, knownSEITracker);
 
-            for (Entry<QName, ServiceInterfaceEntry> sieEntry : namesToSIEntries
+            for (final Entry<QName, ServiceInterfaceEntry> sieEntry : namesToSIEntries
                     .entrySet()) {
                 // merge value into qNamesToSIEs
                 if (qNamesToSIEs.put(sieEntry.getKey(), sieEntry.getValue()) != null) {
@@ -119,11 +119,11 @@ public class JMXGenerator implements BasicCodeGenerator, MavenProjectAware {
             }
             if (yangModulesInCurrentMavenModule.contains(module)) {
                 // write this sie to disk
-                for (ServiceInterfaceEntry sie : namesToSIEntries.values()) {
+                for (final ServiceInterfaceEntry sie : namesToSIEntries.values()) {
                     try {
-                        generatedFiles.addFile(codeWriter.writeSie(sie,
+                        generatedFiles.addFile(this.codeWriter.writeSie(sie,
                                 outputBaseDir));
-                    } catch (Exception e) {
+                    } catch (final Exception e) {
                         throw new RuntimeException(
                                 "Error occurred during SIE source generate phase",
                                 e);
@@ -132,26 +132,26 @@ public class JMXGenerator implements BasicCodeGenerator, MavenProjectAware {
             }
         }
 
-        File mainBaseDir = concatFolders(projectBaseDir, "src", "main", "java");
-        Preconditions.checkNotNull(resourceBaseDir,
+        final File mainBaseDir = concatFolders(this.projectBaseDir, "src", "main", "java");
+        Preconditions.checkNotNull(this.resourceBaseDir,
                 "resource base dir attribute was null");
 
-        StringBuilder fullyQualifiedNamesOfFactories = new StringBuilder();
+        final StringBuilder fullyQualifiedNamesOfFactories = new StringBuilder();
         // create MBEs
-        for (Module module : yangModulesInCurrentMavenModule) {
-            String packageName = packageTranslator.getPackageName(module);
-            Map<String /* MB identity local name */, ModuleMXBeanEntry> namesToMBEs = ModuleMXBeanEntry
+        for (final Module module : yangModulesInCurrentMavenModule) {
+            final String packageName = packageTranslator.getPackageName(module);
+            final Map<String /* MB identity local name */, ModuleMXBeanEntry> namesToMBEs = ModuleMXBeanEntry
                     .create(module, qNamesToSIEs, context, new TypeProviderWrapper(new TypeProviderImpl(context)),
                             packageName);
 
-            for (Entry<String, ModuleMXBeanEntry> mbeEntry : namesToMBEs
+            for (final Entry<String, ModuleMXBeanEntry> mbeEntry : namesToMBEs
                     .entrySet()) {
-                ModuleMXBeanEntry mbe = mbeEntry.getValue();
+                final ModuleMXBeanEntry mbe = mbeEntry.getValue();
                 try {
-                    List<File> files1 = codeWriter.writeMbe(mbe, outputBaseDir,
+                    final List<File> files1 = this.codeWriter.writeMbe(mbe, outputBaseDir,
                             mainBaseDir);
                     generatedFiles.addFile(files1);
-                } catch (Exception e) {
+                } catch (final Exception e) {
                     throw new RuntimeException(
                             "Error occurred during MBE source generate phase",
                             e);
@@ -162,18 +162,18 @@ public class JMXGenerator implements BasicCodeGenerator, MavenProjectAware {
             }
         }
         // create ModuleFactory file if needed
-        if (fullyQualifiedNamesOfFactories.length() > 0
-                && generateModuleFactoryFile) {
-            File serviceLoaderFile = JMXGenerator.concatFolders(
-                    resourceBaseDir, "META-INF", "services",
+        if ((fullyQualifiedNamesOfFactories.length() > 0)
+                && this.generateModuleFactoryFile) {
+            final File serviceLoaderFile = JMXGenerator.concatFolders(
+                    this.resourceBaseDir, "META-INF", "services",
                     ModuleFactory.class.getName());
             // if this file does not exist, create empty file
             serviceLoaderFile.getParentFile().mkdirs();
             try {
                 serviceLoaderFile.createNewFile();
                 Files.write(fullyQualifiedNamesOfFactories.toString(), serviceLoaderFile, StandardCharsets.UTF_8);
-            } catch (IOException e) {
-                String message = "Cannot write to " + serviceLoaderFile;
+            } catch (final IOException e) {
+                final String message = "Cannot write to " + serviceLoaderFile;
                 LOG.error(message, e);
                 throw new RuntimeException(message, e);
             }
@@ -184,7 +184,7 @@ public class JMXGenerator implements BasicCodeGenerator, MavenProjectAware {
     @VisibleForTesting
     static File concatFolders(final File projectBaseDir, final String... folderNames) {
         File result = projectBaseDir;
-        for (String folder: folderNames) {
+        for (final String folder: folderNames) {
             result = new File(result, folder);
         }
         return result;
@@ -198,17 +198,17 @@ public class JMXGenerator implements BasicCodeGenerator, MavenProjectAware {
     }
 
     private static boolean extractModuleFactoryBoolean(final Map<String, String> additionalCfg) {
-        String bool = additionalCfg.get(MODULE_FACTORY_FILE_BOOLEAN);
+        final String bool = additionalCfg.get(MODULE_FACTORY_FILE_BOOLEAN);
         return !"false".equals(bool);
     }
 
     private static Map<String, String> extractNamespaceMapping(
             final Map<String, String> additionalCfg) {
-        Map<String, String> namespaceToPackage = Maps.newHashMap();
-        for (String key : additionalCfg.keySet()) {
+        final Map<String, String> namespaceToPackage = Maps.newHashMap();
+        for (final String key : additionalCfg.keySet()) {
             if (key.startsWith(NAMESPACE_TO_PACKAGE_PREFIX)) {
-                String mapping = additionalCfg.get(key);
-                NamespaceMapping mappingResolved = extractNamespaceMapping(mapping);
+                final String mapping = additionalCfg.get(key);
+                final NamespaceMapping mappingResolved = extractNamespaceMapping(mapping);
                 namespaceToPackage.put(mappingResolved.namespace,
                         mappingResolved.packageName);
             }
@@ -217,7 +217,7 @@ public class JMXGenerator implements BasicCodeGenerator, MavenProjectAware {
     }
 
     private static NamespaceMapping extractNamespaceMapping(final String mapping) {
-        Matcher matcher = NAMESPACE_MAPPING_PATTERN.matcher(mapping);
+        final Matcher matcher = NAMESPACE_MAPPING_PATTERN.matcher(mapping);
         Preconditions.checkArgument(matcher.matches(),
             "Namespace to package mapping:%s is in invalid format, requested format is: %s",
             mapping, NAMESPACE_MAPPING_PATTERN);
@@ -232,7 +232,7 @@ public class JMXGenerator implements BasicCodeGenerator, MavenProjectAware {
     @Override
     public void setMavenProject(final MavenProject project) {
         this.projectBaseDir = project.getBasedir();
-        LOG.debug("{}: project base dir: {}", getClass().getCanonicalName(), projectBaseDir);
+        LOG.debug("{}: project base dir: {}", getClass().getCanonicalName(), this.projectBaseDir);
     }
 
     @VisibleForTesting
@@ -240,9 +240,9 @@ public class JMXGenerator implements BasicCodeGenerator, MavenProjectAware {
         private final Set<File> files = Sets.newHashSet();
 
         void addFile(final File file) {
-            if (files.contains(file)) {
-                List<File> undeletedFiles = Lists.newArrayList();
-                for (File presentFile : files) {
+            if (this.files.contains(file)) {
+                final List<File> undeletedFiles = Lists.newArrayList();
+                for (final File presentFile : this.files) {
                     if (!presentFile.delete()) {
                         undeletedFiles.add(presentFile);
                     }
@@ -256,17 +256,17 @@ public class JMXGenerator implements BasicCodeGenerator, MavenProjectAware {
                         "Name conflict in generated files, file" + file
                                 + " present twice");
             }
-            files.add(file);
+            this.files.add(file);
         }
 
         void addFile(final Collection<File> files) {
-            for (File file : files) {
+            for (final File file : files) {
                 addFile(file);
             }
         }
 
         public Set<File> getFiles() {
-            return files;
+            return this.files;
         }
     }
 }
index 294520b36389992edb75af3e0121c7232728496d..22201699119d85e937a7e801fea0ee9fc92638f5 100644 (file)
@@ -47,8 +47,8 @@ import org.opendaylight.controller.config.yangjmxgenerator.plugin.ftl.model.Meth
 import org.opendaylight.controller.config.yangjmxgenerator.plugin.ftl.model.MethodDefinition;
 import org.opendaylight.controller.config.yangjmxgenerator.plugin.ftl.model.ModuleField;
 import org.opendaylight.controller.config.yangjmxgenerator.plugin.util.FullyQualifiedNameHelper;
-import org.opendaylight.yangtools.sal.binding.model.api.ParameterizedType;
-import org.opendaylight.yangtools.sal.binding.model.api.Type;
+import org.opendaylight.mdsal.binding.model.api.ParameterizedType;
+import org.opendaylight.mdsal.binding.model.api.Type;
 import org.opendaylight.yangtools.yang.binding.BindingMapping;
 
 public class TemplateFactory {
@@ -59,42 +59,42 @@ public class TemplateFactory {
      */
     public static Map<String, FtlTemplate> getTOAndMXInterfaceFtlFiles(
             final RuntimeBeanEntry entry) {
-        Map<String, FtlTemplate> result = new HashMap<>();
+        final Map<String, FtlTemplate> result = new HashMap<>();
         { // create GeneralInterfaceFtlFile for runtime MXBean. Attributes will
           // be transformed to getter methods
-            String mxBeanTypeName = entry.getJavaNameOfRuntimeMXBean();
-            List<String> extendedInterfaces = Collections.singletonList(RuntimeBean.class
+            final String mxBeanTypeName = entry.getJavaNameOfRuntimeMXBean();
+            final List<String> extendedInterfaces = Collections.singletonList(RuntimeBean.class
                     .getCanonicalName());
-            List<MethodDeclaration> methods = new ArrayList<>();
+            final List<MethodDeclaration> methods = new ArrayList<>();
 
             // convert attributes to getters
-            for (AttributeIfc attributeIfc : entry.getAttributes()) {
+            for (final AttributeIfc attributeIfc : entry.getAttributes()) {
                 String returnType;
                 returnType = getReturnType(attributeIfc);
-                String getterName = "get"
+                final String getterName = "get"
                         + attributeIfc.getUpperCaseCammelCase();
-                MethodDeclaration getter = new MethodDeclaration(returnType,
+                final MethodDeclaration getter = new MethodDeclaration(returnType,
                         getterName, Collections.<Field> emptyList());
                 methods.add(getter);
             }
 
             // add rpc methods
-            for (Rpc rpc : entry.getRpcs()) {
+            for (final Rpc rpc : entry.getRpcs()) {
                 // convert JavaAttribute parameters into fields
-                List<Field> fields = new ArrayList<>();
-                for (JavaAttribute ja : rpc.getParameters()) {
-                    Field field = new Field(Collections.emptyList(),
+                final List<Field> fields = new ArrayList<>();
+                for (final JavaAttribute ja : rpc.getParameters()) {
+                    final Field field = new Field(Collections.emptyList(),
                             ja.getType().getFullyQualifiedName(),
                             ja.getLowerCaseCammelCase(), ja.getNullableDefaultWrappedForCode());
                     fields.add(field);
                 }
-                MethodDeclaration operation = new MethodDeclaration(
+                final MethodDeclaration operation = new MethodDeclaration(
                         getReturnType(rpc.getReturnType()), rpc.getName(), fields);
                 methods.add(operation);
             }
 
             // FIXME header
-            GeneralInterfaceTemplate runtimeMxBeanIfc = new GeneralInterfaceTemplate(
+            final GeneralInterfaceTemplate runtimeMxBeanIfc = new GeneralInterfaceTemplate(
                     null, entry.getPackageName(), mxBeanTypeName,
                     extendedInterfaces, methods);
 
@@ -110,12 +110,12 @@ public class TemplateFactory {
     // FIXME: put into Type.toString
     static String serializeType(final Type type, final boolean addWildcards) {
         if (type instanceof ParameterizedType){
-            ParameterizedType parameterizedType = (ParameterizedType) type;
-            StringBuilder sb = new StringBuilder();
+            final ParameterizedType parameterizedType = (ParameterizedType) type;
+            final StringBuilder sb = new StringBuilder();
             sb.append(parameterizedType.getRawType().getFullyQualifiedName());
             sb.append(addWildcards ? "<? extends " : "<");
             boolean first = true;
-            for(Type parameter: parameterizedType.getActualTypeArguments()) {
+            for(final Type parameter: parameterizedType.getActualTypeArguments()) {
                 if (first) {
                     first = false;
                 } else {
@@ -137,7 +137,7 @@ public class TemplateFactory {
     private static String getReturnType(final AttributeIfc attributeIfc) {
         String returnType;
         if (attributeIfc instanceof TypedAttribute) {
-            Type type = ((TypedAttribute) attributeIfc).getType();
+            final Type type = ((TypedAttribute) attributeIfc).getType();
             returnType = serializeType(type);
         } else if (attributeIfc == VoidAttribute.getInstance()) {
             return "void";
@@ -152,14 +152,14 @@ public class TemplateFactory {
     public static GeneralInterfaceTemplate serviceInterfaceFromSie(
             final ServiceInterfaceEntry sie) {
 
-        List<String> extendedInterfaces = Lists
+        final List<String> extendedInterfaces = Lists
                 .newArrayList(AbstractServiceInterface.class.getCanonicalName());
         if (sie.getBase().isPresent()) {
             extendedInterfaces.add(sie.getBase().get().getFullyQualifiedName());
         }
 
         // FIXME header
-        GeneralInterfaceTemplate sieTemplate = new GeneralInterfaceTemplate(
+        final GeneralInterfaceTemplate sieTemplate = new GeneralInterfaceTemplate(
                 getHeaderFromEntry(sie), sie.getPackageName(),
                 sie.getTypeName(), extendedInterfaces,
                 Lists.<MethodDeclaration> newArrayList());
@@ -177,7 +177,7 @@ public class TemplateFactory {
 
     public static AbstractFactoryTemplate abstractFactoryTemplateFromMbe(
             final ModuleMXBeanEntry mbe) {
-        AbstractFactoryAttributesProcessor attrProcessor = new AbstractFactoryAttributesProcessor();
+        final AbstractFactoryAttributesProcessor attrProcessor = new AbstractFactoryAttributesProcessor();
         attrProcessor.processAttributes(mbe.getAttributes());
 
 
@@ -190,22 +190,22 @@ public class TemplateFactory {
 
     public static AbstractModuleTemplate abstractModuleTemplateFromMbe(
             final ModuleMXBeanEntry mbe) {
-        AbstractModuleAttributesProcessor attrProcessor = new AbstractModuleAttributesProcessor(mbe.getAttributes());
+        final AbstractModuleAttributesProcessor attrProcessor = new AbstractModuleAttributesProcessor(mbe.getAttributes());
 
-        List<ModuleField> moduleFields = attrProcessor.getModuleFields();
-        List<String> implementedIfcs = Lists.newArrayList(
+        final List<ModuleField> moduleFields = attrProcessor.getModuleFields();
+        final List<String> implementedIfcs = Lists.newArrayList(
                 mbe.getFullyQualifiedName(mbe.getMXBeanInterfaceName()));
 
-        for (String implementedService : mbe.getProvidedServices().keySet()) {
+        for (final String implementedService : mbe.getProvidedServices().keySet()) {
             implementedIfcs.add(implementedService);
         }
 
         boolean generateRuntime = false;
         String registratorFullyQualifiedName = null;
-        if (mbe.getRuntimeBeans() != null
+        if ((mbe.getRuntimeBeans() != null)
                 && !mbe.getRuntimeBeans().isEmpty()) {
             generateRuntime = true;
-            RuntimeBeanEntry rootEntry = RuntimeRegistratorFtlTemplate
+            final RuntimeBeanEntry rootEntry = RuntimeRegistratorFtlTemplate
                     .findRoot(mbe.getRuntimeBeans());
             registratorFullyQualifiedName = rootEntry
                     .getPackageName()
@@ -215,9 +215,9 @@ public class TemplateFactory {
                     .getCanonicalName());
         }
 
-        List<String> extendedClasses = Collections.singletonList(AbstractModule.class.getCanonicalName() + "<" + mbe.getAbstractModuleName() + ">");
+        final List<String> extendedClasses = Collections.singletonList(AbstractModule.class.getCanonicalName() + "<" + mbe.getAbstractModuleName() + ">");
 
-        AbstractModuleTemplate abstractModuleTemplate = new AbstractModuleTemplate(
+        final AbstractModuleTemplate abstractModuleTemplate = new AbstractModuleTemplate(
                 getHeaderFromEntry(mbe), mbe.getPackageName(),
                 mbe.getAbstractModuleName(), extendedClasses, implementedIfcs, moduleFields,
                 attrProcessor.getMethods(), generateRuntime,
@@ -241,9 +241,9 @@ public class TemplateFactory {
 
     public static GeneralInterfaceTemplate mXBeanInterfaceTemplateFromMbe(
             final ModuleMXBeanEntry mbe) {
-        MXBeanInterfaceAttributesProcessor attrProcessor = new MXBeanInterfaceAttributesProcessor();
+        final MXBeanInterfaceAttributesProcessor attrProcessor = new MXBeanInterfaceAttributesProcessor();
         attrProcessor.processAttributes(mbe.getAttributes());
-        GeneralInterfaceTemplate ifcTemplate = new GeneralInterfaceTemplate(
+        final GeneralInterfaceTemplate ifcTemplate = new GeneralInterfaceTemplate(
                 getHeaderFromEntry(mbe), mbe.getPackageName(),
                 mbe.getMXBeanInterfaceName(), Lists.<String> newArrayList(),
                 attrProcessor.getMethods());
@@ -253,15 +253,15 @@ public class TemplateFactory {
 
     public static Map<String, GeneralClassTemplate> tOsFromMbe(
             final ModuleMXBeanEntry mbe) {
-        Map<String, GeneralClassTemplate> retVal = Maps.newHashMap();
-        TOAttributesProcessor processor = new TOAttributesProcessor();
+        final Map<String, GeneralClassTemplate> retVal = Maps.newHashMap();
+        final TOAttributesProcessor processor = new TOAttributesProcessor();
         processor.processAttributes(mbe.getAttributes());
-        for (org.opendaylight.controller.config.yangjmxgenerator.plugin.ftl.TemplateFactory.TOAttributesProcessor.TOInternal to : processor
+        for (final org.opendaylight.controller.config.yangjmxgenerator.plugin.ftl.TemplateFactory.TOAttributesProcessor.TOInternal to : processor
                 .getTOs()) {
-            List<Constructor> constructors = Lists.newArrayList();
+            final List<Constructor> constructors = Lists.newArrayList();
             constructors.add(new Constructor(to.getName(), "super();"));
 
-            Header header = getHeaderFromEntry(mbe);
+            final Header header = getHeaderFromEntry(mbe);
             retVal.put(
                     to.getType(),
                     new GeneralClassTemplate(header, mbe.getPackageName(), to
@@ -274,13 +274,13 @@ public class TemplateFactory {
 
     public static Map<String, GeneralClassTemplate> tOsFromRbe(
             final RuntimeBeanEntry rbe) {
-        Map<String, GeneralClassTemplate> retVal = Maps.newHashMap();
-        TOAttributesProcessor processor = new TOAttributesProcessor();
-        Map<String, AttributeIfc> yangPropertiesToTypesMap = Maps.newHashMap(rbe.getYangPropertiesToTypesMap());
+        final Map<String, GeneralClassTemplate> retVal = Maps.newHashMap();
+        final TOAttributesProcessor processor = new TOAttributesProcessor();
+        final Map<String, AttributeIfc> yangPropertiesToTypesMap = Maps.newHashMap(rbe.getYangPropertiesToTypesMap());
 
         // Add TOs from output parameters
-        for (Rpc rpc : rbe.getRpcs()) {
-            AttributeIfc returnType = rpc.getReturnType();
+        for (final Rpc rpc : rbe.getRpcs()) {
+            final AttributeIfc returnType = rpc.getReturnType();
 
             if (returnType == VoidAttribute.getInstance()) {
                 continue;
@@ -288,7 +288,7 @@ public class TemplateFactory {
             if (returnType instanceof JavaAttribute) {
                 continue;
             }
-            if (returnType instanceof ListAttribute && returnType.getOpenType() instanceof SimpleType) {
+            if ((returnType instanceof ListAttribute) && (returnType.getOpenType() instanceof SimpleType)) {
                 continue;
             }
 
@@ -298,9 +298,9 @@ public class TemplateFactory {
         }
 
         processor.processAttributes(yangPropertiesToTypesMap);
-        for (org.opendaylight.controller.config.yangjmxgenerator.plugin.ftl.TemplateFactory.TOAttributesProcessor.TOInternal to : processor
+        for (final org.opendaylight.controller.config.yangjmxgenerator.plugin.ftl.TemplateFactory.TOAttributesProcessor.TOInternal to : processor
                 .getTOs()) {
-            List<Constructor> constructors = Lists.newArrayList();
+            final List<Constructor> constructors = Lists.newArrayList();
             constructors.add(new Constructor(to.getName(), "super();"));
 
             // TODO header
@@ -325,13 +325,13 @@ public class TemplateFactory {
         private final List<TOInternal> tos = Lists.newArrayList();
 
         void processAttributes(final Map<String, AttributeIfc> attributes) {
-            for (Entry<String, AttributeIfc> attrEntry : attributes.entrySet()) {
-                AttributeIfc attributeIfc = attrEntry.getValue();
+            for (final Entry<String, AttributeIfc> attrEntry : attributes.entrySet()) {
+                final AttributeIfc attributeIfc = attrEntry.getValue();
                 if (attributeIfc instanceof TOAttribute) {
                     createTOInternal((TOAttribute) attributeIfc);
                 }
                 if (attributeIfc instanceof ListAttribute) {
-                    AttributeIfc innerAttr = ((ListAttribute) attributeIfc)
+                    final AttributeIfc innerAttr = ((ListAttribute) attributeIfc)
                             .getInnerAttribute();
                     if (innerAttr instanceof TOAttribute) {
                         createTOInternal((TOAttribute) innerAttr);
@@ -342,15 +342,15 @@ public class TemplateFactory {
 
         private void createTOInternal(final TOAttribute toAttribute) {
 
-            Map<String, AttributeIfc> attrs = toAttribute.getCapitalizedPropertiesToTypesMap();
+            final Map<String, AttributeIfc> attrs = toAttribute.getCapitalizedPropertiesToTypesMap();
             // recursive processing of TO's attributes
             processAttributes(attrs);
 
-            tos.add(new TOInternal(toAttribute.getType(), attrs));
+            this.tos.add(new TOInternal(toAttribute.getType(), attrs));
         }
 
         List<TOInternal> getTOs() {
-            return tos;
+            return this.tos;
         }
 
         private static class TOInternal {
@@ -373,18 +373,18 @@ public class TemplateFactory {
             private final static String dependencyResolverInjectMethodName = "injectDependencyResolver";
 
             private void processAttrs(final Map<String, AttributeIfc> attrs, final String packageName) {
-                fields = Lists.newArrayList();
-                methods = Lists.newArrayList();
+                this.fields = Lists.newArrayList();
+                this.methods = Lists.newArrayList();
 
                 // FIXME conflict if "dependencyResolver" field from yang
-                Field depRes = new Field(DependencyResolver.class.getName(), dependencyResolverVarName);
-                fields.add(depRes);
-                methods.add(new MethodDefinition("void", dependencyResolverInjectMethodName, Lists.newArrayList(depRes),
+                final Field depRes = new Field(DependencyResolver.class.getName(), dependencyResolverVarName);
+                this.fields.add(depRes);
+                this.methods.add(new MethodDefinition("void", dependencyResolverInjectMethodName, Lists.newArrayList(depRes),
                         "this." + dependencyResolverVarName + " = " + dependencyResolverVarName + ";"));
 
-                for (Entry<String, AttributeIfc> attrEntry : attrs.entrySet()) {
-                    String innerName = attrEntry.getKey();
-                    String varName = BindingMapping.getPropertyName(attrEntry.getKey());
+                for (final Entry<String, AttributeIfc> attrEntry : attrs.entrySet()) {
+                    final String innerName = attrEntry.getKey();
+                    final String varName = BindingMapping.getPropertyName(attrEntry.getKey());
 
                     String fullyQualifiedName, nullableDefault = null;
                     if (attrEntry.getValue() instanceof TypedAttribute) {
@@ -393,9 +393,9 @@ public class TemplateFactory {
                             nullableDefault = ((JavaAttribute)attrEntry.getValue()).getNullableDefaultWrappedForCode();
                             if(((JavaAttribute)attrEntry.getValue()).isIdentityRef()) {
 
-                                String fieldType = serializeType(type, true);
-                                String innerType = getInnerTypeFromIdentity(type);
-                                methods.add(new MethodDefinition(fieldType, "resolve" + attrEntry.getKey(), Collections.<Field>emptyList(),
+                                final String fieldType = serializeType(type, true);
+                                final String innerType = getInnerTypeFromIdentity(type);
+                                this.methods.add(new MethodDefinition(fieldType, "resolve" + attrEntry.getKey(), Collections.<Field>emptyList(),
                                         "return " + varName + ".resolveIdentity(" + dependencyResolverVarName + "," +  innerType + ".class);"));
                                 type = identityRefType;
                             }
@@ -405,30 +405,30 @@ public class TemplateFactory {
                         fullyQualifiedName = FullyQualifiedNameHelper
                                 .getFullyQualifiedName(packageName, attrEntry.getValue().getUpperCaseCammelCase());
                     }
-                    fields.add(new Field(fullyQualifiedName, varName, nullableDefault, needsDepResolver(attrEntry.getValue())));
+                    this.fields.add(new Field(fullyQualifiedName, varName, nullableDefault, needsDepResolver(attrEntry.getValue())));
 
-                    String getterName = "get" + innerName;
-                    MethodDefinition getter = new MethodDefinition(
+                    final String getterName = "get" + innerName;
+                    final MethodDefinition getter = new MethodDefinition(
                             fullyQualifiedName, getterName,
                             Collections.<Field> emptyList(), "return "
                                     + varName + ";");
 
-                    String setterName = "set" + innerName;
-                    MethodDefinition setter = new MethodDefinition("void",
+                    final String setterName = "set" + innerName;
+                    final MethodDefinition setter = new MethodDefinition("void",
                             setterName, Lists.newArrayList(new Field(
                                     fullyQualifiedName, varName)), "this."
                                     + varName + " = " + varName + ";");
-                    methods.add(getter);
-                    methods.add(setter);
+                    this.methods.add(getter);
+                    this.methods.add(setter);
                 }
 
                 // Add hashCode
                 final MethodDefinition hashCode = getHash(attrs);
-                methods.add(hashCode);
+                this.methods.add(hashCode);
 
                 // Add equals
                 final MethodDefinition equals = getEquals(attrs);
-                methods.add(equals);
+                this.methods.add(equals);
             }
 
             private MethodDefinition getEquals(final Map<String, AttributeIfc> attrs) {
@@ -436,8 +436,8 @@ public class TemplateFactory {
                         "        if (this == o) { return true; }\n" +
                         "        if (o == null || getClass() != o.getClass()) { return false; }\n");
                 equalsBodyBuilder.append(String.format(
-                        "        final %s that = (%s) o;\n", name, name));
-                for (AttributeIfc s : attrs.values()) {
+                        "        final %s that = (%s) o;\n", this.name, this.name));
+                for (final AttributeIfc s : attrs.values()) {
                     equalsBodyBuilder.append(String.format(
                             "        if (!java.util.Objects.equals(%1$s, that.%1$s)) {\n" +
                             "            return false;\n" +
@@ -452,7 +452,7 @@ public class TemplateFactory {
             private static MethodDefinition getHash(final Map<String, AttributeIfc> attrs) {
                 final StringBuilder hashBodyBuilder = new StringBuilder(
                         "        return java.util.Objects.hash(");
-                for (AttributeIfc s : attrs.values()) {
+                for (final AttributeIfc s : attrs.values()) {
                     hashBodyBuilder.append(s.getLowerCaseCammelCase());
                     hashBodyBuilder.append(", ");
                 }
@@ -462,19 +462,19 @@ public class TemplateFactory {
             }
 
             String getType() {
-                return fullyQualifiedName;
+                return this.fullyQualifiedName;
             }
 
             String getName() {
-                return name;
+                return this.name;
             }
 
             List<Field> getFields() {
-                return fields;
+                return this.fields;
             }
 
             List<MethodDefinition> getMethods() {
-                return methods;
+                return this.methods;
             }
         }
     }
@@ -484,15 +484,15 @@ public class TemplateFactory {
         private final List<MethodDeclaration> methods = Lists.newArrayList();
 
         void processAttributes(final Map<String, AttributeIfc> attributes) {
-            for (Entry<String, AttributeIfc> attrEntry : attributes.entrySet()) {
+            for (final Entry<String, AttributeIfc> attrEntry : attributes.entrySet()) {
                 String returnType;
-                AttributeIfc attributeIfc = attrEntry.getValue();
+                final AttributeIfc attributeIfc = attrEntry.getValue();
 
                 if (attributeIfc instanceof TypedAttribute) {
-                    TypedAttribute typedAttribute = (TypedAttribute) attributeIfc;
+                    final TypedAttribute typedAttribute = (TypedAttribute) attributeIfc;
                     returnType = serializeType(typedAttribute.getType());
 
-                    if (attributeIfc instanceof JavaAttribute && ((JavaAttribute)attrEntry.getValue()).isIdentityRef()) {
+                    if ((attributeIfc instanceof JavaAttribute) && ((JavaAttribute)attrEntry.getValue()).isIdentityRef()) {
                         returnType = serializeType(identityRefType);
                     }
 
@@ -502,20 +502,20 @@ public class TemplateFactory {
                                     + attributeIfc.getClass());
                 }
 
-                String getterName = "get"
+                final String getterName = "get"
                         + attributeIfc.getUpperCaseCammelCase();
-                MethodDeclaration getter = new MethodDeclaration(returnType,
+                final MethodDeclaration getter = new MethodDeclaration(returnType,
                         getterName, Collections.<Field> emptyList());
 
-                String varName = BindingMapping.getPropertyName(attrEntry.getKey());
-                String setterName = "set"
+                final String varName = BindingMapping.getPropertyName(attrEntry.getKey());
+                final String setterName = "set"
                         + attributeIfc.getUpperCaseCammelCase();
-                MethodDeclaration setter = new MethodDeclaration("void",
+                final MethodDeclaration setter = new MethodDeclaration("void",
                         setterName, Lists.newArrayList(new Field(returnType,
                                 varName)));
 
-                methods.add(getter);
-                methods.add(setter);
+                this.methods.add(getter);
+                this.methods.add(setter);
 
                 if (attributeIfc.getNullableDescription() != null) {
                     setter.setJavadoc(attrEntry.getValue()
@@ -525,7 +525,7 @@ public class TemplateFactory {
         }
 
         List<MethodDeclaration> getMethods() {
-            return methods;
+            return this.methods;
         }
     }
 
@@ -534,17 +534,17 @@ public class TemplateFactory {
 
         @Override
         public String getPackageName() {
-            return IDENTITY_ATTRIBUTE_REF_CLASS.getPackage().getName();
+            return this.IDENTITY_ATTRIBUTE_REF_CLASS.getPackage().getName();
         }
 
         @Override
         public String getName() {
-            return IDENTITY_ATTRIBUTE_REF_CLASS.getSimpleName();
+            return this.IDENTITY_ATTRIBUTE_REF_CLASS.getSimpleName();
         }
 
         @Override
         public String getFullyQualifiedName() {
-            return IDENTITY_ATTRIBUTE_REF_CLASS.getName();
+            return this.IDENTITY_ATTRIBUTE_REF_CLASS.getName();
         }
     };
 
@@ -553,12 +553,12 @@ public class TemplateFactory {
         private final List<Field> fields = Lists.newArrayList();
 
         void processAttributes(final Map<String, AttributeIfc> attributes) {
-            for (AttributeIfc attributeIfc : attributes.values()) {
+            for (final AttributeIfc attributeIfc : attributes.values()) {
                 if (attributeIfc instanceof TypedAttribute) {
-                    TypedAttribute typedAttribute = (TypedAttribute) attributeIfc;
-                    String type = serializeType(typedAttribute.getType());
+                    final TypedAttribute typedAttribute = (TypedAttribute) attributeIfc;
+                    final String type = serializeType(typedAttribute.getType());
 
-                    fields.add(new Field(type, attributeIfc
+                    this.fields.add(new Field(type, attributeIfc
                             .getUpperCaseCammelCase(), null));
                 } else {
                     throw new UnsupportedOperationException(
@@ -569,7 +569,7 @@ public class TemplateFactory {
         }
 
         List<Field> getFields() {
-            return fields;
+            return this.fields;
         }
     }
 
@@ -592,16 +592,16 @@ public class TemplateFactory {
         }
 
         private static Holder processAttributes(final Map<String, AttributeIfc> attributes) {
-            List<ModuleField> moduleFields = new ArrayList<>();
-            List<MethodDefinition> methods = new ArrayList<>();
-            for (Entry<String, AttributeIfc> attrEntry : attributes.entrySet()) {
+            final List<ModuleField> moduleFields = new ArrayList<>();
+            final List<MethodDefinition> methods = new ArrayList<>();
+            for (final Entry<String, AttributeIfc> attrEntry : attributes.entrySet()) {
                 String type, nullableDefaultWrapped = null;
-                AttributeIfc attributeIfc = attrEntry.getValue();
+                final AttributeIfc attributeIfc = attrEntry.getValue();
                 boolean isIdentity = false;
-                boolean needsDepResolver = needsDepResolver(attrEntry.getValue());
+                final boolean needsDepResolver = needsDepResolver(attrEntry.getValue());
 
                 if (attributeIfc instanceof TypedAttribute) {
-                    TypedAttribute typedAttribute = (TypedAttribute) attributeIfc;
+                    final TypedAttribute typedAttribute = (TypedAttribute) attributeIfc;
                     type = serializeType(typedAttribute.getType());
                     if (attributeIfc instanceof JavaAttribute) {
                         nullableDefaultWrapped = ((JavaAttribute) attributeIfc).getNullableDefaultWrappedForCode();
@@ -619,9 +619,9 @@ public class TemplateFactory {
                 boolean isDependency = false;
                 boolean isListOfDependencies = false;
                 Dependency dependency = null;
-                Annotation overrideAnnotation = new Annotation("Override",
+                final Annotation overrideAnnotation = new Annotation("Override",
                         Collections.<Parameter> emptyList());
-                List<Annotation> annotations = Lists
+                final List<Annotation> annotations = Lists
                         .newArrayList(overrideAnnotation);
 
                 if (attributeIfc instanceof AbstractDependencyAttribute) {
@@ -635,26 +635,26 @@ public class TemplateFactory {
                     }
                 }
 
-                String varName = BindingMapping.getPropertyName(attrEntry.getKey());
+                final String varName = BindingMapping.getPropertyName(attrEntry.getKey());
 
                 ModuleField field;
                 if (isIdentity) {
-                    String identityBaseClass = getInnerTypeFromIdentity(((TypedAttribute) attributeIfc).getType());
-                    IdentityRefModuleField identityField = new IdentityRefModuleField(type, varName,
+                    final String identityBaseClass = getInnerTypeFromIdentity(((TypedAttribute) attributeIfc).getType());
+                    final IdentityRefModuleField identityField = new IdentityRefModuleField(type, varName,
                             attributeIfc.getUpperCaseCammelCase(), identityBaseClass);
 
-                    String getterName = "get"
+                    final String getterName = "get"
                             + attributeIfc.getUpperCaseCammelCase() + "Identity";
-                    MethodDefinition additionalGetter = new MethodDefinition(type, getterName, Collections.<Field> emptyList(),
+                    final MethodDefinition additionalGetter = new MethodDefinition(type, getterName, Collections.<Field> emptyList(),
                             Collections.<Annotation> emptyList(), "return " + identityField.getIdentityClassName()
                                     + ";");
                     methods.add(additionalGetter);
 
-                    String setterName = "set"
+                    final String setterName = "set"
                             + attributeIfc.getUpperCaseCammelCase();
 
-                    String setterBody = "this." + identityField.getIdentityClassName() + " = " + identityField.getIdentityClassName() + ";";
-                    MethodDefinition additionalSetter = new MethodDefinition("void",
+                    final String setterBody = "this." + identityField.getIdentityClassName() + " = " + identityField.getIdentityClassName() + ";";
+                    final MethodDefinition additionalSetter = new MethodDefinition("void",
                             setterName,
                             Lists.newArrayList(new Field(type, identityField.getIdentityClassName())),
                             Collections.<Annotation> emptyList(), setterBody);
@@ -671,16 +671,16 @@ public class TemplateFactory {
                 moduleFields.add(field);
 
 
-                String getterName = "get"
+                final String getterName = "get"
                         + attributeIfc.getUpperCaseCammelCase();
-                MethodDefinition getter = new MethodDefinition(type,
+                final MethodDefinition getter = new MethodDefinition(type,
                         getterName, Collections.<Field> emptyList(),
                         Lists.newArrayList(overrideAnnotation), "return "
                         + varName + ";");
 
                 methods.add(getter);
 
-                String setterName = "set"
+                final String setterName = "set"
                         + attributeIfc.getUpperCaseCammelCase();
 
                 if (attributeIfc.getNullableDescription() != null) {
@@ -690,11 +690,11 @@ public class TemplateFactory {
 
                 String setterBody = "this." + varName + " = " + varName + ";";
                 if (isListOfDependencies) {
-                    String nullCheck = String.format("if (%s == null) {\n%s = new java.util.ArrayList<>(); \n}%n",
+                    final String nullCheck = String.format("if (%s == null) {\n%s = new java.util.ArrayList<>(); \n}%n",
                             varName, varName);
                     setterBody = nullCheck + setterBody;
                 }
-                MethodDefinition setter = new MethodDefinition("void",
+                final MethodDefinition setter = new MethodDefinition("void",
                         setterName,
                         Lists.newArrayList(new Field(type, varName)),
                         annotations, setterBody);
@@ -706,11 +706,11 @@ public class TemplateFactory {
         }
 
         List<ModuleField> getModuleFields() {
-            return holder.moduleFields;
+            return this.holder.moduleFields;
         }
 
         List<MethodDefinition> getMethods() {
-            return holder.methods;
+            return this.holder.methods;
         }
 
     }
@@ -721,7 +721,7 @@ public class TemplateFactory {
             return true;
         }
         if(value instanceof ListAttribute) {
-            AttributeIfc innerAttribute = ((ListAttribute) value).getInnerAttribute();
+            final AttributeIfc innerAttribute = ((ListAttribute) value).getInnerAttribute();
             return needsDepResolver(innerAttribute);
         }
 
@@ -730,7 +730,7 @@ public class TemplateFactory {
 
     private static String getInnerTypeFromIdentity(final Type type) {
         Preconditions.checkArgument(type instanceof ParameterizedType);
-        Type[] args = ((ParameterizedType) type).getActualTypeArguments();
+        final Type[] args = ((ParameterizedType) type).getActualTypeArguments();
         Preconditions.checkArgument(args.length ==1);
         return serializeType(args[0]);
     }
index 076e4e981277ae0da1d1c4621a8ce8b0dc3b90a5..e4e955987d4cdee744c675c09a9b22efdef72d45 100644 (file)
@@ -11,7 +11,6 @@ import static org.junit.Assert.assertNotNull;
 import static org.mockito.Matchers.anyString;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
-
 import com.google.common.collect.Maps;
 import java.util.Collections;
 import java.util.Map;
@@ -21,22 +20,22 @@ import org.opendaylight.controller.config.yangjmxgenerator.attribute.AttributeIf
 import org.opendaylight.controller.config.yangjmxgenerator.attribute.JavaAttribute;
 import org.opendaylight.controller.config.yangjmxgenerator.plugin.ftl.AbstractFactoryTemplate;
 import org.opendaylight.controller.config.yangjmxgenerator.plugin.ftl.TemplateFactory;
-import org.opendaylight.yangtools.sal.binding.model.api.Type;
+import org.opendaylight.mdsal.binding.model.api.Type;
 
 public class ModuleMXBeanEntryTemplatesTest {
 
     @Test
     public void test() {
-        ModuleMXBeanEntry mbe = mockMbe("package");
-        AbstractFactoryTemplate template = TemplateFactory
+        final ModuleMXBeanEntry mbe = mockMbe("package");
+        final AbstractFactoryTemplate template = TemplateFactory
                 .abstractFactoryTemplateFromMbe(mbe);
         assertNotNull(template);
     }
 
-    public static ModuleMXBeanEntry mockMbe(String packageName) {
-        ModuleMXBeanEntry mbe = mock(ModuleMXBeanEntry.class);
-        Map<String, AttributeIfc> a = Maps.newHashMap();
-        JavaAttribute attr = mockJavaAttr();
+    public static ModuleMXBeanEntry mockMbe(final String packageName) {
+        final ModuleMXBeanEntry mbe = mock(ModuleMXBeanEntry.class);
+        final Map<String, AttributeIfc> a = Maps.newHashMap();
+        final JavaAttribute attr = mockJavaAttr();
 
         a.put("attr1", attr);
         doReturn(a).when(mbe).getAttributes();
@@ -52,8 +51,8 @@ public class ModuleMXBeanEntryTemplatesTest {
     }
 
     public static JavaAttribute mockJavaAttr() {
-        JavaAttribute attr = mock(JavaAttribute.class);
-        Type typeA = mock(Type.class);
+        final JavaAttribute attr = mock(JavaAttribute.class);
+        final Type typeA = mock(Type.class);
         doReturn("package").when(typeA).getName();
         doReturn("type").when(typeA).getPackageName();
         doReturn("package.type").when(typeA).getFullyQualifiedName();
index 48895d21694879963a0981b5fdc7ae28dcd1e53b..07b4f2d7db006560122d160d53577ddbeed86270 100644 (file)
@@ -9,7 +9,7 @@ package org.opendaylight.controller.config.yangjmxgenerator;
 
 import java.util.Map;
 import java.util.Map.Entry;
-import org.opendaylight.yangtools.binding.generator.util.BindingGeneratorUtil;
+import org.opendaylight.mdsal.binding.generator.util.BindingGeneratorUtil;
 import org.opendaylight.yangtools.yang.model.api.Module;
 
 /**
@@ -19,7 +19,7 @@ import org.opendaylight.yangtools.yang.model.api.Module;
 public class PackageTranslator {
     private final Map<String, String> namespacePrefixToPackageMap;
 
-    public PackageTranslator(Map<String, String> namespacePrefixToPackageMap) {
+    public PackageTranslator(final Map<String, String> namespacePrefixToPackageMap) {
         this.namespacePrefixToPackageMap = namespacePrefixToPackageMap;
     }
 
@@ -34,14 +34,14 @@ public class PackageTranslator {
      * @throws IllegalStateException
      *             if there is no mapping found.
      */
-    public String getPackageName(Module module) {
+    public String getPackageName(final Module module) {
         Entry<String, String> longestMatch = null;
         int longestMatchLength = 0;
-        String namespace = module.getNamespace().toString();
-        for (Entry<String, String> entry : namespacePrefixToPackageMap
+        final String namespace = module.getNamespace().toString();
+        for (final Entry<String, String> entry : this.namespacePrefixToPackageMap
                 .entrySet()) {
             if (namespace.startsWith(entry.getKey())
-                    && entry.getKey().length() > longestMatchLength) {
+                    && (entry.getKey().length() > longestMatchLength)) {
                 longestMatch = entry;
                 longestMatchLength = entry.getKey().length();
             }
@@ -55,7 +55,7 @@ public class PackageTranslator {
     }
 
     // TODO add to PackageTranslator
-    private static String sanitizePackage(String namespace) {
+    private static String sanitizePackage(final String namespace) {
         String newNamespace = namespace;
         newNamespace = newNamespace.replace("://", ".");
         newNamespace = newNamespace.replace("/", ".");
index fd19f7e38c2f5324000072afc5fd9c28c65d299d..02f2084a6096f6869dc50f79c979b4059b1e4685 100644 (file)
@@ -7,9 +7,9 @@
  */
 package org.opendaylight.controller.config.yangjmxgenerator;
 
-import org.opendaylight.yangtools.binding.generator.util.BindingGeneratorUtil;
-import org.opendaylight.yangtools.sal.binding.generator.spi.TypeProvider;
-import org.opendaylight.yangtools.sal.binding.model.api.Type;
+import org.opendaylight.mdsal.binding.generator.spi.TypeProvider;
+import org.opendaylight.mdsal.binding.generator.util.BindingGeneratorUtil;
+import org.opendaylight.mdsal.binding.model.api.Type;
 import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.SchemaNode;
@@ -38,10 +38,10 @@ public class TypeProviderWrapper {
 
     public static String convertToJavaName(final SchemaNode schemaNode,
                                            final boolean capitalizeFirstLetter) {
-        for (UnknownSchemaNode unknownNode : schemaNode.getUnknownSchemaNodes()) {
+        for (final UnknownSchemaNode unknownNode : schemaNode.getUnknownSchemaNodes()) {
             if (ConfigConstants.JAVA_NAME_PREFIX_EXTENSION_QNAME
                     .equals(unknownNode.getNodeType())) {
-                String value = unknownNode.getNodeParameter();
+                final String value = unknownNode.getNodeParameter();
                 return convertToJavaName(value, capitalizeFirstLetter);
             }
         }
@@ -59,24 +59,24 @@ public class TypeProviderWrapper {
     }
 
     public Type getType(final LeafSchemaNode leaf) {
-        TypeDefinition<?> type = CompatUtils.compatLeafType(leaf);
+        final TypeDefinition<?> type = CompatUtils.compatLeafType(leaf);
         return getType(leaf, type);
     }
 
     public String getDefault(final LeafSchemaNode node) {
-        return typeProvider.getTypeDefaultConstruction(node);
+        return this.typeProvider.getTypeDefaultConstruction(node);
     }
 
     public Type getType(final SchemaNode leaf, final TypeDefinition<?> type) {
         Type javaType;
         try {
-            javaType = typeProvider.javaTypeForSchemaDefinitionType(
+            javaType = this.typeProvider.javaTypeForSchemaDefinitionType(
                     type, leaf);
             if (javaType == null) {
                 throw new IllegalArgumentException("Unknown type received for "
                         + leaf.toString());
             }
-        } catch (IllegalArgumentException e) {
+        } catch (final IllegalArgumentException e) {
             throw new IllegalArgumentException("Error while resolving type of "
                     + leaf, e);
         }
@@ -87,13 +87,13 @@ public class TypeProviderWrapper {
     public Type getType(final LeafListSchemaNode leaf) {
         Type javaType;
         try {
-            javaType = typeProvider.javaTypeForSchemaDefinitionType(
+            javaType = this.typeProvider.javaTypeForSchemaDefinitionType(
                     leaf.getType(), leaf);
             if (javaType == null) {
                 throw new IllegalArgumentException(
                         "Unknown type received for  " + leaf.toString());
             }
-        } catch (IllegalArgumentException e) {
+        } catch (final IllegalArgumentException e) {
             throw new IllegalArgumentException("Error while resolving type of "
                     + leaf, e);
         }
@@ -101,10 +101,10 @@ public class TypeProviderWrapper {
     }
 
     public String getJMXParamForBaseType(final TypeDefinition<?> baseType) {
-        return typeProvider.getConstructorPropertyName(baseType);
+        return this.typeProvider.getConstructorPropertyName(baseType);
     }
 
     public String getJMXParamForUnionInnerType(final TypeDefinition<?> unionInnerType) {
-        return typeProvider.getParamNameFromType(unionInnerType);
+        return this.typeProvider.getParamNameFromType(unionInnerType);
     }
 }
index a82571cb19c665a90e98ba13f8b334e4fa9f82f8..b2aa4a799ac9b85c857744336fa1bd524e94eaf8 100644 (file)
@@ -10,16 +10,16 @@ package org.opendaylight.controller.config.yangjmxgenerator.attribute;
 import javax.management.ObjectName;
 import javax.management.openmbean.SimpleType;
 import org.opendaylight.controller.config.yangjmxgenerator.ServiceInterfaceEntry;
-import org.opendaylight.yangtools.binding.generator.util.Types;
-import org.opendaylight.yangtools.sal.binding.model.api.Type;
+import org.opendaylight.mdsal.binding.generator.util.Types;
+import org.opendaylight.mdsal.binding.model.api.Type;
 import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
 
 public class DependencyAttribute extends AbstractDependencyAttribute {
 
 
-    public DependencyAttribute(DataSchemaNode attrNode,
-            ServiceInterfaceEntry sie, boolean mandatory,
-            String nullableDescription) {
+    public DependencyAttribute(final DataSchemaNode attrNode,
+            final ServiceInterfaceEntry sie, final boolean mandatory,
+            final String nullableDescription) {
         super(attrNode, sie, mandatory, nullableDescription);
     }
 
index 5136a98e20b258c233b84baade451dc98bdaf280..099d8ed152c39193f3bff03f3bcfbb19afdba60f 100644 (file)
@@ -17,7 +17,7 @@ import javax.management.openmbean.OpenType;
 import javax.management.openmbean.SimpleType;
 import org.opendaylight.controller.config.api.IdentityAttributeRef;
 import org.opendaylight.controller.config.yangjmxgenerator.TypeProviderWrapper;
-import org.opendaylight.yangtools.sal.binding.model.api.Type;
+import org.opendaylight.mdsal.binding.model.api.Type;
 import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
@@ -53,22 +53,22 @@ public class JavaAttribute extends AbstractAttribute implements TypedAttribute {
         this.type = typeProviderWrapper.getType(leaf);
         this.typeDefinition = leaf.getType();
         this.typeProviderWrapper = typeProviderWrapper;
-        this.nullableDefault = nullableDefaultWrappedForCode = null;
+        this.nullableDefault = this.nullableDefaultWrappedForCode = null;
         this.nullableDescription = leaf.getDescription();
     }
 
     public boolean isUnion() {
-        TypeDefinition<?> base = getBaseType(typeProviderWrapper, typeDefinition);
+        final TypeDefinition<?> base = getBaseType(this.typeProviderWrapper, this.typeDefinition);
         return base instanceof UnionTypeDefinition;
     }
 
     public boolean isEnum() {
-        TypeDefinition<?> base = getBaseType(typeProviderWrapper, typeDefinition);
+        final TypeDefinition<?> base = getBaseType(this.typeProviderWrapper, this.typeDefinition);
         return base instanceof EnumTypeDefinition;
     }
 
     public TypeDefinition<?> getTypeDefinition() {
-        return typeDefinition;
+        return this.typeDefinition;
     }
 
     /**
@@ -82,22 +82,22 @@ public class JavaAttribute extends AbstractAttribute implements TypedAttribute {
     }
 
     public String getNullableDefaultWrappedForCode() {
-        return nullableDefaultWrappedForCode;
+        return this.nullableDefaultWrappedForCode;
     }
 
     @Override
     public Type getType() {
-        return type;
+        return this.type;
     }
 
     @Override
     public String getNullableDescription() {
-        return nullableDescription;
+        return this.nullableDescription;
     }
 
     @Override
     public String getNullableDefault() {
-        return nullableDefault;
+        return this.nullableDefault;
     }
 
     @Override
@@ -105,25 +105,25 @@ public class JavaAttribute extends AbstractAttribute implements TypedAttribute {
         if (this == o) {
             return true;
         }
-        if (o == null || getClass() != o.getClass()) {
+        if ((o == null) || (getClass() != o.getClass())) {
             return false;
         }
         if (!super.equals(o)) {
             return false;
         }
 
-        JavaAttribute that = (JavaAttribute) o;
+        final JavaAttribute that = (JavaAttribute) o;
 
-        if (nullableDefault != null ? !nullableDefault
+        if (this.nullableDefault != null ? !this.nullableDefault
                 .equals(that.nullableDefault) : that.nullableDefault != null) {
             return false;
         }
-        if (nullableDescription != null ? !nullableDescription
+        if (this.nullableDescription != null ? !this.nullableDescription
                 .equals(that.nullableDescription)
                 : that.nullableDescription != null) {
             return false;
         }
-        if (type != null ? !type.equals(that.type) : that.type != null) {
+        if (this.type != null ? !this.type.equals(that.type) : that.type != null) {
             return false;
         }
 
@@ -133,26 +133,26 @@ public class JavaAttribute extends AbstractAttribute implements TypedAttribute {
     @Override
     public int hashCode() {
         int result = super.hashCode();
-        result = 31 * result + (type != null ? type.hashCode() : 0);
-        result = 31
-                * result
-                + (nullableDescription != null ? nullableDescription.hashCode()
+        result = (31 * result) + (this.type != null ? this.type.hashCode() : 0);
+        result = (31
+                * result)
+                + (this.nullableDescription != null ? this.nullableDescription.hashCode()
                         : 0);
-        result = 31 * result
-                + (nullableDefault != null ? nullableDefault.hashCode() : 0);
+        result = (31 * result)
+                + (this.nullableDefault != null ? this.nullableDefault.hashCode() : 0);
         return result;
     }
 
     @Override
     public String toString() {
-        return "JavaAttribute{" + getAttributeYangName() + "," + "type=" + type
+        return "JavaAttribute{" + getAttributeYangName() + "," + "type=" + this.type
                 + '}';
     }
 
     @Override
     public OpenType<?> getOpenType() {
-        TypeDefinition<?> baseTypeDefinition = getBaseType(typeProviderWrapper, typeDefinition);
-        Type baseType = typeProviderWrapper.getType(baseTypeDefinition, baseTypeDefinition);
+        final TypeDefinition<?> baseTypeDefinition = getBaseType(this.typeProviderWrapper, this.typeDefinition);
+        final Type baseType = this.typeProviderWrapper.getType(baseTypeDefinition, baseTypeDefinition);
 
         if (isArray()) {
             return getArrayType();
@@ -170,41 +170,41 @@ public class JavaAttribute extends AbstractAttribute implements TypedAttribute {
     }
 
     private OpenType<?> getEnumType(final TypeDefinition<?> baseType) {
-        final String fullyQualifiedName = typeProviderWrapper.getType(node, getTypeDefinition()).getFullyQualifiedName();
+        final String fullyQualifiedName = this.typeProviderWrapper.getType(this.node, getTypeDefinition()).getFullyQualifiedName();
         final String[] items = {"instance"};
-        String description = getNullableDescription() == null ? getAttributeYangName() : getNullableDescription();
+        final String description = getNullableDescription() == null ? getAttributeYangName() : getNullableDescription();
 
         try {
             return new CompositeType(fullyQualifiedName, description, items, items, new OpenType[]{SimpleType.STRING});
-        } catch (OpenDataException e) {
+        } catch (final OpenDataException e) {
             throw new RuntimeException("Unable to create enum type" + fullyQualifiedName + " as open type", e);
         }
     }
 
     public boolean isIdentityRef() {
-        return typeDefinition instanceof IdentityrefTypeDefinition;
+        return this.typeDefinition instanceof IdentityrefTypeDefinition;
     }
 
     private OpenType<?> getCompositeTypeForUnion(final TypeDefinition<?> baseTypeDefinition) {
         Preconditions.checkArgument(baseTypeDefinition instanceof UnionTypeDefinition,
                 "Expected %s instance but was %s", UnionTypeDefinition.class, baseTypeDefinition);
 
-        List<TypeDefinition<?>> types = ((UnionTypeDefinition) baseTypeDefinition).getTypes();
+        final List<TypeDefinition<?>> types = ((UnionTypeDefinition) baseTypeDefinition).getTypes();
 
-        String[] itemNames = new String[types.size()+1];
-        OpenType<?>[] itemTypes = new OpenType[itemNames.length];
+        final String[] itemNames = new String[types.size()+1];
+        final OpenType<?>[] itemTypes = new OpenType[itemNames.length];
 
         addArtificialPropertyToUnionCompositeType(baseTypeDefinition, itemNames, itemTypes);
 
-        String description = getNullableDescription() == null ? getAttributeYangName() : getNullableDescription();
+        final String description = getNullableDescription() == null ? getAttributeYangName() : getNullableDescription();
 
         int i = 1;
-        for (TypeDefinition<?> innerTypeDefinition : types) {
+        for (final TypeDefinition<?> innerTypeDefinition : types) {
 
-            Type innerType = typeProviderWrapper.getType(innerTypeDefinition, innerTypeDefinition);
+            final Type innerType = this.typeProviderWrapper.getType(innerTypeDefinition, innerTypeDefinition);
 
-            TypeDefinition<?> baseInnerTypeDefinition = getBaseType(typeProviderWrapper, innerTypeDefinition);
-            Type innerTypeBaseType = typeProviderWrapper.getType(baseInnerTypeDefinition, baseInnerTypeDefinition);
+            final TypeDefinition<?> baseInnerTypeDefinition = getBaseType(this.typeProviderWrapper, innerTypeDefinition);
+            final Type innerTypeBaseType = this.typeProviderWrapper.getType(baseInnerTypeDefinition, baseInnerTypeDefinition);
 
             OpenType<?> innerCompositeType;
 
@@ -216,16 +216,16 @@ public class JavaAttribute extends AbstractAttribute implements TypedAttribute {
                 innerCompositeType = SimpleTypeResolver.getSimpleType(innerType);
             }
 
-            itemNames[i] = typeProviderWrapper.getJMXParamForUnionInnerType(innerTypeDefinition);
+            itemNames[i] = this.typeProviderWrapper.getJMXParamForUnionInnerType(innerTypeDefinition);
             itemTypes[i++] = innerCompositeType;
         }
 
-        String[] descriptions = itemNames.clone();
+        final String[] descriptions = itemNames.clone();
         descriptions[0] = DESCRIPTION_OF_VALUE_ATTRIBUTE_FOR_UNION;
 
         try {
             return new CompositeType(getUpperCaseCammelCase(), description, itemNames, descriptions, itemTypes);
-        } catch (OpenDataException e) {
+        } catch (final OpenDataException e) {
             throw new RuntimeException("Unable to create " + CompositeType.class + " with inner elements "
                     + Arrays.toString(itemTypes), e);
         }
@@ -234,61 +234,61 @@ public class JavaAttribute extends AbstractAttribute implements TypedAttribute {
     public static final Class<Character> TYPE_OF_ARTIFICIAL_UNION_PROPERTY = char.class;
 
     private void addArtificialPropertyToUnionCompositeType(final TypeDefinition<?> baseTypeDefinition, final String[] itemNames, final OpenType<?>[] itemTypes) {
-        String artificialPropertyName = typeProviderWrapper.getJMXParamForBaseType(baseTypeDefinition);
+        final String artificialPropertyName = this.typeProviderWrapper.getJMXParamForBaseType(baseTypeDefinition);
         itemNames[0] = artificialPropertyName;
 
-        OpenType<?> artificialPropertyType = getArrayOpenTypeForSimpleType(TYPE_OF_ARTIFICIAL_UNION_PROPERTY.getName(),
+        final OpenType<?> artificialPropertyType = getArrayOpenTypeForSimpleType(TYPE_OF_ARTIFICIAL_UNION_PROPERTY.getName(),
                 SimpleTypeResolver.getSimpleType(TYPE_OF_ARTIFICIAL_UNION_PROPERTY.getName()));
         itemTypes[0] = artificialPropertyType;
     }
 
     private OpenType<?> getSimpleType(final Type type) {
-        SimpleType<?> simpleType = SimpleTypeResolver.getSimpleType(type);
+        final SimpleType<?> simpleType = SimpleTypeResolver.getSimpleType(type);
         return simpleType;
     }
 
     private OpenType<?> getCompositeType(final Type baseType, final TypeDefinition<?> baseTypeDefinition) {
 
-        SimpleType<?> innerItemType = SimpleTypeResolver.getSimpleType(baseType);
-        String innerItemName = typeProviderWrapper.getJMXParamForBaseType(baseTypeDefinition);
+        final SimpleType<?> innerItemType = SimpleTypeResolver.getSimpleType(baseType);
+        final String innerItemName = this.typeProviderWrapper.getJMXParamForBaseType(baseTypeDefinition);
 
-        String[] itemNames = new String[]{innerItemName};
-        String description = getNullableDescription() == null ? getAttributeYangName() : getNullableDescription();
+        final String[] itemNames = new String[]{innerItemName};
+        final String description = getNullableDescription() == null ? getAttributeYangName() : getNullableDescription();
 
-        OpenType<?>[] itemTypes = new OpenType[]{innerItemType};
+        final OpenType<?>[] itemTypes = new OpenType[]{innerItemType};
         try {
             return new CompositeType(getUpperCaseCammelCase(), description, itemNames, itemNames, itemTypes);
-        } catch (OpenDataException e) {
+        } catch (final OpenDataException e) {
             throw new RuntimeException("Unable to create " + CompositeType.class + " with inner element of type "
                     + itemTypes, e);
         }
     }
 
     public OpenType<?> getCompositeTypeForIdentity() {
-        String[] itemNames = new String[]{IdentityAttributeRef.QNAME_ATTR_NAME};
-        String description = getNullableDescription() == null ? getAttributeYangName() : getNullableDescription();
-        OpenType<?>[] itemTypes = new OpenType[]{SimpleType.STRING};
+        final String[] itemNames = new String[]{IdentityAttributeRef.QNAME_ATTR_NAME};
+        final String description = getNullableDescription() == null ? getAttributeYangName() : getNullableDescription();
+        final OpenType<?>[] itemTypes = new OpenType[]{SimpleType.STRING};
 
         try {
             return new CompositeType(getUpperCaseCammelCase(), description, itemNames, itemNames, itemTypes);
-        } catch (OpenDataException e) {
+        } catch (final OpenDataException e) {
             throw new RuntimeException("Unable to create " + CompositeType.class + " with inner element of type "
                     + itemTypes, e);
         }
     }
 
     private OpenType<?> getArrayType() {
-        String innerTypeFullyQName = getInnerType(getType());
-        SimpleType<?> innerSimpleType = SimpleTypeResolver.getSimpleType(innerTypeFullyQName);
+        final String innerTypeFullyQName = getInnerType(getType());
+        final SimpleType<?> innerSimpleType = SimpleTypeResolver.getSimpleType(innerTypeFullyQName);
         return getArrayOpenTypeForSimpleType(innerTypeFullyQName, innerSimpleType);
     }
 
     private OpenType<?> getArrayOpenTypeForSimpleType(final String innerTypeFullyQName, final SimpleType<?> innerSimpleType) {
         try {
-            ArrayType<Object> arrayType = isPrimitive(innerTypeFullyQName) ? new ArrayType<>(innerSimpleType, true)
+            final ArrayType<Object> arrayType = isPrimitive(innerTypeFullyQName) ? new ArrayType<>(innerSimpleType, true)
                     : new ArrayType<>(1, innerSimpleType);
             return arrayType;
-        } catch (OpenDataException e) {
+        } catch (final OpenDataException e) {
             throw new RuntimeException("Unable to create " + ArrayType.class + " with inner element of type "
                     + innerSimpleType, e);
         }
@@ -304,7 +304,7 @@ public class JavaAttribute extends AbstractAttribute implements TypedAttribute {
     }
 
     private boolean isArray() {
-        return type.getName().endsWith("[]");
+        return this.type.getName().endsWith("[]");
     }
 
     private boolean isDerivedType(final Type baseType, final Type currentType) {
@@ -312,7 +312,7 @@ public class JavaAttribute extends AbstractAttribute implements TypedAttribute {
     }
 
     private static String getInnerType(final Type type) {
-        String fullyQualifiedName = type.getFullyQualifiedName();
+        final String fullyQualifiedName = type.getFullyQualifiedName();
         return fullyQualifiedName.substring(0, fullyQualifiedName.length() - 2);
     }
 
index 9d8996369db59867b63b6c7808879bdbbf46fd92..23c4c228357ad2caee22d2880e0aff3605758839 100644 (file)
@@ -12,8 +12,8 @@ import javax.management.openmbean.ArrayType;
 import javax.management.openmbean.OpenDataException;
 import javax.management.openmbean.OpenType;
 import org.opendaylight.controller.config.yangjmxgenerator.TypeProviderWrapper;
-import org.opendaylight.yangtools.binding.generator.util.Types;
-import org.opendaylight.yangtools.sal.binding.model.api.Type;
+import org.opendaylight.mdsal.binding.generator.util.Types;
+import org.opendaylight.mdsal.binding.model.api.Type;
 import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
@@ -23,24 +23,24 @@ public class ListAttribute extends AbstractAttribute implements TypedAttribute {
     private final String nullableDescription, nullableDefault;
     private final TypedAttribute innerAttribute;
 
-    public static ListAttribute create(ListSchemaNode node,
-            TypeProviderWrapper typeProvider, String packageName) {
+    public static ListAttribute create(final ListSchemaNode node,
+            final TypeProviderWrapper typeProvider, final String packageName) {
 
-        TOAttribute innerAttribute = TOAttribute.create(node, typeProvider, packageName);
+        final TOAttribute innerAttribute = TOAttribute.create(node, typeProvider, packageName);
 
         return new ListAttribute(node, innerAttribute, node.getDescription());
     }
 
-    public static ListAttribute create(LeafListSchemaNode node,
-            TypeProviderWrapper typeProvider) {
+    public static ListAttribute create(final LeafListSchemaNode node,
+            final TypeProviderWrapper typeProvider) {
 
-        JavaAttribute innerAttribute = new JavaAttribute(node, typeProvider);
+        final JavaAttribute innerAttribute = new JavaAttribute(node, typeProvider);
 
         return new ListAttribute(node, innerAttribute, node.getDescription());
     }
 
-    ListAttribute(DataSchemaNode attrNode, TypedAttribute innerAttribute,
-            String description) {
+    ListAttribute(final DataSchemaNode attrNode, final TypedAttribute innerAttribute,
+            final String description) {
         super(attrNode);
         this.nullableDescription = description;
         this.innerAttribute = innerAttribute;
@@ -49,55 +49,55 @@ public class ListAttribute extends AbstractAttribute implements TypedAttribute {
 
     @Override
     public String getNullableDescription() {
-        return nullableDescription;
+        return this.nullableDescription;
     }
 
     @Override
     public String getNullableDefault() {
-        return nullableDefault;
+        return this.nullableDefault;
     }
 
     public AttributeIfc getInnerAttribute() {
-        return innerAttribute;
+        return this.innerAttribute;
     }
 
     @Override
     public String toString() {
         return "ListAttribute{" + getAttributeYangName() + "," + "to="
-                + innerAttribute + '}';
+                + this.innerAttribute + '}';
     }
 
     @Override
     public int hashCode() {
         int result = super.hashCode();
-        result = 31
-                * result
-                + (nullableDescription != null ? nullableDescription.hashCode()
+        result = (31
+                * result)
+                + (this.nullableDescription != null ? this.nullableDescription.hashCode()
                         : 0);
-        result = 31 * result
-                + (nullableDefault != null ? nullableDefault.hashCode() : 0);
+        result = (31 * result)
+                + (this.nullableDefault != null ? this.nullableDefault.hashCode() : 0);
         return result;
     }
 
     @Override
-    public boolean equals(Object o) {
+    public boolean equals(final Object o) {
         if (this == o) {
             return true;
         }
-        if (o == null || getClass() != o.getClass()) {
+        if ((o == null) || (getClass() != o.getClass())) {
             return false;
         }
         if (!super.equals(o)) {
             return false;
         }
 
-        ListAttribute that = (ListAttribute) o;
+        final ListAttribute that = (ListAttribute) o;
 
-        if (nullableDefault != null ? !nullableDefault
+        if (this.nullableDefault != null ? !this.nullableDefault
                 .equals(that.nullableDefault) : that.nullableDefault != null) {
             return false;
         }
-        if (nullableDescription != null ? !nullableDescription
+        if (this.nullableDescription != null ? !this.nullableDescription
                 .equals(that.nullableDescription)
                 : that.nullableDescription != null) {
             return false;
@@ -109,19 +109,19 @@ public class ListAttribute extends AbstractAttribute implements TypedAttribute {
 
     @Override
     public Type getType() {
-        return Types.parameterizedTypeFor(Types.typeForClass(List.class), innerAttribute.getType());
+        return Types.parameterizedTypeFor(Types.typeForClass(List.class), this.innerAttribute.getType());
     }
 
     @Override
     public ArrayType<?> getOpenType() {
-        OpenType<?> innerOpenType = innerAttribute.getOpenType();
+        final OpenType<?> innerOpenType = this.innerAttribute.getOpenType();
         return constructArrayType(innerOpenType);
     }
 
-    static ArrayType<?> constructArrayType(OpenType<?> innerOpenType){
+    static ArrayType<?> constructArrayType(final OpenType<?> innerOpenType){
         try {
             return new ArrayType<>(1, innerOpenType);
-        } catch (OpenDataException e) {
+        } catch (final OpenDataException e) {
             throw new RuntimeException("Unable to create " + ArrayType.class
                     + " with inner element of type " + innerOpenType, e);
         }
index 48d06a381c1b40f25e52e90d58d59536b6ec9626..da5392919c53ba78725969c09d52be6d6e3d5a8f 100644 (file)
@@ -13,13 +13,13 @@ import javax.management.openmbean.ArrayType;
 import javax.management.openmbean.OpenType;
 import javax.management.openmbean.SimpleType;
 import org.opendaylight.controller.config.yangjmxgenerator.ServiceInterfaceEntry;
-import org.opendaylight.yangtools.binding.generator.util.Types;
-import org.opendaylight.yangtools.sal.binding.model.api.Type;
+import org.opendaylight.mdsal.binding.generator.util.Types;
+import org.opendaylight.mdsal.binding.model.api.Type;
 import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
 
 public class ListDependenciesAttribute extends AbstractDependencyAttribute {
 
-    public ListDependenciesAttribute(DataSchemaNode attrNode, ServiceInterfaceEntry sie, boolean mandatory, String nullableDescription) {
+    public ListDependenciesAttribute(final DataSchemaNode attrNode, final ServiceInterfaceEntry sie, final boolean mandatory, final String nullableDescription) {
         super(attrNode, sie, mandatory, nullableDescription);
     }
 
@@ -30,7 +30,7 @@ public class ListDependenciesAttribute extends AbstractDependencyAttribute {
 
     @Override
     public ArrayType<?> getOpenType() {
-        OpenType<?> innerOpenType = SimpleType.OBJECTNAME;
+        final OpenType<?> innerOpenType = SimpleType.OBJECTNAME;
         return ListAttribute.constructArrayType(innerOpenType);
     }
 
index 08aff1228738dfe15f27c011be236b8588271dfe..cb716745b916f1d09370aeec926fa9582709d4c8 100644 (file)
@@ -14,27 +14,27 @@ import java.math.BigInteger;
 import java.util.Date;
 import java.util.Map;
 import javax.management.openmbean.SimpleType;
-import org.opendaylight.yangtools.sal.binding.model.api.Type;
+import org.opendaylight.mdsal.binding.model.api.Type;
 
 public class SimpleTypeResolver {
 
     private SimpleTypeResolver() {
     }
 
-    public static SimpleType<?> getSimpleType(Type type) {
-        SimpleType<?> expectedSimpleType = JAVA_TYPE_TO_SIMPLE_TYPE.get(type
+    public static SimpleType<?> getSimpleType(final Type type) {
+        final SimpleType<?> expectedSimpleType = JAVA_TYPE_TO_SIMPLE_TYPE.get(type
                 .getFullyQualifiedName());
         Preconditions.checkState(expectedSimpleType != null,
                 "Cannot find simple type for " + type.getFullyQualifiedName());
         return expectedSimpleType;
     }
 
-    public static boolean canResolve(Type type) {
+    public static boolean canResolve(final Type type) {
         return JAVA_TYPE_TO_SIMPLE_TYPE.containsKey(type.getFullyQualifiedName());
     }
 
-    public static SimpleType<?> getSimpleType(String fullyQualifiedName) {
-        SimpleType<?> expectedSimpleType = JAVA_TYPE_TO_SIMPLE_TYPE
+    public static SimpleType<?> getSimpleType(final String fullyQualifiedName) {
+        final SimpleType<?> expectedSimpleType = JAVA_TYPE_TO_SIMPLE_TYPE
                 .get(fullyQualifiedName);
         Preconditions.checkState(expectedSimpleType != null,
                 "Cannot find simple type for " + fullyQualifiedName);
index 91016d4100b6ba6e3fffe871ecbb1b7cb546d08c..b06e76fa92742f6a4bf5b4c5e9d63e113a163148 100644 (file)
@@ -21,8 +21,8 @@ import javax.management.openmbean.CompositeType;
 import javax.management.openmbean.OpenDataException;
 import javax.management.openmbean.OpenType;
 import org.opendaylight.controller.config.yangjmxgenerator.TypeProviderWrapper;
-import org.opendaylight.yangtools.binding.generator.util.ReferencedTypeImpl;
-import org.opendaylight.yangtools.sal.binding.model.api.Type;
+import org.opendaylight.mdsal.binding.generator.util.ReferencedTypeImpl;
+import org.opendaylight.mdsal.binding.model.api.Type;
 import org.opendaylight.yangtools.yang.model.api.AugmentationTarget;
 import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
@@ -48,18 +48,18 @@ public class TOAttribute extends AbstractAttribute implements TypedAttribute {
     }
 
     public static <T extends DataNodeContainer & AugmentationTarget & DataSchemaNode> TOAttribute create(
-            T containerSchemaNode, TypeProviderWrapper typeProviderWrapper, String packageName) {
+            final T containerSchemaNode, final TypeProviderWrapper typeProviderWrapper, final String packageName) {
         // Transfer Object: get the leaves
-        Map<String, AttributeIfc> map = new HashMap<>();
-        Map<String, String> attributeNameMap = new HashMap<>();
-        for (DataSchemaNode dataSchemaNode : containerSchemaNode
+        final Map<String, AttributeIfc> map = new HashMap<>();
+        final Map<String, String> attributeNameMap = new HashMap<>();
+        for (final DataSchemaNode dataSchemaNode : containerSchemaNode
                 .getChildNodes()) {
             try {
-                String yangName = dataSchemaNode.getQName().getLocalName();
+                final String yangName = dataSchemaNode.getQName().getLocalName();
                 map.put(yangName,
                         createInnerAttribute(dataSchemaNode,
                                 typeProviderWrapper, packageName));
-            } catch (IllegalArgumentException e) {
+            } catch (final IllegalArgumentException e) {
                 throw new IllegalStateException("Unable to create TO", e);
             }
         }
@@ -68,9 +68,9 @@ public class TOAttribute extends AbstractAttribute implements TypedAttribute {
     }
 
     private static AttributeIfc createInnerAttribute(
-            DataSchemaNode dataSchemaNode,
-            TypeProviderWrapper typeProviderWrapper, String packageName) {
-        Class<? extends DataSchemaNode> type = isAllowedType(dataSchemaNode);
+            final DataSchemaNode dataSchemaNode,
+            final TypeProviderWrapper typeProviderWrapper, final String packageName) {
+        final Class<? extends DataSchemaNode> type = isAllowedType(dataSchemaNode);
 
         if (type.equals(LeafSchemaNode.class)) {
             return new JavaAttribute((LeafSchemaNode) dataSchemaNode,
@@ -90,8 +90,8 @@ public class TOAttribute extends AbstractAttribute implements TypedAttribute {
     }
 
     private static Class<? extends DataSchemaNode> isAllowedType(
-            DataSchemaNode dataSchemaNode) {
-        for (Class<? extends DataSchemaNode> allowedType : ALLOWED_CHILDREN) {
+            final DataSchemaNode dataSchemaNode) {
+        for (final Class<? extends DataSchemaNode> allowedType : ALLOWED_CHILDREN) {
             if (allowedType.isAssignableFrom(dataSchemaNode.getClass()) == true) {
                 return allowedType;
             }
@@ -101,25 +101,25 @@ public class TOAttribute extends AbstractAttribute implements TypedAttribute {
                 + ALLOWED_CHILDREN);
     }
 
-    private TOAttribute(DataSchemaNode attrNode,
-            Map<String, AttributeIfc> transferObject,
-            Map<String, String> attributeNameMap, String nullableDescription, String packageName) {
+    private TOAttribute(final DataSchemaNode attrNode,
+            final Map<String, AttributeIfc> transferObject,
+            final Map<String, String> attributeNameMap, final String nullableDescription, final String packageName) {
         super(attrNode);
-        yangNameToAttributeMap = transferObject;
+        this.yangNameToAttributeMap = transferObject;
         this.attributeNameMap = attributeNameMap;
         this.nullableDescription = nullableDescription;
-        nullableDefault = null;
+        this.nullableDefault = null;
         this.packageName = packageName;
     }
 
     public Map<String, String> getAttributeNameMap() {
-        return attributeNameMap;
+        return this.attributeNameMap;
     }
 
     public Map<String, AttributeIfc> getCapitalizedPropertiesToTypesMap() {
-        Map<String, AttributeIfc> capitalizedPropertiesToTypesMap = Maps
+        final Map<String, AttributeIfc> capitalizedPropertiesToTypesMap = Maps
                 .newHashMap();
-        for (Entry<String, AttributeIfc> entry : yangNameToAttributeMap
+        for (final Entry<String, AttributeIfc> entry : this.yangNameToAttributeMap
                 .entrySet()) {
 
             capitalizedPropertiesToTypesMap.put(
@@ -130,8 +130,8 @@ public class TOAttribute extends AbstractAttribute implements TypedAttribute {
     }
 
     public Map<String, AttributeIfc> getJmxPropertiesToTypesMap() {
-        Map<String, AttributeIfc> jmxPropertiesToTypesMap = Maps.newHashMap();
-        for (Entry<String, AttributeIfc> entry : yangNameToAttributeMap
+        final Map<String, AttributeIfc> jmxPropertiesToTypesMap = Maps.newHashMap();
+        for (final Entry<String, AttributeIfc> entry : this.yangNameToAttributeMap
                 .entrySet()) {
 
             jmxPropertiesToTypesMap.put(
@@ -142,43 +142,43 @@ public class TOAttribute extends AbstractAttribute implements TypedAttribute {
     }
 
     public Map<String, AttributeIfc> getYangPropertiesToTypesMap() {
-        return yangNameToAttributeMap;
+        return this.yangNameToAttributeMap;
     }
 
     @Override
     public String getNullableDescription() {
-        return nullableDescription;
+        return this.nullableDescription;
     }
 
     @Override
     public String getNullableDefault() {
-        return nullableDefault;
+        return this.nullableDefault;
     }
 
     @Override
-    public boolean equals(Object o) {
+    public boolean equals(final Object o) {
         if (this == o) {
             return true;
         }
-        if (o == null || getClass() != o.getClass()) {
+        if ((o == null) || (getClass() != o.getClass())) {
             return false;
         }
         if (!super.equals(o)) {
             return false;
         }
 
-        TOAttribute that = (TOAttribute) o;
+        final TOAttribute that = (TOAttribute) o;
 
-        if (nullableDefault != null ? !nullableDefault
+        if (this.nullableDefault != null ? !this.nullableDefault
                 .equals(that.nullableDefault) : that.nullableDefault != null) {
             return false;
         }
-        if (nullableDescription != null ? !nullableDescription
+        if (this.nullableDescription != null ? !this.nullableDescription
                 .equals(that.nullableDescription)
                 : that.nullableDescription != null) {
             return false;
         }
-        if (yangNameToAttributeMap != null ? !yangNameToAttributeMap
+        if (this.yangNameToAttributeMap != null ? !this.yangNameToAttributeMap
                 .equals(that.yangNameToAttributeMap)
                 : that.yangNameToAttributeMap != null) {
             return false;
@@ -190,15 +190,15 @@ public class TOAttribute extends AbstractAttribute implements TypedAttribute {
     @Override
     public int hashCode() {
         int result = super.hashCode();
-        result = 31
-                * result
-                + (nullableDescription != null ? nullableDescription.hashCode()
+        result = (31
+                * result)
+                + (this.nullableDescription != null ? this.nullableDescription.hashCode()
                         : 0);
-        result = 31 * result
-                + (nullableDefault != null ? nullableDefault.hashCode() : 0);
-        result = 31
-                * result
-                + (yangNameToAttributeMap != null ? yangNameToAttributeMap
+        result = (31 * result)
+                + (this.nullableDefault != null ? this.nullableDefault.hashCode() : 0);
+        result = (31
+                * result)
+                + (this.yangNameToAttributeMap != null ? this.yangNameToAttributeMap
                         .hashCode() : 0);
         return result;
     }
@@ -206,40 +206,40 @@ public class TOAttribute extends AbstractAttribute implements TypedAttribute {
     @Override
     public String toString() {
         return "TOAttribute{" + getAttributeYangName() + "," + "to="
-                + yangNameToAttributeMap + '}';
+                + this.yangNameToAttributeMap + '}';
     }
 
     @Override
     public Type getType() {
         // TODO: ReferencedTypeImpl from Types
-        return new ReferencedTypeImpl(packageName, getUpperCaseCammelCase());
+        return new ReferencedTypeImpl(this.packageName, getUpperCaseCammelCase());
     }
 
     @Override
     public CompositeType getOpenType() {
-        String description = getNullableDescription() == null ? getAttributeYangName() : getNullableDescription();
+        final String description = getNullableDescription() == null ? getAttributeYangName() : getNullableDescription();
 
-        FunctionImpl functionImpl = new FunctionImpl();
-        Map<String, AttributeIfc> jmxPropertiesToTypesMap = getJmxPropertiesToTypesMap();
-        OpenType<?>[] itemTypes = Collections2.transform(
+        final FunctionImpl functionImpl = new FunctionImpl();
+        final Map<String, AttributeIfc> jmxPropertiesToTypesMap = getJmxPropertiesToTypesMap();
+        final OpenType<?>[] itemTypes = Collections2.transform(
                 jmxPropertiesToTypesMap.entrySet(), functionImpl).toArray(
                 new OpenType<?>[] {});
-        String[] itemNames = functionImpl.getItemNames();
+        final String[] itemNames = functionImpl.getItemNames();
         try {
             // TODO add package name to create fully qualified name for this
             // type
-            CompositeType compositeType = new CompositeType(
+            final CompositeType compositeType = new CompositeType(
                     getUpperCaseCammelCase(), description, itemNames,
                     itemNames, itemTypes);
             return compositeType;
-        } catch (OpenDataException e) {
+        } catch (final OpenDataException e) {
             throw new RuntimeException("Unable to create CompositeType for "
                     + this, e);
         }
     }
 
     public String getPackageName() {
-        return packageName;
+        return this.packageName;
     }
 
 }
@@ -249,13 +249,13 @@ class FunctionImpl implements
     private final List<String> itemNames = new ArrayList<>();
 
     @Override
-    public OpenType<?> apply(Entry<String, AttributeIfc> input) {
-        AttributeIfc innerType = input.getValue();
-        itemNames.add(input.getKey());
+    public OpenType<?> apply(final Entry<String, AttributeIfc> input) {
+        final AttributeIfc innerType = input.getValue();
+        this.itemNames.add(input.getKey());
         return innerType.getOpenType();
     }
 
     public String[] getItemNames(){
-        return itemNames.toArray(new String[itemNames.size()]);
+        return this.itemNames.toArray(new String[this.itemNames.size()]);
     }
 }
index 98a85d476ff1d74c5bd2bdc7b3c3eb25b7c26377..acd373130d369928a7c01fd689aa171d16878c8c 100644 (file)
@@ -7,7 +7,7 @@
  */
 package org.opendaylight.controller.config.yangjmxgenerator.attribute;
 
-import org.opendaylight.yangtools.sal.binding.model.api.Type;
+import org.opendaylight.mdsal.binding.model.api.Type;
 
 public interface TypedAttribute extends AttributeIfc {
 
index eb5f70d7c2ba0087c0a84babeb73bbc9ad265c9e..fc11e932c32249b8326ab6f38e3a849a88f11d96 100644 (file)
@@ -10,7 +10,6 @@ package org.opendaylight.controller.config.yangjmxgenerator;
 import static org.hamcrest.CoreMatchers.is;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertThat;
-
 import com.google.common.base.Preconditions;
 import com.google.common.collect.Sets;
 import java.io.InputStream;
@@ -22,7 +21,7 @@ import java.util.Set;
 import org.junit.Assert;
 import org.junit.Before;
 import org.opendaylight.controller.config.yangjmxgenerator.plugin.util.YangModelSearchUtils;
-import org.opendaylight.yangtools.sal.binding.yang.types.TypeProviderImpl;
+import org.opendaylight.mdsal.binding.yang.types.TypeProviderImpl;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.IdentitySchemaNode;
 import org.opendaylight.yangtools.yang.model.api.Module;
@@ -47,7 +46,7 @@ public abstract class AbstractYangTest {
 
     @Before
     public void loadYangFiles() throws Exception {
-        List<InputStream> yangISs = new ArrayList<>();
+        final List<InputStream> yangISs = new ArrayList<>();
         yangISs.addAll(getStreams("/test-config-threads.yang",
                 "/test-config-threads-java.yang",
                 "/config-bgp-listener-impl.yang", "/ietf-inet-types.yang",
@@ -56,25 +55,25 @@ public abstract class AbstractYangTest {
 
         yangISs.addAll(getConfigApiYangInputStreams());
 
-        context = YangParserTestUtils.parseYangStreams(yangISs);
+        this.context = YangParserTestUtils.parseYangStreams(yangISs);
         // close ISs
-        for (InputStream is : yangISs) {
+        for (final InputStream is : yangISs) {
             is.close();
         }
-        namesToModules = YangModelSearchUtils.mapModulesByNames(context
+        this.namesToModules = YangModelSearchUtils.mapModulesByNames(this.context
                 .getModules());
-        configModule = namesToModules.get(ConfigConstants.CONFIG_MODULE);
-        rpcContextModule = namesToModules.get(ConfigConstants.CONFIG_MODULE);
-        threadsModule = namesToModules
+        this.configModule = this.namesToModules.get(ConfigConstants.CONFIG_MODULE);
+        this.rpcContextModule = this.namesToModules.get(ConfigConstants.CONFIG_MODULE);
+        this.threadsModule = this.namesToModules
                 .get(ConfigConstants.CONFIG_THREADS_MODULE);
-        threadsJavaModule = namesToModules.get("config-threads-java");
-        bgpListenerJavaModule = namesToModules.get("config-bgp-listener-impl");
-        ietfInetTypesModule = namesToModules
+        this.threadsJavaModule = this.namesToModules.get("config-threads-java");
+        this.bgpListenerJavaModule = this.namesToModules.get("config-bgp-listener-impl");
+        this.ietfInetTypesModule = this.namesToModules
                 .get(ConfigConstants.IETF_INET_TYPES);
-        jmxModule = namesToModules.get("config-jmx-it");
-        jmxImplModule = namesToModules.get("config-jmx-it-impl");
-        testFilesModule = namesToModules.get("test-config-files");
-        testFiles1Module = namesToModules.get("test-config-files1");
+        this.jmxModule = this.namesToModules.get("config-jmx-it");
+        this.jmxImplModule = this.namesToModules.get("config-jmx-it-impl");
+        this.testFilesModule = this.namesToModules.get("test-config-files");
+        this.testFiles1Module = this.namesToModules.get("test-config-files1");
 
     }
 
@@ -83,9 +82,9 @@ public abstract class AbstractYangTest {
     }
 
     public Map<QName, IdentitySchemaNode> mapIdentitiesByQNames(final Module module) {
-        Map<QName, IdentitySchemaNode> result = new HashMap<>();
-        for (IdentitySchemaNode identitySchemaNode : module.getIdentities()) {
-            QName qName = identitySchemaNode.getQName();
+        final Map<QName, IdentitySchemaNode> result = new HashMap<>();
+        for (final IdentitySchemaNode identitySchemaNode : module.getIdentities()) {
+            final QName qName = identitySchemaNode.getQName();
             Preconditions.checkArgument(
                     result.containsKey(qName) == false,
                     "Two identities of %s contain same qname %s",
@@ -96,9 +95,9 @@ public abstract class AbstractYangTest {
     }
 
     protected static List<InputStream> getStreams(final String... paths) {
-        List<InputStream> result = new ArrayList<>();
-        for (String path : paths) {
-            InputStream is = AbstractYangTest.class.getResourceAsStream(path);
+        final List<InputStream> result = new ArrayList<>();
+        for (final String path : paths) {
+            final InputStream is = AbstractYangTest.class.getResourceAsStream(path);
             assertNotNull(path + " is null", is);
             result.add(is);
         }
@@ -106,17 +105,17 @@ public abstract class AbstractYangTest {
     }
 
     protected Map<QName, ServiceInterfaceEntry>  loadThreadsServiceInterfaceEntries(final String packageName) {
-        Map<IdentitySchemaNode, ServiceInterfaceEntry> identitiesToSIs = new HashMap<>();
-        return ServiceInterfaceEntry.create(threadsModule, packageName,identitiesToSIs);
+        final Map<IdentitySchemaNode, ServiceInterfaceEntry> identitiesToSIs = new HashMap<>();
+        return ServiceInterfaceEntry.create(this.threadsModule, packageName,identitiesToSIs);
     }
 
     protected Map<String /* identity local name */, ModuleMXBeanEntry> loadThreadsJava(
             final Map<QName, ServiceInterfaceEntry> modulesToSIEs, final String packageName) {
-        Map<String /* identity local name */, ModuleMXBeanEntry> namesToMBEs = ModuleMXBeanEntry
-                .create(threadsJavaModule, modulesToSIEs, context, new TypeProviderWrapper(new TypeProviderImpl
-                (context)), packageName);
+        final Map<String /* identity local name */, ModuleMXBeanEntry> namesToMBEs = ModuleMXBeanEntry
+                .create(this.threadsJavaModule, modulesToSIEs, this.context, new TypeProviderWrapper(new TypeProviderImpl
+                (this.context)), packageName);
         Assert.assertNotNull(namesToMBEs);
-        Set<String> expectedMXBeanNames = Sets.newHashSet(EVENTBUS_MXB_NAME,
+        final Set<String> expectedMXBeanNames = Sets.newHashSet(EVENTBUS_MXB_NAME,
                 ASYNC_EVENTBUS_MXB_NAME, THREADFACTORY_NAMING_MXB_NAME,
                 THREADPOOL_DYNAMIC_MXB_NAME, THREADPOOL_REGISTRY_IMPL_NAME);
         assertThat(namesToMBEs.keySet(), is(expectedMXBeanNames));
index 2fc1be170a13d7267163de1b2bc4b28fe3849285..3eec98e8a18f1ad8bdba595b8dbe1da460b3b008 100644 (file)
@@ -9,7 +9,6 @@ package org.opendaylight.controller.config.yangjmxgenerator;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
-
 import com.google.common.base.Preconditions;
 import java.io.File;
 import java.io.FileInputStream;
@@ -22,7 +21,7 @@ import org.junit.Ignore;
 import org.junit.Test;
 import org.opendaylight.controller.config.yangjmxgenerator.plugin.util.NameConflictException;
 import org.opendaylight.controller.config.yangjmxgenerator.plugin.util.YangModelSearchUtils;
-import org.opendaylight.yangtools.sal.binding.yang.types.TypeProviderImpl;
+import org.opendaylight.mdsal.binding.yang.types.TypeProviderImpl;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
 import org.slf4j.Logger;
@@ -43,23 +42,23 @@ public class ModuleMXBeanEntryNameConflictTest extends AbstractYangTest {
         prepareSamples();
         prepareExceptionAssertions();
 
-        for (Map.Entry<File, String> currentTestEntry : testedFilesToYangModules
+        for (final Map.Entry<File, String> currentTestEntry : this.testedFilesToYangModules
                 .entrySet()) {
             final String moduleName = currentTestEntry.getValue();
             final File yangFile = currentTestEntry.getKey();
-            Module testedModule = loadYangs(yangFile, moduleName);
+            final Module testedModule = loadYangs(yangFile, moduleName);
 
             try {
                 LOG.debug("Testing {}", yangFile);
                 ModuleMXBeanEntry.create(testedModule,
-                        new HashMap<>(), context,
-                        new TypeProviderWrapper(new TypeProviderImpl(context)),
+                        new HashMap<>(), this.context,
+                        new TypeProviderWrapper(new TypeProviderImpl(this.context)),
                         PACKAGE_NAME);
                 fail(yangFile.toString()
                         + " did not cause a name conflict and should");
-            } catch (NameConflictException e) {
+            } catch (final NameConflictException e) {
                 assertEquals(
-                        testedYangModulesToExpectedConflictingName
+                        this.testedYangModulesToExpectedConflictingName
                                 .get(moduleName),
                         e.getConflictingName());
             }
@@ -67,68 +66,68 @@ public class ModuleMXBeanEntryNameConflictTest extends AbstractYangTest {
     }
 
     private void prepareSamples() {
-        File first = new File(getClass().getResource(
+        final File first = new File(getClass().getResource(
                 "/duplicates/config-test-duplicate-attribute-in-list.yang")
                 .getFile());
-        File dir = first.getParentFile();
+        final File dir = first.getParentFile();
 
-        for (File testYang : dir.listFiles()) {
-            String moduleName = getYangModuleName(testYang.getName());
-            testedFilesToYangModules.put(testYang, moduleName);
+        for (final File testYang : dir.listFiles()) {
+            final String moduleName = getYangModuleName(testYang.getName());
+            this.testedFilesToYangModules.put(testYang, moduleName);
         }
     }
 
     private void prepareExceptionAssertions() {
-        testedYangModulesToExpectedConflictingName.put(
+        this.testedYangModulesToExpectedConflictingName.put(
                 "config-test-duplicate-attribute", "DtoA");
-        testedYangModulesToExpectedConflictingName.put(
+        this.testedYangModulesToExpectedConflictingName.put(
                 "config-test-duplicate-attribute-in-list", "DtoA");
-        testedYangModulesToExpectedConflictingName.put(
+        this.testedYangModulesToExpectedConflictingName.put(
                 "config-test-duplicate-attribute-runtime-bean", "DtoA");
-        testedYangModulesToExpectedConflictingName.put(
+        this.testedYangModulesToExpectedConflictingName.put(
                 "config-test-generated-attributes-name-conflict", "StateB");
-        testedYangModulesToExpectedConflictingName.put(
+        this.testedYangModulesToExpectedConflictingName.put(
                 "config-test-runtime-bean-list-name-conflict",
                 "StateARuntimeMXBean");
-        testedYangModulesToExpectedConflictingName.put(
+        this.testedYangModulesToExpectedConflictingName.put(
                 "config-test-runtime-bean-list-name-conflict2",
                 "StateARuntimeMXBean");
-        testedYangModulesToExpectedConflictingName
+        this.testedYangModulesToExpectedConflictingName
                 .put("config-test-runtime-bean-name-conflict", "StateARuntimeMXBean");
-        testedYangModulesToExpectedConflictingName.put(
+        this.testedYangModulesToExpectedConflictingName.put(
                 "config-test-runtime-bean-name-conflict2",
                 "StateARuntimeMXBean");
-        testedYangModulesToExpectedConflictingName.put(
+        this.testedYangModulesToExpectedConflictingName.put(
                 "config-test-duplicate-attribute-in-runtime-and-mxbean",
                 "port");
     }
 
     private static String getYangModuleName(final String name) {
-        int startIndex = 0;
-        int endIndex = name.indexOf(".yang");
+        final int startIndex = 0;
+        final int endIndex = name.indexOf(".yang");
         return name.substring(startIndex, endIndex);
     }
 
     private Module loadYangs(final File testedModule, final String moduleName)
             throws Exception {
-        List<InputStream> yangISs = new ArrayList<>();
+        final List<InputStream> yangISs = new ArrayList<>();
         yangISs.addAll(getStreams("/ietf-inet-types.yang"));
 
         yangISs.add(new FileInputStream(testedModule));
 
         yangISs.addAll(getConfigApiYangInputStreams());
 
-        context =  YangParserTestUtils.parseYangStreams(yangISs);
+        this.context =  YangParserTestUtils.parseYangStreams(yangISs);
         // close ISs
-        for (InputStream is : yangISs) {
+        for (final InputStream is : yangISs) {
             is.close();
         }
-        namesToModules = YangModelSearchUtils.mapModulesByNames(context
+        this.namesToModules = YangModelSearchUtils.mapModulesByNames(this.context
                 .getModules());
-        configModule = namesToModules.get(ConfigConstants.CONFIG_MODULE);
-        final Module module = namesToModules.get(moduleName);
+        this.configModule = this.namesToModules.get(ConfigConstants.CONFIG_MODULE);
+        final Module module = this.namesToModules.get(moduleName);
         Preconditions.checkNotNull(module, "Cannot get module %s from %s",
-                moduleName, namesToModules.keySet());
+                moduleName, this.namesToModules.keySet());
         return module;
     }
 
index 06819737abff3dafe5f252efafef74ea58e9333b..33b9559b98eb7174744bbe58459471a3ba78a993 100644 (file)
@@ -42,9 +42,9 @@ import org.opendaylight.controller.config.yangjmxgenerator.attribute.ListAttribu
 import org.opendaylight.controller.config.yangjmxgenerator.attribute.ListDependenciesAttribute;
 import org.opendaylight.controller.config.yangjmxgenerator.attribute.TOAttribute;
 import org.opendaylight.controller.config.yangjmxgenerator.attribute.TypedAttribute;
-import org.opendaylight.yangtools.binding.generator.util.Types;
-import org.opendaylight.yangtools.sal.binding.model.api.Type;
-import org.opendaylight.yangtools.sal.binding.yang.types.TypeProviderImpl;
+import org.opendaylight.mdsal.binding.generator.util.Types;
+import org.opendaylight.mdsal.binding.model.api.Type;
+import org.opendaylight.mdsal.binding.yang.types.TypeProviderImpl;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.IdentitySchemaNode;
@@ -61,13 +61,13 @@ public class ModuleMXBeanEntryTest extends AbstractYangTest {
         try {
             THREADS_NAMESPACE = new URI(ConfigConstants.CONFIG_NAMESPACE
                     + ":threads");
-        } catch (URISyntaxException e) {
+        } catch (final URISyntaxException e) {
             throw new Error(e);
         }
-        SimpleDateFormat revisionFormat = new SimpleDateFormat("yyyy-MM-dd");
+        final SimpleDateFormat revisionFormat = new SimpleDateFormat("yyyy-MM-dd");
         try {
             THREADS_REVISION_DATE = revisionFormat.parse("2013-04-09");
-        } catch (ParseException e) {
+        } catch (final ParseException e) {
             throw new Error(e);
         }
     }
@@ -77,31 +77,31 @@ public class ModuleMXBeanEntryTest extends AbstractYangTest {
 
     @Before
     public void setUp() {
-        modulesToSIEs = loadThreadsServiceInterfaceEntries("packages.sis");
+        this.modulesToSIEs = loadThreadsServiceInterfaceEntries("packages.sis");
     }
 
 
     protected Map<String /* identity local name */, ModuleMXBeanEntry> loadThreadsJava() {
-        return loadThreadsJava(modulesToSIEs, PACKAGE_NAME);
+        return loadThreadsJava(this.modulesToSIEs, PACKAGE_NAME);
     }
 
     @Test
     public void test_jmxImplModule() {
-        Map<IdentitySchemaNode, ServiceInterfaceEntry> identitiesToSIs = new HashMap<>();
-        Map<QName, ServiceInterfaceEntry> modulesToSIEs = ServiceInterfaceEntry
-                .create(threadsModule, PACKAGE_NAME,identitiesToSIs);
-        modulesToSIEs.putAll(ServiceInterfaceEntry.create(jmxModule,
+        final Map<IdentitySchemaNode, ServiceInterfaceEntry> identitiesToSIs = new HashMap<>();
+        final Map<QName, ServiceInterfaceEntry> modulesToSIEs = ServiceInterfaceEntry
+                .create(this.threadsModule, PACKAGE_NAME,identitiesToSIs);
+        modulesToSIEs.putAll(ServiceInterfaceEntry.create(this.jmxModule,
                 PACKAGE_NAME,identitiesToSIs));
-        Map<String /* identity local name */, ModuleMXBeanEntry> namesToMBEs = ModuleMXBeanEntry
-                .create(jmxImplModule, modulesToSIEs, context, new TypeProviderWrapper(new TypeProviderImpl(context))
+        final Map<String /* identity local name */, ModuleMXBeanEntry> namesToMBEs = ModuleMXBeanEntry
+                .create(this.jmxImplModule, modulesToSIEs, this.context, new TypeProviderWrapper(new TypeProviderImpl(this.context))
                 , PACKAGE_NAME);
-        Map<String, AttributeIfc> attributes = namesToMBEs.get("impl-netconf")
+        final Map<String, AttributeIfc> attributes = namesToMBEs.get("impl-netconf")
                 .getAttributes();
 
         assertCorrectAttributesSize(namesToMBEs, attributes);
 
         //
-        DependencyAttribute threadFactoryAttribute = (DependencyAttribute) attributes
+        final DependencyAttribute threadFactoryAttribute = (DependencyAttribute) attributes
                 .get("thread-factory");
         assertNotNull(threadFactoryAttribute);
         assertFalse(threadFactoryAttribute.getDependency().isMandatory());
@@ -131,7 +131,7 @@ public class ModuleMXBeanEntryTest extends AbstractYangTest {
 
     protected RuntimeBeanEntry findFirstByYangName(
             final Collection<RuntimeBeanEntry> runtimeBeans, final String yangName) {
-        for (RuntimeBeanEntry rb : runtimeBeans) {
+        for (final RuntimeBeanEntry rb : runtimeBeans) {
             if (yangName.equals(rb.getYangName())) {
                 return rb;
             }
@@ -141,7 +141,7 @@ public class ModuleMXBeanEntryTest extends AbstractYangTest {
     }
 
     protected RuntimeBeanEntry findFirstByNamePrefix(final Collection<RuntimeBeanEntry> runtimeBeans, final String namePrefix) {
-        for (RuntimeBeanEntry rb : runtimeBeans) {
+        for (final RuntimeBeanEntry rb : runtimeBeans) {
             if (namePrefix.equals(rb.getJavaNamePrefix())) {
                 return rb;
             }
@@ -162,9 +162,9 @@ public class ModuleMXBeanEntryTest extends AbstractYangTest {
     }
 
     private void assertMatches(final String prefix, final String input) {
-        RevisionAwareXPath whenConstraint = mock(RevisionAwareXPath.class);
+        final RevisionAwareXPath whenConstraint = mock(RevisionAwareXPath.class);
         doReturn(input).when(whenConstraint).toString();
-        Matcher output = ModuleMXBeanEntryBuilder.getWhenConditionMatcher(prefix,
+        final Matcher output = ModuleMXBeanEntryBuilder.getWhenConditionMatcher(prefix,
                 whenConstraint);
         assertTrue(output.matches());
         assertEquals("threadpool-dynamic", output.group(1));
@@ -172,40 +172,40 @@ public class ModuleMXBeanEntryTest extends AbstractYangTest {
 
     @Test
     public void testThreadsJava() {
-        Map<String /* identity local name */, ModuleMXBeanEntry> namesToMBEs = loadThreadsJava();
+        final Map<String /* identity local name */, ModuleMXBeanEntry> namesToMBEs = loadThreadsJava();
 
         { // check threadpool-dynamic
-            ModuleMXBeanEntry dynamicThreadPool = namesToMBEs
+            final ModuleMXBeanEntry dynamicThreadPool = namesToMBEs
                     .get(THREADPOOL_DYNAMIC_MXB_NAME);
-            Map<String, AttributeIfc> attributes = dynamicThreadPool
+            final Map<String, AttributeIfc> attributes = dynamicThreadPool
                     .getAttributes();
             // core-size, keepalive, maximum-size
             // threadfactory
-            Set<String> longAttribs = Sets.newHashSet("core-size",
+            final Set<String> longAttribs = Sets.newHashSet("core-size",
                     "maximum-size");
-            for (String longAttrib : longAttribs) {
+            for (final String longAttrib : longAttribs) {
 
-                TypedAttribute attribute = (TypedAttribute) attributes
+                final TypedAttribute attribute = (TypedAttribute) attributes
                         .get(longAttrib);
                 assertThat("Failed to check " + longAttrib,
                         attribute.getType(),
                         is((Type) Types.typeForClass(Long.class)));
             }
             // check dependency on thread factory
-            QName threadfactoryQName = QName.create(THREADS_NAMESPACE,
+            final QName threadfactoryQName = QName.create(THREADS_NAMESPACE,
                     THREADS_REVISION_DATE, "threadfactory");
-            ServiceInterfaceEntry threadFactorySIEntry = modulesToSIEs
+            final ServiceInterfaceEntry threadFactorySIEntry = this.modulesToSIEs
                     .get(threadfactoryQName);
             assertNotNull(threadFactorySIEntry);
-            boolean expectedMandatory = true;
-            TypedAttribute actualThreadFactory = (TypedAttribute) attributes
+            final boolean expectedMandatory = true;
+            final TypedAttribute actualThreadFactory = (TypedAttribute) attributes
                     .get("threadfactory");
 
-            DataSchemaNode mockedDataSchemaNode = mock(DataSchemaNode.class);
+            final DataSchemaNode mockedDataSchemaNode = mock(DataSchemaNode.class);
             doReturn(Collections.emptyList()).when(mockedDataSchemaNode)
             .getUnknownSchemaNodes();
             doReturn(threadfactoryQName).when(mockedDataSchemaNode).getQName();
-            AttributeIfc expectedDependencyAttribute = new DependencyAttribute(
+            final AttributeIfc expectedDependencyAttribute = new DependencyAttribute(
                     mockedDataSchemaNode, threadFactorySIEntry,
                     expectedMandatory, "threadfactory description");
             assertThat(actualThreadFactory, is(expectedDependencyAttribute));
@@ -221,14 +221,14 @@ public class ModuleMXBeanEntryTest extends AbstractYangTest {
                     is(THREADPOOL_DYNAMIC_MXB_NAME));
 
             // check root runtime bean
-            Collection<RuntimeBeanEntry> runtimeBeans = dynamicThreadPool
+            final Collection<RuntimeBeanEntry> runtimeBeans = dynamicThreadPool
                     .getRuntimeBeans();
             assertThat(runtimeBeans.size(), is(1));
-            RuntimeBeanEntry rootRB = findFirstByYangName(runtimeBeans,
+            final RuntimeBeanEntry rootRB = findFirstByYangName(runtimeBeans,
                     THREADPOOL_DYNAMIC_MXB_NAME);
             assertThat(rootRB.isRoot(), is(true));
             assertThat(rootRB.getAttributes().size(), is(1));
-            JavaAttribute attribute = (JavaAttribute) rootRB.getAttributes()
+            final JavaAttribute attribute = (JavaAttribute) rootRB.getAttributes()
                     .iterator().next();
             assertThat(attribute.getAttributeYangName(), is("created-sessions"));
             assertThat(rootRB.getYangName(), is(THREADPOOL_DYNAMIC_MXB_NAME));
@@ -236,20 +236,20 @@ public class ModuleMXBeanEntryTest extends AbstractYangTest {
                     is(Long.class.getName()));
         }
         {// check threadfactory-naming
-            ModuleMXBeanEntry threadFactoryNaming = namesToMBEs
+            final ModuleMXBeanEntry threadFactoryNaming = namesToMBEs
                     .get(THREADFACTORY_NAMING_MXB_NAME);
-            Collection<RuntimeBeanEntry> runtimeBeans = threadFactoryNaming
+            final Collection<RuntimeBeanEntry> runtimeBeans = threadFactoryNaming
                     .getRuntimeBeans();
             assertThat(runtimeBeans.size(), is(4));
             {
-                RuntimeBeanEntry threadRB = findFirstByYangName(runtimeBeans,
+                final RuntimeBeanEntry threadRB = findFirstByYangName(runtimeBeans,
                         "thread");
                 assertNotNull(threadRB);
                 assertFalse(threadRB.isRoot());
                 assertEquals("name", threadRB.getKeyYangName().get());
                 assertEquals("Name", threadRB.getKeyJavaName().get());
                 assertThat(threadRB.getAttributes().size(), is(1));
-                AttributeIfc threadNameAttr = threadRB.getAttributes()
+                final AttributeIfc threadNameAttr = threadRB.getAttributes()
                         .iterator().next();
                 assertThat(threadNameAttr.getAttributeYangName(), is("name"));
                 assertTrue(threadNameAttr instanceof JavaAttribute);
@@ -258,16 +258,16 @@ public class ModuleMXBeanEntryTest extends AbstractYangTest {
                 assertThat(threadRB.getRpcs().size(), is(2));
             }
             {
-                RuntimeBeanEntry streamRB = findFirstByNamePrefix(runtimeBeans,
+                final RuntimeBeanEntry streamRB = findFirstByNamePrefix(runtimeBeans,
                         "ThreadStream");
                 assertNotNull(streamRB);
                 assertFalse(streamRB.getKeyYangName().isPresent());
                 assertFalse(streamRB.getKeyJavaName().isPresent());
-                Map<String, AttributeIfc> attributeMap = streamRB
+                final Map<String, AttributeIfc> attributeMap = streamRB
                         .getYangPropertiesToTypesMap();
                 assertEquals(4, attributeMap.size());
 
-                TOAttribute toAttr = (TOAttribute) attributeMap.get("peer");
+                final TOAttribute toAttr = (TOAttribute) attributeMap.get("peer");
                 assertNotNull(toAttr);
                 assertThat(toAttr.getAttributeYangName(), is("peer"));
                 assertThat(toAttr.getLowerCaseCammelCase(), is("peer"));
@@ -290,15 +290,15 @@ public class ModuleMXBeanEntryTest extends AbstractYangTest {
                 assertThat(toAttr.getJmxPropertiesToTypesMap().keySet(),
                         is(propsExpected));
 
-                JavaAttribute timestampAttr = (JavaAttribute) attributeMap
+                final JavaAttribute timestampAttr = (JavaAttribute) attributeMap
                         .get("timestamp");
                 assertNotNull(timestampAttr);
 
-                JavaAttribute stateAttr = (JavaAttribute) attributeMap
+                final JavaAttribute stateAttr = (JavaAttribute) attributeMap
                         .get("state");
                 assertNotNull(stateAttr);
 
-                ListAttribute innerStream = (ListAttribute) attributeMap
+                final ListAttribute innerStream = (ListAttribute) attributeMap
                         .get("inner-stream-list");
                 assertNotNull(innerStream);
                 assertThat(innerStream.getAttributeYangName(),
@@ -313,13 +313,13 @@ public class ModuleMXBeanEntryTest extends AbstractYangTest {
 
         }
         { // test multiple dependencies
-            ModuleMXBeanEntry threadPoolRegistry = namesToMBEs.get(THREADPOOL_REGISTRY_IMPL_NAME);
-            Map<String, AttributeIfc> attributes = threadPoolRegistry.getAttributes();
+            final ModuleMXBeanEntry threadPoolRegistry = namesToMBEs.get(THREADPOOL_REGISTRY_IMPL_NAME);
+            final Map<String, AttributeIfc> attributes = threadPoolRegistry.getAttributes();
             assertEquals(1, attributes.size());
-            AttributeIfc threadpoolsAttr = attributes.get("threadpools");
+            final AttributeIfc threadpoolsAttr = attributes.get("threadpools");
             assertNotNull(threadpoolsAttr);
             assertTrue(threadpoolsAttr instanceof ListDependenciesAttribute);
-            ListDependenciesAttribute threadpools = (ListDependenciesAttribute) threadpoolsAttr;
+            final ListDependenciesAttribute threadpools = (ListDependenciesAttribute) threadpoolsAttr;
         }
     }
 
index dcb9089bb8c6d02555f755535b9589578456f1ae..629b1542ba6e7f2843c1f73c5618c71137e662ae 100644 (file)
@@ -13,7 +13,6 @@ import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 import static org.mockito.Mockito.doReturn;
-
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
@@ -24,7 +23,7 @@ import javax.management.openmbean.SimpleType;
 import org.junit.Test;
 import org.mockito.Mockito;
 import org.opendaylight.controller.config.yangjmxgenerator.attribute.JavaAttribute;
-import org.opendaylight.yangtools.sal.binding.yang.types.TypeProviderImpl;
+import org.opendaylight.mdsal.binding.yang.types.TypeProviderImpl;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.ChoiceCaseNode;
 import org.opendaylight.yangtools.yang.model.api.IdentitySchemaNode;
@@ -46,15 +45,15 @@ public class RuntimeBeanEntryTest extends AbstractYangTest {
 
     @Test
     public void createRuntimeBean() {
-        ChoiceCaseNode caseNode = Mockito.mock(ChoiceCaseNode.class);
+        final ChoiceCaseNode caseNode = Mockito.mock(ChoiceCaseNode.class);
         doReturn(new HashSet<LeafSchemaNode>()).when(caseNode).getChildNodes();
         doReturn(new ArrayList<UnknownSchemaNode>()).when(caseNode)
                 .getUnknownSchemaNodes();
-        Map<String, RuntimeBeanEntry> runtimeBeans = RuntimeBeanEntry
+        final Map<String, RuntimeBeanEntry> runtimeBeans = RuntimeBeanEntry
                 .extractClassNameToRuntimeBeanMap(PACKAGE_NAME, caseNode, "test-name", new TypeProviderWrapper(new
-                        TypeProviderImpl(context)), "test", jmxImplModule, context);
+                        TypeProviderImpl(this.context)), "test", this.jmxImplModule, this.context);
         assertEquals(1, runtimeBeans.size());
-        RuntimeBeanEntry runtimeMXBean = runtimeBeans.get("testRuntimeMXBean");
+        final RuntimeBeanEntry runtimeMXBean = runtimeBeans.get("testRuntimeMXBean");
         assertTrue(runtimeMXBean.isRoot());
         assertEquals("test-name", runtimeMXBean.getYangName());
     }
@@ -62,35 +61,35 @@ public class RuntimeBeanEntryTest extends AbstractYangTest {
     @Test
     public void runtimeBeanRPCTest() {
         // create service interfaces
-        Map<QName, ServiceInterfaceEntry> modulesToSIEs = ServiceInterfaceEntry
-                .create(threadsModule, "packages.sis",identitiesToSIs);
+        final Map<QName, ServiceInterfaceEntry> modulesToSIEs = ServiceInterfaceEntry
+                .create(this.threadsModule, "packages.sis",identitiesToSIs);
         assertNotNull(modulesToSIEs);
 
         // create MXBeans map
-        Map<String, ModuleMXBeanEntry> namesToMBEs = ModuleMXBeanEntry.create(
-                threadsJavaModule, modulesToSIEs, context,
-                new TypeProviderWrapper(new TypeProviderImpl(context)),
+        final Map<String, ModuleMXBeanEntry> namesToMBEs = ModuleMXBeanEntry.create(
+                this.threadsJavaModule, modulesToSIEs, this.context,
+                new TypeProviderWrapper(new TypeProviderImpl(this.context)),
                 PACKAGE_NAME);
         assertFalse(namesToMBEs.isEmpty());
 
         // get threadfactory-naming bean
-        ModuleMXBeanEntry threadfactoryNamingMXBean = namesToMBEs
+        final ModuleMXBeanEntry threadfactoryNamingMXBean = namesToMBEs
                 .get(THREADFACTORY_NAMING_MXB_NAME);
         assertNotNull(threadfactoryNamingMXBean);
 
         // get runtime beans
-        Collection<RuntimeBeanEntry> runtimeBeanEntries = threadfactoryNamingMXBean
+        final Collection<RuntimeBeanEntry> runtimeBeanEntries = threadfactoryNamingMXBean
                 .getRuntimeBeans();
         assertFalse(runtimeBeanEntries.isEmpty());
 
         // get root runtime bean
-        RuntimeBeanEntry threadfactoryRuntimeBeanEntry = getRuntimeBeanEntryByJavaName(
+        final RuntimeBeanEntry threadfactoryRuntimeBeanEntry = getRuntimeBeanEntryByJavaName(
                 runtimeBeanEntries, "NamingThreadFactoryRuntimeMXBean");
         assertNotNull(threadfactoryRuntimeBeanEntry);
         assertTrue(threadfactoryRuntimeBeanEntry.isRoot());
 
         // get thread runtime bean
-        RuntimeBeanEntry runtimeBeanEntry = getRuntimeBeanEntryByJavaName(
+        final RuntimeBeanEntry runtimeBeanEntry = getRuntimeBeanEntryByJavaName(
                 runtimeBeanEntries, THREAD_RUNTIME_BEAN_JAVA_NAME);
         assertNotNull(runtimeBeanEntry);
 
@@ -103,21 +102,21 @@ public class RuntimeBeanEntryTest extends AbstractYangTest {
         assertEquals(THREAD_RUNTIME_BEAN_YANG_NAME, runtimeBeanEntry.getYangName());
 
         // get thread runtime bean rpcs
-        List<RuntimeBeanEntry.Rpc> rpcs = new ArrayList<>(
+        final List<RuntimeBeanEntry.Rpc> rpcs = new ArrayList<>(
                 runtimeBeanEntry.getRpcs());
         assertEquals(2, rpcs.size());
 
         // get sleep rpc and test it
-        RuntimeBeanEntry.Rpc rpc = getRpcByName(rpcs, SLEEP_RPC_NAME);
+        final RuntimeBeanEntry.Rpc rpc = getRpcByName(rpcs, SLEEP_RPC_NAME);
         assertNotNull(rpc);
         assertEquals(SLEEP_RPC_NAME, rpc.getYangName());
 
         assertTrue(((JavaAttribute)rpc.getReturnType()).getType().getFullyQualifiedName().endsWith(SLEEP_RPC_OUTPUT));
 
         // get sleep rpc input attribute and test it
-        List<JavaAttribute> attributes = rpc.getParameters();
+        final List<JavaAttribute> attributes = rpc.getParameters();
         assertEquals(1, attributes.size());
-        JavaAttribute attribute = attributes.get(0);
+        final JavaAttribute attribute = attributes.get(0);
         assertEquals(SLEEP_RPC_INPUT_NAME, attribute.getAttributeYangName());
         assertEquals(SLEEP_RPC_INPUT_TYPE, attribute.getType().getName());
         assertEquals(SLEEP_RPC_INPUT_NAME, attribute.getLowerCaseCammelCase());
@@ -130,8 +129,8 @@ public class RuntimeBeanEntryTest extends AbstractYangTest {
     private RuntimeBeanEntry getRuntimeBeanEntryByJavaName(
             final Collection<RuntimeBeanEntry> runtimeBeanEntries,
             final String javaName) {
-        if (runtimeBeanEntries != null && !runtimeBeanEntries.isEmpty()) {
-            for (RuntimeBeanEntry runtimeBeanEntry : runtimeBeanEntries) {
+        if ((runtimeBeanEntries != null) && !runtimeBeanEntries.isEmpty()) {
+            for (final RuntimeBeanEntry runtimeBeanEntry : runtimeBeanEntries) {
                 if (runtimeBeanEntry.getJavaNameOfRuntimeMXBean().equals(
                         javaName)) {
                     return runtimeBeanEntry;
@@ -143,8 +142,8 @@ public class RuntimeBeanEntryTest extends AbstractYangTest {
 
     private RuntimeBeanEntry.Rpc getRpcByName(
             final List<RuntimeBeanEntry.Rpc> rpcs, final String name) {
-        if (rpcs != null && !rpcs.isEmpty()) {
-            for (RuntimeBeanEntry.Rpc rpc : rpcs) {
+        if ((rpcs != null) && !rpcs.isEmpty()) {
+            for (final RuntimeBeanEntry.Rpc rpc : rpcs) {
                 if (rpc.getName().equals(name)) {
                     return rpc;
                 }
index 7765b28bb5c5dc621a768c23fdfc58c16d6f9de8..b3b06151ebe9c243188a411409324bc31003b82b 100644 (file)
@@ -10,7 +10,6 @@ package org.opendaylight.controller.config.yangjmxgenerator;
 import static org.apache.commons.lang3.StringUtils.capitalize;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
-
 import com.google.common.base.Optional;
 import java.net.URI;
 import java.util.Collections;
@@ -18,16 +17,16 @@ import java.util.List;
 import org.junit.Test;
 import org.opendaylight.controller.config.yangjmxgenerator.RuntimeBeanEntry.Rpc;
 import org.opendaylight.controller.config.yangjmxgenerator.attribute.AttributeIfc;
-import org.opendaylight.yangtools.sal.binding.model.api.Type;
+import org.opendaylight.mdsal.binding.model.api.Type;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
 import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
 
 public class RuntimeRegistratorTest {
     // TODO add more tests
-    protected RuntimeBeanEntry prepareRootRB(List<RuntimeBeanEntry> children) {
+    protected RuntimeBeanEntry prepareRootRB(final List<RuntimeBeanEntry> children) {
 
-        DataNodeContainer nodeContainer = mock(DataNodeContainer.class);
+        final DataNodeContainer nodeContainer = mock(DataNodeContainer.class);
         doReturn("DataSchemaNode").when(nodeContainer).toString();
         return new RuntimeBeanEntry("pa.cka.ge", nodeContainer,
                 "module-name", "ModuleName", true, Optional.<String> absent(),
@@ -35,9 +34,9 @@ public class RuntimeRegistratorTest {
                 Collections.<Rpc> emptySet());
     }
 
-    protected RuntimeBeanEntry prepareChildRB(List<RuntimeBeanEntry> children,
-            String prefix) {
-        DataNodeContainer nodeContainer = mock(DataNodeContainer.class);
+    protected RuntimeBeanEntry prepareChildRB(final List<RuntimeBeanEntry> children,
+            final String prefix) {
+        final DataNodeContainer nodeContainer = mock(DataNodeContainer.class);
         doReturn("DataSchemaNode").when(nodeContainer).toString();
         return new RuntimeBeanEntry("pa.cka.ge", nodeContainer,
                 prefix + "child-name", capitalize(prefix) + "ChildName", false,
@@ -48,15 +47,15 @@ public class RuntimeRegistratorTest {
 
     @Test
     public void testHierarchy() {
-        LeafSchemaNode leaf = mock(LeafSchemaNode.class);
+        final LeafSchemaNode leaf = mock(LeafSchemaNode.class);
         doReturn(new QName(URI.create("urn:x"), "leaf-local-name")).when(leaf)
                 .getQName();
         doReturn(Collections.emptyList()).when(leaf).getUnknownSchemaNodes();
         doReturn(null).when(leaf).getDefault();
         doReturn(null).when(leaf).getDescription();
 
-        TypeProviderWrapper typeProviderWrapper = mock(TypeProviderWrapper.class);
-        Type mockedType = mock(Type.class);
+        final TypeProviderWrapper typeProviderWrapper = mock(TypeProviderWrapper.class);
+        final Type mockedType = mock(Type.class);
         doReturn(mockedType).when(typeProviderWrapper).getType(leaf);
         doReturn("java.lang.String").when(mockedType).getFullyQualifiedName();
 
index 3e0a741076f2e3c80e3b8b5e335484a815fb94a5..c48959bdd0dfd713f15df8d65cc8193502db3550 100644 (file)
@@ -10,7 +10,6 @@ package org.opendaylight.controller.config.yang.test.impl;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 import static org.mockito.Mockito.doReturn;
-
 import com.google.common.collect.Lists;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -25,9 +24,9 @@ import org.opendaylight.controller.config.api.jmx.ObjectNameUtil;
 import org.opendaylight.controller.config.manager.impl.AbstractConfigTest;
 import org.opendaylight.controller.config.manager.impl.factoriesresolver.HardcodedModuleFactoriesResolver;
 import org.opendaylight.controller.config.util.ConfigTransactionJMXClient;
+import org.opendaylight.mdsal.binding.generator.util.BindingRuntimeContext;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.test.types.rev131127.TestIdentity1;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.test.types.rev131127.TestIdentity2;
-import org.opendaylight.yangtools.sal.binding.generator.util.BindingRuntimeContext;
 
 public class NetconfTestImplModuleTest  extends AbstractConfigTest {
 
@@ -38,8 +37,8 @@ public class NetconfTestImplModuleTest  extends AbstractConfigTest {
     @Before
     public void setUp() {
 
-        factory = new NetconfTestImplModuleFactory();
-        super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(mockedContext,factory,
+        this.factory = new NetconfTestImplModuleFactory();
+        super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(this.mockedContext,this.factory,
                 new DepTestImplModuleFactory(), new IdentityTestModuleFactory()));
     }
 
@@ -53,10 +52,10 @@ public class NetconfTestImplModuleTest  extends AbstractConfigTest {
 
     @Test
     public void testIdentities() throws Exception {
-        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
+        final ConfigTransactionJMXClient transaction = this.configRegistryClient.createTransaction();
 
-        ObjectName nameCreated = transaction.createModule(IdentityTestModuleFactory.NAME, instanceName);
-        IdentityTestModuleMXBean mxBean = transaction.newMXBeanProxy(nameCreated, IdentityTestModuleMXBean.class);
+        final ObjectName nameCreated = transaction.createModule(IdentityTestModuleFactory.NAME, this.instanceName);
+        final IdentityTestModuleMXBean mxBean = transaction.newMXBeanProxy(nameCreated, IdentityTestModuleMXBean.class);
 
         final IdentitiesContainer c = new IdentitiesContainer();
         c.setAfi(new IdentityAttributeRef(TestIdentity2.QNAME.toString()));
@@ -66,23 +65,23 @@ public class NetconfTestImplModuleTest  extends AbstractConfigTest {
 
     @Test
     public void testDependencyList() throws Exception {
-        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
+        ConfigTransactionJMXClient transaction = this.configRegistryClient.createTransaction();
 
-        ObjectName on = createInstance(transaction, instanceName, 4);
+        final ObjectName on = createInstance(transaction, this.instanceName, 4);
         transaction.validateConfig();
-        CommitStatus status1 = transaction.commit();
+        final CommitStatus status1 = transaction.commit();
 
-        assertBeanCount(1, factory.getImplementationName());
+        assertBeanCount(1, this.factory.getImplementationName());
         assertBeanCount(4 + 1, DepTestImplModuleFactory.NAME);
         assertStatus(status1, 1 + 4 + 1, 0, 0);
 
-        transaction = configRegistryClient.createTransaction();
+        transaction = this.configRegistryClient.createTransaction();
 
-        NetconfTestImplModuleMXBean proxy = transaction.newMXBeanProxy(ObjectNameUtil.withoutTransactionName(on),
+        final NetconfTestImplModuleMXBean proxy = transaction.newMXBeanProxy(ObjectNameUtil.withoutTransactionName(on),
                 NetconfTestImplModuleMXBean.class);
         proxy.getComplexList();
-        List<ObjectName> testingDeps = proxy.getTestingDeps();
-        ObjectName testingDep = proxy.getTestingDep();
+        final List<ObjectName> testingDeps = proxy.getTestingDeps();
+        final ObjectName testingDep = proxy.getTestingDep();
 
         assertEquals(TESTING_DEP_PREFIX, ObjectNameUtil.getInstanceName(testingDep));
         assertTestingDeps(testingDeps, 4);
@@ -90,50 +89,50 @@ public class NetconfTestImplModuleTest  extends AbstractConfigTest {
         transaction.abortConfig();
 
         // check that reuse logic works - equals on list of dependencies.
-        transaction = configRegistryClient.createTransaction();
-        CommitStatus status2 = transaction.commit();
+        transaction = this.configRegistryClient.createTransaction();
+        final CommitStatus status2 = transaction.commit();
         assertStatus(status2, 0, 0, 6);
 
         // replace single dependency
-        transaction = configRegistryClient.createTransaction();
-        String instanceName1 = TESTING_DEP_PREFIX + 1;
+        transaction = this.configRegistryClient.createTransaction();
+        final String instanceName1 = TESTING_DEP_PREFIX + 1;
         transaction.destroyModule(DepTestImplModuleFactory.NAME, instanceName1);
         transaction.createModule(DepTestImplModuleFactory.NAME, instanceName1);
-        CommitStatus status3 = transaction.commit();
+        final CommitStatus status3 = transaction.commit();
         assertStatus(status3, 1, 1, 4);
 
     }
 
     @Test
     public void testNullCheckInListOfDependencies() throws Exception {
-        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
+        final ConfigTransactionJMXClient transaction = this.configRegistryClient.createTransaction();
 
-        ObjectName on = createInstance(transaction, instanceName, 4);
-        NetconfTestImplModuleMXBean proxy = transaction.newMXBeanProxy(on, NetconfTestImplModuleMXBean.class);
+        final ObjectName on = createInstance(transaction, this.instanceName, 4);
+        final NetconfTestImplModuleMXBean proxy = transaction.newMXBeanProxy(on, NetconfTestImplModuleMXBean.class);
         proxy.setTestingDeps(null);
         assertTrue(proxy.getTestingDeps().isEmpty());
         proxy.setTestingDeps(Collections.<ObjectName>emptyList());
     }
 
-    private void assertTestingDeps(List<ObjectName> testingDeps, int i) {
+    private void assertTestingDeps(final List<ObjectName> testingDeps, final int i) {
         assertEquals(i, testingDeps.size());
 
         int c = 1;
-        for (ObjectName testingDep : testingDeps) {
+        for (final ObjectName testingDep : testingDeps) {
             assertEquals(TESTING_DEP_PREFIX + Integer.toString(c++), ObjectNameUtil.getInstanceName(testingDep));
         }
     }
 
 
-    private ObjectName createInstance(ConfigTransactionJMXClient transaction, String instanceName, int depsCount)
+    private ObjectName createInstance(final ConfigTransactionJMXClient transaction, final String instanceName, final int depsCount)
             throws InstanceAlreadyExistsException {
-        ObjectName nameCreated = transaction.createModule(factory.getImplementationName(), instanceName);
-        NetconfTestImplModuleMXBean mxBean = transaction.newMXBeanProxy(nameCreated, NetconfTestImplModuleMXBean.class);
+        final ObjectName nameCreated = transaction.createModule(this.factory.getImplementationName(), instanceName);
+        final NetconfTestImplModuleMXBean mxBean = transaction.newMXBeanProxy(nameCreated, NetconfTestImplModuleMXBean.class);
 
         ObjectName dep = transaction.createModule(DepTestImplModuleFactory.NAME, TESTING_DEP_PREFIX);
         mxBean.setTestingDep(dep);
 
-        ArrayList<ObjectName> testingDeps = Lists.newArrayList();
+        final ArrayList<ObjectName> testingDeps = Lists.newArrayList();
         for (int i = 0; i < depsCount; i++) {
             dep = transaction.createModule(DepTestImplModuleFactory.NAME, TESTING_DEP_PREFIX + Integer.toString(i + 1));
             testingDeps.add(dep);
index 7b8d8c70f760ff54972fd7efbb065974b478747c..5ba5db4640d1abf048c69fb095f3f35705ce9492 100644 (file)
@@ -33,10 +33,10 @@ import org.opendaylight.mdsal.binding.dom.codec.api.BindingCodecTree;
 import org.opendaylight.mdsal.binding.dom.codec.api.BindingCodecTreeFactory;
 import org.opendaylight.mdsal.binding.dom.codec.api.BindingCodecTreeNode;
 import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer;
+import org.opendaylight.mdsal.binding.generator.api.ClassLoadingStrategy;
+import org.opendaylight.mdsal.binding.generator.util.BindingRuntimeContext;
 import org.opendaylight.yangtools.binding.data.codec.impl.BindingNormalizedNodeCodecRegistry;
 import org.opendaylight.yangtools.binding.data.codec.impl.MissingSchemaException;
-import org.opendaylight.yangtools.sal.binding.generator.api.ClassLoadingStrategy;
-import org.opendaylight.yangtools.sal.binding.generator.util.BindingRuntimeContext;
 import org.opendaylight.yangtools.yang.binding.BindingMapping;
 import org.opendaylight.yangtools.yang.binding.DataContainer;
 import org.opendaylight.yangtools.yang.binding.DataObject;
@@ -98,10 +98,10 @@ public final class BindingToNormalizedNodeCodec implements BindingCodecTreeFacto
 
     YangInstanceIdentifier toYangInstanceIdentifierBlocking(final InstanceIdentifier<? extends DataObject> binding) {
         try {
-            return codecRegistry.toYangInstanceIdentifier(binding);
+            return this.codecRegistry.toYangInstanceIdentifier(binding);
         } catch (final MissingSchemaException e) {
             waitForSchema(decompose(binding),e);
-            return codecRegistry.toYangInstanceIdentifier(binding);
+            return this.codecRegistry.toYangInstanceIdentifier(binding);
         }
     }
 
@@ -116,23 +116,23 @@ public final class BindingToNormalizedNodeCodec implements BindingCodecTreeFacto
      *             If supplied Instance Identifier is not valid.
      */
     public YangInstanceIdentifier toNormalized(final InstanceIdentifier<? extends DataObject> binding) {
-        return codecRegistry.toYangInstanceIdentifier(binding);
+        return this.codecRegistry.toYangInstanceIdentifier(binding);
     }
 
     @Override
     public YangInstanceIdentifier toYangInstanceIdentifier(final InstanceIdentifier<?> binding) {
-        return codecRegistry.toYangInstanceIdentifier(binding);
+        return this.codecRegistry.toYangInstanceIdentifier(binding);
     }
 
 
     YangInstanceIdentifier toYangInstanceIdentifierCached(final InstanceIdentifier<?> binding) {
-        return iiCache .getUnchecked(binding);
+        return this.iiCache .getUnchecked(binding);
     }
 
     @Override
     public <T extends DataObject> Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> toNormalizedNode(
             final InstanceIdentifier<T> path, final T data) {
-        return codecRegistry.toNormalizedNode(path, data);
+        return this.codecRegistry.toNormalizedNode(path, data);
     }
 
     /**
@@ -153,32 +153,32 @@ public final class BindingToNormalizedNodeCodec implements BindingCodecTreeFacto
     @Override
     public Entry<InstanceIdentifier<?>, DataObject> fromNormalizedNode(final YangInstanceIdentifier path,
             final NormalizedNode<?, ?> data) {
-        return codecRegistry.fromNormalizedNode(path, data);
+        return this.codecRegistry.fromNormalizedNode(path, data);
     }
 
     @Override
     public Notification fromNormalizedNodeNotification(final SchemaPath path, final ContainerNode data) {
-        return codecRegistry.fromNormalizedNodeNotification(path, data);
+        return this.codecRegistry.fromNormalizedNodeNotification(path, data);
     }
 
     @Override
     public DataObject fromNormalizedNodeRpcData(final SchemaPath path, final ContainerNode data) {
-        return codecRegistry.fromNormalizedNodeRpcData(path, data);
+        return this.codecRegistry.fromNormalizedNodeRpcData(path, data);
     }
 
     @Override
     public InstanceIdentifier<?> fromYangInstanceIdentifier(final YangInstanceIdentifier dom) {
-        return codecRegistry.fromYangInstanceIdentifier(dom);
+        return this.codecRegistry.fromYangInstanceIdentifier(dom);
     }
 
     @Override
     public ContainerNode toNormalizedNodeNotification(final Notification data) {
-        return codecRegistry.toNormalizedNodeNotification(data);
+        return this.codecRegistry.toNormalizedNodeNotification(data);
     }
 
     @Override
     public ContainerNode toNormalizedNodeRpcData(final DataContainer data) {
-        return codecRegistry.toNormalizedNodeRpcData(data);
+        return this.codecRegistry.toNormalizedNodeRpcData(data);
     }
 
     /**
@@ -193,14 +193,14 @@ public final class BindingToNormalizedNodeCodec implements BindingCodecTreeFacto
     public Optional<InstanceIdentifier<? extends DataObject>> toBinding(final YangInstanceIdentifier normalized)
                     throws DeserializationException {
         try {
-            return Optional.<InstanceIdentifier<? extends DataObject>>fromNullable(codecRegistry.fromYangInstanceIdentifier(normalized));
+            return Optional.<InstanceIdentifier<? extends DataObject>>fromNullable(this.codecRegistry.fromYangInstanceIdentifier(normalized));
         } catch (final IllegalArgumentException e) {
             return Optional.absent();
         }
     }
 
     public DataNormalizer getDataNormalizer() {
-        return legacyToNormalized;
+        return this.legacyToNormalized;
     }
 
     public Optional<Entry<InstanceIdentifier<? extends DataObject>, DataObject>> toBinding(
@@ -221,7 +221,7 @@ public final class BindingToNormalizedNodeCodec implements BindingCodecTreeFacto
              *
              */
             @SuppressWarnings("unchecked")
-            final Entry<InstanceIdentifier<? extends DataObject>, DataObject> binding = Entry.class.cast(codecRegistry.fromNormalizedNode(normalized.getKey(), normalized.getValue()));
+            final Entry<InstanceIdentifier<? extends DataObject>, DataObject> binding = Entry.class.cast(this.codecRegistry.fromNormalizedNode(normalized.getKey(), normalized.getValue()));
             return Optional.fromNullable(binding);
         } catch (final IllegalArgumentException e) {
             return Optional.absent();
@@ -230,14 +230,14 @@ public final class BindingToNormalizedNodeCodec implements BindingCodecTreeFacto
 
     @Override
     public void onGlobalContextUpdated(final SchemaContext schemaContext) {
-        legacyToNormalized = new DataNormalizer(schemaContext);
-        BindingRuntimeContext runtimeContext = BindingRuntimeContext.create(classLoadingStrategy, schemaContext);
-        codecRegistry.onBindingRuntimeContextUpdated(runtimeContext);
-        futureSchema.onRuntimeContextUpdated(runtimeContext);
+        this.legacyToNormalized = new DataNormalizer(schemaContext);
+        final BindingRuntimeContext runtimeContext = BindingRuntimeContext.create(this.classLoadingStrategy, schemaContext);
+        this.codecRegistry.onBindingRuntimeContextUpdated(runtimeContext);
+        this.futureSchema.onRuntimeContextUpdated(runtimeContext);
     }
 
     public <T extends DataObject> Function<Optional<NormalizedNode<?, ?>>, Optional<T>>  deserializeFunction(final InstanceIdentifier<T> path) {
-        return codecRegistry.deserializeFunction(path);
+        return this.codecRegistry.deserializeFunction(path);
     }
 
     /**
@@ -248,7 +248,7 @@ public final class BindingToNormalizedNodeCodec implements BindingCodecTreeFacto
      */
     public NormalizedNode<?, ?> getDefaultNodeFor(final YangInstanceIdentifier path) {
         final Iterator<PathArgument> iterator = path.getPathArguments().iterator();
-        DataNormalizationOperation<?> currentOp = legacyToNormalized.getRootOperation();
+        DataNormalizationOperation<?> currentOp = this.legacyToNormalized.getRootOperation();
         while (iterator.hasNext()) {
             final PathArgument currentArg = iterator.next();
             try {
@@ -261,7 +261,7 @@ public final class BindingToNormalizedNodeCodec implements BindingCodecTreeFacto
     }
 
     public BindingNormalizedNodeCodecRegistry getCodecRegistry() {
-        return codecRegistry;
+        return this.codecRegistry;
     }
 
     @Override
@@ -270,7 +270,7 @@ public final class BindingToNormalizedNodeCodec implements BindingCodecTreeFacto
     }
 
     public BindingNormalizedNodeCodecRegistry getCodecFactory() {
-        return codecRegistry;
+        return this.codecRegistry;
     }
 
     // FIXME: This should be probably part of Binding Runtime context
@@ -307,7 +307,7 @@ public final class BindingToNormalizedNodeCodec implements BindingCodecTreeFacto
         final URI namespace = moduleName.getNamespace();
         final Date revision = moduleName.getRevision();
         Module module = runtimeContext().getSchemaContext().findModuleByNamespaceAndRevision(namespace, revision);
-        if(module == null && futureSchema.waitForSchema(namespace,revision)) {
+        if((module == null) && this.futureSchema.waitForSchema(namespace,revision)) {
             module = runtimeContext().getSchemaContext().findModuleByNamespaceAndRevision(namespace, revision);
         }
         Preconditions.checkState(module != null, "Schema for %s is not available.", modeledClass);
@@ -315,9 +315,9 @@ public final class BindingToNormalizedNodeCodec implements BindingCodecTreeFacto
     }
 
     private void waitForSchema(final Collection<Class<?>> binding, final MissingSchemaException e) {
-        LOG.warn("Blocking thread to wait for schema convergence updates for {} {}", futureSchema.getDuration(),
-                futureSchema.getUnit());
-        if(futureSchema.waitForSchema(binding)) {
+        LOG.warn("Blocking thread to wait for schema convergence updates for {} {}", this.futureSchema.getDuration(),
+                this.futureSchema.getUnit());
+        if(this.futureSchema.waitForSchema(binding)) {
             return;
         }
 
@@ -339,25 +339,25 @@ public final class BindingToNormalizedNodeCodec implements BindingCodecTreeFacto
     }
 
     private BindingRuntimeContext runtimeContext() {
-        return futureSchema.runtimeContext();
+        return this.futureSchema.runtimeContext();
     }
 
     @Override
     public BindingCodecTree create(final BindingRuntimeContext context) {
-        return codecRegistry.create(context);
+        return this.codecRegistry.create(context);
     }
 
     @Override
     public BindingCodecTree create(final SchemaContext context, final Class<?>... bindingClasses) {
-        return codecRegistry.create(context, bindingClasses);
+        return this.codecRegistry.create(context, bindingClasses);
     }
 
     @Nonnull
     protected Map.Entry<InstanceIdentifier<?>, BindingCodecTreeNode<?>> getSubtreeCodec(
             final YangInstanceIdentifier domIdentifier) {
 
-        final BindingCodecTree currentCodecTree = codecRegistry.getCodecContext();
-        final InstanceIdentifier<?> bindingPath = codecRegistry.fromYangInstanceIdentifier(domIdentifier);
+        final BindingCodecTree currentCodecTree = this.codecRegistry.getCodecContext();
+        final InstanceIdentifier<?> bindingPath = this.codecRegistry.fromYangInstanceIdentifier(domIdentifier);
         Preconditions.checkArgument(bindingPath != null);
         /**
          * If we are able to deserialize YANG instance identifier, getSubtreeCodec must
index f1ae5cb1c58eb86f8aa384cbfa4232cf580b70f4..8f284f260dddc47a2df6dfeecc31029533a159ec 100644 (file)
@@ -11,10 +11,10 @@ import java.util.Dictionary;
 import java.util.Hashtable;
 import org.opendaylight.controller.sal.binding.codegen.impl.SingletonHolder;
 import org.opendaylight.controller.sal.core.api.model.SchemaService;
+import org.opendaylight.mdsal.binding.generator.api.ClassLoadingStrategy;
 import org.opendaylight.yangtools.binding.data.codec.gen.impl.StreamWriterGenerator;
 import org.opendaylight.yangtools.binding.data.codec.impl.BindingNormalizedNodeCodecRegistry;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.sal.binding.generator.api.ClassLoadingStrategy;
 import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceRegistration;
@@ -33,11 +33,11 @@ public class BindingToNormalizedNodeCodecFactory {
      * @return BindingToNormalizedNodeCodec instance
      */
     @Deprecated
-    public static BindingToNormalizedNodeCodec getOrCreateInstance(ClassLoadingStrategy classLoadingStrategy,
-                            SchemaService schemaService) {
-        BindingNormalizedNodeCodecRegistry codecRegistry = new BindingNormalizedNodeCodecRegistry(
+    public static BindingToNormalizedNodeCodec getOrCreateInstance(final ClassLoadingStrategy classLoadingStrategy,
+                            final SchemaService schemaService) {
+        final BindingNormalizedNodeCodecRegistry codecRegistry = new BindingNormalizedNodeCodecRegistry(
                 StreamWriterGenerator.create(SingletonHolder.JAVASSIST));
-        BindingToNormalizedNodeCodec instance = new BindingToNormalizedNodeCodec(
+        final BindingToNormalizedNodeCodec instance = new BindingToNormalizedNodeCodec(
                                classLoadingStrategy, codecRegistry, true);
         schemaService.registerSchemaContextListener(instance);
         return instance;
@@ -49,8 +49,8 @@ public class BindingToNormalizedNodeCodecFactory {
      * @param classLoadingStrategy
      * @return the BindingToNormalizedNodeCodec instance
      */
-    public static BindingToNormalizedNodeCodec newInstance(ClassLoadingStrategy classLoadingStrategy) {
-        BindingNormalizedNodeCodecRegistry codecRegistry = new BindingNormalizedNodeCodecRegistry(
+    public static BindingToNormalizedNodeCodec newInstance(final ClassLoadingStrategy classLoadingStrategy) {
+        final BindingNormalizedNodeCodecRegistry codecRegistry = new BindingNormalizedNodeCodecRegistry(
                 StreamWriterGenerator.create(SingletonHolder.JAVASSIST));
         return new BindingToNormalizedNodeCodec(classLoadingStrategy, codecRegistry, true);
     }
@@ -62,8 +62,8 @@ public class BindingToNormalizedNodeCodecFactory {
      * @param schemaService the SchemaService.
      * @return the ListenerRegistration
      */
-    public static ListenerRegistration<SchemaContextListener> registerInstance(BindingToNormalizedNodeCodec instance,
-            SchemaService schemaService) {
+    public static ListenerRegistration<SchemaContextListener> registerInstance(final BindingToNormalizedNodeCodec instance,
+            final SchemaService schemaService) {
         return schemaService.registerSchemaContextListener(instance);
     }
 
@@ -78,9 +78,9 @@ public class BindingToNormalizedNodeCodecFactory {
      * @param bundleContext the BundleContext
      * @return ServiceRegistration instance
      */
-    public static ServiceRegistration<BindingToNormalizedNodeCodec> registerOSGiService(BindingToNormalizedNodeCodec instance,
-            BundleContext bundleContext) {
-        Dictionary<String, String> props = new Hashtable<>();
+    public static ServiceRegistration<BindingToNormalizedNodeCodec> registerOSGiService(final BindingToNormalizedNodeCodec instance,
+            final BundleContext bundleContext) {
+        final Dictionary<String, String> props = new Hashtable<>();
 
         // Set the appropriate service properties so the corresponding CSS module is restarted if this
         // blueprint container is restarted
index fb70811840e4cbaa935e1523db64e54ea71036ff..e2fa7d1daf8319d9b3df9c18c174b7dac752d035 100644 (file)
@@ -21,7 +21,7 @@ import java.util.concurrent.ExecutionException;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
 import javax.annotation.concurrent.GuardedBy;
-import org.opendaylight.yangtools.sal.binding.generator.util.BindingRuntimeContext;
+import org.opendaylight.mdsal.binding.generator.util.BindingRuntimeContext;
 import org.opendaylight.yangtools.yang.binding.Augmentation;
 
 class FutureSchema implements AutoCloseable {
@@ -40,39 +40,39 @@ class FutureSchema implements AutoCloseable {
     }
 
     BindingRuntimeContext runtimeContext() {
-        BindingRuntimeContext localRuntimeContext = runtimeContext;
+        final BindingRuntimeContext localRuntimeContext = this.runtimeContext;
         if(localRuntimeContext != null) {
             return localRuntimeContext;
         }
 
         if(waitForSchema(Collections.emptyList())) {
-            return runtimeContext;
+            return this.runtimeContext;
         }
 
         throw new IllegalStateException("No SchemaContext is available");
     }
 
     void onRuntimeContextUpdated(final BindingRuntimeContext context) {
-        synchronized(postponedOperations) {
-            runtimeContext = context;
-            for (final FutureSchemaPredicate op : postponedOperations) {
+        synchronized(this.postponedOperations) {
+            this.runtimeContext = context;
+            for (final FutureSchemaPredicate op : this.postponedOperations) {
                 op.unlockIfPossible(context);
             }
         }
     }
 
     long getDuration() {
-        return duration;
+        return this.duration;
     }
 
     TimeUnit getUnit() {
-        return unit;
+        return this.unit;
     }
 
     @Override
     public void close() {
-        synchronized(postponedOperations) {
-            for (final FutureSchemaPredicate op : postponedOperations) {
+        synchronized(this.postponedOperations) {
+            for (final FutureSchemaPredicate op : this.postponedOperations) {
                 op.cancel();
             }
         }
@@ -111,18 +111,18 @@ class FutureSchema implements AutoCloseable {
         });
     }
 
-    private boolean addPostponedOpAndWait(FutureSchemaPredicate postponedOp) {
-        if(!waitEnabled) {
+    private boolean addPostponedOpAndWait(final FutureSchemaPredicate postponedOp) {
+        if(!this.waitEnabled) {
             return false;
         }
 
-        BindingRuntimeContext localRuntimeContext = runtimeContext;
-        synchronized(postponedOperations) {
-            postponedOperations.add(postponedOp);
+        final BindingRuntimeContext localRuntimeContext = this.runtimeContext;
+        synchronized(this.postponedOperations) {
+            this.postponedOperations.add(postponedOp);
 
             // If the runtimeContext changed, this op may now be satisfied so check it.
-            if(localRuntimeContext != runtimeContext) {
-                postponedOp.unlockIfPossible(runtimeContext);
+            if(localRuntimeContext != this.runtimeContext) {
+                postponedOp.unlockIfPossible(this.runtimeContext);
             }
         }
 
@@ -133,27 +133,27 @@ class FutureSchema implements AutoCloseable {
 
         final boolean waitForSchema() {
             try {
-                schemaPromise.get(duration, unit);
+                this.schemaPromise.get(FutureSchema.this.duration, FutureSchema.this.unit);
                 return true;
             } catch (final InterruptedException | ExecutionException e) {
                 throw Throwables.propagate(e);
             } catch (final TimeoutException e) {
                 return false;
             } finally {
-                synchronized(postponedOperations) {
-                    postponedOperations.remove(this);
+                synchronized(FutureSchema.this.postponedOperations) {
+                    FutureSchema.this.postponedOperations.remove(this);
                 }
             }
         }
 
         final void unlockIfPossible(final BindingRuntimeContext context) {
-            if (!schemaPromise.isDone() && apply(context)) {
-                schemaPromise.set(null);
+            if (!this.schemaPromise.isDone() && apply(context)) {
+                this.schemaPromise.set(null);
             }
         }
 
         final void cancel() {
-            schemaPromise.cancel(true);
+            this.schemaPromise.cancel(true);
         }
 
         private final SettableFuture<?> schemaPromise = SettableFuture.create();
index 6bcd74d213526b83c94b43087443e50ba9385da6..2ca3530a74f3d3594c00a1d6f345c03d4a29f57b 100644 (file)
@@ -20,11 +20,11 @@ import java.util.concurrent.RejectedExecutionHandler;
 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.yangtools.sal.binding.generator.util.JavassistUtils;
+import org.opendaylight.mdsal.binding.generator.util.JavassistUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import javassist.ClassPool;
 
 public class SingletonHolder {
     private static final Logger logger = LoggerFactory.getLogger(SingletonHolder.class);
index f1438c650e6b3bdffa841873dfcef9ac158c2ab4..4f88faac1551e036e22f1dec718a84b53fae5e34 100644 (file)
@@ -4,7 +4,7 @@
 
   <!-- Runtime binding/normalized mapping service -->
 
-  <reference id="classLoadingStrategy" interface="org.opendaylight.yangtools.sal.binding.generator.api.ClassLoadingStrategy"/>
+  <reference id="classLoadingStrategy" interface="org.opendaylight.mdsal.binding.generator.api.ClassLoadingStrategy"/>
   <reference id="schemaService" interface="org.opendaylight.controller.sal.core.api.model.SchemaService" />
 
   <bean id="mappingCodec" class="org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCodecFactory"
index 894b80e56fd237dc699492714947daf2914604e9..3ca23eaa0e4aad972a600400e47a527dd902912f 100644 (file)
@@ -31,10 +31,10 @@ 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.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.Top;
 import org.opendaylight.yangtools.binding.data.codec.impl.BindingNormalizedNodeCodecRegistry;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.sal.binding.generator.impl.GeneratedClassLoadingStrategy;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 
@@ -65,45 +65,45 @@ public class BindingDOMDataTreeChangeServiceAdapterTest {
     @Before
     public void setUp() {
         MockitoAnnotations.initMocks(this);
-        doReturn(mockYangID).when(codecRegistry).toYangInstanceIdentifier(TOP_PATH);
+        doReturn(this.mockYangID).when(this.codecRegistry).toYangInstanceIdentifier(TOP_PATH);
     }
 
     @Test
     public void testRegisterDataTreeChangeListener() {
-        BindingToNormalizedNodeCodec codec = new BindingToNormalizedNodeCodec(classLoadingStrategy, codecRegistry);
+        final BindingToNormalizedNodeCodec codec = new BindingToNormalizedNodeCodec(this.classLoadingStrategy, this.codecRegistry);
 
-        DataTreeChangeService service = BindingDOMDataTreeChangeServiceAdapter.create(codec, mockDOMService);
+        final DataTreeChangeService service = BindingDOMDataTreeChangeServiceAdapter.create(codec, this.mockDOMService);
 
-        doReturn(mockDOMReg).when(mockDOMService).registerDataTreeChangeListener(domDataTreeIdentifier(mockYangID),
+        doReturn(this.mockDOMReg).when(this.mockDOMService).registerDataTreeChangeListener(domDataTreeIdentifier(this.mockYangID),
                 any(DOMDataTreeChangeListener.class));
-        DataTreeIdentifier<Top> treeId = new DataTreeIdentifier<>(LogicalDatastoreType.CONFIGURATION, TOP_PATH);
-        TestClusteredDataTreeChangeListener mockClusteredListener = new TestClusteredDataTreeChangeListener();
+        final DataTreeIdentifier<Top> treeId = new DataTreeIdentifier<>(LogicalDatastoreType.CONFIGURATION, TOP_PATH);
+        final TestClusteredDataTreeChangeListener mockClusteredListener = new TestClusteredDataTreeChangeListener();
         service.registerDataTreeChangeListener(treeId , mockClusteredListener);
 
-        verify(mockDOMService).registerDataTreeChangeListener(domDataTreeIdentifier(mockYangID),
+        verify(this.mockDOMService).registerDataTreeChangeListener(domDataTreeIdentifier(this.mockYangID),
                 isA(ClusteredDOMDataTreeChangeListener.class));
 
-        reset(mockDOMService);
-        doReturn(mockDOMReg).when(mockDOMService).registerDataTreeChangeListener(domDataTreeIdentifier(mockYangID),
+        reset(this.mockDOMService);
+        doReturn(this.mockDOMReg).when(this.mockDOMService).registerDataTreeChangeListener(domDataTreeIdentifier(this.mockYangID),
                 any(DOMDataTreeChangeListener.class));
-        TestDataTreeChangeListener mockNonClusteredListener = new TestDataTreeChangeListener();
+        final TestDataTreeChangeListener mockNonClusteredListener = new TestDataTreeChangeListener();
         service.registerDataTreeChangeListener(treeId , mockNonClusteredListener);
 
-        verify(mockDOMService).registerDataTreeChangeListener(domDataTreeIdentifier(mockYangID),
+        verify(this.mockDOMService).registerDataTreeChangeListener(domDataTreeIdentifier(this.mockYangID),
                 not(isA(ClusteredDOMDataTreeChangeListener.class)));
     }
 
     static DOMDataTreeIdentifier domDataTreeIdentifier(final YangInstanceIdentifier yangID) {
         return Matchers.argThat(new ArgumentMatcher<DOMDataTreeIdentifier>() {
             @Override
-            public boolean matches(Object argument) {
-                DOMDataTreeIdentifier treeId = (DOMDataTreeIdentifier) argument;
-                return treeId.getDatastoreType() == LogicalDatastoreType.CONFIGURATION &&
+            public boolean matches(final Object argument) {
+                final DOMDataTreeIdentifier treeId = (DOMDataTreeIdentifier) argument;
+                return (treeId.getDatastoreType() == LogicalDatastoreType.CONFIGURATION) &&
                         yangID.equals(treeId.getRootIdentifier());
             }
 
             @Override
-            public void describeTo(Description description) {
+            public void describeTo(final Description description) {
                 description.appendValue(new DOMDataTreeIdentifier(LogicalDatastoreType.CONFIGURATION, yangID));
             }
         });
@@ -111,13 +111,13 @@ public class BindingDOMDataTreeChangeServiceAdapterTest {
 
     private static class TestClusteredDataTreeChangeListener implements ClusteredDataTreeChangeListener<Top> {
         @Override
-        public void onDataTreeChanged(Collection<DataTreeModification<Top>> changes) {
+        public void onDataTreeChanged(final Collection<DataTreeModification<Top>> changes) {
         }
     }
 
     private static class TestDataTreeChangeListener implements DataTreeChangeListener<Top> {
         @Override
-        public void onDataTreeChanged(Collection<DataTreeModification<Top>> changes) {
+        public void onDataTreeChanged(final Collection<DataTreeModification<Top>> changes) {
         }
     }
 }
index aef168ddf0881a7d0ecb84d0c9eac497b0dc9aef..b0b740f07c7d72eac7613bf3a69b182567dfada4 100644 (file)
@@ -25,6 +25,8 @@ import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicReference;
 import org.junit.Test;
 import org.opendaylight.controller.md.sal.binding.test.AbstractSchemaAwareTest;
+import org.opendaylight.mdsal.binding.generator.impl.GeneratedClassLoadingStrategy;
+import org.opendaylight.mdsal.binding.generator.util.JavassistUtils;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.augment.rev140709.TreeComplexUsesAugment;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.augment.rev140709.TreeLeafOnlyAugment;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.bi.ba.rpcservice.rev140701.OpendaylightTestRpcServiceService;
@@ -34,8 +36,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controll
 import org.opendaylight.yangtools.binding.data.codec.gen.impl.DataObjectSerializerGenerator;
 import org.opendaylight.yangtools.binding.data.codec.gen.impl.StreamWriterGenerator;
 import org.opendaylight.yangtools.binding.data.codec.impl.BindingNormalizedNodeCodecRegistry;
-import org.opendaylight.yangtools.sal.binding.generator.impl.GeneratedClassLoadingStrategy;
-import org.opendaylight.yangtools.sal.binding.generator.util.JavassistUtils;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
@@ -70,28 +70,28 @@ public class BindingNormalizedCodecTest extends AbstractSchemaAwareTest {
         this.context = context;
         final DataObjectSerializerGenerator streamWriter = StreamWriterGenerator.create(JavassistUtils.forClassPool(ClassPool.getDefault()));
         final BindingNormalizedNodeCodecRegistry registry = new BindingNormalizedNodeCodecRegistry(streamWriter);
-        codec = new BindingToNormalizedNodeCodec(GeneratedClassLoadingStrategy.getTCCLClassLoadingStrategy(), registry, true);
+        this.codec = new BindingToNormalizedNodeCodec(GeneratedClassLoadingStrategy.getTCCLClassLoadingStrategy(), registry, true);
     }
 
     @Test
     public void testComplexAugmentationSerialization() {
-        codec.onGlobalContextUpdated(context);
-        final PathArgument lastArg = codec.toYangInstanceIdentifier(BA_TREE_COMPLEX_USES).getLastPathArgument();
+        this.codec.onGlobalContextUpdated(this.context);
+        final PathArgument lastArg = this.codec.toYangInstanceIdentifier(BA_TREE_COMPLEX_USES).getLastPathArgument();
         assertTrue(lastArg instanceof AugmentationIdentifier);
     }
 
 
     @Test
     public void testLeafOnlyAugmentationSerialization() {
-        codec.onGlobalContextUpdated(context);
-        final PathArgument leafOnlyLastArg = codec.toYangInstanceIdentifier(BA_TREE_LEAF_ONLY).getLastPathArgument();
+        this.codec.onGlobalContextUpdated(this.context);
+        final PathArgument leafOnlyLastArg = this.codec.toYangInstanceIdentifier(BA_TREE_LEAF_ONLY).getLastPathArgument();
         assertTrue(leafOnlyLastArg instanceof AugmentationIdentifier);
         assertTrue(((AugmentationIdentifier) leafOnlyLastArg).getPossibleChildNames().contains(SIMPLE_VALUE_QNAME));
     }
 
     @Test
     public void testToYangInstanceIdentifierBlocking() {
-        codec.onGlobalContextUpdated(new EmptySchemaContext());
+        this.codec.onGlobalContextUpdated(new EmptySchemaContext());
 
         final CountDownLatch done = new CountDownLatch(1);
         final AtomicReference<YangInstanceIdentifier> yangId = new AtomicReference<>();
@@ -100,8 +100,8 @@ public class BindingNormalizedCodecTest extends AbstractSchemaAwareTest {
             @Override
             public void run() {
                 try {
-                    yangId.set(codec.toYangInstanceIdentifierBlocking(BA_TOP_LEVEL_LIST));
-                } catch(RuntimeException e) {
+                    yangId.set(BindingNormalizedCodecTest.this.codec.toYangInstanceIdentifierBlocking(BA_TOP_LEVEL_LIST));
+                } catch(final RuntimeException e) {
                     error.set(e);
                 } finally {
                     done.countDown();
@@ -110,7 +110,7 @@ public class BindingNormalizedCodecTest extends AbstractSchemaAwareTest {
         }.start();
 
         Uninterruptibles.sleepUninterruptibly(500, TimeUnit.MILLISECONDS);
-        codec.onGlobalContextUpdated(context);
+        this.codec.onGlobalContextUpdated(this.context);
 
         assertEquals("toYangInstanceIdentifierBlocking completed", true,
                 Uninterruptibles.awaitUninterruptibly(done, 3, TimeUnit.SECONDS));
@@ -128,7 +128,7 @@ public class BindingNormalizedCodecTest extends AbstractSchemaAwareTest {
 
     @Test
     public void testGetRpcMethodToSchemaPathBlocking() {
-        codec.onGlobalContextUpdated(new EmptySchemaContext());
+        this.codec.onGlobalContextUpdated(new EmptySchemaContext());
         testGetRpcMethodToSchemaPath();
     }
 
@@ -140,8 +140,8 @@ public class BindingNormalizedCodecTest extends AbstractSchemaAwareTest {
             @Override
             public void run() {
                 try {
-                    retMap.set(codec.getRpcMethodToSchemaPath(OpendaylightTestRpcServiceService.class));
-                } catch(RuntimeException e) {
+                    retMap.set(BindingNormalizedCodecTest.this.codec.getRpcMethodToSchemaPath(OpendaylightTestRpcServiceService.class));
+                } catch(final RuntimeException e) {
                     error.set(e);
                 } finally {
                     done.countDown();
@@ -150,7 +150,7 @@ public class BindingNormalizedCodecTest extends AbstractSchemaAwareTest {
         }.start();
 
         Uninterruptibles.sleepUninterruptibly(500, TimeUnit.MILLISECONDS);
-        codec.onGlobalContextUpdated(context);
+        this.codec.onGlobalContextUpdated(this.context);
 
         assertEquals("getRpcMethodToSchemaPath completed", true,
                 Uninterruptibles.awaitUninterruptibly(done, 3, TimeUnit.SECONDS));
@@ -158,7 +158,7 @@ public class BindingNormalizedCodecTest extends AbstractSchemaAwareTest {
             throw error.get();
         }
 
-        for(Method method: retMap.get().keySet()) {
+        for(final Method method: retMap.get().keySet()) {
             if(method.getName().equals("rockTheHouse")) {
                 return;
             }
index f8a95b73cc7ab6f1f658f69f1bd460b929e5321d..10b040f3e6102d963fd40da1591f2107c7d3d86a 100644 (file)
@@ -20,11 +20,11 @@ import org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCo
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
 import org.opendaylight.controller.md.sal.dom.api.ClusteredDOMDataChangeListener;
+import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
+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.binding.data.codec.impl.BindingNormalizedNodeCodecRegistry;
-import org.opendaylight.yangtools.sal.binding.generator.impl.GeneratedClassLoadingStrategy;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
@@ -55,26 +55,26 @@ public class BindingDOMDataBrokerAdapterTest {
     @Test
     public void testClusteredDataChangeListernerRegisteration() {
 
-        BindingToNormalizedNodeCodec codec = new BindingToNormalizedNodeCodec(classLoadingStrategy, codecRegistry);
+        final BindingToNormalizedNodeCodec codec = new BindingToNormalizedNodeCodec(this.classLoadingStrategy, this.codecRegistry);
 
-        try (BindingDOMDataBrokerAdapter bindingDOMDataBrokerAdapter = new BindingDOMDataBrokerAdapter(dataBroker,
+        try (BindingDOMDataBrokerAdapter bindingDOMDataBrokerAdapter = new BindingDOMDataBrokerAdapter(this.dataBroker,
                 codec)) {
-            Mockito.when(codecRegistry.toYangInstanceIdentifier(TOP_PATH)).thenReturn(yangInstanceIdentifier);
+            Mockito.when(this.codecRegistry.toYangInstanceIdentifier(TOP_PATH)).thenReturn(this.yangInstanceIdentifier);
 
-            ArgumentCaptor<ClusteredDOMDataChangeListener> clusteredDOMListener = ArgumentCaptor
+            final ArgumentCaptor<ClusteredDOMDataChangeListener> clusteredDOMListener = ArgumentCaptor
                     .forClass(ClusteredDOMDataChangeListener.class);
-            ArgumentCaptor<LogicalDatastoreType> logicalDatastoreType = ArgumentCaptor
+            final ArgumentCaptor<LogicalDatastoreType> logicalDatastoreType = ArgumentCaptor
                     .forClass(LogicalDatastoreType.class);
-            ArgumentCaptor<AsyncDataBroker.DataChangeScope> dataChangeScope = ArgumentCaptor
+            final ArgumentCaptor<AsyncDataBroker.DataChangeScope> dataChangeScope = ArgumentCaptor
                     .forClass(AsyncDataBroker.DataChangeScope.class);
-            ArgumentCaptor<YangInstanceIdentifier> yangInstanceIdentifier = ArgumentCaptor
+            final ArgumentCaptor<YangInstanceIdentifier> yangInstanceIdentifier = ArgumentCaptor
                     .forClass(YangInstanceIdentifier.class);
 
-            TestListener listener = new TestListener();
+            final TestListener listener = new TestListener();
 
             bindingDOMDataBrokerAdapter.registerDataChangeListener(LogicalDatastoreType.OPERATIONAL, TOP_PATH,
                     listener, AsyncDataBroker.DataChangeScope.BASE);
-            Mockito.verify(dataBroker).registerDataChangeListener(logicalDatastoreType.capture(),
+            Mockito.verify(this.dataBroker).registerDataChangeListener(logicalDatastoreType.capture(),
                     yangInstanceIdentifier.capture(), clusteredDOMListener.capture(), dataChangeScope.capture());
         }
 
@@ -83,7 +83,7 @@ public class BindingDOMDataBrokerAdapterTest {
     private class TestListener implements ClusteredDataChangeListener {
 
         @Override
-        public void onDataChanged(AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> change) {
+        public void onDataChanged(final AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> change) {
 
         }
     }
index 9355231e63d5c206a8cb05e973d59de226e391a6..02f3257b659b5d15d7260f92a14907a572946146 100644 (file)
@@ -10,7 +10,6 @@ package org.opendaylight.controller.md.sal.binding.test;
 import com.google.common.collect.ImmutableMap;
 import com.google.common.util.concurrent.ListeningExecutorService;
 import com.google.common.util.concurrent.MoreExecutors;
-import javassist.ClassPool;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
 import org.opendaylight.controller.md.sal.binding.api.NotificationService;
@@ -26,12 +25,13 @@ import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStore;
 import org.opendaylight.controller.sal.binding.test.util.MockSchemaService;
 import org.opendaylight.controller.sal.core.api.model.SchemaService;
 import org.opendaylight.controller.sal.core.spi.data.DOMStore;
+import org.opendaylight.mdsal.binding.generator.impl.GeneratedClassLoadingStrategy;
+import org.opendaylight.mdsal.binding.generator.util.JavassistUtils;
 import org.opendaylight.yangtools.binding.data.codec.gen.impl.DataObjectSerializerGenerator;
 import org.opendaylight.yangtools.binding.data.codec.gen.impl.StreamWriterGenerator;
 import org.opendaylight.yangtools.binding.data.codec.impl.BindingNormalizedNodeCodecRegistry;
-import org.opendaylight.yangtools.sal.binding.generator.impl.GeneratedClassLoadingStrategy;
-import org.opendaylight.yangtools.sal.binding.generator.util.JavassistUtils;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import javassist.ClassPool;
 
 public abstract class AbstractDataBrokerTestCustomizer {
 
@@ -49,25 +49,25 @@ public abstract class AbstractDataBrokerTestCustomizer {
     }
 
     public AbstractDataBrokerTestCustomizer() {
-        schemaService = new MockSchemaService();
+        this.schemaService = new MockSchemaService();
         final ClassPool pool = ClassPool.getDefault();
         final DataObjectSerializerGenerator generator = StreamWriterGenerator.create(JavassistUtils.forClassPool(pool));
         final BindingNormalizedNodeCodecRegistry codecRegistry = new BindingNormalizedNodeCodecRegistry(generator);
         final GeneratedClassLoadingStrategy loading = GeneratedClassLoadingStrategy.getTCCLClassLoadingStrategy();
-        bindingToNormalized = new BindingToNormalizedNodeCodec(loading, codecRegistry);
-        schemaService.registerSchemaContextListener(bindingToNormalized);
-        domNotificationRouter = DOMNotificationRouter.create(16);
+        this.bindingToNormalized = new BindingToNormalizedNodeCodec(loading, codecRegistry);
+        this.schemaService.registerSchemaContextListener(this.bindingToNormalized);
+        this.domNotificationRouter = DOMNotificationRouter.create(16);
     }
 
     public DOMStore createConfigurationDatastore() {
         final InMemoryDOMDataStore store = new InMemoryDOMDataStore("CFG", MoreExecutors.newDirectExecutorService());
-        schemaService.registerSchemaContextListener(store);
+        this.schemaService.registerSchemaContextListener(store);
         return store;
     }
 
     public DOMStore createOperationalDatastore() {
         final InMemoryDOMDataStore store = new InMemoryDOMDataStore("OPER", MoreExecutors.newDirectExecutorService());
-        schemaService.registerSchemaContextListener(store);
+        this.schemaService.registerSchemaContextListener(store);
         return store;
     }
 
@@ -76,46 +76,46 @@ public abstract class AbstractDataBrokerTestCustomizer {
     }
 
     public NotificationService createNotificationService() {
-        return new BindingDOMNotificationServiceAdapter(bindingToNormalized.getCodecRegistry(), domNotificationRouter);
+        return new BindingDOMNotificationServiceAdapter(this.bindingToNormalized.getCodecRegistry(), this.domNotificationRouter);
     }
 
     public NotificationPublishService createNotificationPublishService() {
-        return new BindingDOMNotificationPublishServiceAdapter(bindingToNormalized, domNotificationRouter);
+        return new BindingDOMNotificationPublishServiceAdapter(this.bindingToNormalized, this.domNotificationRouter);
     }
 
     public abstract ListeningExecutorService getCommitCoordinatorExecutor();
 
     public DataBroker createDataBroker() {
-        return new BindingDOMDataBrokerAdapter(getDOMDataBroker(), bindingToNormalized);
+        return new BindingDOMDataBrokerAdapter(getDOMDataBroker(), this.bindingToNormalized);
     }
 
     public BindingToNormalizedNodeCodec getBindingToNormalized() {
-        return bindingToNormalized;
+        return this.bindingToNormalized;
     }
 
     public SchemaService getSchemaService() {
-        return schemaService;
+        return this.schemaService;
     }
 
     private DOMDataBroker getDOMDataBroker() {
-        if (domDataBroker == null) {
-            domDataBroker = createDOMDataBroker();
+        if (this.domDataBroker == null) {
+            this.domDataBroker = createDOMDataBroker();
         }
-        return domDataBroker;
+        return this.domDataBroker;
     }
 
     private synchronized ImmutableMap<LogicalDatastoreType, DOMStore> getDatastores() {
-        if (datastores == null) {
-            datastores = createDatastores();
+        if (this.datastores == null) {
+            this.datastores = createDatastores();
         }
-        return datastores;
+        return this.datastores;
     }
 
     public void updateSchema(final SchemaContext ctx) {
-        schemaService.changeSchema(ctx);
+        this.schemaService.changeSchema(ctx);
     }
 
     public DOMNotificationRouter getDomNotificationRouter() {
-        return domNotificationRouter;
+        return this.domNotificationRouter;
     }
 }
index 21f806508fb12e286d17826d368b649e738147b6..6b415a0a1243b393bc0d45c196dcbbf272863449 100644 (file)
@@ -8,7 +8,7 @@
 package org.opendaylight.controller.md.sal.binding.test;
 
 import org.junit.Before;
-import org.opendaylight.yangtools.sal.binding.generator.impl.ModuleInfoBackedContext;
+import org.opendaylight.mdsal.binding.generator.impl.ModuleInfoBackedContext;
 import org.opendaylight.yangtools.yang.binding.YangModuleInfo;
 import org.opendaylight.yangtools.yang.binding.util.BindingReflections;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
@@ -20,8 +20,8 @@ public abstract class AbstractSchemaAwareTest  {
     }
 
     protected SchemaContext getSchemaContext() throws Exception {
-        Iterable<YangModuleInfo> moduleInfos = getModuleInfos();
-        ModuleInfoBackedContext moduleContext = ModuleInfoBackedContext.create();
+        final Iterable<YangModuleInfo> moduleInfos = getModuleInfos();
+        final ModuleInfoBackedContext moduleContext = ModuleInfoBackedContext.create();
         moduleContext.addModuleInfos(moduleInfos);
         return moduleContext.tryToCreateSchemaContext().get();
     }
index 4f577eecf0a02f3a739fb44865970a15c8e276cb..5bd1316504a02f8d5b4aa25a2cc4c911d1d852a8 100644 (file)
@@ -8,7 +8,6 @@
 package org.opendaylight.controller.sal.binding.test.util;
 
 import static com.google.common.base.Preconditions.checkState;
-
 import com.google.common.annotations.Beta;
 import com.google.common.collect.ClassToInstanceMap;
 import com.google.common.collect.ImmutableMap;
@@ -16,7 +15,6 @@ import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.MutableClassToInstanceMap;
 import com.google.common.util.concurrent.ListeningExecutorService;
 import com.google.common.util.concurrent.MoreExecutors;
-import javassist.ClassPool;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.MountPointService;
 import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
@@ -52,15 +50,16 @@ import org.opendaylight.controller.sal.binding.impl.RootBindingAwareBroker;
 import org.opendaylight.controller.sal.core.api.BrokerService;
 import org.opendaylight.controller.sal.core.spi.data.DOMStore;
 import org.opendaylight.controller.sal.dom.broker.BrokerImpl;
+import org.opendaylight.mdsal.binding.generator.impl.GeneratedClassLoadingStrategy;
+import org.opendaylight.mdsal.binding.generator.impl.ModuleInfoBackedContext;
+import org.opendaylight.mdsal.binding.generator.util.JavassistUtils;
 import org.opendaylight.yangtools.binding.data.codec.gen.impl.DataObjectSerializerGenerator;
 import org.opendaylight.yangtools.binding.data.codec.gen.impl.StreamWriterGenerator;
 import org.opendaylight.yangtools.binding.data.codec.impl.BindingNormalizedNodeCodecRegistry;
-import org.opendaylight.yangtools.sal.binding.generator.impl.GeneratedClassLoadingStrategy;
-import org.opendaylight.yangtools.sal.binding.generator.impl.ModuleInfoBackedContext;
-import org.opendaylight.yangtools.sal.binding.generator.util.JavassistUtils;
 import org.opendaylight.yangtools.yang.binding.YangModuleInfo;
 import org.opendaylight.yangtools.yang.binding.util.BindingReflections;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import javassist.ClassPool;
 
 @Beta
 public class BindingTestContext implements AutoCloseable {
@@ -109,11 +108,11 @@ public class BindingTestContext implements AutoCloseable {
 
 
     public DOMDataBroker getDomAsyncDataBroker() {
-        return newDOMDataBroker;
+        return this.newDOMDataBroker;
     }
 
     public BindingToNormalizedNodeCodec getCodec() {
-        return codec;
+        return this.codec;
     }
 
     protected BindingTestContext(final ListeningExecutorService executor, final ClassPool classPool, final boolean startWithSchema) {
@@ -126,26 +125,26 @@ public class BindingTestContext implements AutoCloseable {
     }
 
     public void startNewDataBroker() {
-        checkState(executor != null, "Executor needs to be set");
-        checkState(newDOMDataBroker != null, "DOM Data Broker must be set");
-        dataBroker = new BindingDOMDataBrokerAdapter(newDOMDataBroker, codec);
+        checkState(this.executor != null, "Executor needs to be set");
+        checkState(this.newDOMDataBroker != null, "DOM Data Broker must be set");
+        this.dataBroker = new BindingDOMDataBrokerAdapter(this.newDOMDataBroker, this.codec);
     }
 
     public void startNewDomDataBroker() {
-        checkState(executor != null, "Executor needs to be set");
+        checkState(this.executor != null, "Executor needs to be set");
         final InMemoryDOMDataStore operStore = new InMemoryDOMDataStore("OPER",
             MoreExecutors.newDirectExecutorService());
         final InMemoryDOMDataStore configStore = new InMemoryDOMDataStore("CFG",
             MoreExecutors.newDirectExecutorService());
-        newDatastores = ImmutableMap.<LogicalDatastoreType, DOMStore>builder()
+        this.newDatastores = ImmutableMap.<LogicalDatastoreType, DOMStore>builder()
                 .put(LogicalDatastoreType.OPERATIONAL, operStore)
                 .put(LogicalDatastoreType.CONFIGURATION, configStore)
                 .build();
 
-        newDOMDataBroker = new SerializedDOMDataBroker(newDatastores, executor);
+        this.newDOMDataBroker = new SerializedDOMDataBroker(this.newDatastores, this.executor);
 
-        mockSchemaService.registerSchemaContextListener(configStore);
-        mockSchemaService.registerSchemaContextListener(operStore);
+        this.mockSchemaService.registerSchemaContextListener(configStore);
+        this.mockSchemaService.registerSchemaContextListener(operStore);
     }
 
     public void startBindingDataBroker() {
@@ -153,22 +152,22 @@ public class BindingTestContext implements AutoCloseable {
     }
 
     public void startBindingBroker() {
-        checkState(executor != null, "Executor needs to be set");
-        checkState(baData != null, "Binding Data Broker must be started");
-        checkState(baNotifyImpl != null, "Notification Service must be started");
-
-        baConsumerRpc = new BindingDOMRpcServiceAdapter(getDomRpcInvoker(), codec);
-        baProviderRpc = new BindingDOMRpcProviderServiceAdapter(getDomRpcRegistry(), codec);
-
-        baBrokerImpl = new RootBindingAwareBroker("test");
-
-        final MountPointService mountService = new BindingDOMMountPointServiceAdapter(biMountImpl, codec);
-        baBrokerImpl.setMountService(mountService);
-        baBrokerImpl.setLegacyMountManager(new HydrogenMountProvisionServiceAdapter(mountService));
-        baBrokerImpl.setRpcBroker(new HeliumRpcProviderRegistry(baConsumerRpc, baProviderRpc));
-        baBrokerImpl.setLegacyDataBroker(baData);
-        baBrokerImpl.setNotificationBroker(baNotifyImpl);
-        baBrokerImpl.start();
+        checkState(this.executor != null, "Executor needs to be set");
+        checkState(this.baData != null, "Binding Data Broker must be started");
+        checkState(this.baNotifyImpl != null, "Notification Service must be started");
+
+        this.baConsumerRpc = new BindingDOMRpcServiceAdapter(getDomRpcInvoker(), this.codec);
+        this.baProviderRpc = new BindingDOMRpcProviderServiceAdapter(getDomRpcRegistry(), this.codec);
+
+        this.baBrokerImpl = new RootBindingAwareBroker("test");
+
+        final MountPointService mountService = new BindingDOMMountPointServiceAdapter(this.biMountImpl, this.codec);
+        this.baBrokerImpl.setMountService(mountService);
+        this.baBrokerImpl.setLegacyMountManager(new HydrogenMountProvisionServiceAdapter(mountService));
+        this.baBrokerImpl.setRpcBroker(new HeliumRpcProviderRegistry(this.baConsumerRpc, this.baProviderRpc));
+        this.baBrokerImpl.setLegacyDataBroker(this.baData);
+        this.baBrokerImpl.setNotificationBroker(this.baNotifyImpl);
+        this.baBrokerImpl.start();
     }
 
     public void startForwarding() {
@@ -176,17 +175,17 @@ public class BindingTestContext implements AutoCloseable {
     }
 
     public void startBindingToDomMappingService() {
-        checkState(classPool != null, "ClassPool needs to be present");
+        checkState(this.classPool != null, "ClassPool needs to be present");
 
-        final DataObjectSerializerGenerator generator = StreamWriterGenerator.create(JavassistUtils.forClassPool(classPool));
+        final DataObjectSerializerGenerator generator = StreamWriterGenerator.create(JavassistUtils.forClassPool(this.classPool));
         final BindingNormalizedNodeCodecRegistry codecRegistry = new BindingNormalizedNodeCodecRegistry(generator);
         final GeneratedClassLoadingStrategy loading = GeneratedClassLoadingStrategy.getTCCLClassLoadingStrategy();
-        codec = new BindingToNormalizedNodeCodec(loading,  codecRegistry);
-        mockSchemaService.registerSchemaContextListener(codec);
+        this.codec = new BindingToNormalizedNodeCodec(loading,  codecRegistry);
+        this.mockSchemaService.registerSchemaContextListener(this.codec);
     }
 
     private void updateYangSchema(final ImmutableSet<YangModuleInfo> moduleInfos) {
-        mockSchemaService.changeSchema(getContext(moduleInfos));
+        this.mockSchemaService.changeSchema(getContext(moduleInfos));
     }
 
     private SchemaContext getContext(final ImmutableSet<YangModuleInfo> moduleInfos) {
@@ -207,41 +206,41 @@ public class BindingTestContext implements AutoCloseable {
         startBindingBroker();
 
         startForwarding();
-        if (startWithSchema) {
+        if (this.startWithSchema) {
             loadYangSchemaFromClasspath();
         }
     }
 
     public void startNewBindingDataBroker() {
-        final HydrogenDataBrokerAdapter forwarded = new HydrogenDataBrokerAdapter(dataBroker);
-        baData = forwarded;
+        final HydrogenDataBrokerAdapter forwarded = new HydrogenDataBrokerAdapter(this.dataBroker);
+        this.baData = forwarded;
     }
 
     private void startDomMountPoint() {
-        biMountImpl = new DOMMountPointServiceImpl();
+        this.biMountImpl = new DOMMountPointServiceImpl();
     }
 
     private void startDomBroker() {
-        checkState(executor != null);
+        checkState(this.executor != null);
 
-        domRouter = new DOMRpcRouter();
-        mockSchemaService.registerSchemaContextListener(domRouter);
+        this.domRouter = new DOMRpcRouter();
+        this.mockSchemaService.registerSchemaContextListener(this.domRouter);
 
         final ClassToInstanceMap<BrokerService> services = MutableClassToInstanceMap.create();
-        services.put(DOMRpcService.class, domRouter);
+        services.put(DOMRpcService.class, this.domRouter);
 
-        biBrokerImpl = new BrokerImpl(domRouter,services);
+        this.biBrokerImpl = new BrokerImpl(this.domRouter,services);
 
     }
 
     public void startBindingNotificationBroker() {
-        checkState(executor != null);
+        checkState(this.executor != null);
         final DOMNotificationRouter router = DOMNotificationRouter.create(16);
-        domPublishService = router;
-        domListenService = router;
-        publishService = new BindingDOMNotificationPublishServiceAdapter(codec, domPublishService);
-        listenService = new BindingDOMNotificationServiceAdapter(codec, domListenService);
-        baNotifyImpl = new HeliumNotificationProviderServiceAdapter(publishService,listenService);
+        this.domPublishService = router;
+        this.domListenService = router;
+        this.publishService = new BindingDOMNotificationPublishServiceAdapter(this.codec, this.domPublishService);
+        this.listenService = new BindingDOMNotificationServiceAdapter(this.codec, this.domListenService);
+        this.baNotifyImpl = new HeliumNotificationProviderServiceAdapter(this.publishService,this.listenService);
 
     }
 
@@ -252,19 +251,19 @@ public class BindingTestContext implements AutoCloseable {
 
     @Deprecated
     public DataProviderService getBindingDataBroker() {
-        return baData;
+        return this.baData;
     }
 
     public RpcProviderRegistry getBindingRpcRegistry() {
-        return baBrokerImpl.getRoot();
+        return this.baBrokerImpl.getRoot();
     }
 
     public DOMRpcProviderService getDomRpcRegistry() {
-        return domRouter;
+        return this.domRouter;
     }
 
     public DOMRpcService getDomRpcInvoker() {
-        return domRouter;
+        return this.domRouter;
     }
 
     @Override
@@ -273,15 +272,15 @@ public class BindingTestContext implements AutoCloseable {
     }
 
     public MountProviderService getBindingMountProviderService() {
-        return baBrokerImpl.getLegacyMount();
+        return this.baBrokerImpl.getLegacyMount();
     }
 
     public DOMMountPointService getDomMountProviderService() {
-        return biMountImpl;
+        return this.biMountImpl;
     }
 
     public DataBroker getDataBroker() {
-        return dataBroker;
+        return this.dataBroker;
     }
 
 
index 8d329624219916de411dec97d0c6e5c3e930a0bb..3be301a32f5292a0e98f3d6d80dfb1bf518aab16 100644 (file)
@@ -13,11 +13,11 @@ import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
 import org.opendaylight.controller.md.sal.dom.store.impl.DatastoreTestTask.WriteTransactionCustomizer;
+import org.opendaylight.mdsal.binding.generator.impl.ModuleInfoBackedContext;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.Top;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.TwoLevelList;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.two.level.list.TopLevelList;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.two.level.list.top.level.list.NestedList;
-import org.opendaylight.yangtools.sal.binding.generator.impl.ModuleInfoBackedContext;
 import org.opendaylight.yangtools.util.concurrent.SpecialExecutors;
 import org.opendaylight.yangtools.yang.binding.YangModuleInfo;
 import org.opendaylight.yangtools.yang.binding.util.BindingReflections;
@@ -51,23 +51,23 @@ public abstract class AbstractDataChangeListenerTest {
 
     @Before
     public final void setup() throws Exception {
-        YangModuleInfo moduleInfo = BindingReflections
+        final YangModuleInfo moduleInfo = BindingReflections
                 .getModuleInfo(TwoLevelList.class);
-        ModuleInfoBackedContext context = ModuleInfoBackedContext.create();
+        final ModuleInfoBackedContext context = ModuleInfoBackedContext.create();
         context.registerModuleInfo(moduleInfo);
-        schemaContext = context.tryToCreateSchemaContext().get();
+        this.schemaContext = context.tryToCreateSchemaContext().get();
 
-        dclExecutorService = new TestDCLExecutorService(
+        this.dclExecutorService = new TestDCLExecutorService(
                 SpecialExecutors.newBlockingBoundedFastThreadPool(1, 10, "DCL" ));
 
-        datastore = new InMemoryDOMDataStore("TEST", dclExecutorService);
-        datastore.onGlobalContextUpdated(schemaContext);
+        this.datastore = new InMemoryDOMDataStore("TEST", this.dclExecutorService);
+        this.datastore.onGlobalContextUpdated(this.schemaContext);
     }
 
     @After
     public void tearDown() {
-        if( dclExecutorService != null ) {
-            dclExecutorService.shutdownNow();
+        if( this.dclExecutorService != null ) {
+            this.dclExecutorService.shutdownNow();
         }
     }
 
@@ -79,7 +79,7 @@ public abstract class AbstractDataChangeListenerTest {
      *         children.
      */
     public final DatastoreTestTask newTestTask() {
-        return new DatastoreTestTask(datastore, dclExecutorService).cleanup(DatastoreTestTask
+        return new DatastoreTestTask(this.datastore, this.dclExecutorService).cleanup(DatastoreTestTask
                 .simpleDelete(TOP_LEVEL));
     }
 
@@ -113,26 +113,26 @@ public abstract class AbstractDataChangeListenerTest {
     }
 
     protected static <K> void assertContains(final Collection<K> set, final K... values) {
-        for (K key : values) {
+        for (final K key : values) {
             Assert.assertTrue(set.contains(key));
         }
 
     }
 
     protected static <K> void assertNotContains(final Collection<K> set, final K... values) {
-        for (K key : values) {
+        for (final K key : values) {
             Assert.assertFalse(set.contains(key));
         }
     }
 
     protected static <K> void assertContains(final Map<K,?> map, final K... values) {
-        for (K key : values) {
+        for (final K key : values) {
             Assert.assertTrue(map.containsKey(key));
         }
     }
 
     protected static <K> void assertNotContains(final Map<K,?> map, final K... values) {
-        for (K key : values) {
+        for (final K key : values) {
             Assert.assertFalse(map.containsKey(key));
         }
     }
@@ -159,8 +159,8 @@ public abstract class AbstractDataChangeListenerTest {
 
     public static final WriteTransactionCustomizer writeOneTopMultipleNested(
             final String topName, final String... nestedName) {
-        CollectionNodeBuilder<MapEntryNode, OrderedMapNode> nestedMapBuilder = nestedMap();
-        for (String nestedItem : nestedName) {
+        final CollectionNodeBuilder<MapEntryNode, OrderedMapNode> nestedMapBuilder = nestedMap();
+        for (final String nestedItem : nestedName) {
             nestedMapBuilder.addChild(nestedList(nestedItem).build());
         }
 
index e7af4dffae98b0b0543a8919c8ead80c6132512a..9910039e2e187f012b235ea43fb3afb4e64d932a 100644 (file)
@@ -14,9 +14,9 @@ import java.util.concurrent.ExecutionException;
 import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction;
+import org.opendaylight.mdsal.binding.generator.impl.ModuleInfoBackedContext;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.bi.ba.rpcservice.rev140701.RockTheHouseInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.Top;
-import org.opendaylight.yangtools.sal.binding.generator.impl.ModuleInfoBackedContext;
 import org.opendaylight.yangtools.yang.binding.YangModuleInfo;
 import org.opendaylight.yangtools.yang.binding.util.BindingReflections;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
@@ -31,22 +31,22 @@ public class SchemaUpdateForTransactionTest {
 
     @Before
     public void setupStore() {
-        domStore = new InMemoryDOMDataStore("TEST", MoreExecutors.newDirectExecutorService());
+        this.domStore = new InMemoryDOMDataStore("TEST", MoreExecutors.newDirectExecutorService());
         loadSchemas(RockTheHouseInput.class);
     }
 
     public void loadSchemas(final Class<?>... classes) {
         YangModuleInfo moduleInfo;
         try {
-            ModuleInfoBackedContext context = ModuleInfoBackedContext.create();
-            for (Class<?> clz : classes) {
+            final ModuleInfoBackedContext context = ModuleInfoBackedContext.create();
+            for (final Class<?> clz : classes) {
                 moduleInfo = BindingReflections.getModuleInfo(clz);
 
                 context.registerModuleInfo(moduleInfo);
             }
-            schemaContext = context.tryToCreateSchemaContext().get();
-            domStore.onGlobalContextUpdated(schemaContext);
-        } catch (Exception e) {
+            this.schemaContext = context.tryToCreateSchemaContext().get();
+            this.domStore.onGlobalContextUpdated(this.schemaContext);
+        } catch (final Exception e) {
             Throwables.propagateIfPossible(e);
         }
     }
@@ -68,11 +68,11 @@ public class SchemaUpdateForTransactionTest {
     @Test
     public void testTransactionSchemaUpdate() throws InterruptedException, ExecutionException {
 
-        assertNotNull(domStore);
+        assertNotNull(this.domStore);
 
         // We allocate transaction, initial schema context does not
         // contain Lists model
-        DOMStoreReadWriteTransaction writeTx = domStore.newReadWriteTransaction();
+        final DOMStoreReadWriteTransaction writeTx = this.domStore.newReadWriteTransaction();
         assertNotNull(writeTx);
 
         // we trigger schema context update to contain Lists model
index acf5397478a5ff520d963086ce15a14923d55e4e..9b3446c93b4c365fdf83191be64e2429b7f6ba22 100644 (file)
@@ -23,6 +23,7 @@ import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
 import org.opendaylight.controller.sal.core.api.model.SchemaService;
 import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer;
+import org.opendaylight.mdsal.binding.generator.impl.GeneratedClassLoadingStrategy;
 import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
 import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceRegistration;
 import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.AddShardReplicaInput;
@@ -46,7 +47,6 @@ import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.l
 import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.UnsubscribeYnlOutput;
 import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.WriteTransactionsInput;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.sal.binding.generator.impl.GeneratedClassLoadingStrategy;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.common.RpcError;
 import org.opendaylight.yangtools.yang.common.RpcError.ErrorType;