X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=openflowplugin-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fopenflowplugin%2Fimpl%2Fconfiguration%2FConfigurationServiceFactoryImpl.java;h=15ef52d6941c7f31b0403a3c70cf8d1b37751d20;hb=6b344b02f99bb57cd962762dd62914c07a288a00;hp=834b595fdc043e2411a8af4407ec0c3af9fcc7a3;hpb=89da5edcc40ca9f589c708844bd5efe46a330486;p=openflowplugin.git diff --git a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/configuration/ConfigurationServiceFactoryImpl.java b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/configuration/ConfigurationServiceFactoryImpl.java index 834b595fdc..15ef52d694 100644 --- a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/configuration/ConfigurationServiceFactoryImpl.java +++ b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/configuration/ConfigurationServiceFactoryImpl.java @@ -36,7 +36,9 @@ public class ConfigurationServiceFactoryImpl implements ConfigurationServiceFact private static final Logger LOG = LoggerFactory.getLogger(ConfigurationServiceFactory.class); @Override - public ConfigurationService newInstance(final OpenflowProviderConfig providerConfig, final BundleContext bundleContext) { + public ConfigurationService newInstance( + final OpenflowProviderConfig providerConfig, + final BundleContext bundleContext) { return new ConfigurationServiceImpl(providerConfig, bundleContext); } @@ -66,6 +68,18 @@ public class ConfigurationServiceFactoryImpl implements ConfigurationServiceFact providerConfig.getEchoReplyTimeout().getValue().toString()) .put(ConfigurationProperty.IS_STATISTICS_POLLING_ON.toString(), providerConfig.isIsStatisticsPollingOn().toString()) + .put(ConfigurationProperty.IS_TABLE_STATISTICS_POLLING_ON.toString(), + providerConfig.isIsTableStatisticsPollingOn().toString()) + .put(ConfigurationProperty.IS_FLOW_STATISTICS_POLLING_ON.toString(), + providerConfig.isIsFlowStatisticsPollingOn().toString()) + .put(ConfigurationProperty.IS_GROUP_STATISTICS_POLLING_ON.toString(), + providerConfig.isIsGroupStatisticsPollingOn().toString()) + .put(ConfigurationProperty.IS_METER_STATISTICS_POLLING_ON.toString(), + providerConfig.isIsMeterStatisticsPollingOn().toString()) + .put(ConfigurationProperty.IS_PORT_STATISTICS_POLLING_ON.toString(), + providerConfig.isIsPortStatisticsPollingOn().toString()) + .put(ConfigurationProperty.IS_QUEUE_STATISTICS_POLLING_ON.toString(), + providerConfig.isIsQueueStatisticsPollingOn().toString()) .put(ConfigurationProperty.SKIP_TABLE_FEATURES.toString(), providerConfig.isSkipTableFeatures().toString()) .put(ConfigurationProperty.BASIC_TIMER_DELAY.toString(), @@ -83,28 +97,30 @@ public class ConfigurationServiceFactoryImpl implements ConfigurationServiceFact .build()); LOG.info("Loading configuration from '{}' configuration file", OFConstants.CONFIG_FILE_ID); - Optional.ofNullable(bundleContext.getServiceReference(ConfigurationAdmin.class.getName())).ifPresent(serviceReference -> { - final ConfigurationAdmin configurationAdmin = (ConfigurationAdmin) bundleContext.getService(serviceReference); - - try { - final Configuration configuration = configurationAdmin.getConfiguration(OFConstants.CONFIG_FILE_ID); - - Optional.ofNullable(configuration.getProperties()).ifPresent(properties -> { - final Enumeration keys = properties.keys(); - final Map mapProperties = new HashMap<>(properties.size()); - - while (keys.hasMoreElements()) { - final String key = keys.nextElement(); - final String value = properties.get(key).toString(); - mapProperties.put(key, value); + Optional.ofNullable(bundleContext.getServiceReference(ConfigurationAdmin.class)) + .ifPresent(serviceReference -> { + final ConfigurationAdmin configurationAdmin = bundleContext.getService(serviceReference); + + try { + final Configuration configuration + = configurationAdmin.getConfiguration(OFConstants.CONFIG_FILE_ID); + + Optional.ofNullable(configuration.getProperties()).ifPresent(properties -> { + final Enumeration keys = properties.keys(); + final Map mapProperties = new HashMap<>(properties.size()); + + while (keys.hasMoreElements()) { + final String key = keys.nextElement(); + final String value = properties.get(key).toString(); + mapProperties.put(key, value); + } + + update(mapProperties); + }); + } catch (IOException e) { + LOG.debug("Failed to load {} configuration file. Error {}", OFConstants.CONFIG_FILE_ID, e); } - - update(mapProperties); }); - } catch (IOException e) { - LOG.debug("Failed to load {} configuration file. Error {}", OFConstants.CONFIG_FILE_ID, e); - } - }); } @Override @@ -117,7 +133,10 @@ public class ConfigurationServiceFactoryImpl implements ConfigurationServiceFact return; } - LOG.info("{} configuration property was changed from '{}' to '{}'", propertyName, originalValue, newValue); + LOG.info("{} configuration property was changed from '{}' to '{}'", + propertyName, + originalValue, + newValue); } else { if (Objects.isNull(newValue)) { return;