Search in sources :

Example 21 with StringSerializer

use of me.prettyprint.cassandra.serializers.StringSerializer in project cassandra-indexing by hmsonline.

the class AbstractIndexingTest method persist.

protected void persist(Keyspace keyspace, String columnFamily, String rowKey, Map<String, String> columns) throws Exception {
    logger.debug("Writing [" + rowKey + "] in [" + columnFamily + "] @ [" + keyspace.getKeyspaceName() + "]");
    StringSerializer serializer = StringSerializer.get();
    Mutator<String> mutator = HFactory.createMutator(keyspace, serializer);
    for (String columnName : columns.keySet()) {
        logger.debug("Writing [" + columnName + "] @ [" + rowKey + "] in [" + columnFamily + "] @ [" + keyspace + "]");
        mutator.addInsertion(rowKey, columnFamily, HFactory.createStringColumn(columnName, columns.get(columnName)));
    }
    mutator.execute();
}
Also used : StringSerializer(me.prettyprint.cassandra.serializers.StringSerializer)

Aggregations

StringSerializer (me.prettyprint.cassandra.serializers.StringSerializer)21 HInvalidRequestException (me.prettyprint.hector.api.exceptions.HInvalidRequestException)10 UnsupportedEncodingException (java.io.UnsupportedEncodingException)9 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)9 CassandraResourceProvider (org.apache.sling.cassandra.resource.provider.CassandraResourceProvider)9 Test (org.junit.Test)8 CqlRows (me.prettyprint.cassandra.model.CqlRows)6 HashMap (java.util.HashMap)5 CassandraResourceResolver (org.apache.sling.cassandra.resource.provider.CassandraResourceResolver)4 HColumn (me.prettyprint.hector.api.beans.HColumn)2 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 CqlQuery (me.prettyprint.cassandra.model.CqlQuery)1 OrderedRows (me.prettyprint.hector.api.beans.OrderedRows)1 Row (me.prettyprint.hector.api.beans.Row)1 MetadataRepositoryException (org.apache.archiva.metadata.repository.MetadataRepositoryException)1 Namespace (org.apache.archiva.metadata.repository.cassandra.model.Namespace)1 CassandraMapperException (org.apache.sling.cassandra.resource.provider.mapper.CassandraMapperException)1