This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add a repository declaration for mvn.riptano.com: | |
<repositories> | |
<repository> | |
<id>riptano</id> | |
<name>riptano</name> | |
<url>http://mvn.riptano.com/content/repositories/public/</url> | |
</repository> | |
</repositories> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cassandra.yaml: | |
- name: Indexed1 | |
column_metadata: | |
- name: price | |
validator_class: LongType | |
index_type: KEYS | |
column_metadata: | |
- name: airport | |
index_type: KEYS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%@ page contentType="text/html; charset=UTF-8" %> | |
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> | |
<%@ taglib uri="hectortags" prefix="h" %> | |
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> | |
<html> | |
<head><title>Hector Column Example</title></head> | |
<body bgcolor="white"> | |
<p> | |
<h:hectorColumn tagContextName="twissjavaTagContext" columnFamily="User" key="${param.user}" columnNames="password,user" columnValueSerializer="${h:stringSerializer()}"> | |
${queryResult} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.java b/core/src/main/java/me/prettyprint/cassandra/testutils/EmbeddedServerHelper.java | |
index 7770070..3e3fbb5 100644 | |
--- a/core/src/main/java/me/prettyprint/cassandra/testutils/EmbeddedServerHelper.java | |
+++ b/core/src/main/java/me/prettyprint/cassandra/testutils/EmbeddedServerHelper.java | |
@@ -5,16 +5,21 @@ import java.io.FileOutputStream; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.io.OutputStream; | |
+import java.util.concurrent.ExecutorService; | |
+import java.util.concurrent.Executors; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface HColumnFamily<K, N> { | |
HColumnFamily<K, N> addKey(K key); | |
HColumnFamily<K, N> addKeys(Iterable<K> keys); | |
HColumnFamily<K, N> addColumn(HColumn<N, ?> column); | |
HColumnFamily<K, N> addColumns(List<HColumn<N, ?>> columns); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Where we have the following generic declaration of a type K for the key an N for the column name: HColumnFamily<K,N> | |
@Before | |
public void setupLocal() { | |
setupClient(); | |
Cluster cluster = new ThriftCluster("Test Cluster", cassandraHostConfigurator); | |
keyspace = HFactory.createKeyspace("Keyspace1", cluster); | |
Mutator<String> mutator = HFactory.createMutator(keyspace, StringSerializer.get()); | |
mutator.addInsertion("zznate", "Standard1", HFactory.createStringColumn("email", "[email protected]")); | |
mutator.addInsertion("zznate", "Standard1", HFactory.createColumn("int", 1, StringSerializer.get(), IntegerSerializer.get())); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void testMultigetSerializers() { | |
Mutator m = createMutator(keyspace, is); | |
m.addInsertion(5, cf, | |
HFactory.createColumn(10, new byte[0], is, bas)); | |
m.execute(); | |
MultigetSliceQuery<Integer, Integer,byte[]> query = HFactory.createMultigetSliceQuery(keyspace, is, is, bas); | |
query.setColumnFamily(cf).setKeys(new Integer[]{5}).setColumnNames(new Integer[]{10}); | |
QueryResult<Rows<Integer,Integer,byte[]>> result = query.execute(); | |
System.out.println(result.toString()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.text.SimpleDateFormat; | |
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.List; | |
import java.util.UUID; | |
import me.prettyprint.cassandra.serializers.BytesArraySerializer; | |
import me.prettyprint.cassandra.serializers.StringSerializer; | |
import me.prettyprint.cassandra.serializers.UUIDSerializer; | |
import me.prettyprint.cassandra.service.template.ColumnFamilyResult; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Cassandra cassandra = new Cassandra(); | |
Keyspace keyspace = cassandra.getKeyspace("MyKeyspace"); | |
ColumnFamily columnFamily = keyspace.getColumnFamily("Users"); | |
Row row = new Row() | |
.put("username", "zznate") | |
.put("email","[email protected]") | |
.increment("hits",1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Integer call() { | |
Mutator<String> mutator = HFactory.createMutator(tutorialKeyspace, StringSerializer.get()); | |
int count = 0; | |
for (int x=0; x<5000; x++) { | |
mutator.addInsertion(myKey,CF_TIMESERIES_SINGLE_ROW, buildColumnFor(x)); | |
} | |
mutator.execute(); | |
log.debug("Inserted {} rows", count); | |
return Integer.valueOf(count); |