net.sf.farrago.jdbc
Class FarragoAbstractJdbcDriver

java.lang.Object
  extended by net.sf.farrago.jdbc.FarragoAbstractJdbcDriver
All Implemented Interfaces:
Driver
Direct Known Subclasses:
FarragoJdbcClientDriver, FarragoJdbcRoutineDriver, FarragoUnregisteredJdbcEngineDriver, FarragoUnregisteredVjdbcClientDriver, FarragoUnregisteredVjdbcHttpClientDriver

public abstract class FarragoAbstractJdbcDriver
extends Object
implements Driver

FarragoAbstractJdbcDriver is an abstract base for the client and engine sides of the Farrago JDBC driver.

Version:
$Id: //open/dev/farrago/src/net/sf/farrago/jdbc/FarragoAbstractJdbcDriver.java#23 $
Author:
John V. Sichi

Constructor Summary
FarragoAbstractJdbcDriver()
           
 
Method Summary
 boolean acceptsURL(String url)
           
 boolean acceptsUrlWithHostPort()
          Indicates whether driver accepts URLs with host:port specification.
 Properties applyDefaultConnectionProps(Properties info)
          Returns new Properties object with all input properties and default connection properties.
private  Properties copyProperties(Properties src, Properties dest)
          Returns destination Properties object after copying source properties into it.
 String getBaseUrl()
           
 String getClientUrl()
           
 Properties getDefaultConnectionProps()
          Returns default connection properties.
 int getMajorVersion()
           
 int getMinorVersion()
           
 DriverPropertyInfo[] getPropertyInfo(String url, Properties info)
           
abstract  String getUrlPrefix()
           
 boolean jdbcCompliant()
           
 String parseConnectionParams(String connectionURI, Properties info)
          Parses params from connection string into Properties object, returning the stripped URI.
 void register()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.sql.Driver
connect
 

Constructor Detail

FarragoAbstractJdbcDriver

public FarragoAbstractJdbcDriver()
Method Detail

jdbcCompliant

public boolean jdbcCompliant()
Specified by:
jdbcCompliant in interface Driver

getUrlPrefix

public abstract String getUrlPrefix()
Returns:
the prefix for JDBC URL's understood by this driver

getBaseUrl

public String getBaseUrl()
Returns:
the base JDBC URL for this driver; subclassing drivers can override this to customize the URL scheme

getClientUrl

public String getClientUrl()
Returns:
the JDBC URL interpreted by the engine driver as a connection from an RMI client; subclassing drivers can override this to customize the URL scheme

getMajorVersion

public int getMajorVersion()
Specified by:
getMajorVersion in interface Driver

getMinorVersion

public int getMinorVersion()
Specified by:
getMinorVersion in interface Driver

getPropertyInfo

public DriverPropertyInfo[] getPropertyInfo(String url,
                                            Properties info)
                                     throws SQLException
Specified by:
getPropertyInfo in interface Driver
Throws:
SQLException

acceptsURL

public boolean acceptsURL(String url)
                   throws SQLException
Specified by:
acceptsURL in interface Driver
Throws:
SQLException

acceptsUrlWithHostPort

public boolean acceptsUrlWithHostPort()
Indicates whether driver accepts URLs with host:port specification. Returns false by default. Subclassing drivers should override and return true to enable FarragoTestCase to create URLs with host:port specifications.

Returns:
false

register

public void register()

applyDefaultConnectionProps

public Properties applyDefaultConnectionProps(Properties info)
Returns new Properties object with all input properties and default connection properties. Input properties take precedence over default properties.

Parameters:
info - input properties, copied but unchanged
Returns:
new Properties object, never null
See Also:
getDefaultConnectionProps()

getDefaultConnectionProps

public Properties getDefaultConnectionProps()
Returns default connection properties.

Returns:
new Properties object, never null
See Also:
applyDefaultConnectionProps(java.util.Properties)

copyProperties

private Properties copyProperties(Properties src,
                                  Properties dest)
Returns destination Properties object after copying source properties into it. Any existing destination property with the same name as a source property is replaced by the source property. A new destination Properties object is created if the input argument is null. Note: Properties object is treated like a Hashtable and all key-value pairs are copied, regardless of whether the keys or values are Strings. Chained Properties objects are OK, but there is no API for accessing non-String values from chained Properties object. So only String values can be copied from chained Properties.

Parameters:
src - source properties, must not be null
dest - destination properties, may be null
Returns:
merged properties

parseConnectionParams

public String parseConnectionParams(String connectionURI,
                                    Properties info)
                             throws SQLException
Parses params from connection string into Properties object, returning the stripped URI.

Parameters:
connectionURI - connection string with optional params
info - Properties object; pass null to just get the stripped URI
Returns:
connection URI stripped of params; parameters parsed into info if not null.
Throws:
SQLException