本文整理汇总了Java中oracle.kv.KVStoreConfig类的典型用法代码示例。如果您正苦于以下问题:Java KVStoreConfig类的具体用法?Java KVStoreConfig怎么用?Java KVStoreConfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
KVStoreConfig类属于oracle.kv包,在下文中一共展示了KVStoreConfig类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setupClient
import oracle.kv.KVStoreConfig; //导入依赖的package包/类
/**
* Sets the configuration for the client according to the properties
* and establishes a new connection to the Oracle NoSQL datastore.
*/
private void setupClient(){
conf = new KVStoreConfig(storeName, hostNamePorts);
conf.setRequestTimeout(requestTimeout, timeUnit);
conf.setSocketReadTimeout(readTimeout, timeUnit);
conf.setSocketOpenTimeout(openTimeout, timeUnit);
conf.setConsistency(consistency);
Durability newDurability = new Durability(durabilitySyncPolicy, // Master sync
durabilitySyncPolicy, // Replica sync
durabilityReplicaAckPolicy);
conf.setDurability(newDurability);
kvstore = KVStoreFactory.getStore(conf);
}
示例2: KVHiveRecordReader
import oracle.kv.KVStoreConfig; //导入依赖的package包/类
public KVHiveRecordReader(InputSplit split, JobConf conf) {
inputSplit = (KVHiveInputSplit) split;
majorKeyLabels = conf.get(ConfigProperties.KV_MAJOR_KEYS_MAPPING);
majorKeyLabelsArray = majorKeyLabels.split(",");
String kvStoreName = inputSplit.getKVStoreName();
String[] kvHelperHosts = inputSplit.getKVHelperHosts();
kvstore = KVStoreFactory.getStore(new KVStoreConfig(kvStoreName, kvHelperHosts));
KVStoreImpl kvstoreImpl = (KVStoreImpl) kvstore;
int singlePartId = inputSplit.getKVPart();
iter = kvstoreImpl.partitionIterator(inputSplit.getDirection(),
inputSplit.getBatchSize(),
singlePartId,
inputSplit.getParentKey(),
inputSplit.getSubRange(),
inputSplit.getDepth(),
inputSplit.getConsistency(),
inputSplit.getTimeout(),
inputSplit.getTimeoutUnit());
AvroCatalog avroCatalog = kvstoreImpl.getAvroCatalog();
if (avroCatalog != null) {
Map<String, Schema> currentSchemas = avroCatalog.getCurrentSchemas();
if (currentSchemas != null && !currentSchemas.isEmpty()) {
binding = avroCatalog.getJsonMultiBinding(currentSchemas);
}
}
}
示例3: connect
import oracle.kv.KVStoreConfig; //导入依赖的package包/类
/**
* Connect to the NoSQL KVStore.
*/
public void connect() {
// Build KV store config
KVStoreConfig config = new KVStoreConfig(kvStoreName, kvHost + ":" + kvPort);
// Set durability configuration
switch (kvStoreDurability) {
case "SYNC":
config.setDurability(Durability.COMMIT_SYNC);
break;
case "WRITE_NO_SYNC":
config.setDurability(Durability.COMMIT_WRITE_NO_SYNC);
break;
case "NO_SYNC":
config.setDurability(Durability.COMMIT_NO_SYNC);
break;
default:
LOG.info("Invalid durability setting: " + kvStoreDurability);
LOG.info("Proceeding with default WRITE_NO_SYNC");
config.setDurability(Durability.COMMIT_WRITE_NO_SYNC);
break;
}
// Connect to KV store
try {
kvStore = KVStoreFactory.getStore(config);
LOG.info("Connection to KV store established");
} catch (FaultException e) {
LOG.error("Could not establish connection to KV store!");
LOG.error(e.getMessage());
// Throw error
throw e;
}
}
示例4: getKVStore
import oracle.kv.KVStoreConfig; //导入依赖的package包/类
public static KVStore getKVStore() {
if (kvStore == null) {
try {
kvStore =
KVStoreFactory.getStore(new KVStoreConfig(StoreConfig.KVSTORE_NAME, StoreConfig.KVSTORE_URL));
} catch (Exception e) {
System.out.println("ERROR: Please make sure Oracle NoSQL Database is up and running at '" +
StoreConfig.KVSTORE_URL + "' with store name as: '" + StoreConfig.KVSTORE_NAME +
"'");
//e.printStackTrace();
}
} //EOF if
return kvStore;
}
示例5: initDB
import oracle.kv.KVStoreConfig; //导入依赖的package包/类
@PostConstruct
private void initDB() {
// bootstrap
store = KVStoreFactory.getStore(new KVStoreConfig("kvstore", "localhost:5000"));
}
示例6: initKvStore
import oracle.kv.KVStoreConfig; //导入依赖的package包/类
private KVStore initKvStore(OracleNoSqlConfig configuration) throws Exception {
List<KvStoreNode> kvStoreNodes = configuration.getKvStoreNodes();
String[] helperHostPorts = new String[kvStoreNodes.size()];
for (int i = 0; i < kvStoreNodes.size(); i++) {
KvStoreNode node = kvStoreNodes.get(i);
helperHostPorts[i] = node.getHost() + ":" + node.getPort();
}
Properties securityProperties = new Properties();
if (configuration.getUsername() != null) {
username = configuration.getUsername();
securityProperties.put(KVSecurityConstants.AUTH_USERNAME_PROPERTY, configuration.getUsername());
} else {
username = "";
}
if (configuration.getWalletDir() != null) {
securityProperties.put(KVSecurityConstants.AUTH_WALLET_PROPERTY, configuration.getWalletDir());
}
if (configuration.getPwdFile() != null) {
securityProperties.put(KVSecurityConstants.AUTH_PWDFILE_PROPERTY, configuration.getPwdFile());
}
if (configuration.getSecurityFile() != null) {
securityProperties.put(KVSecurityConstants.SECURITY_FILE_PROPERTY, configuration.getSecurityFile());
}
if (configuration.getTransport() != null) {
securityProperties.put(KVSecurityConstants.TRANSPORT_PROPERTY, configuration.getTransport());
}
if (configuration.getSsl() != null) {
securityProperties.put(KVSecurityConstants.SSL_TRANSPORT_NAME, configuration.getSsl());
}
if (configuration.getSslCipherSuites() != null) {
securityProperties.put(KVSecurityConstants.SSL_CIPHER_SUITES_PROPERTY, configuration.getSslCipherSuites());
}
if (configuration.getSslProtocols() != null) {
securityProperties.put(KVSecurityConstants.SSL_PROTOCOLS_PROPERTY, configuration.getSslProtocols());
}
if (configuration.getSslHostnameVerifier() != null) {
securityProperties.put(KVSecurityConstants.SSL_HOSTNAME_VERIFIER_PROPERTY, configuration.getSslHostnameVerifier());
}
if (configuration.getSslTrustStore() != null) {
securityProperties.put(KVSecurityConstants.SSL_TRUSTSTORE_FILE_PROPERTY, configuration.getSslTrustStore());
}
if (configuration.getSslTrustStoreType() != null) {
securityProperties.put(KVSecurityConstants.SSL_TRUSTSTORE_TYPE_PROPERTY, configuration.getSslTrustStoreType());
}
KVStoreConfig config = new KVStoreConfig(configuration.getStoreName(), helperHostPorts);
config.setSecurityProperties(securityProperties);
KVStore kvStore = KVStoreFactory.getStore(config);
return kvStore;
}
示例7: connectToStore
import oracle.kv.KVStoreConfig; //导入依赖的package包/类
private static KVStore connectToStore() {
KVStoreConfig config = new KVStoreConfig(STORE_NAME, STORE_HOST + ":" + STORE_PORT);
return KVStoreFactory.getStore(config);
}