本文整理汇总了Java中org.apache.commons.configuration2.builder.fluent.Configurations.properties方法的典型用法代码示例。如果您正苦于以下问题:Java Configurations.properties方法的具体用法?Java Configurations.properties怎么用?Java Configurations.properties使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.configuration2.builder.fluent.Configurations
的用法示例。
在下文中一共展示了Configurations.properties方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: get
import org.apache.commons.configuration2.builder.fluent.Configurations; //导入方法依赖的package包/类
@Override
public Configuration get() {
Configurations configs = new Configurations();
try {
return configs.properties(new File(getPropertyFilePath()));
} catch (ConfigurationException e) {
log.error(" error on build configuration", e);
throw new IllegalStateException(e);
}
}
示例2: Config
import org.apache.commons.configuration2.builder.fluent.Configurations; //导入方法依赖的package包/类
/**
* Read config file and store in {@code Config}.
*
* @param configFile the config file.
* @throws ConfigurationException - if an error occurred when loading the configuration
* @throws BiremeException - wrap and throw Exception which cannot be handled
*/
public Config(String configFile) throws ConfigurationException, BiremeException {
Configurations configs = new Configurations();
config = configs.properties(new File(configFile));
basicConfig();
connectionConfig("target");
dataSourceConfig();
logConfig();
}
示例3: fetchTableMap
import org.apache.commons.configuration2.builder.fluent.Configurations; //导入方法依赖的package包/类
private HashMap<String, String> fetchTableMap(String dataSource)
throws ConfigurationException, BiremeException {
Configurations configs = new Configurations();
Configuration tableConfig = null;
tableConfig = configs.properties(new File(DEFAULT_TABLEMAP_DIR + dataSource + ".properties"));
String originTable, mappedTable;
HashMap<String, String> localTableMap = new HashMap<String, String>();
Iterator<String> tables = tableConfig.getKeys();
while (tables.hasNext()) {
originTable = tables.next();
mappedTable = tableConfig.getString(originTable);
if (originTable.split("\\.").length != 2 || mappedTable.split("\\.").length != 2) {
String message = "Wrong format: " + originTable + ", " + mappedTable;
logger.fatal(message);
throw new BiremeException(message);
}
localTableMap.put(dataSource + "." + originTable, mappedTable);
if (!tableMap.values().contains(mappedTable)) {
loadersCount++;
}
tableMap.put(dataSource + "." + originTable, mappedTable);
}
return localTableMap;
}
示例4: Config
import org.apache.commons.configuration2.builder.fluent.Configurations; //导入方法依赖的package包/类
private Config() {
Configuration configuration;
try {
Configurations configurations = new Configurations();
configuration = configurations.properties(new File("configuration.properties"));
} catch (ConfigurationException ce) {
ce.printStackTrace();
configuration = null;
}
this.properties = configuration;
this.initSuccess = configuration != null;
}
示例5: DoctorKafkaConfig
import org.apache.commons.configuration2.builder.fluent.Configurations; //导入方法依赖的package包/类
public DoctorKafkaConfig(String configPath) throws Exception {
try {
Configurations configurations = new Configurations();
configuration = configurations.properties(new File(configPath));
operatorConfiguration = new SubsetConfiguration(configuration, DOCTORKAFKA_PREFIX);
this.initialize();
} catch (Exception e) {
LOG.error("Failed to initialize configuration file {}", configPath, e);
}
}
示例6: getDefaultConfiguration
import org.apache.commons.configuration2.builder.fluent.Configurations; //导入方法依赖的package包/类
/**
* Loads the default properties from the classpath.
*
* @return the default properties
*/
private Configuration getDefaultConfiguration() {
Configurations configs = new Configurations();
try {
return configs.properties(PROPERTIES_DEFAULT);
} catch (ConfigurationException e) {
throw new RuntimeException(String.format("Can't load default properties '%s'", PROPERTIES_DEFAULT), e);
}
}
示例7: swagger2MarkupConfigFromCommonsConfiguration
import org.apache.commons.configuration2.builder.fluent.Configurations; //导入方法依赖的package包/类
public void swagger2MarkupConfigFromCommonsConfiguration() throws IOException, ConfigurationException {
Path localSwaggerFile = Paths.get("/path/to/swagger.yaml");
// tag::swagger2MarkupConfigFromCommonsConfiguration[]
Configurations configs = new Configurations();
Configuration configuration = configs.properties("config.properties"); //<1>
Swagger2MarkupConfig config = new Swagger2MarkupConfigBuilder(configuration) //<2>
.build();
Swagger2MarkupConverter converter = Swagger2MarkupConverter.from(localSwaggerFile)
.withConfig(config)
.build();
// end::swagger2MarkupConfigFromCommonsConfiguration[]
}
示例8: run
import org.apache.commons.configuration2.builder.fluent.Configurations; //导入方法依赖的package包/类
public void run() {
Swagger2MarkupConfig swagger2MarkupConfig = null;
if(StringUtils.isNotBlank(configFile)) {
Configurations configs = new Configurations();
Configuration config;
try {
config = configs.properties(configFile);
} catch (ConfigurationException e) {
throw new IllegalArgumentException("Failed to read configFile", e);
}
swagger2MarkupConfig = new Swagger2MarkupConfigBuilder(config).build();
}
Swagger2MarkupConverter.Builder converterBuilder = Swagger2MarkupConverter.from(URIUtils.create(swaggerInput));
if(swagger2MarkupConfig != null){
converterBuilder.withConfig(swagger2MarkupConfig);
}
Swagger2MarkupConverter converter = converterBuilder.build();
if(StringUtils.isNotBlank(outputFile)){
converter.toFile(Paths.get(outputFile).toAbsolutePath());
}else if (StringUtils.isNotBlank(outputDir)){
converter.toFolder(Paths.get(outputDir).toAbsolutePath());
}else {
throw new IllegalArgumentException("Either outputFile or outputDir option must be used");
}
}
示例9: ApacheCommonsConfigFile
import org.apache.commons.configuration2.builder.fluent.Configurations; //导入方法依赖的package包/类
/**
* only used for unit testing -- loads
* @param heapSpankPropertiesFile
* @throws ConfigurationException
* @throws MultiPropertyException
*/
public ApacheCommonsConfigFile(File heapSpankPropertiesFile) throws ConfigurationException, MultiPropertyException {
Configurations configurations = new Configurations();
PropertiesConfiguration config = configurations.properties(heapSpankPropertiesFile);
this.compositeConfiguration.addConfiguration( config );
}