本文整理汇总了Java中org.apache.commons.collections.ExtendedProperties.getString方法的典型用法代码示例。如果您正苦于以下问题:Java ExtendedProperties.getString方法的具体用法?Java ExtendedProperties.getString怎么用?Java ExtendedProperties.getString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.collections.ExtendedProperties
的用法示例。
在下文中一共展示了ExtendedProperties.getString方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: log
import org.apache.commons.collections.ExtendedProperties; //导入方法依赖的package包/类
private static void log(ExtendedProperties properties, Level level) {
Object next;
Set<String> names = new TreeSet<>();
Iterator iterator = properties.getKeys();
if (iterator != null) {
while (iterator.hasNext()) {
next = iterator.next();
if (next instanceof String) {
names.add((String) next);
}
}
}
String value;
for (String name : names) {
value = properties.getString(name);
logger.log(level, name + " = " + (StringUtils.containsIgnoreCase(name, "password") ? "***" : value));
}
}
示例2: getPredicate
import org.apache.commons.collections.ExtendedProperties; //导入方法依赖的package包/类
private Predicate getPredicate(ExtendedProperties properties, List<Predicate> predicates, String keyPreffix) {
String key = keyPreffix + ".predicate.join";
String operator = properties.getString(key, "all");
String[] operators = new String[]{"all", "any", "none", "one"};
int i = ArrayUtils.indexOf(operators, operator.toLowerCase());
switch (i) {
case 1:
return PredicateUtils.anyPredicate(predicates);
case 2:
return PredicateUtils.nonePredicate(predicates);
case 3:
return PredicateUtils.onePredicate(predicates);
default:
return PredicateUtils.allPredicate(predicates);
}
}
示例3: commonInit
import org.apache.commons.collections.ExtendedProperties; //导入方法依赖的package包/类
/**
* This initialization is used by all resource
* loaders and must be called to set up common
* properties shared by all resource loaders
*/
public void commonInit( RuntimeServices rs, ExtendedProperties configuration)
{
this.rsvc = rs;
/*
* these two properties are not required for all loaders.
* For example, for ClasspathLoader, what would cache mean?
* so adding default values which I think are the safest
*
* don't cache, and modCheckInterval irrelevant...
*/
isCachingOn = configuration.getBoolean("cache", false);
modificationCheckInterval = configuration.getLong("modificationCheckInterval", 0);
/*
* this is a must!
*/
className = configuration.getString("class");
}
示例4: initConfiguration
import org.apache.commons.collections.ExtendedProperties; //导入方法依赖的package包/类
/**
* @see org.opencms.configuration.I_CmsConfigurationParameterHandler#initConfiguration()
*/
public void initConfiguration() {
ExtendedProperties config = new ExtendedProperties();
config.putAll(m_configuration);
String maxAge = config.getString("client.cache.maxage");
if (maxAge == null) {
m_clientCacheMaxAge = -1;
} else {
m_clientCacheMaxAge = Long.parseLong(maxAge);
}
if (CmsLog.INIT.isInfoEnabled()) {
if (maxAge != null) {
CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_CLIENT_CACHE_MAX_AGE_1, maxAge));
}
CmsLog.INIT.info(Messages.get().getBundle().key(
Messages.INIT_LOADER_INITIALIZED_1,
this.getClass().getName()));
}
}
示例5: ForEach
import org.apache.commons.collections.ExtendedProperties; //导入方法依赖的package包/类
private ForEach(File templatePropertiesFile) {
ExtendedProperties templateExtendedProperties = PropertiesHandler.getExtendedProperties(templatePropertiesFile);
string = templateExtendedProperties.getString(TP_FOR_EACH);
String[] tokens = StringUtils.split(string, '.');
if (tokens != null) {
String token;
ForEachVariable variable;
ForEachVariable previous;
Map<String, ForEachVariable> variables = new LinkedHashMap<>();
for (int i = 0; i < tokens.length; i++) {
token = tokens[i];
if (variables.containsKey(token)) {
String pattern = "{0} (token \"{1}\" is used more than once)";
String message = MessageFormat.format(pattern, string, token);
throw new IllegalArgumentException(message);
}
variable = new ForEachVariable();
variable.token = token;
variable.getter = templateExtendedProperties.getString(token + ".getter");
variable.predicate = getPredicate(templateExtendedProperties, token);
variable.comparator = getComparator(templateExtendedProperties, token);
if (i == 0) {
start = variable;
} else {
previous = variables.get(tokens[i - 1]);
previous.next = variable;
}
variables.put(token, variable);
}
}
}
示例6: init
import org.apache.commons.collections.ExtendedProperties; //导入方法依赖的package包/类
public void init( ExtendedProperties configuration)
{
dataSourceName = configuration.getString("resource.datasource");
tableName = configuration.getString("resource.table");
keyColumn = configuration.getString("resource.keycolumn");
templateColumn = configuration.getString("resource.templatecolumn");
timestampColumn = configuration.getString("resource.timestampcolumn");
Runtime.info("Resources Loaded From: " + dataSourceName + "/" + tableName);
Runtime.info( "Resource Loader using columns: " + keyColumn + ", "
+ templateColumn + " and " + timestampColumn);
Runtime.info("Resource Loader Initalized.");
}
示例7: setContextProperties
import org.apache.commons.collections.ExtendedProperties; //导入方法依赖的package包/类
/**
* Set the context properties that will be
* fed into the initial context be the
* generating process starts.
*/
public void setContextProperties( String file )
{
String[] sources = StringUtils.split(file,",");
contextProperties = new ExtendedProperties();
// Always try to get the context properties resource
// from a file first. Templates may be taken from a JAR
// file but the context properties resource may be a
// resource in the filesystem. If this fails than attempt
// to get the context properties resource from the
// classpath.
for (int i = 0; i < sources.length; i++)
{
ExtendedProperties source = new ExtendedProperties();
try
{
// resolve relative path from basedir and leave
// absolute path untouched.
File fullPath = project.resolveFile(sources[i]);
log("Using contextProperties file: " + fullPath);
source.load(new FileInputStream(fullPath));
}
catch (Exception e)
{
ClassLoader classLoader = this.getClass().getClassLoader();
try
{
InputStream inputStream = classLoader.getResourceAsStream(sources[i]);
if (inputStream == null)
{
throw new BuildException("Context properties file " + sources[i] +
" could not be found in the file system or on the classpath!");
}
else
{
source.load(inputStream);
}
}
catch (IOException ioe)
{
source = null;
}
}
Iterator j = source.getKeys();
while (j.hasNext())
{
String name = (String) j.next();
String value = source.getString(name);
contextProperties.setProperty(name,value);
}
}
}
示例8: init
import org.apache.commons.collections.ExtendedProperties; //导入方法依赖的package包/类
@Override
public void init(ExtendedProperties configuration) {
prefix = configuration.getString("prefix", "");
}
示例9: createModule
import org.apache.commons.collections.ExtendedProperties; //导入方法依赖的package包/类
protected ButterflyModule createModule(String name) {
_logger.trace("> Creating module: {}", name);
if (_modulesByName.containsKey(name)) {
_logger.trace("< Module '{}' already exists", name);
return _modulesByName.get(name);
}
ExtendedProperties p = _moduleProperties.get(name);
File path = new File(p.getString(PATH_PROP));
_logger.debug("Module path: {}", path);
File classes = new File(path,"MOD-INF/classes");
if (classes.exists()) {
_classLoader.addRepository(classes);
}
File libs = new File(path,"MOD-INF/lib");
if (libs.exists()) {
_classLoader.addRepository(libs);
}
ButterflyModule m = new ButterflyModuleImpl();
// process module's controller
String manager = p.getString("module-impl");
if (manager != null && !manager.equals(m.getClass().getName())) {
try {
Class<?> c = _classLoader.loadClass(manager);
m = (ButterflyModule) c.newInstance();
} catch (Exception e) {
_logger.error("Error loading special module manager", e);
}
}
m.setName(name);
m.setPath(path);
m.setModules(_modulesByName);
m.setMounter(_mounter);
m.setClassLoader(_classLoader);
m.setTimer(_timer);
_modulesByName.put(name,m);
// process inheritance
ButterflyModule parentModule = null;
String parentName = p.getString(extendsProperty);
if (parentName != null) {
if (_moduleProperties.containsKey(parentName)) {
if (_modulesByName.containsKey(parentName)) {
parentModule = _modulesByName.get(parentName);
} else {
parentModule = createModule(parentName);
}
} else {
throw new RuntimeException("Cannot wire module '" + name + "' because the extended module '" + parentName + "' is not defined.");
}
}
if (parentModule != null) {
m.setExtended(parentModule);
parentModule.addExtendedBy(m);
}
_logger.trace("< Creating module: {}", name);
return m;
}