org.apache.commons.configuration.Configuration.getList()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(9.7k)|赞(0)|评价(0)|浏览(161)

本文整理了Java中org.apache.commons.configuration.Configuration.getList()方法的一些代码示例,展示了Configuration.getList()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Configuration.getList()方法的具体详情如下:
包路径:org.apache.commons.configuration.Configuration
类名称:Configuration
方法名:getList

Configuration.getList介绍

[英]Get a List of strings associated with the given configuration key. If the key doesn't map to an existing object an empty List is returned.
[中]获取与给定配置键关联的字符串列表。如果键未映射到现有对象,则返回空列表。

代码示例

代码示例来源:origin: apache/incubator-pinot

@SuppressWarnings("unchecked")
private List<String> getTableNames() {
 return _brokerRoutingConfig.getList(TABLE_NAME);
}

代码示例来源:origin: apache/incubator-pinot

@SuppressWarnings("unchecked")
public StarTreeV2Metadata(Configuration metadataProperties) {
 _numDocs = metadataProperties.getInt(TOTAL_DOCS);
 _dimensionsSplitOrder = metadataProperties.getList(DIMENSIONS_SPLIT_ORDER);
 _functionColumnPairs = new HashSet<>();
 for (Object functionColumnPair : metadataProperties.getList(FUNCTION_COLUMN_PAIRS)) {
  _functionColumnPairs.add(AggregationFunctionColumnPair.fromColumnName((String) functionColumnPair));
 }
 _maxLeafRecords = metadataProperties.getInt(MAX_LEAF_RECORDS);
 _skipStarNodeCreationForDimensions =
   new HashSet<>(metadataProperties.getList(SKIP_STAR_NODE_CREATION_FOR_DIMENSIONS));
}

代码示例来源:origin: apache/incubator-pinot

@SuppressWarnings("unchecked")
private void loadConfig() {
 if (null == _tableCfg) {
  return;
 }
 _nodeToInstancesMap.clear();
 _numNodes = _tableCfg.getInt(NUM_NODES_PER_REPLICA);
 for (int i = 0; i < _numNodes; i++) {
  _nodeToInstancesMap.put(i, _tableCfg.getList(getKey(SERVERS_FOR_NODE, Integer.toString(i))));
 }
 _defaultServers = _tableCfg.getList(getKey(SERVERS_FOR_NODE, DEFAULT_SERVERS_FOR_NODE));
}

代码示例来源:origin: apache/incubator-gobblin

private static Properties getProperties(Configuration config) {
 Properties props = new Properties();
 char delimiter = (config instanceof AbstractConfiguration)
      ? ((AbstractConfiguration) config).getListDelimiter() : ',';
  Iterator keys = config.getKeys();
  while (keys.hasNext())
  {
   String key = (String) keys.next();
   List list = config.getList(key);
   props.setProperty("flyway." + key, StringUtils.join(list.iterator(), delimiter));
  }
  return props;
}

代码示例来源:origin: apache/incubator-pinot

/**
 * Initiate the segment fetcher factory. This method should only be called once.
 * @param segmentFetcherClassConfig Segment fetcher factory config
 *
 */
public void init(Configuration segmentFetcherClassConfig)
  throws ClassNotFoundException, IllegalAccessException, InstantiationException {
 @SuppressWarnings("unchecked")
 List<String> protocols = segmentFetcherClassConfig.getList(PROTOCOLS_KEY, DEFAULT_PROTOCOLS);
 for (String protocol : protocols) {
  String fetcherClass = segmentFetcherClassConfig
    .getString(protocol + FETCHER_CLASS_KEY_SUFFIX, DEFAULT_FETCHER_CLASS_MAP.get(protocol));
  Preconditions.checkNotNull(fetcherClass, "No fetcher class defined for protocol: " + protocol);
  LOGGER.info("Creating a new segment fetcher for protocol: {} with class: {}", protocol, fetcherClass);
  SegmentFetcher segmentFetcher = (SegmentFetcher) Class.forName(fetcherClass).newInstance();
  LOGGER.info("Initializing segment fetcher for protocol: {}", protocol);
  Configuration segmentFetcherConfig = segmentFetcherClassConfig.subset(protocol);
  logFetcherInitConfig(segmentFetcher, protocol, segmentFetcherConfig);
  segmentFetcher.init(segmentFetcherConfig);
  _segmentFetcherMap.put(protocol, segmentFetcher);
 }
}

