Skip to content

Commit

Permalink
Forgot the keyspace holder
Browse files Browse the repository at this point in the history
  • Loading branch information
wolpert committed Dec 7, 2010
1 parent 4fd5287 commit e1b2327
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README
@@ -1,7 +1,7 @@
http://www.opensource.org/licenses/apache2.0.php

Cassandra Version: 0.7.0
Hector Version: 0.7.0-19_10212010
Hector Version: 0.7.0-20
Grails: 1.2.2 or higher


Expand Down
50 changes: 50 additions & 0 deletions src/java/codehead/KeyspaceHolder.java
@@ -0,0 +1,50 @@
package codehead;

import me.prettyprint.hector.api.Cluster;
import me.prettyprint.hector.api.Keyspace;
import me.prettyprint.hector.api.factory.HFactory;

public class KeyspaceHolder extends ThreadLocal <Keyspace>{

private String clusterName="Test Cluster";
private String keyspaceName="Keyspace1";
private String servers="localhost:9160";

protected Keyspace initialValue() {
return HFactory.createKeyspace(keyspaceName, getCluster());
}

/**
* Returns the hector cluster object
* @return
*/
public Cluster getCluster(){
return HFactory.getOrCreateCluster(clusterName, servers);
}

public String getClusterName() {
return clusterName;
}

public void setClusterName(String clusterName) {
this.clusterName = clusterName;
}

public String getKeyspaceName() {
return keyspaceName;
}

public void setKeyspaceName(String keyspaceName) {
this.keyspaceName = keyspaceName;
}

public String getServers() {
return servers;
}

public void setServers(String servers) {
this.servers = servers;
}


}

0 comments on commit e1b2327

Please sign in to comment.