本文整理汇总了Java中org.apache.cassandra.utils.SemanticVersion类的典型用法代码示例。如果您正苦于以下问题:Java SemanticVersion类的具体用法?Java SemanticVersion怎么用?Java SemanticVersion使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SemanticVersion类属于org.apache.cassandra.utils包,在下文中一共展示了SemanticVersion类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: validateCQLVersion
import org.apache.cassandra.utils.SemanticVersion; //导入依赖的package包/类
private void validateCQLVersion(int major) throws InvalidRequestException
{
/*
* The rules are:
* - If no version are set, we don't validate anything. The reason is
* that 1) old CQL2 client might not have called set_cql_version
* and 2) some client may have removed the set_cql_version for CQL3
* when updating to 1.2.0. A CQL3 client upgrading from pre-1.2
* shouldn't be in that case however since set_cql_version uses to
* be mandatory (for CQL3).
* - Otherwise, checks the major matches whatever was set.
*/
SemanticVersion versionSet = state().getCQLVersion();
if (versionSet == null)
return;
if (versionSet.major != major)
throw new InvalidRequestException(
"Cannot execute/prepare CQL" + major + " statement since the CQL has been set to CQL" + versionSet.major
+ "(This might mean your client hasn't been upgraded correctly to use the new CQL3 methods introduced in Cassandra 1.2+).");
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:22,代码来源:CassandraServer.java
示例2: getCQLSupportedVersion
import org.apache.cassandra.utils.SemanticVersion; //导入依赖的package包/类
public static SemanticVersion[] getCQLSupportedVersion()
{
SemanticVersion cql = org.apache.cassandra.cql.QueryProcessor.CQL_VERSION;
SemanticVersion cql3 = org.apache.cassandra.cql3.QueryProcessor.CQL_VERSION;
return new SemanticVersion[]{ cql, cql3 };
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:8,代码来源:ClientState.java
示例3: execute
import org.apache.cassandra.utils.SemanticVersion; //导入依赖的package包/类
public Message.Response execute(QueryState state)
{
String cqlVersion = options.get(CQL_VERSION);
if (cqlVersion == null)
throw new ProtocolException("Missing value CQL_VERSION in STARTUP message");
try
{
if (new SemanticVersion(cqlVersion).compareTo(new SemanticVersion("2.99.0")) < 0)
throw new ProtocolException(String.format("CQL version %s is not supported by the binary protocol (supported version are >= 3.0.0)", cqlVersion));
}
catch (IllegalArgumentException e)
{
throw new ProtocolException(e.getMessage());
}
if (options.containsKey(COMPRESSION))
{
String compression = options.get(COMPRESSION).toLowerCase();
if (compression.equals("snappy"))
{
if (FrameCompressor.SnappyCompressor.instance == null)
throw new ProtocolException("This instance does not support Snappy compression");
connection.setCompressor(FrameCompressor.SnappyCompressor.instance);
}
else if (compression.equals("lz4"))
{
connection.setCompressor(FrameCompressor.LZ4Compressor.instance);
}
else
{
throw new ProtocolException(String.format("Unknown compression algorithm: %s", compression));
}
}
if (DatabaseDescriptor.getAuthenticator().requireAuthentication())
return new AuthenticateMessage(DatabaseDescriptor.getAuthenticator().getClass().getName());
else
return new ReadyMessage();
}
开发者ID:daidong,项目名称:GraphTrek,代码行数:41,代码来源:StartupMessage.java
示例4: execute
import org.apache.cassandra.utils.SemanticVersion; //导入依赖的package包/类
public Message.Response execute(QueryState state)
{
ClientState cState = state.getClientState();
String cqlVersion = options.get(CQL_VERSION);
if (cqlVersion == null)
throw new ProtocolException("Missing value CQL_VERSION in STARTUP message");
try
{
cState.setCQLVersion(cqlVersion);
}
catch (InvalidRequestException e)
{
throw new ProtocolException(e.getMessage());
}
if (cState.getCQLVersion().compareTo(new SemanticVersion("2.99.0")) < 0)
throw new ProtocolException(String.format("CQL version %s is not supported by the binary protocol (supported version are >= 3.0.0)", cqlVersion));
if (options.containsKey(COMPRESSION))
{
String compression = options.get(COMPRESSION).toLowerCase();
if (compression.equals("snappy"))
{
if (FrameCompressor.SnappyCompressor.instance == null)
throw new ProtocolException("This instance does not support Snappy compression");
connection.setCompressor(FrameCompressor.SnappyCompressor.instance);
}
else
{
throw new ProtocolException(String.format("Unknown compression algorithm: %s", compression));
}
}
if (DatabaseDescriptor.getAuthenticator().requireAuthentication())
return new AuthenticateMessage(DatabaseDescriptor.getAuthenticator().getClass().getName());
else
return new ReadyMessage();
}
开发者ID:dprguiuc,项目名称:Cassandra-Wasef,代码行数:40,代码来源:StartupMessage.java
示例5: getCQLVersion
import org.apache.cassandra.utils.SemanticVersion; //导入依赖的package包/类
public SemanticVersion getCQLVersion()
{
return cqlVersion;
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:5,代码来源:ClientState.java
示例6: execute
import org.apache.cassandra.utils.SemanticVersion; //导入依赖的package包/类
public Message.Response execute(QueryState state)
{
ClientState cState = state.getClientState();
String cqlVersion = options.get(CQL_VERSION);
if (cqlVersion == null)
throw new ProtocolException("Missing value CQL_VERSION in STARTUP message");
try
{
cState.setCQLVersion(cqlVersion);
}
catch (InvalidRequestException e)
{
throw new ProtocolException(e.getMessage());
}
if (cState.getCQLVersion().compareTo(new SemanticVersion("2.99.0")) < 0)
throw new ProtocolException(String.format("CQL version %s is not supported by the binary protocol (supported version are >= 3.0.0)", cqlVersion));
if (options.containsKey(COMPRESSION))
{
String compression = options.get(COMPRESSION).toLowerCase();
if (compression.equals("snappy"))
{
if (FrameCompressor.SnappyCompressor.instance == null)
throw new ProtocolException("This instance does not support Snappy compression");
connection.setCompressor(FrameCompressor.SnappyCompressor.instance);
}
else if (compression.equals("lz4"))
{
connection.setCompressor(FrameCompressor.LZ4Compressor.instance);
}
else
{
throw new ProtocolException(String.format("Unknown compression algorithm: %s", compression));
}
}
if (DatabaseDescriptor.getAuthenticator().requireAuthentication())
return new AuthenticateMessage(DatabaseDescriptor.getAuthenticator().getClass().getName());
else
return new ReadyMessage();
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:44,代码来源:StartupMessage.java
示例7: getCQLSupportedVersion
import org.apache.cassandra.utils.SemanticVersion; //导入依赖的package包/类
public static SemanticVersion[] getCQLSupportedVersion()
{
return new SemanticVersion[]{ QueryProcessor.CQL_VERSION };
}
开发者ID:daidong,项目名称:GraphTrek,代码行数:5,代码来源:ClientState.java
注:本文中的org.apache.cassandra.utils.SemanticVersion类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论