Search in sources :

Example 6 with CqlRows

use of me.prettyprint.cassandra.model.CqlRows in project sling by apache.

the class AccessControlUtil method getACL.

private String[] getACL(String path) throws Exception {
    if (getCassandraSystemNodeACL(path) != null) {
        return getCassandraSystemNodeACL(path);
    }
    String rid = getrowID(path);
    createColumnFamily(ACL_CF, provider.getKeyspace(), new StringSerializer());
    String getAllACEs = "select * from " + ACL_CF + " where KEY = '" + rid + "'";
    QueryResult<CqlRows<String, String, String>> results = CassandraResourceProviderUtil.executeQuery(getAllACEs, provider.getKeyspace(), new StringSerializer());
    String policy = null;
    for (Row<String, String, String> row : ((CqlRows<String, String, String>) results.get()).getList()) {
        for (HColumn column : row.getColumnSlice().getColumns()) {
            if ("policy".equalsIgnoreCase(column.getName().toString()) && column.getValue() != null) {
                policy = column.getValue().toString();
            }
        }
    }
    return policy != null ? policy.split(";") : null;
}
Also used : CqlRows(me.prettyprint.cassandra.model.CqlRows) HColumn(me.prettyprint.hector.api.beans.HColumn) StringSerializer(me.prettyprint.cassandra.serializers.StringSerializer)

Example 7 with CqlRows

use of me.prettyprint.cassandra.model.CqlRows in project sling by apache.

the class CassandraResourceProviderUtil method logResults.

public static void logResults(QueryResult<CqlRows<String, String, String>> result) {
    LOGGER.info("############# RESULT ################");
    for (Row<String, String, String> row : ((CqlRows<String, String, String>) result.get()).getList()) {
        for (HColumn column : row.getColumnSlice().getColumns()) {
            LOGGER.info(column.getValue().toString());
        }
        LOGGER.info("------------------------------------------------------------------------------------");
    }
    LOGGER.info("############# RESULT ################");
}
Also used : CqlRows(me.prettyprint.cassandra.model.CqlRows) HColumn(me.prettyprint.hector.api.beans.HColumn)

Aggregations

CqlRows (me.prettyprint.cassandra.model.CqlRows)7 StringSerializer (me.prettyprint.cassandra.serializers.StringSerializer)6 HColumn (me.prettyprint.hector.api.beans.HColumn)3 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)1 CqlQuery (me.prettyprint.cassandra.model.CqlQuery)1 CassandraMapperException (org.apache.sling.cassandra.resource.provider.mapper.CassandraMapperException)1