/* (non-Javadoc)
@see me.prettyprint.cassandra.service.Cluster#describeKeyspaces()
427970
@Override
  public List<KeyspaceDefinition> describeKeyspaces() throws HectorException {
    Operation<List<KeyspaceDefinition>> op = new Operation<List<KeyspaceDefinition>>(OperationType.META_READ, getCredentials()) {
      @Override
      public List<KeyspaceDefinition> execute(Cassandra.Client cassandra) throws HectorException {
        try {
          return ThriftKsDef.fromThriftList(cassandra.describe_keyspaces());
        } catch (Exception e) {
          throw xtrans.translate(e);
        }
      }
    };
    connectionManager.operateWithFailover(op);
    return op.getResult();
  }
666107
public boolean keyspaceExists(DBConn dbConn, String keyspace) {
        try {
            dbConn.getClientSession().describe_keyspace(keyspace);
            return true;
        } catch (Exception e) {
            return false;   // Notfound
        }
    }
985762
protected void getOracleTablespaces(Map<String, String> dbPoolData) {

        String dataTablespace = "users";
        String indexTablespace = "users";
        CmsSetupDb setupDb = new CmsSetupDb(null);

        try {
            setupDb.setConnection(
                dbPoolData.get("driver"),
                dbPoolData.get("url"),
                dbPoolData.get("params"),
                dbPoolData.get("user"),
                dbPoolData.get("pwd"));

            // read tablespace for data
            CmsSetupDBWrapper db = null;
            try {
                db = setupDb.executeSqlStatement("SELECT DISTINCT tablespace_name FROM user_tables", null);
                if (db.getResultSet().next()) {
                    dataTablespace = db.getResultSet().getString(1).toLowerCase();
                }
            } finally {
                if (db != null) {
                    db.close();
                }
            }
            // read tablespace for indexes
            try {
                db = setupDb.executeSqlStatement("SELECT DISTINCT tablespace_name FROM user_indexes", null);
                if (db.getResultSet().next()) {
                    indexTablespace = db.getResultSet().getString(1).toLowerCase();
                }
            } finally {
                if (db != null) {
                    db.close();
                }
            }
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            setupDb.closeConnection();
        }

        dbPoolData.put("indexTablespace", indexTablespace);
        System.out.println("Index Tablespace:           " + indexTablespace);

        dbPoolData.put("dataTablespace", dataTablespace);
        System.out.println("Data Tablespace:            " + dataTablespace);
    }
1277635
@Override
    public String getCacheKey(final Object keyObject, final String namespace) {
        return namespace + SEPARATOR + defaultKeyProvider.generateKey(keyObject);
    }
92476
public void deleteKeyspace(KeyspaceImpl keyspace) {
        Lock lock = lockManager.getLock(getLockingKey(keyspace));
        lock.lock();
        try {
            if (keyspaceCacheMap.containsKey(keyspace)) {
                KeyspaceCacheContainer container = keyspaceCacheMap.remove(keyspace);
                container.graph().close();
                container.invalidateSessions();
            }
        } finally {
            lock.unlock();
        }
    }
1213521
public ResultSet execute(String keyspace, @NotNull String query) {
        getMetricsFactory().getCounter(MetricsType.CASSANDRA_QUERIES_COUNT.name()).inc();

        Timer time = getMetricsFactory().getTimer(MetricsType.CASSANDRA_EXECUTE.name());

        ResultSet resultSet = getOrCreateSession(keyspace).execute(query);
        time.stop();

        return resultSet;
    }
811455
public void setKeys(java.util.Collection<KeyListEntry> keys) {
        if (keys == null) {
            this.keys = null;
            return;
        }

        this.keys = new com.ibm.cloud.objectstorage.internal.SdkInternalList<KeyListEntry>(keys);
    }
480025
function describeKey(e) {
    var via = '';
    var desc = [];
    if (e.getModifierState("Shift")) desc.push("Shift");
    if (e.getModifierState("Control")) desc.push("Control");
    if (e.getModifierState("Alt")) desc.push("Alt");
    if (e.getModifierState("Meta")) desc.push("Meta");
    if (e.key !== 'Unidentified') {
        desc.push(e.key);
        via = 'e.key' + (e.nativeEvent.key ? '' : ' polyfill');
    } else if (e.nativeEvent.keyIdentifier) {
        var keyId = e.nativeEvent.keyIdentifier;
        if (keyId.substring(0, 2) === 'U+') {
            var code = parseInt(keyId.substring(2), 16);
            desc.push(String.fromCharCode(code));
        } else {
            desc.push(keyId);
        }
        via = 'e.keyIdentifier';
    } else if (specials[e.which]) {
        desc.push(specials[e.which]);
        via = 'e.which + lookup';
    } else {
        desc.push(String.fromCharCode(e.which));
        via = 'e.which';
    }
    e.persist();
    console.log(e);
    return '{' + desc.join('+') + '} (' + via + ')';
}
933983
public ResultSet execute(String keyspace, @NotNull Statement statement) {
        Timer time = getMetricsFactory().getTimer(MetricsType.CASSANDRA_EXECUTE.name());

        getMetricsFactory().getCounter(MetricsType.CASSANDRA_QUERIES_COUNT.name()).inc();

        ResultSet resultSetFuture = getOrCreateSession(keyspace).execute(statement);

        time.stop();

        return resultSetFuture;
    }
918040
private void createOrUpdateKeyspace(List<TableInfo> tableInfos) throws Exception
    {
        KsDef ksDef = onCreateKeyspace(); // create keyspace event.
        createColumnFamilies(tableInfos, ksDef); // create column family event.
    }
282581
public static Set<String> getCfNamesByKeySpace(KsDef keySpace)
    {
        Set<String> names = new LinkedHashSet<String>();

        for (CfDef cfDef : keySpace.getCf_defs())
        {
            names.add(cfDef.getName());
        }

        return names;
    }
801949
def init_tables
      # Do nothing if keyspace already exists
      if @cassandra.keyspaces.include?(@keyspace)
        @cassandra.keyspace = @keyspace
      else
        freq_table    = Cassandra::ColumnFamily.new({:keyspace => @keyspace, :name => "classes"}) # word  => {classname => count}
        summary_table = Cassandra::ColumnFamily.new({:keyspace => @keyspace, :name => "totals"})  # class => {wordcount => count}
        ks_def = Cassandra::Keyspace.new({
            :name               => @keyspace,
            :strategy_class     => 'org.apache.cassandra.locator.SimpleStrategy',
            :replication_factor => 1,
            :cf_defs            => [freq_table, summary_table] 
          })
        @cassandra.add_keyspace ks_def
        @cassandra.keyspace = @keyspace
      end
    end
346537
def keyspace_structure
      @keyspace_structure ||= begin
        args = ["-e", "'DESCRIBE KEYSPACE #{Cassie.configuration[:keyspace]}'"]
        runner = Cassie::Support::SystemCommand.new("cqlsh", args)
        runner.succeed

        runner.output
      end
    end
1374271
@Override
    public void describe(DDParser.Diagnostics diag) {
        diag.describeIfSet("class-name", className);
        diag.describeIfSet("name", name);
        diag.describeIfSet("actions", actions);

    }
1204958
private void migrateTenantDefinitions() {
        DBService dbservice = DBService.instance();
        List<String> keyspaces = null;
        if (dbservice instanceof ThriftService) {
            keyspaces = ((ThriftService)dbservice).getDoradusKeyspaces();
        } else if (dbservice instanceof CQLService) {
            keyspaces = ((CQLService)dbservice).getDoradusKeyspaces();
        } else {
            return;
        }
        for (String keyspace : keyspaces) {
            migrateTenantDefinition(keyspace);
        }
    }
451312
@Override
    public Iterator<String> getSpaces() {
        ConnectOperation co =
            new ConnectOperation(host, port, username, password, zone);

        log.trace("Listing spaces");
        try {
            return listDirectories(baseDirectory, co.getConnection());
        } catch (IOException e) {
            log.error("Could not connect to iRODS", e);
            throw new StorageException(e);
        }
    }
141097
@SuppressWarnings({ "unchecked", "rawtypes" })
	protected void ensureLocalSpaceDefinition(SpaceID id, Object[] initializationParameters) {
		synchronized (getSpaceRepositoryMutex()) {
			if (!this.spaces.containsKey(id)) {
				createSpaceInstance((Class) id.getSpaceSpecification(), id, false, initializationParameters);
			}
		}
	}