gate.db
Class OracleDataStore

java.lang.Object
  |
  +--gate.util.AbstractFeatureBearer
        |
        +--gate.persist.SerialDataStore
              |
              +--gate.db.Database
                    |
                    +--gate.db.OracleDataStore
All Implemented Interfaces:
DataStore, FeatureBearer

public class OracleDataStore
extends Database

Provides connection to an Oracle Database.


Field Summary
private static boolean DEBUG
          Debug flag
 
Fields inherited from class gate.db.Database
availableConnections, catalog, connections, dictionary, driver, features, password, schema, TRANSACTION_LEVEL, url, user
 
Fields inherited from class gate.persist.SerialDataStore
autoSaving, currentProtocolVersion, datastoreListeners, protocolVersionNumbers, randomiser, storageDir, versionFileName, versionNumber
 
Constructor Summary
OracleDataStore(Driver driver, String url, String user, String password, String catalog, String schema)
          Constructs a OracleDataStore
 
Method Summary
private  Blob buildBlobFromObject(Connection con, Object obj)
          Returns a Blob representation of any serializable java object.
 Map getDictionary()
           
 void putObject(PreparedStatement ps, int place, Object value)
          Acts as a setBlob for the provided prepared statement on the position indicated by place.
 Object readObjectBlob(ResultSet rs, Connection con, String columnName)
          Reads a Object from a BLOB on the current row in a result set.
 
Methods inherited from class gate.db.Database
connect, deleteFeaturesOf, getCatalog, getConnection, getFeatures, getSchema, isConnected, readFeaturesOf, release, setFeatures, takeBackConnection, writeFeaturesOf
 
Methods inherited from class gate.persist.SerialDataStore
addDatastoreListener, adopt, close, constructPersistenceId, create, delete, delete, equals, fireResourceAdopted, fireResourceDeleted, fireResourceWritten, getLr, getLrIds, getLrName, getLrNames, getLrTypes, getStorageDir, getStorageUrl, getVersionFile, hashCode, isAutoSaving, isValidProtocolVersion, open, random, removeDatastoreListener, setAutoSaving, setStorageDir, setStorageUrl, sync, toString
 
Methods inherited from class gate.util.AbstractFeatureBearer
getName, setName
 
Methods inherited from class java.lang.Object
, clone, finalize, getClass, notify, notifyAll, registerNatives, wait, wait, wait
 
Methods inherited from interface gate.util.FeatureBearer
getName, setName
 

Field Detail

DEBUG

private static final boolean DEBUG
Debug flag
Constructor Detail

OracleDataStore

public OracleDataStore(Driver driver,
                       String url,
                       String user,
                       String password,
                       String catalog,
                       String schema)
Constructs a OracleDataStore
Parameters:
driver - the driver used to connect to the database. We didn't choose to default this value to any specific Oracle Jdbc drivers because this option should belong to the user.
url - The URL of the database.
user - the username
password - the password
catalog - the catalog in which the Gate2 table reside.
schema - The schema in which the Gate2 table reside.
Method Detail

readObjectBlob

public Object readObjectBlob(ResultSet rs,
                             Connection con,
                             String columnName)
                      throws SQLException
Reads a Object from a BLOB on the current row in a result set. Note that the Blob must contain a java Object saved using serialisation.
Overrides:
readObjectBlob in class Database
Parameters:
rs - a result set positioned on the row from which the BLOB is to be read
columnName - the name of the column containing the BLOB on the current row.
Returns:
an object containing the blob.

buildBlobFromObject

private Blob buildBlobFromObject(Connection con,
                                 Object obj)
                          throws SQLException
Returns a Blob representation of any serializable java object.
Parameters:
stmt - a value of type 'Statement'
obj - a value of type 'Object'
Returns:
a value of type 'Blob'
Throws:
SQLException - if an error occurs

putObject

public void putObject(PreparedStatement ps,
                      int place,
                      Object value)
               throws SQLException
Acts as a setBlob for the provided prepared statement on the position indicated by place.
Overrides:
putObject in class Database
Parameters:
ps - A prepared statement where the blob will be set.
place - The position on the prepared statement where the blob will be set.
value - The object that will be serialised and converted into a blob.

getDictionary

public Map getDictionary()
Overrides:
getDictionary in class Database