當前位置: 首頁>>代碼示例>>Java>>正文


Java SimpleConfiguration.setProperty方法代碼示例

本文整理匯總了Java中org.apache.fluo.api.config.SimpleConfiguration.setProperty方法的典型用法代碼示例。如果您正苦於以下問題:Java SimpleConfiguration.setProperty方法的具體用法?Java SimpleConfiguration.setProperty怎麽用?Java SimpleConfiguration.setProperty使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.fluo.api.config.SimpleConfiguration的用法示例。


在下文中一共展示了SimpleConfiguration.setProperty方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: save

import org.apache.fluo.api.config.SimpleConfiguration; //導入方法依賴的package包/類
@Override
public void save(FluoConfiguration fluoConfig) {
  SimpleConfiguration appConfig = fluoConfig.getAppConfiguration();
  appConfig.setProperty(PREFIX + cqId + ".buckets", numBuckets + "");
  appConfig.setProperty(PREFIX + cqId + ".key", keyType);
  appConfig.setProperty(PREFIX + cqId + ".val", valueType);
  if (bufferSize != null) {
    appConfig.setProperty(PREFIX + cqId + ".bufferSize", bufferSize);
  }
  if (bucketsPerTablet != null) {
    appConfig.setProperty(PREFIX + cqId + ".bucketsPerTablet", bucketsPerTablet);
  }

  Bytes dataRangeEnd = Bytes.of(cqId + DATA_RANGE_END);
  Bytes updateRangeEnd = Bytes.of(cqId + UPDATE_RANGE_END);

  new TransientRegistry(fluoConfig.getAppConfiguration()).addTransientRange("cfm." + cqId,
      new RowRange(dataRangeEnd, updateRangeEnd));

  TableOptimizations.registerOptimization(appConfig, cqId, CombineQueue.Optimizer.class);
}
 
開發者ID:apache,項目名稱:fluo-recipes,代碼行數:22,代碼來源:CqConfigurator.java

示例2: save

import org.apache.fluo.api.config.SimpleConfiguration; //導入方法依賴的package包/類
void save(SimpleConfiguration appConfig) {
  appConfig.setProperty(PREFIX + queueId + ".buckets", buckets + "");
  appConfig.setProperty(PREFIX + queueId + ".key", keyType);
  appConfig.setProperty(PREFIX + queueId + ".val", valueType);

  if (exporterType != null) {
    appConfig.setProperty(PREFIX + queueId + ".exporter", exporterType);
  }

  if (bufferSize != null) {
    appConfig.setProperty(PREFIX + queueId + ".bufferSize", bufferSize);
  }

  if (bucketsPerTablet != null) {
    appConfig.setProperty(PREFIX + queueId + ".bucketsPerTablet", bucketsPerTablet);
  }

  Bytes exportRangeStart = Bytes.of(queueId + ExportQueue.RANGE_BEGIN);
  Bytes exportRangeStop = Bytes.of(queueId + ExportQueue.RANGE_END);

  new TransientRegistry(appConfig).addTransientRange("exportQueue." + queueId,
      new RowRange(exportRangeStart, exportRangeStop));

  TableOptimizations.registerOptimization(appConfig, queueId, Optimizer.class);
}
 
開發者ID:apache,項目名稱:fluo-recipes,代碼行數:26,代碼來源:FluentConfigurator.java

示例3: getZookeeperConfig

import org.apache.fluo.api.config.SimpleConfiguration; //導入方法依賴的package包/類
public static SimpleConfiguration getZookeeperConfig(FluoConfiguration config) {
  if (!isInitialized(config)) {
    throw new IllegalStateException(
        "Fluo Application '" + config.getApplicationName() + "' has not been initialized");
  }

  SimpleConfiguration zooConfig = new SimpleConfiguration();

  try (CuratorFramework curator = CuratorUtil.newAppCurator(config)) {
    curator.start();

    ByteArrayInputStream bais =
        new ByteArrayInputStream(curator.getData().forPath(ZookeeperPath.CONFIG_SHARED));
    Properties sharedProps = new Properties();
    sharedProps.load(bais);

    for (String prop : sharedProps.stringPropertyNames()) {
      zooConfig.setProperty(prop, sharedProps.getProperty(prop));
    }
  } catch (Exception e) {
    throw new IllegalStateException(e);
  }
  return zooConfig;
}
 
開發者ID:apache,項目名稱:fluo,代碼行數:25,代碼來源:FluoAdminImpl.java

示例4: save

import org.apache.fluo.api.config.SimpleConfiguration; //導入方法依賴的package包/類
@Override
public void save(FluoConfiguration fluoConf) {
  SimpleConfiguration appConfig = fluoConf.getAppConfiguration();
  // TODO Auto-generated method stub
  appConfig.setProperty(PREFIX + id + ".instance", instance);
  appConfig.setProperty(PREFIX + id + ".zookeepers", zookeepers);
  appConfig.setProperty(PREFIX + id + ".user", user);
  appConfig.setProperty(PREFIX + id + ".password", password);
  appConfig.setProperty(PREFIX + id + ".table", table);
}
 
