当前位置: 首页>>代码示例>>Java>>正文


Java ExtendedProperties类代码示例

本文整理汇总了Java中org.apache.commons.collections.ExtendedProperties的典型用法代码示例。如果您正苦于以下问题:Java ExtendedProperties类的具体用法?Java ExtendedProperties怎么用?Java ExtendedProperties使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ExtendedProperties类属于org.apache.commons.collections包,在下文中一共展示了ExtendedProperties类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getResourceAsExtendedProperties

import org.apache.commons.collections.ExtendedProperties; //导入依赖的package包/类
public static ExtendedProperties getResourceAsExtendedProperties(String resource) {
    if (StringUtils.isBlank(resource)) {
        return null;
    }
    ExtendedProperties properties = new ExtendedProperties();
    try (InputStream stream = PropertiesHandler.class.getResourceAsStream(resource)) {
        if (stream == null) {
            logger.error("resource " + resource + " is missing");
        } else {
            properties.load(stream);
            logger.info("resource " + resource + " loaded (" + properties.size() + " properties)");
        }
    } catch (Exception ex) {
        logger.fatal(ex);
    }
    return properties;
}
 
开发者ID:proyecto-adalid,项目名称:adalid,代码行数:18,代码来源:PropertiesHandler.java

示例2: init

import org.apache.commons.collections.ExtendedProperties; //导入依赖的package包/类
@Override
public void init(ExtendedProperties configuration) {
	this.resourceLoader = (org.springframework.core.io.ResourceLoader)
			this.rsvc.getApplicationAttribute(SPRING_RESOURCE_LOADER);
	String resourceLoaderPath = (String) this.rsvc.getApplicationAttribute(SPRING_RESOURCE_LOADER_PATH);
	if (this.resourceLoader == null) {
		throw new IllegalArgumentException(
				"'resourceLoader' application attribute must be present for SpringResourceLoader");
	}
	if (resourceLoaderPath == null) {
		throw new IllegalArgumentException(
				"'resourceLoaderPath' application attribute must be present for SpringResourceLoader");
	}
	this.resourceLoaderPaths = StringUtils.commaDelimitedListToStringArray(resourceLoaderPath);
	for (int i = 0; i < this.resourceLoaderPaths.length; i++) {
		String path = this.resourceLoaderPaths[i];
		if (!path.endsWith("/")) {
			this.resourceLoaderPaths[i] = path + "/";
		}
	}
	if (logger.isInfoEnabled()) {
		logger.info("SpringResourceLoader for Velocity: using resource loader [" + this.resourceLoader +
				"] and resource loader paths " + Arrays.asList(this.resourceLoaderPaths));
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:26,代码来源:SpringResourceLoader.java

示例3: 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));
    }
}
 
开发者ID:proyecto-adalid,项目名称:adalid,代码行数:19,代码来源:PropertiesHandler.java

示例4: getExtendedProperties

import org.apache.commons.collections.ExtendedProperties; //导入依赖的package包/类
public static ExtendedProperties getExtendedProperties(File file, Level badFileLogLevel, Level goodFileLogLevel) {
    ExtendedProperties extendedProperties = new ExtendedProperties();
    String filename = file == null ? "" : file.getPath();
    if (file == null) {
        logger.error("null properties file");
    } else if (file.isFile()) {
        try {
            logger.trace("loading " + filename);
            try (InputStream inStream = new FileInputStream(filename)) {
                extendedProperties.load(inStream);
            }
            logger.log(goodFileLogLevel, "file " + filename + " loaded (" + extendedProperties.size() + " properties)");
            printExtendedProperties(extendedProperties);
        } catch (Exception ex) {
            logger.fatal(ThrowableUtils.getString(ex), ex);
        }
    } else {
        logger.log(badFileLogLevel, filename + " does not exist or is not a normal file");
    }
    return extendedProperties;
}
 
开发者ID:proyecto-adalid,项目名称:adalid,代码行数:22,代码来源:PropertiesHandler.java

示例5: deletePreviouslyGeneratedFiles

import org.apache.commons.collections.ExtendedProperties; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private void deletePreviouslyGeneratedFiles(ExtendedProperties properties) {
    String[] stringArray;
    Set<String> stringPropertyNames = properties.keySet();
    for (String name : stringPropertyNames) {
        switch (name) {
            case DO_CASCADED_DELETE:
                stringArray = properties.getStringArray(name);
                deletePreviouslyGeneratedFiles(name, stringArray, true);
                break;
            case DO_ISOLATED_DELETE:
                stringArray = properties.getStringArray(name);
                deletePreviouslyGeneratedFiles(name, stringArray, false);
                break;
        }
    }
}
 
开发者ID:proyecto-adalid,项目名称:adalid,代码行数:18,代码来源:Writer.java

示例6: 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);
    }
}
 
开发者ID:proyecto-adalid,项目名称:adalid,代码行数:17,代码来源:Writer.java

示例7: getArguments

import org.apache.commons.collections.ExtendedProperties; //导入依赖的package包/类
private static String[] getArguments(Class<?> clazz, ExtendedProperties properties, Level level) {
    if (properties == null) {
        logger.log(level, ARGS_FAILED + "; properties is null");
    } else if (properties.isEmpty()) {
        logger.log(level, ARGS_FAILED + "; properties is empty");
    } else {
        String key = clazz.getName() + ARGS_SUFFIX;
        try {
            String[] strings = properties.getStringArray(key);
            if (strings == null || strings.length == 0) {
                logger.log(level, ARGS_FAILED + "; property " + key + " not found");
            } else {
                return strings;
            }
        } catch (Exception e) {
            logger.log(level, ARGS_FAILED + "; " + key + " not properly defined (" + e + ")");
        }
    }
    return null;
}
 
