/** * Adds the given config section to the config service and optionally within * a named area * * @param section * The config section to add * @param area * The name of the area to add the section to, if null the * section is only added to the global section list */ protected void addConfigSection(ConfigSection section, String area) { ConfigImpl globalConfig = getGlobalConfigImpl(); Map<String, List<ConfigSection>> sectionsByArea = getSectionsByArea(); List<ConfigSection> sections = getSections(); addConfigSection(section, area, globalConfig, sectionsByArea, sections); }
/** * Parses all the files passed to this config service */ protected List<ConfigDeployment> parse() { return appendConfig(configSource); }
/** * Resets the config service */ public void reset() { if (logger.isDebugEnabled()) logger.debug("Resetting config service"); destroy(); initConfig(); }
public Config getConfig(Object object, ConfigLookupContext context) { return getConfig(object, context, getGlobalConfigImpl(), getSectionsByArea(), getSections()); }
/** * Initialises the config service - via bootstrap */ public List<ConfigDeployment> initConfig() { putSections(new ArrayList<ConfigSection>()); putSectionsByArea(new HashMap<String, List<ConfigSection>>()); putEvaluators(new HashMap<String, Evaluator>()); putGlobalConfig(new ConfigImpl()); // Add the built-in evaluators String stringCompare = "string-compare"; addEvaluator(stringCompare, createEvaluator(stringCompare, StringEvaluator.class.getName())); String objectType = "object-type"; addEvaluator(objectType, createEvaluator(objectType, ObjectTypeEvaluator.class.getName())); ConfigDeployment builtin = new ConfigDeployment("<Built-in evaluators>", null); builtin.setDeploymentStatus(ConfigDeployment.STATUS_OK); List<ConfigDeployment> builtins = new ArrayList<ConfigDeployment>(); builtins.add(builtin); return builtins; }
/** * Retrieves the implementation of the named evaluator * * @param name * Name of the evaluator to retrieve * @return The evaluator, null if it doesn't exist */ protected Evaluator getEvaluator(String name) { return (Evaluator)getEvaluators().get(name); }
/** * Destroy config in shutdown */ @Override protected void onShutdown(ApplicationEvent event) { destroy(); } }
/** * @see org.springframework.extensions.config.ConfigService#getConfig(java.lang.Object) */ public Config getConfig(Object object) { return getConfig(object, new ConfigLookupContext()); }
/** * @see org.springframework.extensions.config.ConfigService#getGlobalConfig() */ public Config getGlobalConfig() { return getGlobalConfigImpl(); }
/** * 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); }
/** * Initialises the config service - via bootstrap */ public List<ConfigDeployment> initConfig() { putSections(new ArrayList<ConfigSection>()); putSectionsByArea(new HashMap<String, List<ConfigSection>>()); putEvaluators(new HashMap<String, Evaluator>()); putGlobalConfig(new ConfigImpl()); // Add the built-in evaluators String stringCompare = "string-compare"; addEvaluator(stringCompare, createEvaluator(stringCompare, StringEvaluator.class.getName())); String objectType = "object-type"; addEvaluator(objectType, createEvaluator(objectType, ObjectTypeEvaluator.class.getName())); ConfigDeployment builtin = new ConfigDeployment("<Built-in evaluators>", null); builtin.setDeploymentStatus(ConfigDeployment.STATUS_OK); List<ConfigDeployment> builtins = new ArrayList<ConfigDeployment>(); builtins.add(builtin); return builtins; }
public Config getConfig(Object object, ConfigLookupContext context) { return getConfig(object, context, getGlobalConfigImpl(), getSectionsByArea(), getSections()); }
/** * Retrieves the implementation of the named evaluator * * @param name * Name of the evaluator to retrieve * @return The evaluator, null if it doesn't exist */ protected Evaluator getEvaluator(String name) { return (Evaluator)getEvaluators().get(name); }
/** * Destroy config in shutdown */ @Override protected void onShutdown(ApplicationEvent event) { destroy(); } }
/** * @see org.springframework.extensions.config.ConfigService#getConfig(java.lang.Object) */ public Config getConfig(Object object) { return getConfig(object, new ConfigLookupContext()); }
/** * @see org.springframework.extensions.config.ConfigService#getGlobalConfig() */ public Config getGlobalConfig() { return getGlobalConfigImpl(); }
/** * 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); }
/** * Initialises the config service - via bootstrap */ public List<ConfigDeployment> initConfig() { putSections(new ArrayList<ConfigSection>()); putSectionsByArea(new HashMap<String, List<ConfigSection>>()); putEvaluators(new HashMap<String, Evaluator>()); putGlobalConfig(new ConfigImpl()); // Add the built-in evaluators String stringCompare = "string-compare"; addEvaluator(stringCompare, createEvaluator(stringCompare, StringEvaluator.class.getName())); String objectType = "object-type"; addEvaluator(objectType, createEvaluator(objectType, ObjectTypeEvaluator.class.getName())); ConfigDeployment builtin = new ConfigDeployment("<Built-in evaluators>", null); builtin.setDeploymentStatus(ConfigDeployment.STATUS_OK); List<ConfigDeployment> builtins = new ArrayList<ConfigDeployment>(); builtins.add(builtin); return builtins; }
public Config getConfig(Object object, ConfigLookupContext context) { return getConfig(object, context, getGlobalConfigImpl(), getSectionsByArea(), getSections()); }
/** * Adds the given config section to the config service and optionally within * a named area * * @param section * The config section to add * @param area * The name of the area to add the section to, if null the * section is only added to the global section list */ protected void addConfigSection(ConfigSection section, String area) { ConfigImpl globalConfig = getGlobalConfigImpl(); Map<String, List<ConfigSection>> sectionsByArea = getSectionsByArea(); List<ConfigSection> sections = getSections(); addConfigSection(section, area, globalConfig, sectionsByArea, sections); }