本文整理汇总了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);
}
示例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);
}
示例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;
}
示例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);
}
示例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));
}
}
}
示例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);
}
示例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;
}
示例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"));
}
}
示例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 + "");
}
}
示例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"));
}
}
示例11: setAppConfig
import org.apache.fluo.api.config.SimpleConfiguration; //导入方法依赖的package包/类
@Override
protected void setAppConfig(SimpleConfiguration config) {
config.setProperty("myapp.sizeLimit", 50000);
}
示例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());
}