Example usage for org.apache.cassandra.db KeyspaceNotDefinedException KeyspaceNotDefinedException

List of usage examples for org.apache.cassandra.db KeyspaceNotDefinedException KeyspaceNotDefinedException

Introduction

In this page you can find the example usage for org.apache.cassandra.db KeyspaceNotDefinedException KeyspaceNotDefinedException.

Prototype

public KeyspaceNotDefinedException(String why) 

Source Link

Usage

From source file:org.teiid.resource.adapter.cassandra.CassandraConnectionImpl.java

License:Open Source License

@Override
public KeyspaceMetadata keyspaceInfo() throws KeyspaceNotDefinedException {
    String keyspace = config.getKeyspace();
    KeyspaceMetadata result = metadata.getKeyspace(keyspace);
    if (result == null && keyspace.length() > 2 && keyspace.charAt(0) == '"'
            && keyspace.charAt(keyspace.length() - 1) == '"') {
        //try unquoted
        keyspace = keyspace.substring(1, keyspace.length() - 1);
        result = metadata.getKeyspace(keyspace);
    }/*w w w .  j  av a2  s  . c o  m*/
    if (result == null) {
        throw new KeyspaceNotDefinedException(keyspace);
    }
    return result;
}