本文整理匯總了Java中org.apache.commons.configuration.BaseConfiguration.setProperty方法的典型用法代碼示例。如果您正苦於以下問題:Java BaseConfiguration.setProperty方法的具體用法?Java BaseConfiguration.setProperty怎麽用?Java BaseConfiguration.setProperty使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.commons.configuration.BaseConfiguration
的用法示例。
在下文中一共展示了BaseConfiguration.setProperty方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: DataStore
import org.apache.commons.configuration.BaseConfiguration; //導入方法依賴的package包/類
public DataStore(Configuration conf) throws QonduitException {
try {
final BaseConfiguration apacheConf = new BaseConfiguration();
Configuration.Accumulo accumuloConf = conf.getAccumulo();
apacheConf.setProperty("instance.name", accumuloConf.getInstanceName());
apacheConf.setProperty("instance.zookeeper.host", accumuloConf.getZookeepers());
final ClientConfiguration aconf = new ClientConfiguration(Collections.singletonList(apacheConf));
final Instance instance = new ZooKeeperInstance(aconf);
connector = instance
.getConnector(accumuloConf.getUsername(), new PasswordToken(accumuloConf.getPassword()));
} catch (Exception e) {
throw new QonduitException(HttpResponseStatus.INTERNAL_SERVER_ERROR.code(), "Error creating DataStoreImpl",
e.getMessage(), e);
}
}
示例2: main
import org.apache.commons.configuration.BaseConfiguration; //導入方法依賴的package包/類
public static void main(String[] args) throws Exception {
try (ConfigurableApplicationContext ctx = new SpringApplicationBuilder(SpringBootstrap.class)
.bannerMode(Mode.OFF).web(false).run(args)) {
Configuration conf = ctx.getBean(Configuration.class);
final BaseConfiguration apacheConf = new BaseConfiguration();
Configuration.Accumulo accumuloConf = conf.getAccumulo();
apacheConf.setProperty("instance.name", accumuloConf.getInstanceName());
apacheConf.setProperty("instance.zookeeper.host", accumuloConf.getZookeepers());
final ClientConfiguration aconf = new ClientConfiguration(Collections.singletonList(apacheConf));
final Instance instance = new ZooKeeperInstance(aconf);
Connector con = instance.getConnector(accumuloConf.getUsername(),
new PasswordToken(accumuloConf.getPassword()));
Scanner s = con.createScanner(conf.getMetaTable(),
con.securityOperations().getUserAuthorizations(con.whoami()));
try {
s.setRange(new Range(Meta.METRIC_PREFIX, true, Meta.TAG_PREFIX, false));
for (Entry<Key, Value> e : s) {
System.out.println(e.getKey().getRow().toString().substring(Meta.METRIC_PREFIX.length()));
}
} finally {
s.close();
}
}
}
示例3: setUp
import org.apache.commons.configuration.BaseConfiguration; //導入方法依賴的package包/類
@Before
public void setUp() throws Exception {
final String clientPort = "21818";
final String dataDirectory = System.getProperty("java.io.tmpdir");
zookeeperHost = "localhost:" + clientPort;
ServerConfig config = new ServerConfig();
config.parse(new String[] { clientPort, dataDirectory });
testConfig = new BaseConfiguration();
testConfig.setProperty("quorum", zookeeperHost);
testConfig.setProperty("znode", "/config");
testConfig.setProperty(APPNAME_PROPERTY, "test");
testConfig.setProperty(ROOTCONFIG_PROPERTY, "test");
zkServer = new ZookeeperTestUtil.ZooKeeperThread(config);
server = new Thread(zkServer);
server.start();
zookeeper = connect(zookeeperHost);
}
示例4: setUp
import org.apache.commons.configuration.BaseConfiguration; //導入方法依賴的package包/類
@Before
public void setUp() {
conf = new BaseConfiguration();
conf.setProperty(DesaServices.PROPERTY_DESASERVICES, "ds1, dsNulls");
String prefix = DesaServices.PREFIX_DESA + '.' + "ds1" + '.';
conf.setProperty(prefix + DesaConfiguration.PROPERTY_USER, "ds1user");
conf.setProperty(prefix + DesaConfiguration.PROPERTY_PASSWD, "ds1passwd");
conf.setProperty(prefix + DesaConfiguration.PROPERTY_PRODUCER, "ds1producer");
conf.setProperty(prefix + DesaConfiguration.PROPERTY_OPERATOR, "ds1operator");
conf.setProperty(prefix + DesaConfiguration.PROPERTY_EXPORTMODELS, "model:id1, model:id2");
conf.setProperty(prefix + DesaConfiguration.PROPERTY_RESTAPI, "https://SERVER/dea-frontend/rest/sipsubmission");
conf.setProperty(prefix + DesaConfiguration.PROPERTY_WEBSERVICE, "https://SERVER/dea-frontend/ws/SIPSubmissionService");
conf.setProperty(prefix + DesaConfiguration.PROPERTY_NOMENCLATUREACRONYMS, "acr1, acr2");
prefix = DesaServices.PREFIX_DESA + '.' + "dsNulls" + '.';
conf.setProperty(prefix + DesaConfiguration.PROPERTY_USER, null);
conf.setProperty(prefix + DesaConfiguration.PROPERTY_PASSWD, "");
conf.setProperty(prefix + DesaConfiguration.PROPERTY_EXPORTMODELS, null);
conf.setProperty(prefix + DesaConfiguration.PROPERTY_NOMENCLATUREACRONYMS, null);
prefix = DesaServices.PREFIX_DESA + '.' + "dsNotActive" + '.';
conf.setProperty(prefix + DesaConfiguration.PROPERTY_USER, "NA");
desaServices = new DesaServices(conf);
}
示例5: open
import org.apache.commons.configuration.BaseConfiguration; //導入方法依賴的package包/類
public static TorcGraph open(String graphName) {
Map<String, String> env = System.getenv();
BaseConfiguration config = new BaseConfiguration();
config.setDelimiterParsingDisabled(true);
config.setProperty(TorcGraph.CONFIG_GRAPH_NAME, graphName);
config.setProperty(TorcGraph.CONFIG_COORD_LOCATOR,
env.get("RAMCLOUD_COORDINATOR_LOCATOR"));
if (env.containsKey("RAMCLOUD_SERVERS")) {
config.setProperty(TorcGraph.CONFIG_NUM_MASTER_SERVERS,
env.get("RAMCLOUD_SERVERS"));
}
return open(config);
}
示例6: staticBeforeClean
import org.apache.commons.configuration.BaseConfiguration; //導入方法依賴的package包/類
@BeforeClass
public static void staticBeforeClean() {
BaseConfiguration configuration = new BaseConfiguration();
configuration.setProperty(MetricsObserverInitializer.METRICS_FILE_ENABLED, true);
configuration.setProperty(MetricsObserverInitializer.METRICS_POLL_TIME, 1);
DynamicPropertyFactory.initWithConfigurationSource(configuration);
MetricsServoRegistry.metricsList.clear();
MetricsServoRegistry.LOCAL_METRICS_MAP = new ThreadLocal<>();
}
示例7: getOutputGraph
import org.apache.commons.configuration.BaseConfiguration; //導入方法依賴的package包/類
public static HadoopGraph getOutputGraph(final Configuration configuration, final GraphComputer.ResultGraph resultGraph, final GraphComputer.Persist persist) {
final HadoopConfiguration hadoopConfiguration = new HadoopConfiguration(configuration);
final BaseConfiguration newConfiguration = new BaseConfiguration();
newConfiguration.copy(hadoopConfiguration);
if (resultGraph.equals(GraphComputer.ResultGraph.NEW)) {
newConfiguration.setProperty(Constants.GREMLIN_HADOOP_INPUT_LOCATION, hadoopConfiguration.getOutputLocation());
if (hadoopConfiguration.containsKey(Constants.GREMLIN_HADOOP_GRAPH_WRITER))
if (null != InputOutputHelper.getInputFormat(hadoopConfiguration.getGraphWriter()))
newConfiguration.setProperty(Constants.GREMLIN_HADOOP_GRAPH_READER, InputOutputHelper.getInputFormat(hadoopConfiguration.getGraphWriter()).getCanonicalName());
newConfiguration.setProperty(Constants.GREMLIN_HADOOP_GRAPH_READER_HAS_EDGES, persist.equals(GraphComputer.Persist.EDGES));
}
newConfiguration.setProperty(Constants.GREMLIN_HADOOP_OUTPUT_LOCATION, hadoopConfiguration.getOutputLocation() + "_");
return HadoopGraph.open(newConfiguration);
}
示例8: makeApacheConfiguration
import org.apache.commons.configuration.BaseConfiguration; //導入方法依賴的package包/類
private static Configuration makeApacheConfiguration(final SparkConf sparkConfiguration) {
final BaseConfiguration apacheConfiguration = new BaseConfiguration();
apacheConfiguration.setDelimiterParsingDisabled(true);
for (final Tuple2<String, String> tuple : sparkConfiguration.getAll()) {
apacheConfiguration.setProperty(tuple._1(), tuple._2());
}
return apacheConfiguration;
}
示例9: getOutputGraph
import org.apache.commons.configuration.BaseConfiguration; //導入方法依賴的package包/類
public static HadoopGraph getOutputGraph(final Configuration configuration, final GraphComputer.ResultGraph resultGraph, final GraphComputer.Persist persist) {
final HadoopConfiguration hadoopConfiguration = new HadoopConfiguration(configuration);
final BaseConfiguration newConfiguration = new BaseConfiguration();
newConfiguration.copy(org.apache.tinkerpop.gremlin.hadoop.structure.io.InputOutputHelper.getOutputGraph(configuration, resultGraph, persist).configuration());
if (resultGraph.equals(GraphComputer.ResultGraph.NEW) && hadoopConfiguration.containsKey(Constants.GREMLIN_HADOOP_GRAPH_WRITER)) {
if (null != InputOutputHelper.getInputFormat(hadoopConfiguration.getGraphWriter()))
newConfiguration.setProperty(Constants.GREMLIN_HADOOP_GRAPH_READER, InputOutputHelper.getInputFormat(hadoopConfiguration.getGraphWriter()).getCanonicalName());
}
return HadoopGraph.open(newConfiguration);
}
示例10: getBaseConfiguration
import org.apache.commons.configuration.BaseConfiguration; //導入方法依賴的package包/類
protected Configuration getBaseConfiguration() {
final BaseConfiguration configuration = new BaseConfiguration();
configuration.setDelimiterParsingDisabled(true);
configuration.setProperty("spark.master", "local[4]");
configuration.setProperty(Constants.SPARK_SERIALIZER, GryoSerializer.class.getCanonicalName());
configuration.setProperty("spark.kryo.registrationRequired", true);
configuration.setProperty(Graph.GRAPH, HadoopGraph.class.getName());
configuration.setProperty(Constants.GREMLIN_HADOOP_JARS_IN_DISTRIBUTED_CACHE, false);
return configuration;
}
示例11: createSession
import org.apache.commons.configuration.BaseConfiguration; //導入方法依賴的package包/類
@Override
public DuctileStoreSession createSession() {
try {
BaseConfiguration configuration = new BaseConfiguration();
configuration.setProperty(Graph.GRAPH, DuctileGraph.class.getName());
return new DuctileStoreSession(graph, configuration);
} catch (IOException e) {
throw new XOException("Could not create graph.", e);
}
}
示例12: TitanDbConnectionState
import org.apache.commons.configuration.BaseConfiguration; //導入方法依賴的package包/類
public TitanDbConnectionState(Map<String, String> props) {
BaseConfiguration config = new BaseConfiguration();
config.setDelimiterParsingDisabled(true);
/*
* Extract parameters from properties map.
*/
String cassandraLocator;
if (props.containsKey("cassandraLocator")) {
cassandraLocator = props.get("cassandraLocator");
} else {
cassandraLocator = "127.0.0.1";
}
String graphName;
if (props.containsKey("graphName")) {
graphName = props.get("graphName");
} else {
graphName = "default";
}
config.setProperty("storage.backend", "cassandra");
config.setProperty("storage.hostname", cassandraLocator);
config.setProperty("storage.cassandra.keyspace", graphName);
client = TitanFactory.open(config);
}
示例13: TorcDbConnectionState
import org.apache.commons.configuration.BaseConfiguration; //導入方法依賴的package包/類
public TorcDbConnectionState(Map<String, String> props) {
BaseConfiguration config = new BaseConfiguration();
config.setDelimiterParsingDisabled(true);
/*
* Extract parameters from properties map.
*/
String coordinatorLocator;
if (props.containsKey("coordinatorLocator")) {
coordinatorLocator = props.get("coordinatorLocator");
} else {
coordinatorLocator = "tcp:host=127.0.0.1,port=12246";
}
String graphName;
if (props.containsKey("graphName")) {
graphName = props.get("graphName");
} else {
graphName = "default";
}
config.setProperty(
TorcGraph.CONFIG_COORD_LOCATOR,
coordinatorLocator);
config.setProperty(
TorcGraph.CONFIG_GRAPH_NAME,
graphName);
this.client = TorcGraph.open(config);
}
示例14: open
import org.apache.commons.configuration.BaseConfiguration; //導入方法依賴的package包/類
@Override
public boolean open() {
BaseConfiguration conf = new BaseConfiguration();
conf.setProperty("storage.backend", storageBackend);
conf.setProperty("storage.tablename", storageTableName);
titanGraph = TitanFactory.open(conf);
titanGraph.makeKey(vertexUserId).dataType(String.class).indexed(Vertex.class).make();
titanGraph.makeLabel(edgeMentions).make();
titanGraph.makeLabel(edgeReTweets).make();
titanGraph.commit();
return true;
}
示例15: start
import org.apache.commons.configuration.BaseConfiguration; //導入方法依賴的package包/類
@Override
public void start() throws Exception {
EurekaClientConfiguration eurekaClientConfiguration = configuration.getEureka();
ServerFactory serverFactory = configuration.getServerFactory();
BaseConfiguration baseConfiguration = new BaseConfiguration();
baseConfiguration.setProperty(eurekaNamespace + "name", eurekaClientConfiguration.getName());
baseConfiguration.setProperty(eurekaNamespace + "vipAddress", eurekaClientConfiguration.getVipAddress());
baseConfiguration.setProperty(eurekaNamespace + "serviceUrl.default", eurekaClientConfiguration.getDefaultServiceUrl());
baseConfiguration.setProperty(eurekaNamespace + "port", eurekaClientConfiguration.getPort());
Integer port = DropwizardServerHelpers.getPort(serverFactory);
Integer adminPort = DropwizardServerHelpers.getAdminPort(serverFactory);
baseConfiguration.setProperty(eurekaNamespace + "healthCheckUrl", String.format("http://${eureka.hostname}:%d/healthcheck", adminPort));
baseConfiguration.setProperty(eurekaNamespace + "secureHealthCheckUrl", String.format("http://${eureka.hostname}:%d/healthcheck", adminPort));
baseConfiguration.setProperty(eurekaNamespace + "statusPageUrl", String.format("http://${eureka.hostname}:%d/healthcheck", adminPort));
ConfigurationManager.loadPropertiesFromConfiguration(baseConfiguration);
EurekaInstanceConfig eurekaInstanceConfig = createEurekaInstanceConfig(discoveryMetadataProviders);
DiscoveryManager.getInstance().initComponent(eurekaInstanceConfig, new DefaultEurekaClientConfig(eurekaNamespace));
DiscoveryManager.getInstance().getDiscoveryClient().registerHealthCheckCallback(healthCheck);
markAsUp();
}