代码示例来源:origin: alibaba/yugong

private Collection<TableHolder> initTables() {
  logger.info("check source tables read privileges ...");
  List tableWhiteList = config.getList("yugong.table.white");
  List tableBlackList = config.getList("yugong.table.black");
  boolean isEmpty = true;
  for (Object table : tableWhiteList) {

代码示例来源:origin: apache/servicecomb-java-chassis

@SuppressWarnings("unchecked")
public static List<BasePath> getMicroservicePaths(Configuration configuration) {
 List<BasePath> basePaths = new ArrayList<>();
 for (Object path : configuration.getList("service_description.paths")) {
  BasePath basePath = new BasePath();
  Map<String, ?> pathMap = (Map<String, ?>) path;
  basePath.setPath(buildPath((String) pathMap.get("path")));
  basePath.setProperty((Map<String, String>) pathMap.get("property"));
  basePaths.add(basePath);
 }
 return basePaths;
}

代码示例来源:origin: apache/tinkerpop

public synchronized static void initialize(final Configuration configuration) {
  if (!INITIALIZED) {
    INITIALIZED = true;
    GRYO_POOL = GryoPool.build().
        poolSize(configuration.getInt(GryoPool.CONFIG_IO_GRYO_POOL_SIZE, 256)).
        version(GryoVersion.valueOf(configuration.getString(GryoPool.CONFIG_IO_GRYO_VERSION, GryoPool.CONFIG_IO_GRYO_POOL_VERSION_DEFAULT.name()))).
        ioRegistries(configuration.getList(IoRegistry.IO_REGISTRY, Collections.emptyList())).
        initializeMapper(m -> m.registrationRequired(false)).
        create();
  }
}

代码示例来源:origin: apache/tinkerpop

settings.hosts = conf.getList("hosts").stream().map(Object::toString).collect(Collectors.toList());
  cpSettings.sslEnabledProtocols = connectionPoolConf.getList("sslEnabledProtocols").stream().map(Object::toString)
      .collect(Collectors.toList());
  cpSettings.sslCipherSuites = connectionPoolConf.getList("sslCipherSuites").stream().map(Object::toString)
      .collect(Collectors.toList());

代码示例来源:origin: apache/tinkerpop

public GryoSerializer(final SparkConf sparkConfiguration) {
  final long bufferSizeKb = sparkConfiguration.getSizeAsKb("spark.kryoserializer.buffer", "64k");
  final long maxBufferSizeMb = sparkConfiguration.getSizeAsMb("spark.kryoserializer.buffer.max", "64m");
  this.referenceTracking = sparkConfiguration.getBoolean("spark.kryo.referenceTracking", true);
  this.registrationRequired = sparkConfiguration.getBoolean(Constants.SPARK_KRYO_REGISTRATION_REQUIRED, false);
  if (bufferSizeKb >= ByteUnit.GiB.toKiB(2L)) {
    throw new IllegalArgumentException("spark.kryoserializer.buffer must be less than 2048 mb, got: " + bufferSizeKb + " mb.");
  } else {
    this.bufferSize = (int) ByteUnit.KiB.toBytes(bufferSizeKb);
    if (maxBufferSizeMb >= ByteUnit.GiB.toMiB(2L)) {
      throw new IllegalArgumentException("spark.kryoserializer.buffer.max must be less than 2048 mb, got: " + maxBufferSizeMb + " mb.");
    } else {
      this.maxBufferSize = (int) ByteUnit.MiB.toBytes(maxBufferSizeMb);
      //this.userRegistrator = sparkConfiguration.getOption("spark.kryo.registrator");
    }
  }
  // create a GryoPool and store it in static HadoopPools
  final List<Object> ioRegistries = new ArrayList<>();
  ioRegistries.addAll(makeApacheConfiguration(sparkConfiguration).getList(IoRegistry.IO_REGISTRY, Collections.emptyList()));
  ioRegistries.add(SparkIoRegistry.class.getCanonicalName().replace("." + SparkIoRegistry.class.getSimpleName(), "$" + SparkIoRegistry.class.getSimpleName()));
  HadoopPools.initialize(GryoPool.build().
      version(GryoVersion.valueOf(sparkConfiguration.get(GryoPool.CONFIG_IO_GRYO_VERSION, GryoPool.CONFIG_IO_GRYO_POOL_VERSION_DEFAULT.name()))).
      poolSize(sparkConfiguration.getInt(GryoPool.CONFIG_IO_GRYO_POOL_SIZE, GryoPool.CONFIG_IO_GRYO_POOL_SIZE_DEFAULT)).
      ioRegistries(ioRegistries).
      initializeMapper(builder ->
          builder.referenceTracking(this.referenceTracking).
              registrationRequired(this.registrationRequired)).
      create());
}

代码示例来源:origin: org.jboss.forge/forge-shell

@Override
public List<?> getList(final String key, final List<?> defaultValue)
{
 return delegate.getList(key, defaultValue);
}

代码示例来源:origin: com.tinkerpop/gremlin-core

public static <T> T deserialize(final Configuration configuration, final String key) throws IOException, ClassNotFoundException {
  final List byteList = configuration.getList(key);
  byte[] bytes = new byte[byteList.size()];
  for (int i = 0; i < byteList.size(); i++) {
    bytes[i] = Byte.valueOf(byteList.get(i).toString().replace("[", "").replace("]", ""));
  }
  return (T) Serializer.deserializeObject(bytes);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-configuration

public Object get(String name, int index)
{
  if (!checkIndexedProperty(name))
  {
    throw new IllegalArgumentException("Property '" + name
        + "' is not indexed.");
  }
  List<Object> list = getConfiguration().getList(name);
  return list.get(index);
}

代码示例来源:origin: OpenNMS/opennms

@SuppressWarnings("unchecked")
public List<Integer> getValidClosedStateId() {
  
  List<String> closedStateId = getProperties().getList("otrs.validclosedstateid");
  return stringToInt(closedStateId);
  
}

代码示例来源:origin: OpenNMS/opennms

@SuppressWarnings("unchecked")
public List<Integer> getValidOpenStateId() {
  
  List<String> openStateId = getProperties().getList("otrs.validopenstateid");
  return stringToInt(openStateId);
  
}

代码示例来源:origin: OpenNMS/opennms

@SuppressWarnings("unchecked")
@Override
public List<String> getValidClosedStatus() {
  return getProperties().getList(getPrefix() + ".validclosedstatus");
}

代码示例来源:origin: OpenNMS/opennms

@SuppressWarnings("unchecked")
@Override
public List<String> getValidOpenStatus() {
  return getProperties().getList(getPrefix() + ".validopenstatus");
}

代码示例来源:origin: OpenNMS/opennms

@SuppressWarnings("unchecked")
public List<Integer> getValidCancelledStateId() {
  
  List<String> cancelledStateId = getProperties().getList("otrs.validcancelledstateid");
  return stringToInt(cancelledStateId);
  
}

代码示例来源:origin: org.opennms.features/org.opennms.features.request-tracker

@SuppressWarnings("unchecked")
@Override
public List<String> getValidOpenStatus() {
  return getProperties().getList(getPrefix() + ".validopenstatus");
}

代码示例来源:origin: org.apache.marmotta/marmotta-core

@Override
public List<Object> getList(String key, List<?> defaultValue) {
  final Configuration mem = getInMemoryConfiguration();
  if (mem.containsKey(key))
    return mem.getList(key, defaultValue);
  else
    return super.getList(key, defaultValue);
}

相关文章