开发者ID:proyecto-adalid,项目名称:adalid,代码行数:21,代码来源:Utility.java

示例8: mergeProperties

import org.apache.commons.collections.ExtendedProperties; //导入依赖的package包/类
/**
 * 合併設定
 * 
 * properties改成使用 extendedProperties 取屬性
 * 
 * @throws Exception
 */
protected void mergeProperties() throws Exception {
	Properties props = new Properties();
	if (this.configLocation != null) {
		LOGGER.info(new StringBuilder().append("Loading config from ").append(this.configLocation).toString());
		PropertiesLoaderUtils.fillProperties(props, this.configLocation);
	}
	if (this.properties != null) {
		LOGGER.info(new StringBuilder().append("Loading config from properties").toString());
		props.putAll(this.properties);
		// 清除原properties,省mem,因之後會使用extendedProperties了
		this.properties.clear();
	}
	//
	if (props.size() > 0) {
		this.extendedProperties = ExtendedProperties.convertProperties(props);
		if (this.extendedProperties.size() > 0) {
			LOGGER.info(new StringBuilder().append("All properties: " + extendedProperties).toString());
		}
	}
}
 
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:28,代码来源:BaseFactoryBeanSupporter.java

示例9: init

import org.apache.commons.collections.ExtendedProperties; //导入依赖的package包/类
public void init( ExtendedProperties configuration)
{
    rsvc.info("FileResourceLoader : initialization starting.");
    
    paths = configuration.getVector("path");
    
    /*
     *  lets tell people what paths we will be using
     */

    int sz = paths.size();

    for( int i=0; i < sz; i++)
    {
        rsvc.info("FileResourceLoader : adding path '" + (String) paths.get(i) + "'");
    }

    rsvc.info("FileResourceLoader : initialization complete.");
}
 
开发者ID:BowlerHatLLC,项目名称:feathers-sdk,代码行数:20,代码来源:FileResourceLoader.java

示例10: 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");
}
 
开发者ID:BowlerHatLLC,项目名称:feathers-sdk,代码行数:27,代码来源:ResourceLoader.java

示例11: setConfiguration

import org.apache.commons.collections.ExtendedProperties; //导入依赖的package包/类
/**
 * Allow an external system to set an ExtendedProperties
 * object to use. This is useful where the external
 * system also uses the ExtendedProperties class and
 * the velocity configuration is a subset of
 * parent application's configuration. This is
 * the case with Turbine.
 *
 * @param ExtendedProperties configuration
 */
public void setConfiguration( ExtendedProperties configuration)
{
    if (overridingProperties == null)
    {
        overridingProperties = configuration;
    }
    else
    {
        // Avoid possible ConcurrentModificationException
        if (overridingProperties != configuration)
        {
            overridingProperties.combine(configuration);
        }
    }
}
 
开发者ID:BowlerHatLLC,项目名称:feathers-sdk,代码行数:26,代码来源:RuntimeInstance.java

示例12: init

import org.apache.commons.collections.ExtendedProperties; //导入依赖的package包/类
@Override
public void init(ExtendedProperties configuration) {
	String[] all = configuration.getStringArray(IncludeKey);
	include = new HashSet<String>();
	match = new HashSet<String>();
	if (all != null) {
		for (String s : all) {
			if (s.endsWith("/*")) {
				match.add(s.substring(0, s.length() - 1));
			} else {
				include.add(s);
			}
		}
	}
	if (log.isTraceEnabled()) {
		log.trace("FixedClasspathResourceLoader : initialization complete with include:"
				+ include);
	}
}
 
开发者ID:xiyelife,项目名称:jresplus,代码行数:20,代码来源:FixedClasspathResourceLoader.java

示例13: 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()));
    }
}
 
开发者ID:stephan-hartmann,项目名称:opencms-rfs-driver,代码行数:25,代码来源:RfsAwareDumpLoader.java

示例14: init

import org.apache.commons.collections.ExtendedProperties; //导入依赖的package包/类
/**
 *  This is abstract in the base class, so we need it.
 *  <br>
 *  NOTE: this expects that the ServletContext has already
 *        been placed in the runtime's application attributes
 *        under its full class name (i.e. "javax.servlet.ServletContext").
 *
 * @param configuration the {@link ExtendedProperties} associated with 
 *        this resource loader.
 */
public void init(ExtendedProperties configuration)
{
  paths = configuration.getStringArray("path");
  if (paths == null || paths.length == 0)
  {
    paths = new String[1];
    paths[0] = "/";
  }
  else
  {
    /* make sure the paths end with a '/' */
    for (int i = 0; i < paths.length; i++)
    {
      if (!paths[i].endsWith("/"))
      {
        paths[i] += '/';
      }
    }
  }
  //My_System.variable("paths", paths);
}
 
开发者ID:approvals,项目名称:ApprovalTests.Java,代码行数:32,代码来源:ServletContextLoader.java

示例15: newVelocityEngine

import org.apache.commons.collections.ExtendedProperties; //导入依赖的package包/类
private static VelocityEngine newVelocityEngine() {
    ExtendedProperties prop = new ExtendedProperties();
    prop.addProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM_CLASS, SimpleLog4JLogSystem.class.getName());
    prop.addProperty("runtime.log.logsystem.log4j.category", "GenerateToString");

    VelocityEngine velocity = new VelocityEngine();
    velocity.setExtendedProperties(prop);
    velocity.init();

    return velocity;
}
 
开发者ID:CeH9,项目名称:PackageTemplates,代码行数:12,代码来源:VelocityHelper.java


注:本文中的org.apache.commons.collections.ExtendedProperties类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。