開發者ID:apache,項目名稱:fluo-recipes,代碼行數:11,代碼來源:AeFluentConfigurator.java

示例5: save

import org.apache.fluo.api.config.SimpleConfiguration; //導入方法依賴的package包/類
void save(SimpleConfiguration appConfig) {
  fluentCfg.save(appConfig);

  if (exporterConfig != null) {
    Iterator<String> keys = exporterConfig.getKeys();
    while (keys.hasNext()) {
      String key = keys.next();
      appConfig.setProperty(PREFIX + fluentCfg.queueId + ".exporterCfg." + key,
          exporterConfig.getRawString(key));
    }
  }
}
 
開發者ID:apache,項目名稱:fluo-recipes,代碼行數:13,代碼來源:ExportQueue.java

示例6: testExportQueueOptions

import org.apache.fluo.api.config.SimpleConfiguration; //導入方法依賴的package包/類
@Test
public void testExportQueueOptions() {
  FluoConfiguration conf = new FluoConfiguration();

  SimpleConfiguration ec1 = new SimpleConfiguration();
  ec1.setProperty("ep1", "ev1");
  ec1.setProperty("ep2", 3L);

  ExportQueue.configure("Q1").keyType("KT").valueType("VT").buckets(100).save(conf);
  ExportQueue.configure("Q2").keyType("KT2").valueType("VT2").buckets(200).bucketsPerTablet(20)
      .bufferSize(1000000).save(conf);

  FluentConfigurator opts1 = FluentConfigurator.load("Q1", conf.getAppConfiguration());

  Assert.assertNull(opts1.exporterType);
  Assert.assertEquals(opts1.keyType, "KT");
  Assert.assertEquals(opts1.valueType, "VT");
  Assert.assertEquals(opts1.buckets, 100);
  Assert.assertEquals(opts1.bucketsPerTablet.intValue(),
      FluentConfigurator.DEFAULT_BUCKETS_PER_TABLET);
  Assert.assertEquals(opts1.bufferSize.intValue(), FluentConfigurator.DEFAULT_BUFFER_SIZE);

  FluentConfigurator opts2 = FluentConfigurator.load("Q2", conf.getAppConfiguration());

  Assert.assertNull(opts2.exporterType);
  Assert.assertEquals(opts2.keyType, "KT2");
  Assert.assertEquals(opts2.valueType, "VT2");
  Assert.assertEquals(opts2.buckets, 200);
  Assert.assertEquals(opts2.bucketsPerTablet.intValue(), 20);
  Assert.assertEquals(opts2.bufferSize.intValue(), 1000000);
}
 
開發者ID:apache,項目名稱:fluo-recipes,代碼行數:32,代碼來源:OptionsTest.java

示例7: configureMetrics

import org.apache.fluo.api.config.SimpleConfiguration; //導入方法依賴的package包/類
public SimpleConfiguration configureMetrics(SimpleConfiguration config) {
  if (metrics) {
    config.setProperty("fluo.metrics.reporter.graphite.enable", true);
    config.setProperty("fluo.metrics.reporter.graphite.host", "localhost");
    config.setProperty("fluo.metrics.reporter.graphite.port", 2003);
    config.setProperty("fluo.metrics.reporter.graphite.frequency", 30);
  }
  return config;
}
 
開發者ID:astralway,項目名稱:webindex,代碼行數:10,代碼來源:DevServer.java

示例8: testBasic

import org.apache.fluo.api.config.SimpleConfiguration; //導入方法依賴的package包/類
@Test
public void testBasic() {
  SimpleConfiguration uc = client.getAppConfiguration();
  Assert.assertEquals(50000, uc.getInt("myapp.sizeLimit"));
  uc.setProperty("myapp.sizeLimit", 3);
  uc = client.getAppConfiguration();
  Assert.assertEquals(50000, uc.getInt("myapp.sizeLimit"));

  // update shared config
  SimpleConfiguration appConfig = config.getAppConfiguration();
  appConfig.clear();
  appConfig.setProperty("myapp.sizeLimit", 40000);
  appConfig.setProperty("myapp.timeLimit", 30000);
  try (FluoAdmin admin = FluoFactory.newAdmin(config)) {
    admin.updateSharedConfig();
  }

  // set app config that differs from what was just put in zk
  appConfig.setProperty("myapp.sizeLimit", 6);
  appConfig.setProperty("myapp.timeLimit", 7);

  try (FluoClient client2 = FluoFactory.newClient(config)) {
    uc = client2.getAppConfiguration();
    Assert.assertEquals(40000, uc.getInt("myapp.sizeLimit"));
    Assert.assertEquals(30000, uc.getInt("myapp.timeLimit"));
  }

}
 
開發者ID:apache,項目名稱:fluo,代碼行數:29,代碼來源:AppConfigIT.java

示例9: save

