List of usage examples for org.apache.commons.configuration ConfigurationConverter getMap
public static Map getMap(Configuration config)
From source file:ExplorerAdminResource.java
@GET @Path("explorers/config") public MapEntity getConfig() { return new MapEntity(ConfigurationConverter.getMap(manager.getConfiguration())); }
From source file:com.dattack.dbtools.drules.engine.DefaultNotificationActionBeanVisitor.java
private static String formatMessage(final NotificationActionSendMailBean action, final Configuration configuration) throws TemplateException, IOException, ConfigurationException { final Template template = createTemplate(action); final Map<Object, Object> dataModel = new HashMap<>(); dataModel.putAll(ConfigurationConverter.getMap(configuration)); final StringWriter outputWriter = new StringWriter(); template.process(dataModel, outputWriter); return outputWriter.toString(); }
From source file:com.dattack.dbtools.drules.engine.DefaultEventActionVisitor.java
@Override public void visit(final EventActionEvalJsBean item) { try {//from w w w . java 2 s .c om final Object value = JavaScriptEngine.eval(item.getExpression(), ConfigurationConverter.getMap(ThreadContext.getInstance().getConfiguration())); ThreadContext.getInstance().setProperty(item.getName(), value); } catch (final ScriptException e) { throw new DrulesNestableRuntimeException(e); } }
From source file:com.germinus.easyconf.ComponentProperties.java
/** * Returns a decorator of the configuration that implements the Map * interface. Note that any changes made to this decorator will be made to * the original configuration and viceversa. * //from w w w.j a va 2s .com * @return a <code>java.util.Map</code> instance */ public Map toMap() { return ConfigurationConverter.getMap(properties); }
From source file:com.netflix.explorers.PropertiesGlobalModelContext.java
public PropertiesGlobalModelContext(Properties props) { this.properties = props; environmentName = props.getProperty(PROPERTY_ENVIRONMENT_NAME); currentRegion = props.getProperty(PROPERTY_CURRENT_REGION); applicationVersion = props.getProperty(PROPERTY_APPLICATION_VERSION); applicationName = props.getProperty(PROPERTY_APPLICATION_NAME); isLocal = Boolean.parseBoolean(props.getProperty(PROPERTY_IS_LOCAL, "false")); homePageUrl = props.getProperty(PROPERTY_HOME_PAGE); defaultPort = Short.parseShort(props.getProperty(PROPERTY_DEFAULT_PORT, "8080")); dataCenter = props.getProperty(PROPERTY_DATA_CENTER); defaultExplorerName = props.getProperty(PROPERTY_DEFAULT_EXPLORER); try {//from w w w .j a v a 2 s . c o m Map<Object, Object> dcs = ConfigurationConverter .getMap(ConfigurationConverter.getConfiguration(props).subset(PROPERTIES_PREFIX + ".dc")); for (Entry<Object, Object> dc : dcs.entrySet()) { String key = StringUtils.substringBefore(dc.getKey().toString(), "."); String attr = StringUtils.substringAfter(dc.getKey().toString(), "."); CrossLink link = links.get(key); if (link == null) { link = new CrossLink(); links.put(key, link); } BeanUtils.setProperty(link, attr, dc.getValue()); } } catch (Exception e) { LOG.error("Exception ", e); throw new RuntimeException(e); } }
From source file:com.dattack.dbtools.drules.engine.report.Report.java
private void handle(final AbstractEventActionThrowableBean action, final List<RowData> rowDataList, final String status) { try {//www. j a v a 2s . c om final Map<Object, Object> dataModel = new HashMap<>(); dataModel.putAll(ConfigurationConverter.getMap(ThreadContext.getInstance().getConfiguration())); dataModel.put(PropertyNames.STATUS, status); dataModel.put("rowDataList", rowDataList); dataModel.put(PropertyNames.LOG, log(rowDataList)); final StringWriter outputWriter = new StringWriter(); final Template template = createTemplate(action); template.process(dataModel, outputWriter); append(outputWriter.toString()); } catch (ConfigurationException | IOException | TemplateException e) { LOGGER.warn(e.getMessage(), e); } }
From source file:com.feedzai.fos.impl.weka.config.WekaModelConfig.java
/** * Returns the pool configuration of the scorer. * * @return a map from configuration key to configuration value *///from w w w.j a va2 s . c o m @NotNull public Map<Object, Object> getPoolConfiguration() { return ConfigurationConverter.getMap(configuration.subset(GenericObjectPoolConfig.class.getName())); }
From source file:com.comcast.viper.flume2storm.sink.StormSinkConfiguration.java
/** * Copy constructor/*from w w w.ja va 2 s. c o m*/ * * @param other * the configuration to copy */ public StormSinkConfiguration(final StormSinkConfiguration other) { batchSize = other.batchSize; locationServiceFactoryClassName = other.locationServiceFactoryClassName; serviceProviderSerializationClassName = other.serviceProviderSerializationClassName; connectionParametersFactoryClassName = other.connectionParametersFactoryClassName; eventSenderFactoryClassName = other.eventSenderFactoryClassName; configuration = new MapConfiguration(ConfigurationConverter.getMap(other.configuration)); }
From source file:com.comcast.viper.flume2storm.IntegrationTest.java
@SuppressWarnings("unchecked") protected static final Context configToContext(Configuration configuration) { if (configuration == null) { return new Context(); }/*from ww w.j a v a 2s. co m*/ return new Context(ConfigurationConverter.getMap(configuration)); }
From source file:ninja.i18n.MessagesImpl.java
@Override public Map<Object, Object> getAll(Optional<String> language) { Configuration configuration = getLanguageConfigurationForLocale(language); return ConfigurationConverter.getMap(configuration); }