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


Java SimpleConfiguration.getString方法代码示例

本文整理汇总了Java中org.apache.fluo.api.config.SimpleConfiguration.getString方法的典型用法代码示例。如果您正苦于以下问题:Java SimpleConfiguration.getString方法的具体用法?Java SimpleConfiguration.getString怎么用?Java SimpleConfiguration.getString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.fluo.api.config.SimpleConfiguration的用法示例。


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

示例1: getConfiguredOptimizations

import org.apache.fluo.api.config.SimpleConfiguration; //导入方法依赖的package包/类
/**
 * A utility method to get all registered table optimizations. Many recipes will automatically
 * register table optimizations when configured.
 */
public static TableOptimizations getConfiguredOptimizations(FluoConfiguration fluoConfig) {
  try (FluoClient client = FluoFactory.newClient(fluoConfig)) {
    SimpleConfiguration appConfig = client.getAppConfiguration();
    TableOptimizations tableOptim = new TableOptimizations();

    SimpleConfiguration subset = appConfig.subset(PREFIX.substring(0, PREFIX.length() - 1));
    Iterator<String> keys = subset.getKeys();
    while (keys.hasNext()) {
      String key = keys.next();
      String clazz = subset.getString(key);
      try {
        TableOptimizationsFactory factory =
            Class.forName(clazz).asSubclass(TableOptimizationsFactory.class).newInstance();
        tableOptim.merge(factory.getTableOptimizations(key, appConfig));
      } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
        throw new RuntimeException(e);
      }
    }

    return tableOptim;
  }
}
 
开发者ID:apache,项目名称:fluo-recipes,代码行数:27,代码来源:TableOptimizations.java

示例2: start

import org.apache.fluo.api.config.SimpleConfiguration; //导入方法依赖的package包/类
@Override
public List<AutoCloseable> start(Params params) {
  SimpleConfiguration config =
      new FluoConfiguration(params.getConfiguration()).getReporterConfiguration("graphite");

  if (!config.getBoolean("enable", false)) {
    return Collections.emptyList();
  }

  String host = config.getString("host");
  String prefix = config.getString("prefix", "");
  int port = config.getInt("port", 8080);
  TimeUnit rateUnit = TimeUnit.valueOf(config.getString("rateUnit", "seconds").toUpperCase());
  TimeUnit durationUnit =
      TimeUnit.valueOf(config.getString("durationUnit", "milliseconds").toUpperCase());

  Graphite graphite = new Graphite(host, port);
  GraphiteReporter reporter =
      GraphiteReporter.forRegistry(params.getMetricRegistry()).convertDurationsTo(durationUnit)
          .convertRatesTo(rateUnit).prefixedWith(prefix).build(graphite);
  reporter.start(config.getInt("frequency", 60), TimeUnit.SECONDS);

  log.info("Reporting metrics to graphite server {}:{}", host, port);

  return Collections.singletonList((AutoCloseable) reporter);
}
 
开发者ID:apache,项目名称:fluo,代码行数:27,代码来源:GraphiteReporterStarter.java

示例3: start

import org.apache.fluo.api.config.SimpleConfiguration; //导入方法依赖的package包/类
@Override
public List<AutoCloseable> start(Params params) {
  SimpleConfiguration config =
      new FluoConfiguration(params.getConfiguration()).getReporterConfiguration("csv");

  String dir = config.getString("dir", "");
  if (!config.getBoolean("enable", false) || dir.isEmpty()) {
    return Collections.emptyList();
  }

  TimeUnit rateUnit = TimeUnit.valueOf(config.getString("rateUnit", "seconds").toUpperCase());
  TimeUnit durationUnit =
      TimeUnit.valueOf(config.getString("durationUnit", "milliseconds").toUpperCase());

  CsvReporter reporter = CsvReporter.forRegistry(params.getMetricRegistry())
      .convertDurationsTo(durationUnit).convertRatesTo(rateUnit).build(new File(dir));
  reporter.start(config.getInt("frequency", 60), TimeUnit.SECONDS);

  log.info("Reporting metrics as csv to directory {}", dir);

  return Collections.singletonList((AutoCloseable) reporter);
}
 
开发者ID:apache,项目名称:fluo,代码行数:23,代码来源:CsvReporterStarter.java

示例4: load

import org.apache.fluo.api.config.SimpleConfiguration; //导入方法依赖的package包/类
public static AeFluentConfigurator load(String id, SimpleConfiguration config) {
  AeFluentConfigurator aefc = new AeFluentConfigurator(id);
  aefc.instance = config.getString(PREFIX + id + ".instance");
  aefc.zookeepers = config.getString(PREFIX + id + ".zookeepers");
  aefc.user = config.getString(PREFIX + id + ".user");
  aefc.password = config.getString(PREFIX + id + ".password");
  aefc.table = config.getString(PREFIX + id + ".table");

  return aefc;
}
 
开发者ID:apache,项目名称:fluo-recipes,代码行数:11,代码来源:AeFluentConfigurator.java

示例5: init

import org.apache.fluo.api.config.SimpleConfiguration; //导入方法依赖的package包/类
@Override
public void init(org.apache.fluo.recipes.core.export.Exporter.Context context) throws Exception {
  SimpleConfiguration sc = context.getExporterConfiguration();
  String instanceName = sc.getString("instanceName");
  String zookeepers = sc.getString("zookeepers");
  String user = sc.getString("user");
  String password = sc.getString("password");
  String table = sc.getString("table");

  FluoConfiguration tmpFc = new FluoConfiguration();
  org.apache.fluo.recipes.accumulo.export.function.AccumuloExporter.configure("aecfgid")
      .instance(instanceName, zookeepers).credentials(user, password).table(table).save(tmpFc);
  accumuloWriter = new org.apache.fluo.recipes.accumulo.export.function.AccumuloExporter<K, V>(
      "aecfgid", tmpFc.getAppConfiguration(), this::translate);
}
 
