/** * Make a read-only copy of the given configuration * * @param config the configuration to copy */ public ImmutableConfig(Config config) { if (config.getConfigElements() == null) { this.configElements = Collections.emptyMap(); } else { Map<String, ConfigElement> configElements = new HashMap<String, ConfigElement>(config.getConfigElements()); this.configElements = Collections.unmodifiableMap(configElements); } }
/** * Make a read-only copy of the given configuration * * @param config the configuration to copy */ public ImmutableConfig(Config config) { if (config.getConfigElements() == null) { this.configElements = Collections.emptyMap(); } else { Map<String, ConfigElement> configElements = new HashMap<String, ConfigElement>(config.getConfigElements()); this.configElements = Collections.unmodifiableMap(configElements); } }
@Override public Object get(Object identifier) { if (logger.isDebugEnabled()) logger.debug("Getting scoped config for '" + identifier + "'"); Map<String, ConfigElement> map = null; if (configService != null) { Config result = configService.getConfig(identifier); map = result.getConfigElements(); } else { map = Collections.emptyMap(); } if (logger.isDebugEnabled()) logger.debug("Returning config for '" + identifier + "': " + map); return map; } }
@Override public Object get(Object identifier) { if (logger.isDebugEnabled()) logger.debug("Getting scoped config for '" + identifier + "'"); Map<String, ConfigElement> map = null; if (configService != null) { Config result = configService.getConfig(identifier); map = result.getConfigElements(); } else { map = Collections.emptyMap(); } if (logger.isDebugEnabled()) logger.debug("Returning config for '" + identifier + "': " + map); return map; } }
@Override public Object get(Object identifier) { if (logger.isDebugEnabled()) logger.debug("Getting scoped config for '" + identifier + "'"); Map<String, ConfigElement> map = null; if (configService != null) { Config result = configService.getConfig(identifier); map = result.getConfigElements(); } else { map = Collections.emptyMap(); } if (logger.isDebugEnabled()) logger.debug("Returning config for '" + identifier + "': " + map); return map; } }
/** * Retrieves the global configuration as a Map. * * @return Map of the global config */ public Map<String, ConfigElement> getGlobal() { if (this.globalConfig == null) { if (this.configService != null) { // get the global config this.globalConfig = this.configService.getGlobalConfig().getConfigElements(); } // if no global config was found create an empty map if (this.globalConfig == null) { this.globalConfig = Collections.emptyMap(); } } return this.globalConfig; }
/** * Retrieves the global configuration as a Map. * * @return Map of the global config */ public Map<String, ConfigElement> getGlobal() { if (this.globalConfig == null) { if (this.configService != null) { // get the global config this.globalConfig = this.configService.getGlobalConfig().getConfigElements(); } // if no global config was found create an empty map if (this.globalConfig == null) { this.globalConfig = Collections.emptyMap(); } } return this.globalConfig; }
/** * Retrieves the global configuration as a Map. * * @return Map of the global config */ public Map<String, ConfigElement> getGlobal() { if (this.globalConfig == null) { if (this.configService != null) { // get the global config this.globalConfig = this.configService.getGlobalConfig().getConfigElements(); } // if no global config was found create an empty map if (this.globalConfig == null) { this.globalConfig = Collections.emptyMap(); } } return this.globalConfig; }
@Override public Object get(Object identifier) { if (logger.isDebugEnabled()) logger.debug("Getting scoped config for '" + identifier + "'"); Map<String, ConfigElement> map = null; if (configService != null) { Config result = configService.getConfig(identifier, new ConfigLookupContext(), globalConfig, sectionsByArea, sections); map = result.getConfigElements(); } else { map = Collections.emptyMap(); } if (logger.isDebugEnabled()) logger.debug("Returning config for '" + identifier + "': " + map); return map; } }
@Override public Object get(Object identifier) { if (logger.isDebugEnabled()) logger.debug("Getting scoped config for '" + identifier + "'"); Map<String, ConfigElement> map = null; if (configService != null) { Config result = configService.getConfig(identifier, new ConfigLookupContext(), globalConfig, sectionsByArea, sections); map = result.getConfigElements(); } else { map = Collections.emptyMap(); } if (logger.isDebugEnabled()) logger.debug("Returning config for '" + identifier + "': " + map); return map; } }
@Override public Object get(Object identifier) { if (logger.isDebugEnabled()) logger.debug("Getting scoped config for '" + identifier + "'"); Map<String, ConfigElement> map = null; if (configService != null) { Config result = configService.getConfig(identifier, new ConfigLookupContext(), globalConfig, sectionsByArea, sections); map = result.getConfigElements(); } else { map = Collections.emptyMap(); } if (logger.isDebugEnabled()) logger.debug("Returning config for '" + identifier + "': " + map); return map; } }
@Override public Object get(Object identifier) { if (logger.isDebugEnabled()) logger.debug("Getting scoped config for '" + identifier + "'"); Map<String, ConfigElement> map = null; if (configService != null) { Config result = configService.getConfig(identifier, new ConfigLookupContext(), globalConfig, sectionsByArea, sections); map = result.getConfigElements(); } else { map = Collections.emptyMap(); } if (logger.isDebugEnabled()) logger.debug("Returning config for '" + identifier + "': " + map); return map; } }
@Override public Object get(Object identifier) { if (logger.isDebugEnabled()) logger.debug("Getting scoped config for '" + identifier + "'"); Map<String, ConfigElement> map = null; if (configService != null) { Config result = configService.getConfig(identifier, new ConfigLookupContext(), globalConfig, sectionsByArea, sections); map = result.getConfigElements(); } else { map = Collections.emptyMap(); } if (logger.isDebugEnabled()) logger.debug("Returning config for '" + identifier + "': " + map); return map; } }
@Override public Object get(Object identifier) { if (logger.isDebugEnabled()) logger.debug("Getting scoped config for '" + identifier + "'"); Map<String, ConfigElement> map = null; if (configService != null) { Config result = configService.getConfig(identifier, new ConfigLookupContext(), globalConfig, sectionsByArea, sections); map = result.getConfigElements(); } else { map = Collections.emptyMap(); } if (logger.isDebugEnabled()) logger.debug("Returning config for '" + identifier + "': " + map); return map; } }
ConfigElement existingConfigElement = results.getConfigElements().get(name); if (existingConfigElement != null) results.getConfigElements().put(name, newConfigElement); results.getConfigElements().put(name, combinedConfigElement); results.getConfigElements().put(name, newConfigElement);
ConfigElement existingConfigElement = results.getConfigElements().get(name); if (existingConfigElement != null) results.getConfigElements().put(name, newConfigElement); results.getConfigElements().put(name, combinedConfigElement); results.getConfigElements().put(name, newConfigElement);
ConfigElement existingConfigElement = results.getConfigElements().get(name); if (existingConfigElement != null) results.getConfigElements().put(name, newConfigElement); results.getConfigElements().put(name, combinedConfigElement); results.getConfigElements().put(name, newConfigElement);
Map<String, ConfigElement> configElements = configConditions.getConfigElements();
assertNotNull("Global config should not be null", global); assertEquals("There shouldn't be any config elements for global", 0, global.getConfigElements().size()); cfg.getConfigElements().size()); assertNotNull("Global config should not be null", global); assertEquals("There shouldn't be any config elements for global", 0, global.getConfigElements().size()); cfg.getConfigElements().size()); assertNotNull("Global config should not be null", global); assertEquals("There shouldn't be any config elements for global", 0, global.getConfigElements().size()); cfg.getConfigElements().size());
Map<String, ConfigElement> elements = replaceTestCfg.getConfigElements(); assertEquals("number of elements", 9, elements.size());