Package com.datastax.driver.core

Examples of com.datastax.driver.core.Metadata


  public CassandraDataStore(Cluster cluster, ICassandraSettings settings)
  {
    this.cluster = Args.notNull(cluster, "cluster");
    this.settings = Args.notNull(settings, "settings");

    Metadata metadata = cluster.getMetadata();

    if (LOGGER.isInfoEnabled())
    {
      LOGGER.info("Connected to cluster: {}", metadata.getClusterName());

      for (Host host : metadata.getAllHosts())
      {
        LOGGER.info("Datatacenter: {}; Host: {}; Rack: {}",
            new Object[]{host.getDatacenter(), host.getAddress(), host.getRack()});
      }
    }
View Full Code Here


      cassandraAdminTemplate.execute(DropTableSpecification.dropTable(table.getName()));
    }
  }

  private KeyspaceMetadata getKeyspaceMetadata() {
    Metadata metadata = getSession().getCluster().getMetadata();
    return metadata.getKeyspace(getSession().getLoggedKeyspace());
  }
View Full Code Here

    };

    public Map<String, TableMetadata> fetchTableMetaData(Cluster cluster, Collection<EntityMeta> entityMetas) {

        log.debug("Fetch existing table meta data from Cassandra");
        final Metadata clusterMetadata = cluster.getMetadata();
        final List<KeyspaceAndTable> keyspaceAndTables = FluentIterable.from(entityMetas).transform(EXTRACT_KEYSPACE_AND_TABLE).toList();

        Map<String, TableMetadata> tableMetas = new HashMap<>();

        for (KeyspaceAndTable keyspaceAndTable : keyspaceAndTables) {
            final KeyspaceMetadata keyspaceMetadata = clusterMetadata.getKeyspace(keyspaceAndTable.keyspaceName);
            Validator.validateTableTrue(keyspaceMetadata != null, "Keyspace '%s' doest not exist or cannot be found", keyspaceAndTable.keyspaceName);

            final TableMetadata tableMetadata = keyspaceMetadata.getTable(keyspaceAndTable.tableName);
            if (tableMetadata != null) {
                tableMetas.put(keyspaceAndTable.qualifiedTableName, tableMetadata);
View Full Code Here

TOP

Related Classes of com.datastax.driver.core.Metadata

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.