开发者ID:apache,项目名称:fluo-recipes,代码行数:16,代码来源:AccumuloExporter.java

示例6: getInstance

import org.apache.fluo.api.config.SimpleConfiguration; //导入方法依赖的package包/类
static SimpleSerializer getInstance(SimpleConfiguration appConfig) {
  String serType = appConfig.getString("recipes.serializer",
      "org.apache.fluo.recipes.kryo.KryoSimplerSerializer");
  try {
    SimpleSerializer simplerSer = SimpleSerializer.class.getClassLoader().loadClass(serType)
        .asSubclass(SimpleSerializer.class).newInstance();
    simplerSer.init(appConfig);
    return simplerSer;
  } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
    throw new RuntimeException(e);
  }
}
 
开发者ID:apache,项目名称:fluo-recipes,代码行数:13,代码来源:SimpleSerializer.java

示例7: Options

import org.apache.fluo.api.config.SimpleConfiguration; //导入方法依赖的package包/类
Options(String mapId, SimpleConfiguration appConfig) {
  this.mapId = mapId;

  this.numBuckets = appConfig.getInt(PREFIX + mapId + ".buckets");
  this.combinerType = appConfig.getString(PREFIX + mapId + ".combiner");
  this.keyType = appConfig.getString(PREFIX + mapId + ".key");
  this.valueType = appConfig.getString(PREFIX + mapId + ".val");
  this.updateObserverType = appConfig.getString(PREFIX + mapId + ".updateObserver", null);
  this.bufferSize = appConfig.getLong(PREFIX + mapId + ".bufferSize", DEFAULT_BUFFER_SIZE);
  this.bucketsPerTablet =
      appConfig.getInt(PREFIX + mapId + ".bucketsPerTablet", DEFAULT_BUCKETS_PER_TABLET);
}
 
开发者ID:apache,项目名称:fluo-recipes,代码行数:13,代码来源:CollisionFreeMap.java

示例8: load

import org.apache.fluo.api.config.SimpleConfiguration; //导入方法依赖的package包/类
static FluentConfigurator load(String queueId, SimpleConfiguration appConfig) {
  FluentConfigurator fc = new FluentConfigurator(queueId);
  fc.buckets = appConfig.getInt(PREFIX + queueId + ".buckets");
  fc.keyType = appConfig.getString(PREFIX + queueId + ".key");
  fc.valueType = appConfig.getString(PREFIX + queueId + ".val");
  fc.bufferSize = appConfig.getLong(PREFIX + queueId + ".bufferSize", DEFAULT_BUFFER_SIZE);
  fc.bucketsPerTablet =
      appConfig.getInt(PREFIX + queueId + ".bucketsPerTablet", DEFAULT_BUCKETS_PER_TABLET);
  fc.exporterType = appConfig.getString(PREFIX + queueId + ".exporter", null);
  return fc;
}
 
开发者ID:apache,项目名称:fluo-recipes,代码行数:12,代码来源:FluentConfigurator.java

示例9: init

import org.apache.fluo.api.config.SimpleConfiguration; //导入方法依赖的package包/类
@Override
public void init(Context context) {
  SimpleConfiguration myConfig = context.getObserverConfiguration();

  String ocTokens[] = myConfig.getString("observedCol").split(":");
  observedColumn = new ObservedColumn(new Column(ocTokens[0], ocTokens[1]),
      NotificationType.valueOf(ocTokens[2]));
  outputCQ = Bytes.of(myConfig.getString("outputCQ"));
  String swn = myConfig.getString("setWeakNotification", "false");
  if (swn.equals("true")) {
    setWeakNotification = true;
  }
  meter = context.getMetricsReporter().meter("test_meter");
  counter = context.getMetricsReporter().counter("test_counter");
}
 
开发者ID:apache,项目名称:fluo,代码行数:16,代码来源:ObserverConfigIT.java

示例10: init

import org.apache.fluo.api.config.SimpleConfiguration; //导入方法依赖的package包/类
@Override
public void init(SimpleConfiguration appConfig) {
  Preconditions.checkArgument(factory == null && factoryType == null, "Already initialized");
  factoryType = appConfig.getString(KRYO_FACTORY_PROP, DefaultFactory.class.getName());
}
 
开发者ID:apache,项目名称:fluo-recipes,代码行数:6,代码来源:KryoSimplerSerializer.java

示例11: getValueType

import org.apache.fluo.api.config.SimpleConfiguration; //导入方法依赖的package包/类
static String getValueType(String cqId, SimpleConfiguration appConfig) {
  return appConfig.getString(PREFIX + cqId + ".val");
}
 
开发者ID:apache,项目名称:fluo-recipes,代码行数:4,代码来源:CqConfigurator.java

示例12: getKeyType

import org.apache.fluo.api.config.SimpleConfiguration; //导入方法依赖的package包/类
static String getKeyType(String cqId, SimpleConfiguration appConfig) {
  return appConfig.getString(PREFIX + cqId + ".key");
}
 
开发者ID:apache,项目名称:fluo-recipes,代码行数:4,代码来源:CqConfigurator.java


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