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


Java ClientState.forInternalCalls方法代码示例

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


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

示例1: parseSchema

import org.apache.cassandra.service.ClientState; //导入方法依赖的package包/类
/**
 * Get the meta data (column definitions) for the target table.
 * 
 * @param query The CREATE TABLE statement for the table the Json data should be put into.
 * @return The table's meta data
 */
private static CFMetaData parseSchema(String query) {
    try {
        ClientState state = ClientState.forInternalCalls();
        ParsedStatement.Prepared prepared = QueryProcessor.getStatement(query, state);
        CQLStatement stmt = prepared.statement;
        stmt.validate(state);

        if (!stmt.getClass().equals(CreateTableStatement.class)) {
            throw new IllegalArgumentException("Invalid query, must be a CREATE TABLE statement");
        }

        return CreateTableStatement.class.cast(stmt).getCFMetaData();
    } catch (RequestValidationException | IllegalArgumentException e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:PubGrade,项目名称:Json2SSTable,代码行数:23,代码来源:Json2SSTable.java

示例2: getStatement

import org.apache.cassandra.service.ClientState; //导入方法依赖的package包/类
private static <T extends CQLStatement> Pair<T, List<ColumnSpecification>> getStatement(String query, Class<T> klass, String type)
{
    try
    {
        ClientState state = ClientState.forInternalCalls();
        ParsedStatement.Prepared prepared = QueryProcessor.getStatement(query, state);
        CQLStatement stmt = prepared.statement;
        stmt.validate(state);

        if (!stmt.getClass().equals(klass))
            throw new IllegalArgumentException("Invalid query, must be a " + type + " statement");

        return Pair.create(klass.cast(stmt), prepared.boundNames);
    }
    catch (RequestValidationException e)
    {
        throw new IllegalArgumentException(e.getMessage(), e);
    }
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:20,代码来源:CQLSSTableWriter.java

示例3: setupClientState

import org.apache.cassandra.service.ClientState; //导入方法依赖的package包/类
void setupClientState()
{

    try
    {
        role = RoleResource.role(roleName);
        // use reflection to set the logged in user so that we don't need to
        // bother setting up an IRoleManager
        user = new AuthenticatedUser(roleName);
        clientState = ClientState.forInternalCalls();
        Field userField = ClientState.class.getDeclaredField("user");
        userField.setAccessible(true);
        userField.set(clientState, user);
    }
    catch (IllegalAccessException | NoSuchFieldException e)
    {
        throw new RuntimeException(e);
    }
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:20,代码来源:UFAuthTest.java

示例4: schemaChange

import org.apache.cassandra.service.ClientState; //导入方法依赖的package包/类
protected static void schemaChange(String query)
{
    try
    {
        ClientState state = ClientState.forInternalCalls();
        state.setKeyspace(SystemKeyspace.NAME);
        QueryState queryState = new QueryState(state);

        ParsedStatement.Prepared prepared = QueryProcessor.parseStatement(query, queryState);
        prepared.statement.validate(state);

        QueryOptions options = QueryOptions.forInternalCalls(Collections.<ByteBuffer>emptyList());

        lastSchemaChangeResult = prepared.statement.executeInternal(queryState, options);
    }
    catch (Exception e)
    {
        logger.info("Error performing schema change", e);
        throw new RuntimeException("Error setting schema for test (query was: " + query + ")", e);
    }
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:22,代码来源:CQLTester.java

示例5: InternalStateInstance

import org.apache.cassandra.service.ClientState; //导入方法依赖的package包/类
InternalStateInstance()
{
    ClientState state = ClientState.forInternalCalls();
    try
    {
        state.setKeyspace(Keyspace.SYSTEM_KS);
    }
    catch (InvalidRequestException e)
    {
        throw new RuntimeException();
    }
    this.queryState = new QueryState(state);
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:14,代码来源:QueryProcessor.java


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