Package com.netflix.astyanax.ddl

Examples of com.netflix.astyanax.ddl.KeyspaceDefinition


        break;
      }
    }

    if(!exists) {
      KeyspaceDefinition def = cluster.makeKeyspaceDefinition();
      def.setName(keyspaceName);
      def.setStrategyClass("org.apache.cassandra.locator.SimpleStrategy");
      Map<String, String> map = new HashMap<String, String>();
      map.put("replication_factor", "3");
      def.setStrategyOptions(map);
      cluster.addKeyspace(def);
    }
   
    AstyanaxContext<Keyspace> context = builder.buildKeyspace(ThriftFamilyFactory.getInstance());
    context.start();
   
    keyspace = context.getEntity();

    KeyspaceDefinition keySpaceMeta = keyspace.describeKeyspace();
   
    findExistingColumnFamilies(keySpaceMeta);
    log.info("On keyspace="+keyspace.getKeyspaceName()+"Existing column families="+cfNameToCassandra.keySet()+"\nNOTE: WE WILL CREATE " +
        "new column families automatically as you save entites that have no column family");
  }
View Full Code Here


     
      //perhaps the schema is changing and was caused by someone else, let's wait until it stablizes
      waitForNodesToBeUpToDate(null, 300000);
     
      //NOW, the schema appears stable, let's get that column family and load it
      KeyspaceDefinition keySpaceMeta = keyspace.describeKeyspace();
      ColumnFamilyDefinition def = keySpaceMeta.getColumnFamily(realCf);
      if(def == null) {
        log.info("Well, we did NOT find any column family="+realCf+" to load in cassandra(from virt="+virtCf+")");
        return null;
      }
      log.info("coooool, we found a new column family="+realCf+"(virt="+virtCf+") to load so we are going to load that for you so every future operation is FAST");
View Full Code Here

  public void clearImpl() throws ConnectionException {
    Cluster cluster = columnFamilies.getCluster();
    String keyspaceName = columnFamilies.getKeyspaceName();
    log.info("Clearing keyspace="+keyspaceName+" in cassandra");
    List<KeyspaceDefinition> keyspaces = cluster.describeKeyspaces();
    KeyspaceDefinition ourDef = null;
    for(KeyspaceDefinition kDef : keyspaces) {
      if(keyspaceName.equalsIgnoreCase(kDef.getName())) {
        ourDef = kDef;
        break;
      }
View Full Code Here

        break;
      }
    }

    if(!exists) {
      KeyspaceDefinition def = cluster.makeKeyspaceDefinition();
      def.setName(keyspaceName);
      def.setStrategyClass("org.apache.cassandra.locator.SimpleStrategy");
      Map<String, String> map = new HashMap<String, String>();
      map.put("replication_factor", "3");
      def.setStrategyOptions(map);
      cluster.addKeyspace(def);
    }
   
    context = builder.buildKeyspace(ThriftFamilyFactory.getInstance());
    context.start();
   
    keyspace = context.getEntity();

    KeyspaceDefinition keySpaceMeta = keyspace.describeKeyspace();
   
    findExistingColumnFamilies(keySpaceMeta);
    if (log.isInfoEnabled())
      log.info("On keyspace="+keyspace.getKeyspaceName()+"Existing column families="+cfNameToCassandra.keySet()+"\nNOTE: WE WILL CREATE " +
        "new column families automatically as you save entites that have no column family");
View Full Code Here

     
      //perhaps the schema is changing and was caused by someone else, let's wait until it stablizes
      waitForNodesToBeUpToDate(null, 300000);
     
      //NOW, the schema appears stable, let's get that column family and load it
      KeyspaceDefinition keySpaceMeta = keyspace.describeKeyspace();
      ColumnFamilyDefinition def = keySpaceMeta.getColumnFamily(realCf);
      if(def == null) {
        if (log.isInfoEnabled())
          log.info("Well, we did NOT find any column family="+realCf+" to load in cassandra(from virt="+virtCf+")");
        return null;
      }
