当前位置: 首页>>代码示例>>Java>>正文


Java Schema.NAME_LENGTH属性代码示例

本文整理汇总了Java中org.apache.cassandra.config.Schema.NAME_LENGTH属性的典型用法代码示例。如果您正苦于以下问题:Java Schema.NAME_LENGTH属性的具体用法?Java Schema.NAME_LENGTH怎么用?Java Schema.NAME_LENGTH使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.cassandra.config.Schema的用法示例。


在下文中一共展示了Schema.NAME_LENGTH属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: validate

/**
 * 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());
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:31,代码来源:CreateKeyspaceStatement.java

示例2: validate

/**
 * 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.");
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:30,代码来源:CreateKeyspaceStatement.java


注:本文中的org.apache.cassandra.config.Schema.NAME_LENGTH属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。