com.hp.hpl.mesa.rdf.jena.rdb
Interface IDBConnection

All Known Implementing Classes:
DBConnection

public interface IDBConnection

Encapsulate the specification of a jdbc connection, mostly used to simplify the calling pattern for ModelRDB factory methods.

Version:
$Revision: 1.2 $ on $Date: 2001/11/26 18:20:09 $
Author:
Dave Reynolds

Field Summary
static java.lang.String DATABASE_TYPE
          Property name for the database type
static java.lang.String DRIVER_CLASSNAME
          Property name for the driver class name
static java.lang.String LAYOUT_TYPE
          Property name for the layout type
 
Method Summary
 void addProperty(java.lang.String propname, java.lang.String value)
          Add a new property value to both RDF_LAYOUT_INFO table.
 void close()
          Close the jdbc connection
 java.sql.Connection getConnection()
          Return the jdbc connection.
 IRDBDriver getDriver()
          Return an IRDBDriver suitable for this database connection.
 IRDBDriver getDriver(java.lang.String layout, java.lang.String database)
          Helper function to locate and instantiate the driver class corresponding to a given layout and database name Throws an RDFRDBexception if the driver can't be instantiated
 java.util.Properties getProperties()
          Returns a set of property values for the database at the end of the connection.
 java.lang.String getProperty(java.lang.String propname)
          Returns a property value for the database at the end of the connection.
 boolean isFormatOK()
          Return true if the database seems to be formated for RDF storage.
 void setDriver(IRDBDriver driver)
          Set the IRDBDriver to use for this connection.
 

Field Detail

DATABASE_TYPE

public static final java.lang.String DATABASE_TYPE
Property name for the database type

LAYOUT_TYPE

public static final java.lang.String LAYOUT_TYPE
Property name for the layout type

DRIVER_CLASSNAME

public static final java.lang.String DRIVER_CLASSNAME
Property name for the driver class name
Method Detail

getConnection

public java.sql.Connection getConnection()
                                  throws java.sql.SQLException
Return the jdbc connection.

close

public void close()
           throws java.sql.SQLException
Close the jdbc connection

isFormatOK

public boolean isFormatOK()
                   throws RDFRDBException
Return true if the database seems to be formated for RDF storage. This is not an integrity check this is simply a flag recording that a base level table exists. Any access errors are treated as the database not being formated. Throws an exception if the database is not even openable.

getProperty

public java.lang.String getProperty(java.lang.String propname)
                             throws java.sql.SQLException
Returns a property value for the database at the end of the connection. This is used to retrieve appropriate formating and driver information from a standard RDF_LAYOUT_INFO table. For a database that has not been formatted all calls will return null. Any access errors are treated as the database not being formated. Throws an exception if the database is not even openable.

getProperties

public java.util.Properties getProperties()
                                   throws java.sql.SQLException
Returns a set of property values for the database at the end of the connection. This is used to retrieve appropriate formating and driver information from a standard RDF_LAYOUT_INFO table. For a database that has not been formatted all calls will return null. Any access errors are treated as the database not being formated.

addProperty

public void addProperty(java.lang.String propname,
                        java.lang.String value)
                 throws java.sql.SQLException
Add a new property value to both RDF_LAYOUT_INFO table.

getDriver

public IRDBDriver getDriver()
                     throws RDFRDBException
Return an IRDBDriver suitable for this database connection. This is only usable for a preformatted database, returns null if the database has not been formatted.

setDriver

public void setDriver(IRDBDriver driver)
Set the IRDBDriver to use for this connection. Useful to enable external drivers to be registered outside of the standard driver package.

getDriver

public IRDBDriver getDriver(java.lang.String layout,
                            java.lang.String database)
                     throws RDFRDBException
Helper function to locate and instantiate the driver class corresponding to a given layout and database name Throws an RDFRDBexception if the driver can't be instantiated


Copyright © 2001 Hewlett-Packard. All Rights Reserved.