diff --git a/src/main/java/net/floodlightcontroller/core/module/FloodlightModuleContext.java b/src/main/java/net/floodlightcontroller/core/module/FloodlightModuleContext.java index 77b7e76c79717189a825715fff7c96d3b510d46b..df3c1b14c8e0b895f39204e991a5b091272e20c3 100644 --- a/src/main/java/net/floodlightcontroller/core/module/FloodlightModuleContext.java +++ b/src/main/java/net/floodlightcontroller/core/module/FloodlightModuleContext.java @@ -80,18 +80,23 @@ public class FloodlightModuleContext implements IFloodlightModuleContext { */ @Override public Map<String, String> getConfigParams(IFloodlightModule module) { - Map<String, String> retMap = configParams.get(module.getClass()); + return getConfigParams(module.getClass()); + } + + @Override + public Map<String, String> getConfigParams(Class<? extends IFloodlightModule> moduleClass) { + Map<String, String> retMap = configParams.get(moduleClass); if (retMap == null) { // Return an empty map if none exists so the module does not // need to null check the map retMap = new HashMap<String, String>(); - configParams.put(module.getClass(), retMap); + configParams.put(moduleClass, retMap); } // also add any configuration parameters for superclasses, but // only if more specific configuration does not override it for (Class<? extends IFloodlightModule> c : configParams.keySet()) { - if (c.isInstance(module)) { + if (c.equals(moduleClass)) { for (Map.Entry<String, String> ent : configParams.get(c).entrySet()) { if (!retMap.containsKey(ent.getKey())) { retMap.put(ent.getKey(), ent.getValue()); diff --git a/src/main/java/net/floodlightcontroller/core/module/IFloodlightModuleContext.java b/src/main/java/net/floodlightcontroller/core/module/IFloodlightModuleContext.java index 6288cb7898d4f792a583b7a17c22d29f6da4caf2..596cc6e9e9b151be3ace63c6e5064b3dcd5c160f 100644 --- a/src/main/java/net/floodlightcontroller/core/module/IFloodlightModuleContext.java +++ b/src/main/java/net/floodlightcontroller/core/module/IFloodlightModuleContext.java @@ -41,7 +41,14 @@ public interface IFloodlightModuleContext { * @return All Floodlight modules that are going to be loaded */ public Collection<IFloodlightModule> getAllModules(); - + + /** + * Gets module specific configuration parameters. + * @param moduleClass The module class to get the configuration parameters for + * @return A key, value map of the configuration options + */ + public Map<String, String> getConfigParams(Class<? extends IFloodlightModule> moduleClass); + /** * Gets module specific configuration parameters. * @param module The module to get the configuration parameters for