View Full Code Here

  public void clearImpl() throws ConnectionException {
    Cluster cluster = columnFamilies.getCluster();
    String keyspaceName = columnFamilies.getKeyspaceName();
    log.info("Clearing keyspace="+keyspaceName+" in cassandra");
    List<KeyspaceDefinition> keyspaces = cluster.describeKeyspaces();
    KeyspaceDefinition ourDef = null;
    for(KeyspaceDefinition kDef : keyspaces) {
      if(keyspaceName.equalsIgnoreCase(kDef.getName())) {
        ourDef = kDef;
        break;
      }
View Full Code Here

        break;
      }
    }

    if(!exists) {
      KeyspaceDefinition def = cluster.makeKeyspaceDefinition();
      def.setName(keyspaceName);
      def.setStrategyClass("org.apache.cassandra.locator.SimpleStrategy");
      Map<String, String> map = new HashMap<String, String>();
      map.put("replication_factor", "3");
      def.setStrategyOptions(map);
      cluster.addKeyspace(def);
    }
   
    context = builder.buildKeyspace(ThriftFamilyFactory.getInstance());
    context.start();
   
    keyspace = context.getEntity();

    KeyspaceDefinition keySpaceMeta = keyspace.describeKeyspace();
   
    findExistingColumnFamilies(keySpaceMeta);
    log.info("On keyspace="+keyspace.getKeyspaceName()+"Existing column families="+cfNameToCassandra.keySet()+"\nNOTE: WE WILL CREATE " +
        "new column families automatically as you save entites that have no column family");
  }
View Full Code Here

     
      //perhaps the schema is changing and was caused by someone else, let's wait until it stablizes
      waitForNodesToBeUpToDate(null, 300000);
     
      //NOW, the schema appears stable, let's get that column family and load it
      KeyspaceDefinition keySpaceMeta = keyspace.describeKeyspace();
      ColumnFamilyDefinition def = keySpaceMeta.getColumnFamily(realCf);
      if(def == null) {
        log.info("Well, we did NOT find any column family="+realCf+" to load in cassandra(from virt="+virtCf+")");
        return null;
      }
      log.info("coooool, we found a new column family="+realCf+"(virt="+virtCf+") to load so we are going to load that for you so every future operation is FAST");
View Full Code Here

  public void clearImpl() throws ConnectionException {
    Cluster cluster = columnFamilies.getCluster();
    String keyspaceName = columnFamilies.getKeyspaceName();
    log.info("Clearing keyspace="+keyspaceName+" in cassandra");
    List<KeyspaceDefinition> keyspaces = cluster.describeKeyspaces();
    KeyspaceDefinition ourDef = null;
    for(KeyspaceDefinition kDef : keyspaces) {
      if(keyspaceName.equalsIgnoreCase(kDef.getName())) {
        ourDef = kDef;
        break;
      }
View Full Code Here

        break;
      }
    }

    if(!exists) {
      KeyspaceDefinition def = cluster.makeKeyspaceDefinition();
      def.setName(keyspaceName);
      def.setStrategyClass("org.apache.cassandra.locator.SimpleStrategy");
      Map<String, String> map = new HashMap<String, String>();
      map.put("replication_factor", "3");
      def.setStrategyOptions(map);
      cluster.addKeyspace(def);
    }
   
    context = builder.buildKeyspace(ThriftFamilyFactory.getInstance());
    context.start();
   
    keyspace = context.getEntity();

    KeyspaceDefinition keySpaceMeta = keyspace.describeKeyspace();
   
    findExistingColumnFamilies(keySpaceMeta);
    log.info("On keyspace="+keyspace.getKeyspaceName()+"Existing column families="+cfNameToCassandra.keySet()+"\nNOTE: WE WILL CREATE " +
        "new column families automatically as you save entites that have no column family");
  }
View Full Code Here

TOP

Related Classes of com.netflix.astyanax.ddl.KeyspaceDefinition

Copyright © 2018 www.massapicom. 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.