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


Java ConsistencyLevel.valueOf方法代碼示例

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


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

示例1: parseConsistencyLevel

import com.datastax.driver.core.ConsistencyLevel; //導入方法依賴的package包/類
/**
 * Parses consistency level provided as string.
 *
 * @param level consistency level string.
 * @return consistency level.
 */
private ConsistencyLevel parseConsistencyLevel(String level) {
    if (level == null) {
        return null;
    }
    try {
        return ConsistencyLevel.valueOf(level.trim().toUpperCase());
    }
    catch (Throwable e) {
        throw new IgniteException("Incorrect consistency level '" + level + "' specified for Cassandra connection", e);
    }
}
 
開發者ID:epam,項目名稱:Lagerta,代碼行數:18,代碼來源:DataSource.java

示例2: getDefaultReadConsistencyLevel

import com.datastax.driver.core.ConsistencyLevel; //導入方法依賴的package包/類
protected ConsistencyLevel getDefaultReadConsistencyLevel() {
    if (defaultReadConsistencyLevel == null) {
        if (readConsistencyLevel != null) {
            defaultReadConsistencyLevel = ConsistencyLevel.valueOf(readConsistencyLevel.toUpperCase());
        } else {
            defaultReadConsistencyLevel = ConsistencyLevel.ONE;
        }
    }
    return defaultReadConsistencyLevel;
}
 
開發者ID:osswangxining,項目名稱:iotplatform,代碼行數:11,代碼來源:CassandraQueryOptions.java

示例3: getDefaultWriteConsistencyLevel

import com.datastax.driver.core.ConsistencyLevel; //導入方法依賴的package包/類
protected ConsistencyLevel getDefaultWriteConsistencyLevel() {
    if (defaultWriteConsistencyLevel == null) {
        if (writeConsistencyLevel != null) {
            defaultWriteConsistencyLevel = ConsistencyLevel.valueOf(writeConsistencyLevel.toUpperCase());
        } else {
            defaultWriteConsistencyLevel = ConsistencyLevel.ONE;
        }
    }
    return defaultWriteConsistencyLevel;
}
 
開發者ID:osswangxining,項目名稱:iotplatform,代碼行數:11,代碼來源:CassandraQueryOptions.java

示例4: readConsistency

import com.datastax.driver.core.ConsistencyLevel; //導入方法依賴的package包/類
protected static ConsistencyLevel readConsistency(AuthzTrans trans, String table) {
	String prop = trans.getProperty(CASS_READ_CONSISTENCY+'.'+table);
	if(prop==null) {
		prop = trans.getProperty(CASS_READ_CONSISTENCY);
		if(prop==null) {
			return ConsistencyLevel.ONE; // this is Cassandra Default
		}
	}
	return ConsistencyLevel.valueOf(prop);
}
 
開發者ID:att,項目名稱:AAF,代碼行數:11,代碼來源:CassDAOImpl.java

示例5: writeConsistency

import com.datastax.driver.core.ConsistencyLevel; //導入方法依賴的package包/類
protected static ConsistencyLevel writeConsistency(AuthzTrans trans, String table) {
	String prop = trans.getProperty(CASS_WRITE_CONSISTENCY+'.'+table);
	if(prop==null) {
		prop = trans.getProperty(CASS_WRITE_CONSISTENCY);
		if(prop==null) {
			return ConsistencyLevel.ONE; // this is Cassandra Default\
		}
	}
	return ConsistencyLevel.valueOf(prop);
}
 
開發者ID:att,項目名稱:AAF,代碼行數:11,代碼來源:CassDAOImpl.java

示例6: CassandraConfig

import com.datastax.driver.core.ConsistencyLevel; //導入方法依賴的package包/類
public CassandraConfig(Properties p)
{
    port = Integer.parseInt(p.getProperty(PORT_PROPERTY, DEFAULT_PORT));
    dataCenter = p.getProperty(DATA_CENTER);
    readConsistencyLevel = ConsistencyLevel.valueOf(p.getProperty(READ_CONSISTENCY_LEVEL, "LOCAL_QUORUM"));
    writeConsistencyLevel = ConsistencyLevel.valueOf(p.getProperty(WRITE_CONSISTENCY_LEVEL, "LOCAL_QUORUM"));
    keyspace = p.getProperty(KEYSPACE_PROPERTY);

    if (keyspace == null || keyspace.trim().isEmpty())
    {
        throw new ConfigurationException(
                "Please define a Cassandra keyspace in property: "
                + KEYSPACE_PROPERTY);
    }

    String contactPointsCommaDelimited = p.getProperty(CONTACT_POINTS_PROPERTY);

    if (contactPointsCommaDelimited == null || contactPointsCommaDelimited.trim().isEmpty())
    {
        throw new ConfigurationException(
                "Please define Cassandra contact points for property: "
                + CONTACT_POINTS_PROPERTY);
    }

    contactPoints = contactPointsCommaDelimited.split(",\\s*");

    initialize(p);
}
 
開發者ID:PearsonEducation,項目名稱:Docussandra,代碼行數:29,代碼來源:CassandraConfig.java

示例7: convertFrom