import org.apache.fluo.api.config.SimpleConfiguration; //導入方法依賴的package包/類
void save(SimpleConfiguration appConfig) {
  appConfig.setProperty(PREFIX + mapId + ".combiner", combinerType + "");
  if (updateObserverType != null) {
    appConfig.setProperty(PREFIX + mapId + ".updateObserver", updateObserverType + "");
  }
}
 
開發者ID:apache,項目名稱:fluo-recipes,代碼行數:7,代碼來源:CollisionFreeMap.java

示例10: testDeprecatedExportQueueOptions

import org.apache.fluo.api.config.SimpleConfiguration; //導入方法依賴的package包/類
@Test
@Deprecated
public void testDeprecatedExportQueueOptions() {
  FluoConfiguration conf = new FluoConfiguration();

  SimpleConfiguration ec1 = new SimpleConfiguration();
  ec1.setProperty("ep1", "ev1");
  ec1.setProperty("ep2", 3L);

  ExportQueue.configure(conf,
      new org.apache.fluo.recipes.core.export.ExportQueue.Options("Q1", "ET", "KT", "VT", 100));
  ExportQueue.configure(conf,
      new org.apache.fluo.recipes.core.export.ExportQueue.Options("Q2", "ET2", "KT2", "VT2", 200)
          .setBucketsPerTablet(20).setBufferSize(1000000).setExporterConfiguration(ec1));

  org.apache.fluo.recipes.core.export.ExportQueue.Options opts1 =
      new org.apache.fluo.recipes.core.export.ExportQueue.Options("Q1",
          conf.getAppConfiguration());

  Assert.assertEquals(opts1.fluentCfg.exporterType, "ET");
  Assert.assertEquals(opts1.fluentCfg.keyType, "KT");
  Assert.assertEquals(opts1.fluentCfg.valueType, "VT");
  Assert.assertEquals(opts1.fluentCfg.buckets, 100);
  Assert.assertEquals(opts1.fluentCfg.bucketsPerTablet.intValue(),
      FluentConfigurator.DEFAULT_BUCKETS_PER_TABLET);
  Assert.assertEquals(opts1.fluentCfg.bufferSize.intValue(),
      FluentConfigurator.DEFAULT_BUFFER_SIZE);

  org.apache.fluo.recipes.core.export.ExportQueue.Options opts2 =
      new org.apache.fluo.recipes.core.export.ExportQueue.Options("Q2",
          conf.getAppConfiguration());

  Assert.assertEquals(opts2.fluentCfg.exporterType, "ET2");
  Assert.assertEquals(opts2.fluentCfg.keyType, "KT2");
  Assert.assertEquals(opts2.fluentCfg.valueType, "VT2");
  Assert.assertEquals(opts2.fluentCfg.buckets, 200);
  Assert.assertEquals(opts2.fluentCfg.bucketsPerTablet.intValue(), 20);
  Assert.assertEquals(opts2.fluentCfg.bufferSize.intValue(), 1000000);

  SimpleConfiguration ec2 = opts2.getExporterConfiguration();

  Assert.assertEquals("ev1", ec2.getString("ep1"));
  Assert.assertEquals(3, ec2.getInt("ep2"));

  List<org.apache.fluo.api.config.ObserverSpecification> obsSpecs =
      conf.getObserverSpecifications();
  Assert.assertTrue(obsSpecs.size() == 2);
  for (org.apache.fluo.api.config.ObserverSpecification ospec : obsSpecs) {
    Assert.assertEquals(ExportObserver.class.getName(), ospec.getClassName());
    String qid = ospec.getConfiguration().getString("queueId");
    Assert.assertTrue(qid.equals("Q1") || qid.equals("Q2"));
  }
}
 
開發者ID:apache,項目名稱:fluo-recipes,代碼行數:54,代碼來源:OptionsTest.java

示例11: setAppConfig

import org.apache.fluo.api.config.SimpleConfiguration; //導入方法依賴的package包/類
@Override
protected void setAppConfig(SimpleConfiguration config) {
  config.setProperty("myapp.sizeLimit", 50000);
}
 
開發者ID:apache,項目名稱:fluo,代碼行數:5,代碼來源:AppConfigIT.java

示例12: registerOptimization

import org.apache.fluo.api.config.SimpleConfiguration; //導入方法依賴的package包/類
/**
 * This method provides a standard way to register a table optimization for the Fluo table before
 * initialization. After Fluo is initialized, the optimizations can be retrieved by calling
 * {@link #getConfiguredOptimizations(FluoConfiguration)}.
 * 
 * @param appConfig config, likely obtained from calling
 *        {@link FluoConfiguration#getAppConfiguration()}
 * @param key A unique identifier for the optimization
 * @param clazz The optimization factory type.
 */
public static void registerOptimization(SimpleConfiguration appConfig, String key,
    Class<? extends TableOptimizationsFactory> clazz) {
  appConfig.setProperty(PREFIX + key, clazz.getName());
}
 
開發者ID:apache,項目名稱:fluo-recipes,代碼行數:15,代碼來源:TableOptimizations.java


注:本文中的org.apache.fluo.api.config.SimpleConfiguration.setProperty方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。