Java 类org.apache.commons.configuration.ConfigurationMap 实例源码

项目:test.rockitizer    文件:PayloadReplacer.java   
public static void interpolate(File file)  {
    String content;
    try {
        content = new String(Files.readAllBytes(file.toPath()));
        String replace = StrSubstitutor.replace(content, new ConfigurationMap( configuration()));
        Files.write(file.toPath(), replace.getBytes());

    } catch (IOException e) {
        LOGGER.error( file  +  " interpolation error ", e);

    }

}
项目:ee-config    文件:ResolverFactory.java   
/**
 * Get the properties used to bootstrap the resolver
 * 
 * @param resolver
 * @return
 */
public Map<Object, Object> getBootstrapProperties(ResolverWrapper resolver) {
    // return empty map
    if(resolver.bootstrap() == null) {
        return Collections.emptyMap();  
    }

    // get configuration wrapper
    ConfigurationWrapper wrapper = WrapperFactory.wrap(resolver.bootstrap());

    // bail early if nothing to do
    if(wrapper.sources() == null || wrapper.sources().length == 0) {
        return Collections.emptyMap();
    }

    // obtain instance of CommonsConfiguration provider
    CommonsConfigurationProducer instance = this.producer.get();

    // get commons configuration object from bootstrap
    org.apache.commons.configuration.Configuration config = instance.getConfiguration(wrapper);

    // wrap as map and return
    ConfigurationMap map = new ConfigurationMap(config);
    return map;
}
项目:qaf    文件:JavaStep.java   
private Object getPropValue(String pname) {
    Object o = getBundle().subset(pname);
    if (o instanceof HierarchicalConfiguration && ((HierarchicalConfiguration) o).getRoot().getValue() == null
            && ((HierarchicalConfiguration) o).getRoot().getChildrenCount() > 0) {
        return new ConfigurationMap(getBundle().subset(pname));
    }
    return getBundle().getObject(pname);
}
项目:qaf    文件:UiDriverFactory.java   
@SuppressWarnings("unchecked")
private DesiredCapabilities getDesiredCapabilities() {
    Map<String, Object> capabilities =
            new HashMap<String, Object>(desiredCapabilities.asMap());
    Gson gson = new GsonBuilder().create();

    // capabilities provided for all driver
    Map<String, Object> extraCapabilities =
            gson.fromJson(ApplicationProperties.DRIVER_ADDITIONAL_CAPABILITIES
                    .getStringVal("{}"), Map.class);
    capabilities.putAll(extraCapabilities);

    // individual capability property for all driver
    Configuration config = ConfigurationManager.getBundle()
            .subset(ApplicationProperties.DRIVER_CAPABILITY_PREFIX.key);
    capabilities.putAll(new ConfigurationMap(config));
    // capabilities specific to this driver
    String driverCapsKey = String.format(
            ApplicationProperties.DRIVER_ADDITIONAL_CAPABILITIES_FORMAT.key,
            name());
    extraCapabilities = gson.fromJson(
            ConfigurationManager.getBundle().getString(driverCapsKey, "{}"),
            Map.class);
    capabilities.putAll(extraCapabilities);
    // individual capability property with driver name prefix
    String driverCapKey = String.format(
            ApplicationProperties.DRIVER_CAPABILITY_PREFIX_FORMAT.key,
            browserName);
    config = ConfigurationManager.getBundle().subset(driverCapKey);
    capabilities.putAll(new ConfigurationMap(config));

    Object driverclass = capabilities
            .get(ApplicationProperties.CAPABILITY_NAME_DRIVER_CLASS.key);
    if (null == driverclass) {// backward compatibility only
        driverclass = capabilities.get("driver.class");
    }
    if (null != driverclass) {
        try {
            driverCls = (Class<? extends WebDriver>) Class
                    .forName(String.valueOf(driverclass));
        } catch (Exception e) {
            // throw new AutomationError(e);
        }
    }

    return new DesiredCapabilities(capabilities);
}