forked from apache/cassandra
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
git-svn-id: https://svn.apache.org/repos/asf/cassandra/tags/drivers@1130850 13f79535-47bb-0310-9956-ffa450edef68
- Loading branch information
Eric Evans
committed
Jun 2, 2011
1 parent
4a1ca8f
commit 20635ce
Showing
17 changed files
with
4,992 additions
and
0 deletions.
There are no files selected for viewing
761 changes: 761 additions & 0 deletions
761
java/1.0.3/src/org/apache/cassandra/cql/jdbc/AbstractResultSet.java
Large diffs are not rendered by default.
Oops, something went wrong.
560 changes: 560 additions & 0 deletions
560
java/1.0.3/src/org/apache/cassandra/cql/jdbc/CResultSet.java
Large diffs are not rendered by default.
Oops, something went wrong.
658 changes: 658 additions & 0 deletions
658
java/1.0.3/src/org/apache/cassandra/cql/jdbc/CassandraConnection.java
Large diffs are not rendered by default.
Oops, something went wrong.
134 changes: 134 additions & 0 deletions
134
java/1.0.3/src/org/apache/cassandra/cql/jdbc/CassandraDriver.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,134 @@ | |||
/* | |||
* | |||
* Licensed to the Apache Software Foundation (ASF) under one | |||
* or more contributor license agreements. See the NOTICE file | |||
* distributed with this work for additional information | |||
* regarding copyright ownership. The ASF licenses this file | |||
* to you under the Apache License, Version 2.0 (the | |||
* "License"); you may not use this file except in compliance | |||
* with the License. You may obtain a copy of the License at | |||
* | |||
* http://www.apache.org/licenses/LICENSE-2.0 | |||
* | |||
* Unless required by applicable law or agreed to in writing, | |||
* software distributed under the License is distributed on an | |||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |||
* KIND, either express or implied. See the License for the | |||
* specific language governing permissions and limitations | |||
* under the License. | |||
* | |||
*/ | |||
package org.apache.cassandra.cql.jdbc; | |||
|
|||
import java.sql.Connection; | |||
import java.sql.Driver; | |||
import java.sql.DriverManager; | |||
import java.sql.DriverPropertyInfo; | |||
import java.sql.SQLException; | |||
import java.util.Properties; | |||
|
|||
/** | |||
* The Class CassandraDriver. | |||
*/ | |||
public class CassandraDriver implements Driver | |||
{ | |||
|
|||
/** The Constant MAJOR_VERSION. */ | |||
private static final int MAJOR_VERSION = 1; | |||
|
|||
/** The Constant MINOR_VERSION. */ | |||
private static final int MINOR_VERSION = 0; | |||
|
|||
/** The ACCEPT s_ url. */ | |||
private static String ACCEPTS_URL = "jdbc:cassandra"; | |||
|
|||
// private static final Logger logger = LoggerFactory.getLogger(CassandraDriver.class); | |||
|
|||
static | |||
{ | |||
// Register the CassandraDriver with DriverManager | |||
try | |||
{ | |||
CassandraDriver driverInst = new CassandraDriver(); | |||
DriverManager.registerDriver(driverInst); | |||
} | |||
catch (SQLException e) | |||
{ | |||
throw new DriverResolverException(e.getMessage()); | |||
} | |||
} | |||
|
|||
|
|||
/** | |||
* Method to validate whether provided connection url matches with pattern or not. | |||
* | |||
* @param url connection url. | |||
* @return true, if successful | |||
* @throws SQLException the sQL exception | |||
*/ | |||
public boolean acceptsURL(String url) throws SQLException | |||
{ | |||
return url.startsWith(ACCEPTS_URL); | |||
} | |||
|
|||
/** | |||
* Method to return connection instance for given connection url and connection props. | |||
* | |||
* @param url connection url. | |||
* @param props connection properties. | |||
* @return connection connection instance. | |||
* @throws SQLException the sQL exception | |||
*/ | |||
public Connection connect(String url, Properties props) throws SQLException | |||
{ | |||
if (acceptsURL(url)) | |||
{ | |||
return new CassandraConnection(url); | |||
} | |||
else | |||
{ | |||
throw new InvalidUrlException("Invalid connection url:" + url + ". should start with jdbc:cassandra"); | |||
} | |||
} | |||
|
|||
/** | |||
* Returns default major version. | |||
* @return MAJOR_VERSION major version. | |||
*/ | |||
public int getMajorVersion() | |||
{ | |||
return MAJOR_VERSION; | |||
} | |||
|
|||
/** | |||
* Returns default minor version. | |||
* @return MINOR_VERSION minor version. | |||
*/ | |||
public int getMinorVersion() | |||
{ | |||
return MINOR_VERSION; | |||
} | |||
|
|||
/** | |||
* Returns default driver property info object. | |||
* | |||
* @param arg0 the arg0 | |||
* @param arg1 the arg1 | |||
* @return driverPropertyInfo | |||
* @throws SQLException the sQL exception | |||
*/ | |||
public DriverPropertyInfo[] getPropertyInfo(String arg0, Properties arg1) throws SQLException | |||
{ | |||
return new DriverPropertyInfo[0]; | |||
} | |||
|
|||
/** | |||
* Returns true, if it is jdbc compliant. | |||
* @return value true, if it is jdbc compliant. | |||
*/ | |||
public boolean jdbcCompliant() | |||
{ | |||
return false; | |||
} | |||
|
|||
} |
Oops, something went wrong.