/** * @see org.springframework.extensions.config.element.ConfigElementAdapter#getChildren() */ public List<ConfigElement> getChildren() { throw new ConfigException("Reading the Server config via the generic interfaces is not supported"); }
/** * @see org.springframework.extensions.config.element.ConfigElementAdapter#getChildren() */ public List<ConfigElement> getChildren() { throw new ConfigException("Reading the Server config via the generic interfaces is not supported"); }
/** * @see org.springframework.extensions.config.element.ConfigElementAdapter#getChildren() */ public List<ConfigElement> getChildren() { throw new ConfigException("Reading the Server config via the generic interfaces is not supported"); }
/** * Conditionally adds the source to the set of source strings if its * trimmed length is greater than 0. */ protected void addSourceString(String sourceString) { if (sourceString == null || sourceString.trim().length() == 0) { throw new ConfigException("Invalid source value: " + sourceString); } this.sourceStrings.add(sourceString); }
/** * Conditionally adds the source to the set of source strings if its * trimmed length is greater than 0. */ protected void addSourceString(String sourceString) { if (sourceString == null || sourceString.trim().length() == 0) { throw new ConfigException("Invalid source value: " + sourceString); } this.sourceStrings.add(sourceString); }
/** * Conditionally adds the source to the set of source strings if its * trimmed length is greater than 0. */ protected void addSourceString(String sourceString) { if (sourceString == null || sourceString.trim().length() == 0) { throw new ConfigException("Invalid source value: " + sourceString); } this.sourceStrings.add(sourceString); }
public ConfigSectionImpl(String evaluator, String condition, boolean replace) { this.evaluator = evaluator; this.condition = condition; this.replace = replace; this.configElements = new ArrayList<ConfigElement>(); // don't allow empty strings if (this.evaluator != null && this.evaluator.length() == 0) { throw new ConfigException("The 'evaluator' attribute must have a value if it is present"); } if (this.condition != null && this.condition.length() == 0) { throw new ConfigException("The 'condition' attribute must have a value if it is present"); } }
public ConfigSectionImpl(String evaluator, String condition, boolean replace) { this.evaluator = evaluator; this.condition = condition; this.replace = replace; this.configElements = new ArrayList<ConfigElement>(); // don't allow empty strings if (this.evaluator != null && this.evaluator.length() == 0) { throw new ConfigException("The 'evaluator' attribute must have a value if it is present"); } if (this.condition != null && this.condition.length() == 0) { throw new ConfigException("The 'condition' attribute must have a value if it is present"); } }
public ConfigSectionImpl(String evaluator, String condition, boolean replace) { this.evaluator = evaluator; this.condition = condition; this.replace = replace; this.configElements = new ArrayList<ConfigElement>(); // don't allow empty strings if (this.evaluator != null && this.evaluator.length() == 0) { throw new ConfigException("The 'evaluator' attribute must have a value if it is present"); } if (this.condition != null && this.condition.length() == 0) { throw new ConfigException("The 'condition' attribute must have a value if it is present"); } }
/** * Registers this object with the injected ConfigService */ public void register() { if (configService == null) { throw new ConfigException("Config service must be provided"); } configService.addDeployer(this); }
/** * Instantiate the evaluator with the given name and class * * @param name * Name of the evaluator * @param className * Class name of the evaluator */ @SuppressWarnings("rawtypes") protected Evaluator createEvaluator(String name, String className) { Evaluator evaluator = null; try { Class clazz = Class.forName(className); evaluator = (Evaluator) clazz.newInstance(); } catch (Throwable e) { throw new ConfigException("Could not instantiate evaluator for '" + name + "' with class: " + className, e); } return evaluator; }
/** * Instantiate the config element reader with the given name and class * * @param name * Name of the element * @param className * Class name of the element reader */ private ConfigElementReader createConfigElementReader(String elementName, String className) { ConfigElementReader elementReader = null; try { @SuppressWarnings("unchecked") Class clazz = Class.forName(className); elementReader = (ConfigElementReader) clazz.newInstance(); } catch (Throwable e) { throw new ConfigException("Could not instantiate element reader for '" + elementName + "' with class: " + className, e); } return elementReader; }
/** * Instantiate the config element reader with the given name and class * * @param name * Name of the element * @param className * Class name of the element reader */ private ConfigElementReader createConfigElementReader(String elementName, String className) { ConfigElementReader elementReader = null; try { @SuppressWarnings("unchecked") Class clazz = Class.forName(className); elementReader = (ConfigElementReader) clazz.newInstance(); } catch (Throwable e) { throw new ConfigException("Could not instantiate element reader for '" + elementName + "' with class: " + className, e); } return elementReader; }
/** * Registers this object with the injected ConfigService */ public void register() { if (configService == null) { throw new ConfigException("Config service must be provided"); } configService.addDeployer(this); }
/** * Registers this object with the injected ConfigService */ public void register() { if (configService == null) { throw new ConfigException("Config service must be provided"); } configService.addDeployer(this); }
T item = null; try { JAXBContext context = JAXBContext.newInstance(Configuration.class); Unmarshaller um = context.createUnmarshaller(); Configuration conf = (Configuration) um.unmarshal(xmlFile); Method[] allMethods = Configuration.class.getDeclaredMethods(); for (Method method : allMethods) { if (method.getReturnType().equals(clazz)) { item = (T) method.invoke(conf); break; } } } catch (JAXBException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { throw new ConfigException("Failure detected while loading configuration", e); } return item;
/** * Initialise */ /*package*/ void init() { try { Properties properties = mergeProperties(); this.resolver = new PlaceholderResolvingStringValueResolver(properties, DEFAULT_PLACEHOLDER_PREFIX, DEFAULT_PLACEHOLDER_SUFFIX, DEFAULT_VALUE_SEPARATOR, true); } catch(IOException e) { throw new ConfigException("Failed to retrieve properties", e); } }
/** * Initialise */ /*package*/ void init() { try { Properties properties = mergeProperties(); this.resolver = new PlaceholderResolvingStringValueResolver(properties, DEFAULT_PLACEHOLDER_PREFIX, DEFAULT_PLACEHOLDER_SUFFIX, DEFAULT_VALUE_SEPARATOR, true); } catch(IOException e) { throw new ConfigException("Failed to retrieve properties", e); } }
/** * Initialise */ /*package*/ void init() { try { Properties properties = mergeProperties(); this.resolver = new PlaceholderResolvingStringValueResolver(properties, DEFAULT_PLACEHOLDER_PREFIX, DEFAULT_PLACEHOLDER_SUFFIX, DEFAULT_VALUE_SEPARATOR, true); } catch(IOException e) { throw new ConfigException("Failed to retrieve properties", e); } }
/** * 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); }