本文整理汇总了Java中org.apache.cassandra.thrift.ThriftValidation.validateKeyspaceNotSystem方法的典型用法代码示例。如果您正苦于以下问题:Java ThriftValidation.validateKeyspaceNotSystem方法的具体用法?Java ThriftValidation.validateKeyspaceNotSystem怎么用?Java ThriftValidation.validateKeyspaceNotSystem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.cassandra.thrift.ThriftValidation
的用法示例。
在下文中一共展示了ThriftValidation.validateKeyspaceNotSystem方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: validate
import org.apache.cassandra.thrift.ThriftValidation; //导入方法依赖的package包/类
/**
* The <code>CqlParser</code> only goes as far as extracting the keyword arguments
* from these statements, so this method is responsible for processing and
* validating.
*
* @throws InvalidRequestException if arguments are missing or unacceptable
*/
public void validate(ClientState state) throws RequestValidationException
{
ThriftValidation.validateKeyspaceNotSystem(name);
// keyspace name
if (!name.matches("\\w+"))
throw new InvalidRequestException(String.format("\"%s\" is not a valid keyspace name", name));
if (name.length() > Schema.NAME_LENGTH)
throw new InvalidRequestException(String.format("Keyspace names shouldn't be more than %s characters long (got \"%s\")", Schema.NAME_LENGTH, name));
attrs.validate();
if (attrs.getReplicationStrategyClass() == null)
throw new ConfigurationException("Missing mandatory replication strategy class");
// The strategy is validated through KSMetaData.validate() in announceNewKeyspace below.
// However, for backward compatibility with thrift, this doesn't validate unexpected options yet,
// so doing proper validation here.
AbstractReplicationStrategy.validateReplicationStrategy(name,
AbstractReplicationStrategy.getClass(attrs.getReplicationStrategyClass()),
StorageService.instance.getTokenMetadata(),
DatabaseDescriptor.getEndpointSnitch(),
attrs.getReplicationOptions());
}
示例2: validate
import org.apache.cassandra.thrift.ThriftValidation; //导入方法依赖的package包/类
/**
* The <code>CqlParser</code> only goes as far as extracting the keyword arguments
* from these statements, so this method is responsible for processing and
* validating.
*
* @throws InvalidRequestException if arguments are missing or unacceptable
*/
public void validate(ClientState state) throws RequestValidationException
{
ThriftValidation.validateKeyspaceNotSystem(name);
// keyspace name
if (!name.matches("\\w+"))
throw new InvalidRequestException(String.format("\"%s\" is not a valid keyspace name", name));
if (name.length() > Schema.NAME_LENGTH)
throw new InvalidRequestException(String.format("Keyspace names shouldn't be more than %s characters long (got \"%s\")", Schema.NAME_LENGTH, name));
attrs.validate();
if (attrs.getReplicationStrategyClass() == null)
throw new ConfigurationException("Missing mandatory replication strategy class");
// The strategy is validated through KSMetaData.validate() in announceNewKeyspace below.
// However, for backward compatibility with thrift, this doesn't validate unexpected options yet,
// so doing proper validation here.
KeyspaceParams params = attrs.asNewKeyspaceParams();
params.validate(name);
if (params.replication.klass.equals(LocalStrategy.class))
throw new ConfigurationException("Unable to use given strategy class: LocalStrategy is reserved for internal use.");
}
示例3: prepareKeyspace
import org.apache.cassandra.thrift.ThriftValidation; //导入方法依赖的package包/类
public void prepareKeyspace(ClientState state) throws InvalidRequestException
{
if (!functionName.hasKeyspace() && state.getRawKeyspace() != null)
functionName = new FunctionName(state.getKeyspace(), functionName.name);
if (!functionName.hasKeyspace())
throw new InvalidRequestException("Functions must be fully qualified with a keyspace name if a keyspace is not set for the session");
ThriftValidation.validateKeyspaceNotSystem(functionName.keyspace);
stateFunc = new FunctionName(functionName.keyspace, stateFunc.name);
if (finalFunc != null)
finalFunc = new FunctionName(functionName.keyspace, finalFunc.name);
}
示例4: prepareKeyspace
import org.apache.cassandra.thrift.ThriftValidation; //导入方法依赖的package包/类
public void prepareKeyspace(ClientState state) throws InvalidRequestException
{
if (!functionName.hasKeyspace() && state.getRawKeyspace() != null)
functionName = new FunctionName(state.getKeyspace(), functionName.name);
if (!functionName.hasKeyspace())
throw new InvalidRequestException("Functions must be fully qualified with a keyspace name if a keyspace is not set for the session");
ThriftValidation.validateKeyspaceNotSystem(functionName.keyspace);
}
示例5: prepareKeyspace
import org.apache.cassandra.thrift.ThriftValidation; //导入方法依赖的package包/类
public void prepareKeyspace(ClientState state) throws InvalidRequestException
{
if (!functionName.hasKeyspace() && state.getRawKeyspace() != null)
functionName = new FunctionName(state.getRawKeyspace(), functionName.name);
if (!functionName.hasKeyspace())
throw new InvalidRequestException("Functions must be fully qualified with a keyspace name if a keyspace is not set for the session");
ThriftValidation.validateKeyspaceNotSystem(functionName.keyspace);
}
示例6: prepareKeyspace
import org.apache.cassandra.thrift.ThriftValidation; //导入方法依赖的package包/类
@Override
public void prepareKeyspace(ClientState state) throws InvalidRequestException
{
if (!functionName.hasKeyspace() && state.getRawKeyspace() != null)
functionName = new FunctionName(state.getKeyspace(), functionName.name);
if (!functionName.hasKeyspace())
throw new InvalidRequestException("Functions must be fully qualified with a keyspace name if a keyspace is not set for the session");
ThriftValidation.validateKeyspaceNotSystem(functionName.keyspace);
}
示例7: validate
import org.apache.cassandra.thrift.ThriftValidation; //导入方法依赖的package包/类
/**
* The <code>CqlParser</code> only goes as far as extracting the keyword arguments
* from these statements, so this method is responsible for processing and
* validating.
*
* @throws InvalidRequestException if arguments are missing or unacceptable
*/
@Override
public void validate(ClientState state) throws RequestValidationException
{
super.validate(state);
ThriftValidation.validateKeyspaceNotSystem(name);
// keyspace name
if (!name.matches("\\w+"))
throw new InvalidRequestException(String.format("\"%s\" is not a valid keyspace name", name));
if (name.length() > Schema.NAME_LENGTH)
throw new InvalidRequestException(String.format("Keyspace names shouldn't be more than %s characters long (got \"%s\")", Schema.NAME_LENGTH, name));
attrs.validate();
if (attrs.getReplicationStrategyClass() == null)
throw new ConfigurationException("Missing mandatory replication strategy class");
// The strategy is validated through KSMetaData.validate() in announceNewKeyspace below.
// However, for backward compatibility with thrift, this doesn't validate unexpected options yet,
// so doing proper validation here.
AbstractReplicationStrategy.validateReplicationStrategy(name,
attrs.getReplicationStrategyClass(),
StorageService.instance.getTokenMetadata(),
DatabaseDescriptor.getEndpointSnitch(),
attrs.getReplicationOptions());
}
示例8: validate
import org.apache.cassandra.thrift.ThriftValidation; //导入方法依赖的package包/类
public void validate(ClientState state) throws RequestValidationException
{
ThriftValidation.validateKeyspaceNotSystem(keyspace);
}
示例9: validate
import org.apache.cassandra.thrift.ThriftValidation; //导入方法依赖的package包/类
@Override
public void validate(ClientState state) throws RequestValidationException
{
super.validate(state);
ThriftValidation.validateKeyspaceNotSystem(keyspace);
}