Examples of describeKeyspace()


Examples of com.netflix.astyanax.Cluster.describeKeyspace()

    }
   
    public static void createColumnFamily(AstyanaxContext<Cluster> ctx,String ks, String cf, String comparator,
        String keyValidator, String defValidator, boolean dropFirst) throws ConnectionException{
        Cluster cluster = ctx.getEntity();
        KeyspaceDefinition keyspace = cluster.describeKeyspace(ks);
        if(keyspace != null){
            LOG.warn("Keyspace {} already exists.", ks);
        } else{
            LOG.warn("Creating keyspace '{}'", ks);
            KeyspaceDefinition ksDef = cluster.makeKeyspaceDefinition();
View Full Code Here

Examples of com.netflix.astyanax.Keyspace.describeKeyspace()

        props.setProperty("strategy_options.replication_factor", "1");

        try {
          ks.createKeyspaceIfNotExists(props);

          KeyspaceDefinition ksDef = ks.describeKeyspace();
          Assert.assertNotNull(ksDef);

        } catch (Exception e) {
          Assert.fail(e.getMessage());
        }
View Full Code Here

Examples of me.prettyprint.cassandra.service.ThriftCluster.describeKeyspace()

        ThriftCluster cluster = new ThriftCluster(cassandraClusterName, cassandraHostConfigurator);
        this.myCluster = cluster; // Keep a pointer to the cluster, as Hector is buggy and can't find it again...
        ConfigurableConsistencyLevel consistencyLevelPolicy = new ConfigurableConsistencyLevel();
        consistencyLevelPolicy.setDefaultReadConsistencyLevel(HConsistencyLevel.ONE);

        KeyspaceDefinition keyspaceDef = cluster.describeKeyspace(cassandraKeyspace);
        if (keyspaceDef == null) {
            log.warn("Keyspace \" {} \" does not exist, creating it!", cassandraKeyspace);
            keyspaceDef = new ThriftKsDef(cassandraKeyspace);
            cluster.addKeyspace(keyspaceDef, true);
View Full Code Here

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

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

    }

    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

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

                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

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

    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

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

  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

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

    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

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

  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
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.