本文整理匯總了Java中org.apache.commons.configuration.HierarchicalConfiguration.getList方法的典型用法代碼示例。如果您正苦於以下問題:Java HierarchicalConfiguration.getList方法的具體用法?Java HierarchicalConfiguration.getList怎麽用?Java HierarchicalConfiguration.getList使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.commons.configuration.HierarchicalConfiguration
的用法示例。
在下文中一共展示了HierarchicalConfiguration.getList方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getLocalList
import org.apache.commons.configuration.HierarchicalConfiguration; //導入方法依賴的package包/類
/**
*
* @param config Preferred configuration
* @param altConfig Alternative configuration
* @param inPath XML path
* @param defaultList List of default values to return if none found in config
* @return
*/
private static List<String> getLocalList(HierarchicalConfiguration config, HierarchicalConfiguration altConfig, String inPath,
List<String> defaultList) {
if (config == null) {
throw new IllegalArgumentException("config may not be null");
}
List<Object> objects = config.getList(inPath, altConfig == null ? null : altConfig.getList(inPath, defaultList));
if (objects != null && !objects.isEmpty()) {
List<String> ret = new ArrayList<>(objects.size());
for (Object obj : objects) {
ret.add((String) obj);
}
return ret;
}
return new ArrayList<>(0);
}
示例2: getCollectionBlacklist
import org.apache.commons.configuration.HierarchicalConfiguration; //導入方法依賴的package包/類
/**
* Returns collection names to be omitted from search results, listings etc. from config_viewer.xml
*
* @return
* @should return all key-value pairs
*/
public List<String> getCollectionBlacklist() {
List<String> ret = new ArrayList<>();
if (viewerConfig == null) {
logger.error("Viewer config not loaded, cannot read collection blacklist.");
return ret;
}
List<HierarchicalConfiguration> templates = viewerConfig.configurationsAt("collections.collection");
if (templates != null && !templates.isEmpty()) {
for (Iterator<HierarchicalConfiguration> it = templates.iterator(); it.hasNext();) {
HierarchicalConfiguration sub = it.next();
String field = sub.getString("[@field]");
List<Object> collections = sub.getList("blacklist.collection");
for (Object o : collections) {
ret.add(field + ":" + (String) o);
}
}
}
return ret;
}
示例3: fillGenreMap
import org.apache.commons.configuration.HierarchicalConfiguration; //導入方法依賴的package包/類
private static void fillGenreMap(String xmlGenreFilename) {
File xmlGenreFile = new File(xmlGenreFilename);
if (xmlGenreFile.exists() && xmlGenreFile.isFile() && xmlGenreFilename.toUpperCase().endsWith("XML")) {
try {
XMLConfiguration c = new XMLConfiguration(xmlGenreFile);
List<HierarchicalConfiguration> genres = c.configurationsAt("genre");
for (HierarchicalConfiguration genre : genres) {
String masterGenre = genre.getString(LIT_NAME);
LOG.trace("New masterGenre parsed : (" + masterGenre + ")");
List<Object> subgenres = genre.getList("subgenre");
for (Object subgenre : subgenres) {
LOG.trace("New genre added to map : (" + subgenre + "," + masterGenre + ")");
GENRES_MAP.put((String) subgenre, masterGenre);
}
}
} catch (ConfigurationException error) {
LOG.error("Failed parsing moviejukebox genre input file: {}", xmlGenreFile.getName());
LOG.error(SystemTools.getStackTrace(error));
}
} else {
LOG.error("The moviejukebox genre input file you specified is invalid: {}", xmlGenreFile.getName());
}
}
示例4: buildStoreConfig
import org.apache.commons.configuration.HierarchicalConfiguration; //導入方法依賴的package包/類
private StoreConfig buildStoreConfig(HierarchicalConfiguration configuration) {
StringBuilder sb = new StringBuilder();
String name = configuration.getString("name");
if ( name == null ) sb.append("store name is not defined ");
String path = configuration.getString("path","data");
String filename = configuration.getString("filename", name);
boolean delay = configuration.getBoolean("delay", true);
int mode = configuration.getInt("mode", 0);
int freq = configuration.getInt("freq", this.freq == 0 ? 1 : this.freq );
int batchSize = configuration.getInt("batchSize", 10);
String logPath = configuration.getString("logPath","log");
List<String> replicaUrl = configuration.getList("replicaUrl");
long replciaTimeout = configuration.getLong("replicaTimeout", 60000);
if (replicaUrl == null ) sb.append("no replicaUrl is defined");
boolean sorted = configuration.getBoolean("sorted", false);
if ( sb.length() > 0 ) {
throw new RuntimeException("error on buildStoreConfig "+sb.toString());
}
else {
StoreConfig storeConfig = new StoreConfig(name, path, freq, replicaUrl, batchSize, delay, mode, sorted);
storeConfig.setGetTriggerName( configuration.getString("getTrigger"));
storeConfig.setPutTriggerName( configuration.getString("putTrigger"));
storeConfig.setDeleteTriggerName( configuration.getString("deleteTrigger"));
storeConfig.setUseMaxCache(configuration.getBoolean("useMaxCache", false));
storeConfig.setMaxCacheMemory(configuration.getInt("maxCacheMemory", 20000));
storeConfig.setUseLRU(configuration.getBoolean("useLRU", false));
storeConfig.setLogPath( logPath);
storeConfig.setReplicaTimeout( replciaTimeout);
//add pstReplicaURl
storeConfig.setPstReplicaUrl( configuration.getList("pstReplicaUrl"));
storeConfig.setSerializeClass(configuration.getString("serializeClass"));
return storeConfig ;
}
}
示例5: readIntermediateGMLFile
import org.apache.commons.configuration.HierarchicalConfiguration; //導入方法依賴的package包/類
public void readIntermediateGMLFile() throws IOException{
XMLConfiguration configuration = getConfiguration();
try {
configuration.load(new File(_intermediateGMLInputFile));
System.out.println("reading the partitioned gml information from " + _intermediateGMLInputFile);
} catch (ConfigurationException e) {
throw new RuntimeException(e);
}
List<HierarchicalConfiguration> subConfigurationCollection;
int partitionId;
List<Object> instanceObjectCollection;
List<Path> instancePaths;
subConfigurationCollection = configuration.configurationsAt("partition");
for(HierarchicalConfiguration subConfig : subConfigurationCollection){
partitionId = subConfig.getInt("[@id]");
_partitionedTemplates.put(partitionId, Paths.get(subConfig.getString("template")));
instanceObjectCollection = subConfig.getList("instances.instance");
instancePaths = new LinkedList<>();
for(Object instanceObj : instanceObjectCollection){
instancePaths.add(Paths.get(instanceObj.toString()));
}
_partitionedInstances.put(partitionId, instancePaths);
}
}
示例6: fillCertificationMap
import org.apache.commons.configuration.HierarchicalConfiguration; //導入方法依賴的package包/類
private static void fillCertificationMap(String xmlCertificationFilename) {
File xmlCertificationFile = new File(xmlCertificationFilename);
if (xmlCertificationFile.exists() && xmlCertificationFile.isFile() && xmlCertificationFilename.toUpperCase().endsWith("XML")) {
try {
XMLConfiguration conf = new XMLConfiguration(xmlCertificationFile);
List<HierarchicalConfiguration> certifications = conf.configurationsAt("certification");
for (HierarchicalConfiguration certification : certifications) {
String masterCertification = certification.getString(LIT_NAME);
List<Object> subcertifications = certification.getList("subcertification");
for (Object subcertification : subcertifications) {
CERTIFICATIONS_MAP.put((String) subcertification, masterCertification);
}
}
if (conf.containsKey("default")) {
defaultCertification = conf.getString("default");
LOG.info("Found default certification: {}", defaultCertification);
}
} catch (ConfigurationException error) {
LOG.error("Failed parsing moviejukebox certification input file: {}", xmlCertificationFile.getName());
LOG.error(SystemTools.getStackTrace(error));
}
} else {
LOG.error("The moviejukebox certification input file you specified is invalid: {}", xmlCertificationFile.getName());
}
}
示例7: iterString
import org.apache.commons.configuration.HierarchicalConfiguration; //導入方法依賴的package包/類
private static ImmutableList<String> iterString(HierarchicalConfiguration c, String path) {
List<String> list = c.getList(path);
return list != null ? ListAdapter.adapt(list).toImmutable() : Lists.immutable.<String>empty();
}