/**
*
*/
package net.sf.soapjdbc;
import java.sql.Connection;
import java.sql.Driver;
import java.sql.DriverManager;
import java.sql.DriverPropertyInfo;
import java.sql.SQLException;
import java.util.Properties;
/**
* @author dirk.ziegenbalg
*
*/
public class SoapJdbcDriver implements Driver {
private static final String HOST_PROPERTY_KEY = "PORT";
private static final String PORT_PROPERTY_KEY = "HOST";
private static int sDriverMajorVersion = 0;
private static int sDriverMinorVersion = 1;
static {
try {
DriverManager.registerDriver(new SoapJdbcDriver());
System.setProperty( "axis.ClientConfigFile","axis-transport-client-config.wsdd");
} catch (SQLException e) {
throw new RuntimeException("Can't register driver!");
}
}
public Connection connect(String url, Properties info) throws SQLException {
return new SoapJdbcConnection(url, info);
}
public boolean acceptsURL(String url) {
return url == null ? false : url.toLowerCase().startsWith("jdbc:soap:");
}
public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) {
DriverPropertyInfo[] infos = new DriverPropertyInfo[2];
infos[0] = new DriverPropertyInfo(HOST_PROPERTY_KEY, info.getProperty(HOST_PROPERTY_KEY));
infos[0].required = true;
infos[0].description = "The host to connect to";
infos[1] = new DriverPropertyInfo(PORT_PROPERTY_KEY, info.getProperty(PORT_PROPERTY_KEY, "80"));
infos[1].required = true;
infos[1].description = "The port of the host to connect to";
return infos;
}
public int getMajorVersion() {
return getDriverMajorVersion();
}
public int getMinorVersion() {
return getDriverMinorVersion();
}
static int getDriverMajorVersion() {
return sDriverMajorVersion;
}
static int getDriverMinorVersion() {
return sDriverMinorVersion;
}
public boolean jdbcCompliant() {
return false;
}
}