/** * @see org.springframework.extensions.config.ConfigService#getConfig(java.lang.Object) */ public Config getConfig(Object object) { return getConfig(object, new ConfigLookupContext()); }
/** * Constructs a lookup context for the given area * * @param area The area to search in */ public ConfigLookupContext(String area) { this(); this.addArea(area); }
/** * Constructs a lookup context for the list of the given areas * * @param areas The list of areas to search in */ public ConfigLookupContext(List<String> areas) { this(); this.setAreas(areas); }
ConfigLookupContext lookupContext = new ConfigLookupContext(); lookupContext.addArea("test-area"); config = svc.getConfig("Area Specific Config", lookupContext); ConfigElement areaTest = config.getConfigElement("parent-item"); Config notThere = svc.getConfig("Unit Test", new ConfigLookupContext("not-there")); fail("Retrieving a non existent area should have thrown an exception!");
if (context.includeGlobalSection()) if (context.getAreas().size() > 0) logger.debug("Restricting search within following areas: " + context.getAreas()); for (String area : context.getAreas())
/** * Determines whether the given section applies for the given object, if it * does, the section is added to given results object. * * @param section * The section to process * @param object * The object to retrieve config for * @param context * The context to use for the lookup * @param results * The resulting config object for the search */ protected void processSection(ConfigSection section, Object object, ConfigLookupContext context, ConfigImpl results) { String evaluatorName = section.getEvaluator(); Evaluator evaluator = getEvaluator(evaluatorName); if (evaluator == null) { throw new ConfigException("Unable to locate evaluator implementation for '" + evaluatorName + "' for " + section); } context.getAlgorithm().process(section, evaluator, object, results); }
if (context.includeGlobalSection()) if (context.getAreas().size() > 0) logger.debug("Restricting search within following areas: " + context.getAreas()); for (String area : context.getAreas())
/** * Determines whether the given section applies for the given object, if it * does, the section is added to given results object. * * @param section * The section to process * @param object * The object to retrieve config for * @param context * The context to use for the lookup * @param results * The resulting config object for the search */ protected void processSection(ConfigSection section, Object object, ConfigLookupContext context, ConfigImpl results) { String evaluatorName = section.getEvaluator(); Evaluator evaluator = getEvaluator(evaluatorName); if (evaluator == null) { throw new ConfigException("Unable to locate evaluator implementation for '" + evaluatorName + "' for " + section); } context.getAlgorithm().process(section, evaluator, object, results); }
/** * @see org.springframework.extensions.config.ConfigService#getConfig(java.lang.Object) */ public Config getConfig(Object object) { return getConfig(object, new ConfigLookupContext()); }
if (context.includeGlobalSection()) if (context.getAreas().size() > 0) logger.debug("Restricting search within following areas: " + context.getAreas()); for (String area : context.getAreas())
/** * Constructs a lookup context for the given area * * @param area The area to search in */ public ConfigLookupContext(String area) { this(); this.addArea(area); }
/** * Constructs a lookup context for the list of the given areas * * @param areas The list of areas to search in */ public ConfigLookupContext(List<String> areas) { this(); this.setAreas(areas); }
/** * Determines whether the given section applies for the given object, if it * does, the section is added to given results object. * * @param section * The section to process * @param object * The object to retrieve config for * @param context * The context to use for the lookup * @param results * The resulting config object for the search */ protected void processSection(ConfigSection section, Object object, ConfigLookupContext context, ConfigImpl results) { String evaluatorName = section.getEvaluator(); Evaluator evaluator = getEvaluator(evaluatorName); if (evaluator == null) { throw new ConfigException("Unable to locate evaluator implementation for '" + evaluatorName + "' for " + section); } context.getAlgorithm().process(section, evaluator, object, results); }
/** * @see org.springframework.extensions.config.ConfigService#getConfig(java.lang.Object) */ public Config getConfig(Object object) { return getConfig(object, new ConfigLookupContext()); }
/** * Constructs a lookup context for the given area * * @param area The area to search in */ public ConfigLookupContext(String area) { this(); this.addArea(area); }
/** * Constructs a lookup context for the list of the given areas * * @param areas The list of areas to search in */ public ConfigLookupContext(List<String> areas) { this(); this.setAreas(areas); }
@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; } }