public class Utils extends Object
| Constructor and Description |
|---|
Utils() |
| Modifier and Type | Method and Description |
|---|---|
static String |
createSubName(Properties props)
Create a "Subname" portion of a JDBC URL from properties.
|
static String |
determineCurrentColumnFamily(String cql)
Determine the current column family by inspecting the CQL to find a CF reference.
|
static String |
determineCurrentKeyspace(String cql,
String current)
Determine the current keyspace by inspecting the CQL string to see if a USE statement is provided; which would change the keyspace.
|
static com.datastax.driver.core.policies.LoadBalancingPolicy |
getLbPolicy(String lbString,
String parameters) |
static com.datastax.driver.core.policies.ReconnectionPolicy |
getReconnectionPolicy(String rcString,
String parameters) |
protected static String |
makeQueryString(Properties props) |
protected static ByteBuffer |
pack(List<ByteBuffer> buffers,
int elements,
int size)
Utility method to pack bytes into a byte buffer from a list of ByteBuffers
|
static com.datastax.driver.core.policies.LoadBalancingPolicy |
parseLbPolicy(String loadBalancingPolicyString) |
static ArrayList<?> |
parseList(String itemType,
String value) |
static HashMap<?,?> |
parseMap(String kType,
String vType,
String value) |
protected static Map<String,String> |
parseQueryPart(String query) |
static com.datastax.driver.core.policies.ReconnectionPolicy |
parseReconnectionPolicy(String reconnectionPolicyString) |
static com.datastax.driver.core.policies.RetryPolicy |
parseRetryPolicy(String retryPolicyString) |
static LinkedHashSet<?> |
parseSet(String itemType,
String value) |
static Properties |
parseURL(String url)
Parse a URL for the Cassandra JDBC Driver
The URL must start with the Protocol: "jdbc:cassandra:"
The URI part(the "Subname") must contain a host and an optional port and optional keyspace name
ie.
|
public static final String PROTOCOL
public static final String DEFAULT_HOST
public static final int DEFAULT_PORT
public static final com.datastax.driver.core.ConsistencyLevel DEFAULT_CONSISTENCY
public static final String KEY_VERSION
public static final String KEY_CONSISTENCY
public static final String KEY_PRIMARY_DC
public static final String KEY_BACKUP_DC
public static final String KEY_CONNECTION_RETRIES
public static final String KEY_LOADBALANCING_POLICY
public static final String KEY_RETRY_POLICY
public static final String KEY_RECONNECT_POLICY
public static final String KEY_DEBUG
public static final String TAG_DESCRIPTION
public static final String TAG_USER
public static final String TAG_PASSWORD
public static final String TAG_DATABASE_NAME
public static final String TAG_SERVER_NAME
public static final String TAG_PORT_NUMBER
public static final String TAG_ACTIVE_CQL_VERSION
public static final String TAG_CQL_VERSION
public static final String TAG_BUILD_VERSION
public static final String TAG_THRIFT_VERSION
public static final String TAG_CONSISTENCY_LEVEL
public static final String TAG_LOADBALANCING_POLICY
public static final String TAG_RETRY_POLICY
public static final String TAG_RECONNECT_POLICY
public static final String TAG_DEBUG
public static final String TAG_PRIMARY_DC
public static final String TAG_BACKUP_DC
public static final String TAG_CONNECTION_RETRIES
protected static final String WAS_CLOSED_CON
protected static final String WAS_CLOSED_STMT
protected static final String WAS_CLOSED_RSLT
protected static final String NO_INTERFACE
protected static final String NO_TRANSACTIONS
protected static final String NO_SERVER
protected static final String ALWAYS_AUTOCOMMIT
protected static final String BAD_TIMEOUT
protected static final String SCHEMA_MISMATCH
public static final String NOT_SUPPORTED
protected static final String NO_GEN_KEYS
protected static final String NO_BATCH
protected static final String NO_MULTIPLE
protected static final String NO_VALIDATOR
protected static final String NO_COMPARATOR
protected static final String NO_RESULTSET
protected static final String NO_UPDATE_COUNT
protected static final String NO_CF
protected static final String BAD_KEEP_RSET
protected static final String BAD_TYPE_RSET
protected static final String BAD_CONCUR_RSET
protected static final String BAD_HOLD_RSET
protected static final String BAD_FETCH_DIR
protected static final String BAD_AUTO_GEN
protected static final String BAD_FETCH_SIZE
protected static final String MUST_BE_POSITIVE
protected static final String VALID_LABELS
protected static final String NOT_TRANSLATABLE
protected static final String NOT_BOOLEAN
protected static final String HOST_IN_URL
protected static final String HOST_REQUIRED
protected static final String BAD_KEYSPACE
protected static final String URI_IS_SIMPLE
protected static final String NOT_OPTION
protected static final String FORWARD_ONLY
protected static final org.slf4j.Logger logger
public static final Properties parseURL(String url) throws SQLException
url - The full JDBC URL to be parsedSQLExceptionpublic static final String createSubName(Properties props) throws SQLException
props - A Properties file containing all the properties to be considered.SQLExceptionpublic static String determineCurrentKeyspace(String cql, String current)
cql - A CQL query stringcurrent - The current keyspace stored as state in the connectionpublic static String determineCurrentColumnFamily(String cql)
cql - A CQL query stringprotected static ByteBuffer pack(List<ByteBuffer> buffers, int elements, int size)
buffers - A list of ByteBuffers representing the elements to packelements - The count of the elementssize - The size in bytes of the result bufferprotected static String makeQueryString(Properties props)
protected static Map<String,String> parseQueryPart(String query) throws SQLException
SQLExceptionpublic static LinkedHashSet<?> parseSet(String itemType, String value)
public static com.datastax.driver.core.policies.LoadBalancingPolicy parseLbPolicy(String loadBalancingPolicyString) throws InstantiationException, IllegalAccessException, ClassNotFoundException, NoSuchMethodException, SecurityException, IllegalArgumentException, InvocationTargetException
public static com.datastax.driver.core.policies.LoadBalancingPolicy getLbPolicy(String lbString, String parameters) throws ClassNotFoundException, NoSuchMethodException, SecurityException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException
public static com.datastax.driver.core.policies.RetryPolicy parseRetryPolicy(String retryPolicyString) throws InstantiationException, IllegalAccessException, ClassNotFoundException, NoSuchMethodException, SecurityException, IllegalArgumentException, InvocationTargetException, NoSuchFieldException
public static com.datastax.driver.core.policies.ReconnectionPolicy parseReconnectionPolicy(String reconnectionPolicyString) throws InstantiationException, IllegalAccessException, ClassNotFoundException, NoSuchMethodException, SecurityException, IllegalArgumentException, InvocationTargetException
public static com.datastax.driver.core.policies.ReconnectionPolicy getReconnectionPolicy(String rcString, String parameters) throws ClassNotFoundException, NoSuchMethodException, SecurityException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException
Copyright © 2015–2016. All rights reserved.