本文整理汇总了Java中org.apache.commons.configuration2.CompositeConfiguration类的典型用法代码示例。如果您正苦于以下问题:Java CompositeConfiguration类的具体用法?Java CompositeConfiguration怎么用?Java CompositeConfiguration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CompositeConfiguration类属于org.apache.commons.configuration2包,在下文中一共展示了CompositeConfiguration类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getClientConfiguration
import org.apache.commons.configuration2.CompositeConfiguration; //导入依赖的package包/类
public Configuration getClientConfiguration() {
Configuration clientConfig = new CompositeConfiguration();
Iterator<String> iter = getKeys();
while (iter.hasNext()) {
String key = iter.next();
if (key.startsWith(CLIENT_PREFIX)) {
clientConfig.setProperty(key, getProperty(key));
}
}
return clientConfig;
}
开发者ID:level11data,项目名称:databricks-client-java,代码行数:12,代码来源:DatabricksClientConfiguration.java
示例2: create
import org.apache.commons.configuration2.CompositeConfiguration; //导入依赖的package包/类
@VisibleForTesting
Configuration create(String versionPath, String sitePath, String defaultPath) {
CompositeConfiguration composite = new CompositeConfiguration();
try {
createClasspath(versionPath).ifPresent(composite::addConfiguration);
createSystem().ifPresent(composite::addConfiguration);
createFilePath(sitePath).ifPresent(composite::addConfiguration);
createClasspath(defaultPath).ifPresent(composite::addConfiguration);
} catch (Exception e) {
throw new RuntimeException("Failed to load configurations.", e);
}
return composite;
}
开发者ID:after-the-sunrise,项目名称:cryptotrader,代码行数:25,代码来源:ConfigurationProviderImpl.java
示例3: main
import org.apache.commons.configuration2.CompositeConfiguration; //导入依赖的package包/类
/**
* The main method.
*
* @param args
* the arguments
*/
public static void main(String[] args)
{
System.out.println(getFiles(".", "z:\\dev\\yajsw\\..\\yajsw\\*.jar")
.size());
try
{
// String
// fileName=FilenameUtils.separatorsToSystem("C:\\init\\MOBILEguard\\yajsw/lib/jvmstat/*.jar");
// System.out.println("FileName: "+fileName);
CompositeConfiguration compConfig = new CompositeConfiguration();
AbstractConfiguration configuraton = new BaseConfiguration();
compConfig.addConfiguration(new EnvironmentConfiguration());
configuraton.setProperty("wrapper.java.classpath.1",
"${VERSANT_ROOT}/lib/jvi.*jar");
configuraton.setProperty("wrapper.java.classpath.2",
"${GROOVY_HOME}/lib/*.jar");
compConfig.addConfiguration(configuraton);
System.out.println("Configuration: "
+ ConfigurationConverter.getProperties(compConfig));
System.out.println("subset: "
+ ConfigurationConverter.getProperties(compConfig
.subset("wrapper.java")));
// Collection files=FileUtils.getFiles("../..",
// "C:/versant/7_0_1/lib/jvi*.jar");
// Collection collection=
// org.apache.commons.io.FileUtils.listFiles(new File("C:/"),
// new WildcardFileFilter("jvi*.jar"), new
// WildcardFileFilter("*jar"));
// File[] files= new
// File("C:").listFiles((FilenameFilter)FileFilterUtils.nameFileFilter("C:/versant/7_0_1/lib/jvi*.jar"));
//
// FileUtils.getFiles("C:/versant/7_0_1/lib/", "jvi*.jar");
// System.out.println("FileList="+
// FileUtils.getFiles("C:/versant/7_0_1/lib/", "jvi*.jar"));
// java.util.Arrays.asList(files));
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
开发者ID:yajsw,项目名称:yajsw,代码行数:50,代码来源:FileUtils.java
示例4: getSystemConfiguration
import org.apache.commons.configuration2.CompositeConfiguration; //导入依赖的package包/类
public CompositeConfiguration getSystemConfiguration()
{
return _systemConfiguration;
}
开发者ID:yajsw,项目名称:yajsw,代码行数:5,代码来源:YajswConfigurationImpl.java
示例5: createConfiguration
import org.apache.commons.configuration2.CompositeConfiguration; //导入依赖的package包/类
/**
* Create a {@link Configuration} instance,
* composed of multiple configurations which are enumerated in {@link ConfigurationType}.
*
* @return Composite configuration instance.
*/
@VisibleForTesting
AbstractConfiguration createConfiguration() {
CompositeConfiguration composite = new CompositeConfiguration();
ConfigurationType[] types = ConfigurationType.values();
Arrays.stream(types).forEach(s -> s.get().ifPresent(composite::addConfiguration));
return composite;
}
开发者ID:after-the-sunrise,项目名称:bitflyer4j,代码行数:19,代码来源:Bitflyer4jFactory.java
示例6: setConfiguration
import org.apache.commons.configuration2.CompositeConfiguration; //导入依赖的package包/类
/**
* Adds the configuration stored on disk to the current set of parameters. The
* file <code>fileName</code> must be a valid configuration file as per Javas
* <code>Properties</code> class.
*
* @param fileName
*/
public static void setConfiguration(String fileName) {
try {
AptaLogger.log(Level.INFO, Configuration.class, "Reading configuration from file.");
builder = new FileBasedConfigurationBuilder<org.apache.commons.configuration2.FileBasedConfiguration>(
PropertiesConfiguration.class)
.configure(new Parameters().properties().setFileName(fileName)
.setListDelimiterHandler(new DefaultListDelimiterHandler(',')));
// Create a composite configuration which allows to keep user parameters and defaults separated
CompositeConfiguration cc = new CompositeConfiguration();
cc.addConfiguration(builder.getConfiguration(), true); // changes will be saved in the user config
cc.addConfiguration(getDefaultParametersBuilder().getConfiguration(), false);
parameters = cc;
} catch (Exception e) {
AptaLogger.log(Level.SEVERE, Configuration.class,
"Error, could not read configuration file. Please check it for correctness");
AptaLogger.log(Level.SEVERE, Configuration.class, e);
e.printStackTrace();
}
// TODO: Sanity checks!
}
开发者ID:drivenbyentropy,项目名称:aptasuite,代码行数:38,代码来源:Configuration.java
示例7: createConfiguration
import org.apache.commons.configuration2.CompositeConfiguration; //导入依赖的package包/类
/**
* Creates an empty configuration and configures the class
* @param filename location at which the config should be stored in the future
*/
public static void createConfiguration(Path filePath) {
try {
builder = new FileBasedConfigurationBuilder<FileBasedConfiguration>(PropertiesConfiguration.class)
.configure(new Parameters().properties()
//.setFile(filePath.toFile())
.setListDelimiterHandler(new DefaultListDelimiterHandler(',')));
org.apache.commons.configuration2.Configuration userParameters = builder.getConfiguration();
//We need to explicitly save the file before setting it in the builder, for whatever reason...
builder.getFileHandler().save(filePath.toFile());
builder.getFileHandler().setFile(filePath.toFile());
// Create a composite configuration which allows to keep user parameters and defaults separated
CompositeConfiguration cc = new CompositeConfiguration();
cc.addConfiguration(builder.getConfiguration(), true); // changes will be saved in the user config
cc.addConfiguration(getDefaultParametersBuilder().getConfiguration(), false);
parameters = cc;
} catch (Exception e) {
AptaLogger.log(Level.SEVERE, Configuration.class,
"Error, could not create configuration file.");
AptaLogger.log(Level.SEVERE, Configuration.class, e);
e.printStackTrace();
}
}
开发者ID:drivenbyentropy,项目名称:aptasuite,代码行数:38,代码来源:Configuration.java
注:本文中的org.apache.commons.configuration2.CompositeConfiguration类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论