Java 类org.apache.cassandra.thrift.ThriftClientState 实例源码

项目:cassandra-kmean    文件:QueryProcessor.java   
public static CqlPreparedResult prepare(String queryString, ThriftClientState clientState)
throws RequestValidationException
{
    logger.trace("CQL QUERY: {}", queryString);

    CQLStatement statement = getStatement(queryString);
    int statementId = makeStatementId(queryString);
    logger.trace("Discovered "+ statement.boundTerms + " bound variables.");

    clientState.getPrepared().put(statementId, statement);
    logger.trace(String.format("Stored prepared statement #%d with %d bind markers",
                               statementId,
                               statement.boundTerms));

    if (!postPreparationHooks.isEmpty())
    {
        PreparationContext context = new PreparationContext(clientState, queryString, statement);
        for (PostPreparationHook hook : postPreparationHooks)
            hook.processStatement(statement, context);
    }

    return new CqlPreparedResult(statementId, statement.boundTerms);
}
项目:cassandra-kmean    文件:QueryProcessor.java   
public static CqlResult processPrepared(CQLStatement statement, ThriftClientState clientState, List<ByteBuffer> variables)
throws RequestValidationException, RequestExecutionException
{
    // Check to see if there are any bound variables to verify
    if (!(variables.isEmpty() && (statement.boundTerms == 0)))
    {
        if (variables.size() != statement.boundTerms)
            throw new InvalidRequestException(String.format("there were %d markers(?) in CQL but %d bound variables",
                                                            statement.boundTerms,
                                                            variables.size()));

        // at this point there is a match in count between markers and variables that is non-zero

        if (logger.isTraceEnabled())
            for (int i = 0; i < variables.size(); i++)
                logger.trace("[{}] '{}'", i+1, variables.get(i));
    }

    return processStatement(statement, new ExecutionContext(clientState, null, variables));
}
项目:cassandra-kmean    文件:DeleteStatement.java   
public Mutation mutationForKey(ByteBuffer key, String keyspace, Long timestamp, ThriftClientState clientState, List<ByteBuffer> variables, CFMetaData metadata)
throws InvalidRequestException
{
    Mutation mutation = new Mutation(keyspace, key);

    QueryProcessor.validateKeyAlias(metadata, keyName);

    if (columns.size() < 1)
    {
        // No columns, delete the partition
        mutation.delete(columnFamily, (timestamp == null) ? getTimestamp(clientState) : timestamp);
    }
    else
    {
        // Delete specific columns
        AbstractType<?> at = metadata.comparator.asAbstractType();
        for (Term column : columns)
        {
            CellName columnName = metadata.comparator.cellFromByteBuffer(column.getByteBuffer(at, variables));
            validateColumnName(columnName);
            mutation.delete(columnFamily, columnName, (timestamp == null) ? getTimestamp(clientState) : timestamp);
        }
    }

    return mutation;
}
项目:ACaZoo    文件:QueryProcessor.java   
public static CqlPreparedResult prepare(String queryString, ThriftClientState clientState)
throws SyntaxException
{
    logger.trace("CQL QUERY: {}", queryString);

    CQLStatement statement = getStatement(queryString);
    int statementId = makeStatementId(queryString);
    logger.trace("Discovered "+ statement.boundTerms + " bound variables.");

    clientState.getPrepared().put(statementId, statement);
    logger.trace(String.format("Stored prepared statement #%d with %d bind markers",
                               statementId,
                               statement.boundTerms));

    return new CqlPreparedResult(statementId, statement.boundTerms);
}
项目:ACaZoo    文件:QueryProcessor.java   
public static CqlResult processPrepared(CQLStatement statement, ThriftClientState clientState, List<ByteBuffer> variables)
throws RequestValidationException, RequestExecutionException
{
    // Check to see if there are any bound variables to verify
    if (!(variables.isEmpty() && (statement.boundTerms == 0)))
    {
        if (variables.size() != statement.boundTerms)
            throw new InvalidRequestException(String.format("there were %d markers(?) in CQL but %d bound variables",
                                                            statement.boundTerms,
                                                            variables.size()));

        // at this point there is a match in count between markers and variables that is non-zero

        if (logger.isTraceEnabled())
            for (int i = 0; i < variables.size(); i++)
                logger.trace("[{}] '{}'", i+1, variables.get(i));
    }

    return processStatement(statement, clientState, variables);
}
项目:ACaZoo    文件:DeleteStatement.java   
public List<IMutation> prepareRowMutations(String keyspace, ThriftClientState clientState, Long timestamp, List<ByteBuffer> variables)
throws InvalidRequestException, UnauthorizedException
{
    CFMetaData metadata = validateColumnFamily(keyspace, columnFamily);

    clientState.hasColumnFamilyAccess(keyspace, columnFamily, Permission.MODIFY);
    AbstractType<?> keyType = Schema.instance.getCFMetaData(keyspace, columnFamily).getKeyValidator();

    List<IMutation> rowMutations = new ArrayList<IMutation>(keys.size());

    for (Term key : keys)
    {
        rowMutations.add(mutationForKey(key.getByteBuffer(keyType, variables), keyspace, timestamp, clientState, variables, metadata));
    }

    return rowMutations;
}
项目:ACaZoo    文件:DeleteStatement.java   
public RowMutation mutationForKey(ByteBuffer key, String keyspace, Long timestamp, ThriftClientState clientState, List<ByteBuffer> variables, CFMetaData metadata)
throws InvalidRequestException
{
    RowMutation rm = new RowMutation(keyspace, key);

    QueryProcessor.validateKeyAlias(metadata, keyName);

    if (columns.size() < 1)
    {
        // No columns, delete the row
        rm.delete(columnFamily, (timestamp == null) ? getTimestamp(clientState) : timestamp);
    }
    else
    {
        // Delete specific columns
        for (Term column : columns)
        {
            ByteBuffer columnName = column.getByteBuffer(metadata.comparator, variables);
            validateColumnName(columnName);
            rm.delete(columnFamily, columnName, (timestamp == null) ? getTimestamp(clientState) : timestamp);
        }
    }

    return rm;
}
项目:Cassandra-Wasef    文件:QueryProcessor.java   
public static CqlPreparedResult prepare(String queryString, ThriftClientState clientState)
throws InvalidRequestException, SyntaxException
{
    logger.trace("CQL QUERY: {}", queryString);

    CQLStatement statement = getStatement(queryString);
    int statementId = makeStatementId(queryString);
    logger.trace("Discovered "+ statement.boundTerms + " bound variables.");

    clientState.getPrepared().put(statementId, statement);
    logger.trace(String.format("Stored prepared statement #%d with %d bind markers",
                               statementId,
                               statement.boundTerms));

    return new CqlPreparedResult(statementId, statement.boundTerms);
}
项目:Cassandra-Wasef    文件:QueryProcessor.java   
public static CqlResult processPrepared(CQLStatement statement, ThriftClientState clientState, List<ByteBuffer> variables)
throws RequestValidationException, RequestExecutionException
{
    // Check to see if there are any bound variables to verify
    if (!(variables.isEmpty() && (statement.boundTerms == 0)))
    {
        if (variables.size() != statement.boundTerms)
            throw new InvalidRequestException(String.format("there were %d markers(?) in CQL but %d bound variables",
                                                            statement.boundTerms,
                                                            variables.size()));

        // at this point there is a match in count between markers and variables that is non-zero

        if (logger.isTraceEnabled())
            for (int i = 0; i < variables.size(); i++)
                logger.trace("[{}] '{}'", i+1, variables.get(i));
    }

    return processStatement(statement, clientState, variables);
}
项目:Cassandra-Wasef    文件:DeleteStatement.java   
public List<IMutation> prepareRowMutations(String keyspace, ThriftClientState clientState, Long timestamp, List<ByteBuffer> variables)
throws InvalidRequestException, UnauthorizedException
{
    CFMetaData metadata = validateColumnFamily(keyspace, columnFamily);

    clientState.hasColumnFamilyAccess(keyspace, columnFamily, Permission.MODIFY);
    AbstractType<?> keyType = Schema.instance.getCFMetaData(keyspace, columnFamily).getKeyValidator();

    List<IMutation> rowMutations = new ArrayList<IMutation>(keys.size());

    for (Term key : keys)
    {
        rowMutations.add(mutationForKey(key.getByteBuffer(keyType, variables), keyspace, timestamp, clientState, variables, metadata));
    }

    return rowMutations;
}
项目:stratio-cassandra    文件:QueryProcessor.java   
public static CqlPreparedResult prepare(String queryString, ThriftClientState clientState)
throws RequestValidationException
{
    logger.trace("CQL QUERY: {}", queryString);

    CQLStatement statement = getStatement(queryString);
    int statementId = makeStatementId(queryString);
    logger.trace("Discovered "+ statement.boundTerms + " bound variables.");

    clientState.getPrepared().put(statementId, statement);
    logger.trace(String.format("Stored prepared statement #%d with %d bind markers",
                               statementId,
                               statement.boundTerms));

    if (!postPreparationHooks.isEmpty())
    {
        PreparationContext context = new PreparationContext(clientState, queryString, statement);
        for (PostPreparationHook hook : postPreparationHooks)
            hook.processStatement(statement, context);
    }

    return new CqlPreparedResult(statementId, statement.boundTerms);
}
项目:stratio-cassandra    文件:QueryProcessor.java   
public static CqlResult processPrepared(CQLStatement statement, ThriftClientState clientState, List<ByteBuffer> variables)
throws RequestValidationException, RequestExecutionException
{
    // Check to see if there are any bound variables to verify
    if (!(variables.isEmpty() && (statement.boundTerms == 0)))
    {
        if (variables.size() != statement.boundTerms)
            throw new InvalidRequestException(String.format("there were %d markers(?) in CQL but %d bound variables",
                                                            statement.boundTerms,
                                                            variables.size()));

        // at this point there is a match in count between markers and variables that is non-zero

        if (logger.isTraceEnabled())
            for (int i = 0; i < variables.size(); i++)
                logger.trace("[{}] '{}'", i+1, variables.get(i));
    }

    return processStatement(statement, new ExecutionContext(clientState, null, variables));
}
项目:stratio-cassandra    文件:DeleteStatement.java   
public Mutation mutationForKey(ByteBuffer key, String keyspace, Long timestamp, ThriftClientState clientState, List<ByteBuffer> variables, CFMetaData metadata)
throws InvalidRequestException
{
    Mutation mutation = new Mutation(keyspace, key);

    QueryProcessor.validateKeyAlias(metadata, keyName);

    if (columns.size() < 1)
    {
        // No columns, delete the partition
        mutation.delete(columnFamily, (timestamp == null) ? getTimestamp(clientState) : timestamp);
    }
    else
    {
        // Delete specific columns
        AbstractType<?> at = metadata.comparator.asAbstractType();
        for (Term column : columns)
        {
            CellName columnName = metadata.comparator.cellFromByteBuffer(column.getByteBuffer(at, variables));
            validateColumnName(columnName);
            mutation.delete(columnFamily, columnName, (timestamp == null) ? getTimestamp(clientState) : timestamp);
        }
    }

    return mutation;
}
项目:cassandra-cqlMod    文件:QueryProcessor.java   
public static CqlPreparedResult prepare(String queryString, ThriftClientState clientState)
throws RequestValidationException
{
    logger.trace("CQL QUERY: {}", queryString);

    CQLStatement statement = getStatement(queryString);
    int statementId = makeStatementId(queryString);
    logger.trace("Discovered "+ statement.boundTerms + " bound variables.");

    clientState.getPrepared().put(statementId, statement);
    logger.trace(String.format("Stored prepared statement #%d with %d bind markers",
                               statementId,
                               statement.boundTerms));

    if (!postPreparationHooks.isEmpty())
    {
        PreparationContext context = new PreparationContext(clientState, queryString, statement);
        for (PostPreparationHook hook : postPreparationHooks)
            hook.processStatement(statement, context);
    }

    return new CqlPreparedResult(statementId, statement.boundTerms);
}
项目:cassandra-cqlMod    文件:QueryProcessor.java   
public static CqlResult processPrepared(CQLStatement statement, ThriftClientState clientState, List<ByteBuffer> variables)
throws RequestValidationException, RequestExecutionException
{
    // Check to see if there are any bound variables to verify
    if (!(variables.isEmpty() && (statement.boundTerms == 0)))
    {
        if (variables.size() != statement.boundTerms)
            throw new InvalidRequestException(String.format("there were %d markers(?) in CQL but %d bound variables",
                                                            statement.boundTerms,
                                                            variables.size()));

        // at this point there is a match in count between markers and variables that is non-zero

        if (logger.isTraceEnabled())
            for (int i = 0; i < variables.size(); i++)
                logger.trace("[{}] '{}'", i+1, variables.get(i));
    }

    return processStatement(statement, new ExecutionContext(clientState, null, variables));
}
项目:cassandra-cqlMod    文件:DeleteStatement.java   
public Mutation mutationForKey(ByteBuffer key, String keyspace, Long timestamp, ThriftClientState clientState, List<ByteBuffer> variables, CFMetaData metadata)
throws InvalidRequestException
{
    Mutation mutation = new Mutation(keyspace, key);

    QueryProcessor.validateKeyAlias(metadata, keyName);

    if (columns.size() < 1)
    {
        // No columns, delete the partition
        mutation.delete(columnFamily, (timestamp == null) ? getTimestamp(clientState) : timestamp);
    }
    else
    {
        // Delete specific columns
        AbstractType<?> at = metadata.comparator.asAbstractType();
        for (Term column : columns)
        {
            CellName columnName = metadata.comparator.cellFromByteBuffer(column.getByteBuffer(at, variables));
            validateColumnName(columnName);
            mutation.delete(columnFamily, columnName, (timestamp == null) ? getTimestamp(clientState) : timestamp);
        }
    }

    return mutation;
}
项目:wso2-cassandra    文件:QueryProcessor.java   
public static CqlPreparedResult prepare(String queryString, ThriftClientState clientState)
throws InvalidRequestException, SyntaxException
{
    logger.trace("CQL QUERY: {}", queryString);

    CQLStatement statement = getStatement(queryString);
    int statementId = makeStatementId(queryString);
    logger.trace("Discovered "+ statement.boundTerms + " bound variables.");

    clientState.getPrepared().put(statementId, statement);
    logger.trace(String.format("Stored prepared statement #%d with %d bind markers",
                               statementId,
                               statement.boundTerms));

    return new CqlPreparedResult(statementId, statement.boundTerms);
}
项目:wso2-cassandra    文件:QueryProcessor.java   
public static CqlResult processPrepared(CQLStatement statement, ThriftClientState clientState, List<ByteBuffer> variables)
throws RequestValidationException, RequestExecutionException
{
    // Check to see if there are any bound variables to verify
    if (!(variables.isEmpty() && (statement.boundTerms == 0)))
    {
        if (variables.size() != statement.boundTerms)
            throw new InvalidRequestException(String.format("there were %d markers(?) in CQL but %d bound variables",
                                                            statement.boundTerms,
                                                            variables.size()));

        // at this point there is a match in count between markers and variables that is non-zero

        if (logger.isTraceEnabled())
            for (int i = 0; i < variables.size(); i++)
                logger.trace("[{}] '{}'", i+1, variables.get(i));
    }

    return processStatement(statement, clientState, variables);
}
项目:wso2-cassandra    文件:DeleteStatement.java   
public List<IMutation> prepareRowMutations(String keyspace, ThriftClientState clientState, Long timestamp, List<ByteBuffer> variables)
throws InvalidRequestException, UnauthorizedException
{
    CFMetaData metadata = validateColumnFamily(keyspace, columnFamily);

    clientState.hasColumnFamilyAccess(keyspace, columnFamily, Permission.MODIFY);
    AbstractType<?> keyType = Schema.instance.getCFMetaData(keyspace, columnFamily).getKeyValidator();

    List<IMutation> rowMutations = new ArrayList<IMutation>(keys.size());

    for (Term key : keys)
    {
        rowMutations.add(mutationForKey(key.getByteBuffer(keyType, variables), keyspace, timestamp, clientState, variables, metadata));
    }

    return rowMutations;
}
项目:cassandra-1.2.16    文件:QueryProcessor.java   
public static CqlPreparedResult prepare(String queryString, ThriftClientState clientState)
throws InvalidRequestException, SyntaxException
{
    logger.trace("CQL QUERY: {}", queryString);

    CQLStatement statement = getStatement(queryString);
    int statementId = makeStatementId(queryString);
    logger.trace("Discovered "+ statement.boundTerms + " bound variables.");

    clientState.getPrepared().put(statementId, statement);
    logger.trace(String.format("Stored prepared statement #%d with %d bind markers",
                               statementId,
                               statement.boundTerms));

    return new CqlPreparedResult(statementId, statement.boundTerms);
}
项目:cassandra-1.2.16    文件:QueryProcessor.java   
public static CqlResult processPrepared(CQLStatement statement, ThriftClientState clientState, List<ByteBuffer> variables)
throws RequestValidationException, RequestExecutionException
{
    // Check to see if there are any bound variables to verify
    if (!(variables.isEmpty() && (statement.boundTerms == 0)))
    {
        if (variables.size() != statement.boundTerms)
            throw new InvalidRequestException(String.format("there were %d markers(?) in CQL but %d bound variables",
                                                            statement.boundTerms,
                                                            variables.size()));

        // at this point there is a match in count between markers and variables that is non-zero

        if (logger.isTraceEnabled())
            for (int i = 0; i < variables.size(); i++)
                logger.trace("[{}] '{}'", i+1, variables.get(i));
    }

    return processStatement(statement, clientState, variables);
}
项目:cassandra-1.2.16    文件:DeleteStatement.java   
public List<IMutation> prepareRowMutations(String keyspace, ThriftClientState clientState, Long timestamp, List<ByteBuffer> variables)
throws InvalidRequestException, UnauthorizedException
{
    CFMetaData metadata = validateColumnFamily(keyspace, columnFamily);

    clientState.hasColumnFamilyAccess(keyspace, columnFamily, Permission.MODIFY);
    AbstractType<?> keyType = Schema.instance.getCFMetaData(keyspace, columnFamily).getKeyValidator();

    List<IMutation> rowMutations = new ArrayList<IMutation>(keys.size());

    for (Term key : keys)
    {
        rowMutations.add(mutationForKey(key.getByteBuffer(keyType, variables), keyspace, timestamp, clientState, variables, metadata));
    }

    return rowMutations;
}
项目:cassandra-kmean    文件:QueryProcessor.java   
public static CqlResult process(String queryString, ThriftClientState clientState)
throws RequestValidationException, RequestExecutionException
{
    logger.trace("CQL QUERY: {}", queryString);
    return processStatement(getStatement(queryString),
                            new ExecutionContext(clientState, queryString, Collections.<ByteBuffer>emptyList()));
}
项目:cassandra-kmean    文件:UpdateStatement.java   
/** {@inheritDoc} */
public List<IMutation> prepareRowMutations(String keyspace, ThriftClientState clientState, Long timestamp, List<ByteBuffer> variables)
throws InvalidRequestException, UnauthorizedException
{
    boolean hasCommutativeOperation = false;

    for (Map.Entry<Term, Operation> column : getColumns().entrySet())
    {
        if (!column.getValue().isUnary())
            hasCommutativeOperation = true;

        if (hasCommutativeOperation && column.getValue().isUnary())
            throw new InvalidRequestException("Mix of commutative and non-commutative operations is not allowed.");
    }

    CFMetaData metadata = validateColumnFamily(keyspace, columnFamily, hasCommutativeOperation);
    if (hasCommutativeOperation)
        getConsistencyLevel().validateCounterForWrite(metadata);

    QueryProcessor.validateKeyAlias(metadata, keyName);

    clientState.hasColumnFamilyAccess(keyspace, columnFamily, Permission.MODIFY);

    List<IMutation> mutations = new LinkedList<>();

    for (Term key: keys)
        mutations.add(mutationForKey(keyspace, key.getByteBuffer(getKeyType(keyspace),variables), metadata, timestamp, clientState, variables));

    return mutations;
}
项目:cassandra-kmean    文件:BatchStatement.java   
public List<IMutation> getMutations(String keyspace, ThriftClientState clientState, List<ByteBuffer> variables)
throws InvalidRequestException, UnauthorizedException
{
    List<IMutation> batch = new LinkedList<IMutation>();

    for (AbstractModification statement : statements) {
        batch.addAll(statement.prepareRowMutations(keyspace, clientState, timestamp, variables));
    }

    return batch;
}
项目:cassandra-kmean    文件:DeleteStatement.java   
public List<IMutation> prepareRowMutations(String keyspace, ThriftClientState clientState, Long timestamp, List<ByteBuffer> variables)
throws InvalidRequestException, UnauthorizedException
{
    CFMetaData metadata = validateColumnFamily(keyspace, columnFamily);

    clientState.hasColumnFamilyAccess(keyspace, columnFamily, Permission.MODIFY);
    AbstractType<?> keyType = Schema.instance.getCFMetaData(keyspace, columnFamily).getKeyValidator();

    List<IMutation> mutations = new ArrayList<IMutation>(keys.size());

    for (Term key : keys)
        mutations.add(mutationForKey(key.getByteBuffer(keyType, variables), keyspace, timestamp, clientState, variables, metadata));

    return mutations;
}
项目:ACaZoo    文件:UpdateStatement.java   
/** {@inheritDoc} */
public List<IMutation> prepareRowMutations(String keyspace, ThriftClientState clientState, Long timestamp, List<ByteBuffer> variables)
throws InvalidRequestException, UnauthorizedException
{
    boolean hasCommutativeOperation = false;

    for (Map.Entry<Term, Operation> column : getColumns().entrySet())
    {
        if (!column.getValue().isUnary())
            hasCommutativeOperation = true;

        if (hasCommutativeOperation && column.getValue().isUnary())
            throw new InvalidRequestException("Mix of commutative and non-commutative operations is not allowed.");
    }

    CFMetaData metadata = validateColumnFamily(keyspace, columnFamily, hasCommutativeOperation);
    if (hasCommutativeOperation)
        getConsistencyLevel().validateCounterForWrite(metadata);

    QueryProcessor.validateKeyAlias(metadata, keyName);

    clientState.hasColumnFamilyAccess(keyspace, columnFamily, Permission.MODIFY);

    List<IMutation> rowMutations = new LinkedList<IMutation>();

    for (Term key: keys)
    {
        rowMutations.add(mutationForKey(keyspace, key.getByteBuffer(getKeyType(keyspace),variables), metadata, timestamp, clientState, variables));
    }

    return rowMutations;
}
项目:ACaZoo    文件:BatchStatement.java   
public List<IMutation> getMutations(String keyspace, ThriftClientState clientState, List<ByteBuffer> variables)
throws InvalidRequestException, UnauthorizedException
{
    List<IMutation> batch = new LinkedList<IMutation>();

    for (AbstractModification statement : statements) {
        batch.addAll(statement.prepareRowMutations(keyspace, clientState, timestamp, variables));
    }

    return batch;
}
项目:Cassandra-Wasef    文件:UpdateStatement.java   
/** {@inheritDoc} */
public List<IMutation> prepareRowMutations(String keyspace, ThriftClientState clientState, Long timestamp, List<ByteBuffer> variables)
throws InvalidRequestException, UnauthorizedException
{
    boolean hasCommutativeOperation = false;

    for (Map.Entry<Term, Operation> column : getColumns().entrySet())
    {
        if (!column.getValue().isUnary())
            hasCommutativeOperation = true;

        if (hasCommutativeOperation && column.getValue().isUnary())
            throw new InvalidRequestException("Mix of commutative and non-commutative operations is not allowed.");
    }

    CFMetaData metadata = validateColumnFamily(keyspace, columnFamily, hasCommutativeOperation);
    if (hasCommutativeOperation)
        getConsistencyLevel().validateCounterForWrite(metadata);

    QueryProcessor.validateKeyAlias(metadata, keyName);

    clientState.hasColumnFamilyAccess(keyspace, columnFamily, Permission.MODIFY);

    List<IMutation> rowMutations = new LinkedList<IMutation>();

    for (Term key: keys)
    {
        rowMutations.add(mutationForKey(keyspace, key.getByteBuffer(getKeyType(keyspace),variables), metadata, timestamp, clientState, variables));
    }

    return rowMutations;
}
项目:Cassandra-Wasef    文件:BatchStatement.java   
public List<IMutation> getMutations(String keyspace, ThriftClientState clientState, List<ByteBuffer> variables)
throws InvalidRequestException, UnauthorizedException
{
    List<IMutation> batch = new LinkedList<IMutation>();

    for (AbstractModification statement : statements) {
        batch.addAll(statement.prepareRowMutations(keyspace, clientState, timestamp, variables));
    }

    return batch;
}
项目:Cassandra-Wasef    文件:DeleteStatement.java   
public RowMutation mutationForKey(ByteBuffer key, String keyspace, Long timestamp, ThriftClientState clientState, List<ByteBuffer> variables, CFMetaData metadata)
throws InvalidRequestException
{
    RowMutation rm = new RowMutation(keyspace, key);

    QueryProcessor.validateKeyAlias(metadata, keyName);

    AbstractType<?> comparator = metadata.getComparatorFor(null);

    if (columns.size() < 1)
    {
        // No columns, delete the row
        rm.delete(new QueryPath(columnFamily), (timestamp == null) ? getTimestamp(clientState) : timestamp);
    }
    else
    {
        // Delete specific columns
        for (Term column : columns)
        {
            ByteBuffer columnName = column.getByteBuffer(comparator, variables);
            validateColumnName(columnName);
            rm.delete(new QueryPath(columnFamily, null, columnName), (timestamp == null) ? getTimestamp(clientState) : timestamp);
        }
    }

    return rm;
}
项目:stratio-cassandra    文件:QueryProcessor.java   
public static CqlResult process(String queryString, ThriftClientState clientState)
throws RequestValidationException, RequestExecutionException
{
    logger.trace("CQL QUERY: {}", queryString);
    return processStatement(getStatement(queryString),
                            new ExecutionContext(clientState, queryString, Collections.<ByteBuffer>emptyList()));
}
项目:stratio-cassandra    文件:UpdateStatement.java   
/** {@inheritDoc} */
public List<IMutation> prepareRowMutations(String keyspace, ThriftClientState clientState, Long timestamp, List<ByteBuffer> variables)
throws InvalidRequestException, UnauthorizedException
{
    boolean hasCommutativeOperation = false;

    for (Map.Entry<Term, Operation> column : getColumns().entrySet())
    {
        if (!column.getValue().isUnary())
            hasCommutativeOperation = true;

        if (hasCommutativeOperation && column.getValue().isUnary())
            throw new InvalidRequestException("Mix of commutative and non-commutative operations is not allowed.");
    }

    CFMetaData metadata = validateColumnFamily(keyspace, columnFamily, hasCommutativeOperation);
    if (hasCommutativeOperation)
        getConsistencyLevel().validateCounterForWrite(metadata);

    QueryProcessor.validateKeyAlias(metadata, keyName);

    clientState.hasColumnFamilyAccess(keyspace, columnFamily, Permission.MODIFY);

    List<IMutation> mutations = new LinkedList<>();

    for (Term key: keys)
        mutations.add(mutationForKey(keyspace, key.getByteBuffer(getKeyType(keyspace),variables), metadata, timestamp, clientState, variables));

    return mutations;
}
项目:stratio-cassandra    文件:BatchStatement.java   
public List<IMutation> getMutations(String keyspace, ThriftClientState clientState, List<ByteBuffer> variables)
throws InvalidRequestException, UnauthorizedException
{
    List<IMutation> batch = new LinkedList<IMutation>();

    for (AbstractModification statement : statements) {
        batch.addAll(statement.prepareRowMutations(keyspace, clientState, timestamp, variables));
    }

    return batch;
}
项目:stratio-cassandra    文件:DeleteStatement.java   
public List<IMutation> prepareRowMutations(String keyspace, ThriftClientState clientState, Long timestamp, List<ByteBuffer> variables)
throws InvalidRequestException, UnauthorizedException
{
    CFMetaData metadata = validateColumnFamily(keyspace, columnFamily);

    clientState.hasColumnFamilyAccess(keyspace, columnFamily, Permission.MODIFY);
    AbstractType<?> keyType = Schema.instance.getCFMetaData(keyspace, columnFamily).getKeyValidator();

    List<IMutation> mutations = new ArrayList<IMutation>(keys.size());

    for (Term key : keys)
        mutations.add(mutationForKey(key.getByteBuffer(keyType, variables), keyspace, timestamp, clientState, variables, metadata));

    return mutations;
}
项目:cassandra-cqlMod    文件:QueryProcessor.java   
public static CqlResult process(String queryString, ThriftClientState clientState)
throws RequestValidationException, RequestExecutionException
{
    logger.trace("CQL QUERY: {}", queryString);
    return processStatement(getStatement(queryString),
                            new ExecutionContext(clientState, queryString, Collections.<ByteBuffer>emptyList()));
}
项目:cassandra-cqlMod    文件:UpdateStatement.java   
/** {@inheritDoc} */
public List<IMutation> prepareRowMutations(String keyspace, ThriftClientState clientState, Long timestamp, List<ByteBuffer> variables)
throws InvalidRequestException, UnauthorizedException
{
    boolean hasCommutativeOperation = false;

    for (Map.Entry<Term, Operation> column : getColumns().entrySet())
    {
        if (!column.getValue().isUnary())
            hasCommutativeOperation = true;

        if (hasCommutativeOperation && column.getValue().isUnary())
            throw new InvalidRequestException("Mix of commutative and non-commutative operations is not allowed.");
    }

    CFMetaData metadata = validateColumnFamily(keyspace, columnFamily, hasCommutativeOperation);
    if (hasCommutativeOperation)
        getConsistencyLevel().validateCounterForWrite(metadata);

    QueryProcessor.validateKeyAlias(metadata, keyName);

    clientState.hasColumnFamilyAccess(keyspace, columnFamily, Permission.MODIFY);

    List<IMutation> mutations = new LinkedList<>();

    for (Term key: keys)
        mutations.add(mutationForKey(keyspace, key.getByteBuffer(getKeyType(keyspace),variables), metadata, timestamp, clientState, variables));

    return mutations;
}
项目:cassandra-cqlMod    文件:BatchStatement.java   
public List<IMutation> getMutations(String keyspace, ThriftClientState clientState, List<ByteBuffer> variables)
throws InvalidRequestException, UnauthorizedException
{
    List<IMutation> batch = new LinkedList<IMutation>();

    for (AbstractModification statement : statements) {
        batch.addAll(statement.prepareRowMutations(keyspace, clientState, timestamp, variables));
    }

    return batch;
}
项目:cassandra-cqlMod    文件:DeleteStatement.java   
public List<IMutation> prepareRowMutations(String keyspace, ThriftClientState clientState, Long timestamp, List<ByteBuffer> variables)
throws InvalidRequestException, UnauthorizedException
{
    CFMetaData metadata = validateColumnFamily(keyspace, columnFamily);

    clientState.hasColumnFamilyAccess(keyspace, columnFamily, Permission.MODIFY);
    AbstractType<?> keyType = Schema.instance.getCFMetaData(keyspace, columnFamily).getKeyValidator();

    List<IMutation> mutations = new ArrayList<IMutation>(keys.size());

    for (Term key : keys)
        mutations.add(mutationForKey(key.getByteBuffer(keyType, variables), keyspace, timestamp, clientState, variables, metadata));

    return mutations;
}
项目:wso2-cassandra    文件:UpdateStatement.java   
/** {@inheritDoc} */
public List<IMutation> prepareRowMutations(String keyspace, ThriftClientState clientState, Long timestamp, List<ByteBuffer> variables)
throws InvalidRequestException, UnauthorizedException
{
    boolean hasCommutativeOperation = false;

    for (Map.Entry<Term, Operation> column : getColumns().entrySet())
    {
        if (!column.getValue().isUnary())
            hasCommutativeOperation = true;

        if (hasCommutativeOperation && column.getValue().isUnary())
            throw new InvalidRequestException("Mix of commutative and non-commutative operations is not allowed.");
    }

    CFMetaData metadata = validateColumnFamily(keyspace, columnFamily, hasCommutativeOperation);
    if (hasCommutativeOperation)
        getConsistencyLevel().validateCounterForWrite(metadata);

    QueryProcessor.validateKeyAlias(metadata, keyName);

    clientState.hasColumnFamilyAccess(keyspace, columnFamily, Permission.MODIFY);

    List<IMutation> rowMutations = new LinkedList<IMutation>();

    for (Term key: keys)
    {
        rowMutations.add(mutationForKey(keyspace, key.getByteBuffer(getKeyType(keyspace),variables), metadata, timestamp, clientState, variables));
    }

    return rowMutations;
}