List of usage examples for org.apache.commons.configuration HierarchicalConfiguration getString
public String getString(String key)
From source file:com.eyeq.pivot4j.ui.condition.AndCondition.java
/** * @see com.eyeq.pivot4j.state.Configurable#restoreSettings(org.apache.commons.configuration.HierarchicalConfiguration) *///from w w w . j ava 2 s .c om @Override public void restoreSettings(HierarchicalConfiguration configuration) { this.subConditions = new LinkedList<Condition>(); try { List<HierarchicalConfiguration> subConfigs = configuration.configurationsAt("condition"); for (HierarchicalConfiguration subConfig : subConfigs) { String name = subConfig.getString("[@name]"); if (name != null) { Condition condition = getConditionFactory().createCondition(name); condition.restoreSettings(subConfig); this.subConditions.add(condition); } } } catch (IllegalArgumentException e) { } }
From source file:com.norconex.importer.handler.tagger.impl.TextBetweenTagger.java
@Override protected void loadHandlerFromXML(XMLConfiguration xml) throws IOException { setCaseSensitive(xml.getBoolean("[@caseSensitive]", false)); setInclusive(xml.getBoolean("[@inclusive]", false)); List<HierarchicalConfiguration> nodes = xml.configurationsAt("textBetween"); for (HierarchicalConfiguration node : nodes) { addTextEndpoints(node.getString("[@name]"), node.getString("start", null), node.getString("end", null)); }/*from w w w.j a v a 2 s . co m*/ }
From source file:com.vangent.hieos.empi.config.FunctionConfig.java
/** * /*from w w w .ja va2s. co m*/ * @param hc * @param empiConfig * @throws EMPIException */ public void load(HierarchicalConfiguration hc, EMPIConfig empiConfig) throws EMPIException { this.name = hc.getString(NAME); this.className = hc.getString(CLASS_NAME); logger.info("... className = " + this.className); // Get an instance of the function and set the configuration. this.function = (Function) ConfigHelper.loadClassInstance(this.className); this.function.setFunctionConfig(this); // Load function parameters. this.loadFunctionParameters(hc); }
From source file:edu.indiana.d2i.sloan.Configuration.java
private void loadConfigurations(String xmlPath) { try {/*from w ww . jav a2 s .c o m*/ XMLConfiguration config = new XMLConfiguration(xmlPath); int size = config.getList("property.name").size(); for (int i = 0; i < size; i++) { HierarchicalConfiguration sub = config.configurationAt(String.format("property(%d)", i)); String name = sub.getString("name"); String val = sub.getString("value"); properties.put(name, val); } } catch (ConfigurationException cex) { throw new RuntimeException(cex); } }
From source file:com.norconex.importer.handler.tagger.impl.SplitTagger.java
@Override protected void loadHandlerFromXML(XMLConfiguration xml) throws IOException { List<HierarchicalConfiguration> nodes = xml.configurationsAt("split"); for (HierarchicalConfiguration node : nodes) { addSplit(node.getString("[@fromField]"), node.getString("[@toField]", null), node.getString("separator"), node.getBoolean("[@regex]", false)); }/*from w w w. ja v a 2s. c o m*/ }
From source file:com.vangent.hieos.empi.config.FunctionConfig.java
/** * //from w w w. j a v a 2s.c o m * @param hc */ public void loadFunctionParameters(HierarchicalConfiguration hc) { // Load function parameters. List functionParameters = hc.configurationsAt(FUNCTION_PARAMETERS); if (functionParameters != null) { for (Iterator it = functionParameters.iterator(); it.hasNext();) { HierarchicalConfiguration hcParameter = (HierarchicalConfiguration) it.next(); String parameterName = hcParameter.getString(PARAMETER_NAME); String parameterValue = hcParameter.getString(PARAMETER_VALUE); this.parameters.put(parameterName.toLowerCase(), parameterValue); } } }
From source file:com.wrmsr.neurosis.util.Configs.java
public static List<String> getAllStrings(HierarchicalConfiguration hc, String key) { List<String> values = hc.getList(key).stream().filter(o -> o != null).map(Object::toString) .collect(Collectors.toList()); try {// w w w .j a va 2s . c o m HierarchicalConfiguration subhc = hc.configurationAt(key); for (String subkey : Lists.newArrayList(subhc.getKeys())) { if (!isNullOrEmpty(subkey)) { String subvalue = subhc.getString(subkey); if (subvalue != null) { values.add(subvalue); } } } } catch (IllegalArgumentException e) { // pass } return values; }
From source file:com.norconex.importer.handler.tagger.impl.ReplaceTagger.java
@Override protected void loadHandlerFromXML(XMLConfiguration xml) throws IOException { List<HierarchicalConfiguration> nodes = xml.configurationsAt("replace"); for (HierarchicalConfiguration node : nodes) { addReplacement(node.getString("fromValue"), node.getString("toValue"), node.getString("[@fromField]"), node.getString("[@toField]", null), node.getBoolean("[@regex]", false)); }// ww w. j av a2 s .co m }
From source file:com.microrisc.simply.init.SimpleInitObjectsFactory.java
/** * Creates and returns mapper of device interfaces to theirs implementing classes. * @param configuration source configuration * @return mapper of device interfaces to theirs implementing classes. * @throws java.lang.Exception if an error has occured during creating of * mapper/*www. j a va 2s . co m*/ */ protected ImplClassesMapper createImplClassesMapper(Configuration configuration) throws Exception { String mappingFile = configuration.getString("implClassesMapping.configFile"); XMLConfiguration mapperConfig = new XMLConfiguration(mappingFile); // get all "interfaceMappings" nodes List<HierarchicalConfiguration> implMappings = mapperConfig.configurationsAt("implMapping"); // if no implementation class mapping exists, throw Exception if (implMappings.isEmpty()) { throw new SimplyException("Implementation mapping: No implementation class mapping exist"); } // mapping Map<Class, Class> ifaceToImpl = new HashMap<>(); // read in all impl mappings for (HierarchicalConfiguration implMapping : implMappings) { String ifaceStr = implMapping.getString("interface"); String implStr = implMapping.getString("implClass"); Class ifaceClass = Class.forName(ifaceStr); Class implClass = Class.forName(implStr); ifaceToImpl.put(ifaceClass, implClass); } return new SimpleImplClassesMapper(ifaceToImpl); }
From source file:com.boozallen.cognition.ingest.storm.topology.ConfigurableIngestTopology.java
/** * Gets a topology builder and set of storm bolt configurations. Initializes the bolts and sets them with the * topology builder.//ww w.ja v a2 s .c o m * * @param builder storm topology builder * @param boltsConf component configurations * @param spout type of storm component being added (spout/bolt) * @throws ConfigurationException */ void configureBolts(TopologyBuilder builder, SubnodeConfiguration boltsConf, String spout) throws ConfigurationException { String prevComponent = spout; // bolts subscribe to other bolts by number HashMap<Integer, String> boltNumberToId = new HashMap<>(); List<HierarchicalConfiguration> bolts = boltsConf.configurationsAt(BOLT); for (HierarchicalConfiguration bolt : bolts) { String boltType = bolt.getString(TYPE); Configuration boltConf = bolt.configurationAt(CONF); int boltNum = bolt.getInt(NUMBER_ATTRIBUTE); String boltId = String.format("%02d_%s", boltNum, boltType); boltNumberToId.put(boltNum, boltId); String subscribingToComponent = getSubscribingToComponent(prevComponent, boltNumberToId, boltConf); logger.info("{} subscribing to {}", boltId, subscribingToComponent); IComponent baseComponent = buildComponent(boltType, boltConf); StormParallelismConfig stormParallelismConfig = getStormParallelismConfig(boltConf); BoltDeclarer declarer = buildBoltDeclarer(builder, stormParallelismConfig, boltId, baseComponent); configureTickFrequency(boltConf, declarer); configureStreamGrouping(subscribingToComponent, boltConf, declarer); prevComponent = boltId; boltNum++; } }