SDMDriver.java [src/org/csu/csip/sdm] Revision: 671c633d419867f644cc0d2a492c05505d984e0a Date: Fri Jul 21 15:53:45 MDT 2017
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.csu.csip.sdm;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.DriverPropertyInfo;
import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
import java.util.Properties;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
* @author <a href="mailto:shaun.case@colostate.edu">Shaun Case</a>
*
* Use the following for your datasource environment:
@Resource(type = JDBC, file = "${<config key>}", id = <id string> , env = {
"driverClassName=org.csu.csip.sdm.SDMDriver","validationQuery=SELECT 1 FROM mapunit;",
"maxWait=300000", "testOnBorrow=false"
})
*/
public class SDMDriver implements java.sql.Driver {
static String URL_TYPE = "jdbc:sdm:rest://";
static
{
try {
// Register the Driver with DriverManager
SDMDriver driverInst = new SDMDriver();
DriverManager.registerDriver(driverInst);
} catch (SQLException ex) {
Logger.getLogger(SDMDriver.class.getName()).log(Level.SEVERE, null, ex);
}
}
@Override
public boolean acceptsURL(String url) throws SQLException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public Connection connect(String url, Properties info) throws SQLException {
if (url.contains(URL_TYPE)){
return new SDMConnection(url);
}else{
throw new SQLException( "Invalid connection url specified. Requires connection of type '" + URL_TYPE + "'");
}
}
@Override
public int getMajorVersion() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public int getMinorVersion() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public Logger getParentLogger() throws SQLFeatureNotSupportedException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) throws SQLException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public boolean jdbcCompliant() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
}