import com.datastax.driver.core.ConsistencyLevel; //導入方法依賴的package包/類
@Override
public ConsistencyLevel convertFrom(String value) {
    if (Strings.isNullOrEmpty(value)) {
        throw new ParameterException("Couldn't convert empty string to a Cassandra consistency level.");
    }

    try {
        return ConsistencyLevel.valueOf(value.toUpperCase(Locale.ENGLISH));
    } catch (Exception e) {
        throw new ParameterException(e.getMessage(), e);
    }
}
 
開發者ID:graylog-labs,項目名稱:graylog-plugin-metrics-reporter,代碼行數:13,代碼來源:ConsistencyLevelConverter.java

示例8: parseArgs

import com.datastax.driver.core.ConsistencyLevel; //導入方法依賴的package包/類
private boolean parseArgs(String[] args)
throws IOException, FileNotFoundException {
String tkey;
if (args.length == 0) {
    System.err.println("No arguments specified");
    return false;
}
if (0 != args.length % 2)
    return false;

Map<String, String> amap = new HashMap<String,String>();
for (int i = 0; i < args.length; i+=2) {
    amap.put(args[i], args[i+1]);
}

       if (null != (tkey = amap.remove("-configFile")))
           if (!processConfigFile(tkey, amap))
               return false;

host = amap.remove("-host");
if (null == host) { // host is required
    System.err.println("Must provide a host");
    return false;
}

keyspaceName = amap.remove("-keyspace");
if (null == keyspaceName) { // keyspace is required
    System.err.println("Must provide a keyspace name");
    return false;
}

tableName = amap.remove("-table");
if (null == tableName) { // table is required
    System.err.println("Must provide a table name");
    return false;
}

if (null != (tkey = amap.remove("-port")))          port = Integer.parseInt(tkey);
if (null != (tkey = amap.remove("-user")))          username = tkey;
if (null != (tkey = amap.remove("-pw")))            password = tkey;
       if (null != (tkey = amap.remove("-ssl-truststore-path"))) truststorePath = tkey;
       if (null != (tkey = amap.remove("-ssl-truststore-pwd")))  truststorePwd =  tkey;
       if (null != (tkey = amap.remove("-ssl-keystore-path")))   keystorePath = tkey;
       if (null != (tkey = amap.remove("-ssl-keystore-pwd")))    keystorePwd = tkey;
       if (null != (tkey = amap.remove("-consistencyLevel"))) consistencyLevel = ConsistencyLevel.valueOf(tkey);
if (null != (tkey = amap.remove("-numFutures")))    numFutures = Integer.parseInt(tkey);
if (null != (tkey = amap.remove("-numSplits")))    numSplits = Integer.parseInt(tkey);
if (null != (tkey = amap.remove("-splitSize")))    splitSize = Long.parseLong(tkey) * 1024 * 1024;
if (null != (tkey = amap.remove("-beginToken")))    beginTokenString = tkey;
if (null != (tkey = amap.remove("-endToken")))      endTokenString = tkey;
if (null != (tkey = amap.remove("-debug")))      debug = Integer.parseInt(tkey);

if (!amap.isEmpty()) {
    for (String k : amap.keySet())
	System.err.println("Unrecognized option: " + k);
    return false;
}
return validateArgs();
   }
 
開發者ID:brianmhess,項目名稱:cassandra-count,代碼行數:60,代碼來源:CqlCount.java

示例9: Query

import com.datastax.driver.core.ConsistencyLevel; //導入方法依賴的package包/類
/**
 * Constructor Query
 * @param description
 * @param name
 * @param preparedStatementString
 * @param binds
 * @return new Query Object
 * @throws Exception
 */
public Query (
  final String description,
  final String name,
  final String preparedStatementString,
  Object... binds) throws Exception {
  
  String psString = preparedStatementString.trim();
  String[] psSplit = psString.split(" ", 2);
  this.type = Type.valueOf(psSplit[0].toUpperCase() );
  
  ArgumentsInl.checkNotNull(
    "Query Type",
    this.type,
    ExceptionType.CODE_EXCEPTION);
  
  this.description = description;
  this.name = name;
  this.preparedStatementString = preparedStatementString;
  
  this.preparedStatement =
    Cassandra.i().makePreparedStatementSync(this.preparedStatementString);
  
  if (this.type == Type.SELECT) {
    
    this.preparedStatement.setConsistencyLevel(
      ConsistencyLevel.valueOf(
        CassandraProperties.i().getStringPropterty(
          CassandraProperties.kReadConsistencyLevel) ) );
    this.consistencyLevel =
      ConsistencyLevel.valueOf(
        CassandraProperties.i().getStringPropterty(
          CassandraProperties.kReadConsistencyLevel) );
  } else {
    
    this.preparedStatement.setConsistencyLevel(
      ConsistencyLevel.valueOf(
        CassandraProperties.i().getStringPropterty(
          CassandraProperties.kWriteConsistencyLevel) ) );
    this.consistencyLevel =
      ConsistencyLevel.valueOf(
        CassandraProperties.i().getStringPropterty(
          CassandraProperties.kWriteConsistencyLevel) );
  }
  
  this.binds = binds;
}
 
開發者ID:vangav,項目名稱:vos_backend,代碼行數:56,代碼來源:Query.java


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