Bug 1312 - msg-spy config validation fix 28/8728/3
authorVaclav Demcak <vdemcak@cisco.com>
Thu, 3 Jul 2014 07:21:48 +0000 (09:21 +0200)
committerVaclav Demcak <vdemcak@cisco.com>
Mon, 7 Jul 2014 11:36:07 +0000 (11:36 +0000)
* fix for commited  BugFix 542 - Plugin internal stats
* fix for forgotten TODO task (initialization method in PluginProvider)

* refactoring for internal statistics
* add internal statistic confSubsystem module
* add MXBean for statistic's report

Change-Id: I1e734063396b2e5344ebd755fde19cea85ac1490
Signed-off-by: Vaclav Demcak <vdemcak@cisco.com>
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/OpenflowPluginProvider.java
openflowplugin/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/openflow/common/config/impl/rev140326/ConfigurableOpenFlowProviderModule.java
openflowplugin/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/openflow/common/config/impl/rev140326/MsgSpyServiceModule.java

index 7ef15a4e883664b3c9045a5b7e92138288a5f3c5..4e34451db08752a75f5376da5b0e66ac2953538c 100644 (file)
@@ -47,6 +47,14 @@ public class OpenflowPluginProvider implements BindingAwareProvider, AutoCloseab
 
     private SalRegistrationManager registrationManager;
 
+    /**
+     * Initialization of services and msgSpy counter
+     */
+    public void initialization() {
+        messageCountProvider = new MessageSpyCounterImpl();
+        this.registerProvider();
+    }
+
     /**
      * @param switchConnectionProvider
      */
@@ -145,13 +153,12 @@ public class OpenflowPluginProvider implements BindingAwareProvider, AutoCloseab
     /**
      * register providers for md-sal
      */
-    public void registerProvider() {
-        // TODO : create normal init
-        messageCountProvider = new MessageSpyCounterImpl();
+    private void registerProvider() {
         if(hasAllDependencies()) {
             this.broker.registerProvider(this,context);
         }
     }
+
     public MessageCountDumper getMessageCountDumper() {
         return messageCountProvider;
     }
index 2cb919a570215a03766c4be79375a7309dbee47c..9e7ecbbed197fb11d9684ed77c44eca1082f1b7f 100644 (file)
@@ -16,10 +16,10 @@ import org.osgi.framework.BundleContext;
 *
 */
 public final class ConfigurableOpenFlowProviderModule extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.common.config.impl.rev140326.AbstractConfigurableOpenFlowProviderModule {
-    
+
     private OpenflowPluginProvider pluginProvider;
     private BundleContext bundleContext;
-    
+
     /**
      * @param identifier
      * @param dependencyResolver
@@ -51,14 +51,14 @@ public final class ConfigurableOpenFlowProviderModule extends org.opendaylight.y
         pluginProvider.setContext(bundleContext);
         pluginProvider.setBroker(getBindingAwareBrokerDependency());
         pluginProvider.setSwitchConnectionProviders(getOpenflowSwitchConnectionProviderDependency());
-        pluginProvider.registerProvider();
+        pluginProvider.initialization();
         return pluginProvider;
     }
-    
+
     /**
      * @param bundleContext the bundleContext to set, see {@link OpenflowPluginProvider#setContext(BundleContext)}
-     * 
-     * @deprecated we should avoid osgi specific stuff .. once, 
+     *
+     * @deprecated we should avoid osgi specific stuff .. once,
      */
     @Deprecated
     public void setBundleContext(BundleContext bundleContext) {
index 9d0acbac117069c2b4f6cd965d8297f05f1587d4..de4c88b889e3db0542bd1c1a75117f4a4c36b780 100644 (file)
@@ -38,10 +38,8 @@ public class MsgSpyServiceModule extends org.opendaylight.yang.gen.v1.urn.openda
 
     @Override
     public void customValidation() {
-        /* OpenflowPluginProvider provides MessageCountDumper implementation, so it can not be null */
-        if (getOpenflowPluginProviderDependency() == null) {
-            throw new IllegalStateException("OpenflowPluginProvider is not accessible!");
-        }
+        // No need to validate dependencies, since all dependencies are mandatory
+        // config-subsystem will perform the validation
     }
 
     @Override