Package me.prettyprint.hector.api

Examples of me.prettyprint.hector.api.Cluster.describeKeyspace()


    private Keyspace getKeyspace() {
        Cluster cassandraCluster = HFactory.createCluster(
                Constants.CLUSTER_NAME, new CassandraHostConfigurator(Constants.CLUSTER_HOST), credentials);

        if (cassandraCluster.describeKeyspace(Constants.KEYSPACE_NAME) == null) {
            BasicColumnFamilyDefinition columnFamilyDefinition = new BasicColumnFamilyDefinition();
            columnFamilyDefinition.setKeyspaceName(Constants.KEYSPACE_NAME);
            columnFamilyDefinition.setName(Constants.COL_FAMILY_NAME);
            columnFamilyDefinition.setComparatorType(ComparatorType.LONGTYPE);
View Full Code Here


    }

    private KeyspaceDefinition getKeyspaceDefinition(String keyspace) throws CassandraServerManagementException {
        validateKeyspace(keyspace);
        Cluster cluster = getCluster(null);
        KeyspaceDefinition keyspaceDefinition = cluster.describeKeyspace(keyspace.trim());
        if (keyspaceDefinition == null) {
            throw new CassandraServerManagementException("Cannot find a keyspace for : " + keyspace, log);
        }
        return keyspaceDefinition;
    }
View Full Code Here

                keyspaceName,
                StrategyModel.SIMPLE_STRATEGY.value(),
                1,
                columnFamilyDefinitions);

        if (cluster.describeKeyspace(keyspaceName) != null) {
            cluster.dropKeyspace(keyspaceName, true);
        }
        cluster.addKeyspace(keyspaceDefinition, true);
        return HFactory.createKeyspace(keyspaceName, cluster);
    }
View Full Code Here

    public static void main(String[] args) throws Exception {
       
        Cluster cluster = HFactory.getOrCreateCluster("TestCluster", "localhost:9160");
               
        try {
            if ( cluster.describeKeyspace(DYN_KEYSPACE) != null ) {
              cluster.dropKeyspace(DYN_KEYSPACE);
            }
           
            BasicColumnDefinition columnDefinition = new BasicColumnDefinition();
            columnDefinition.setName(stringSerializer.toByteBuffer("birthdate"));
View Full Code Here

  private void test() throws Exception {
    Cluster cluster = HFactory.getOrCreateCluster("Test Cluster", "localhost:9171");
    List<KeyspaceDefinition> keyspaces = cluster.describeKeyspaces();
    assertThat(cluster.describeKeyspaces(), notNullValue());
    assertThat(keyspaces.size(), is(3));
    assertThat(cluster.describeKeyspace("mykeyspacename"), notNullValue());
    assertThat(cluster.describeKeyspace("mykeyspacename").getName(), is("mykeyspacename"));

    Keyspace keyspace = HFactory.createKeyspace("mykeyspacename", cluster);
    RangeSlicesQuery<byte[], byte[], byte[]> query = HFactory.createRangeSlicesQuery(
        keyspace,
View Full Code Here

    Cluster cluster = HFactory.getOrCreateCluster("Test Cluster", "localhost:9171");
    List<KeyspaceDefinition> keyspaces = cluster.describeKeyspaces();
    assertThat(cluster.describeKeyspaces(), notNullValue());
    assertThat(keyspaces.size(), is(3));
    assertThat(cluster.describeKeyspace("mykeyspacename"), notNullValue());
    assertThat(cluster.describeKeyspace("mykeyspacename").getName(), is("mykeyspacename"));

    Keyspace keyspace = HFactory.createKeyspace("mykeyspacename", cluster);
    RangeSlicesQuery<byte[], byte[], byte[]> query = HFactory.createRangeSlicesQuery(
        keyspace,
        BytesArraySerializer.get(),
View Full Code Here

  private void test() throws Exception {
    Cluster cluster = HFactory.getOrCreateCluster("Test Cluster", "localhost:9171");
    List<KeyspaceDefinition> keyspaces = cluster.describeKeyspaces();
    assertThat(cluster.describeKeyspaces(), notNullValue());
    assertThat(keyspaces.size(), is(3));
    assertThat(cluster.describeKeyspace("mykeyspacename"), notNullValue());
    assertThat(cluster.describeKeyspace("mykeyspacename").getName(), is("mykeyspacename"));

    Keyspace keyspace = HFactory.createKeyspace("mykeyspacename", cluster);
    RangeSlicesQuery<byte[], byte[], byte[]> query = HFactory.createRangeSlicesQuery(
        keyspace,
View Full Code Here

    Cluster cluster = HFactory.getOrCreateCluster("Test Cluster", "localhost:9171");
    List<KeyspaceDefinition> keyspaces = cluster.describeKeyspaces();
    assertThat(cluster.describeKeyspaces(), notNullValue());
    assertThat(keyspaces.size(), is(3));
    assertThat(cluster.describeKeyspace("mykeyspacename"), notNullValue());
    assertThat(cluster.describeKeyspace("mykeyspacename").getName(), is("mykeyspacename"));

    Keyspace keyspace = HFactory.createKeyspace("mykeyspacename", cluster);
    RangeSlicesQuery<byte[], byte[], byte[]> query = HFactory.createRangeSlicesQuery(
        keyspace,
        BytesArraySerializer.get(),
View Full Code Here

  private void test() throws Exception {
    Cluster cluster = HFactory.getOrCreateCluster("Test Cluster", "localhost:9171");
    List<KeyspaceDefinition> keyspaces = cluster.describeKeyspaces();
    assertThat(cluster.describeKeyspaces(), notNullValue());
    assertThat(keyspaces.size(), is(3));
    assertThat(cluster.describeKeyspace("mykeyspacename"), notNullValue());
    assertThat(cluster.describeKeyspace("mykeyspacename").getName(), is("mykeyspacename"));

    Keyspace keyspace = HFactory.createKeyspace("mykeyspacename", cluster);
    RangeSlicesQuery<byte[], byte[], byte[]> query = HFactory.createRangeSlicesQuery(
        keyspace,
View Full Code Here

    Cluster cluster = HFactory.getOrCreateCluster("Test Cluster", "localhost:9171");
    List<KeyspaceDefinition> keyspaces = cluster.describeKeyspaces();
    assertThat(cluster.describeKeyspaces(), notNullValue());
    assertThat(keyspaces.size(), is(3));
    assertThat(cluster.describeKeyspace("mykeyspacename"), notNullValue());
    assertThat(cluster.describeKeyspace("mykeyspacename").getName(), is("mykeyspacename"));

    Keyspace keyspace = HFactory.createKeyspace("mykeyspacename", cluster);
    RangeSlicesQuery<byte[], byte[], byte[]> query = HFactory.createRangeSlicesQuery(
        keyspace,
        BytesArraySerializer.get(),
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.