GATE
Version 3.1-2270

gate.persist
Class DBHelper

java.lang.Object
  extended by gate.persist.DBHelper

public class DBHelper
extends Object


Field Summary
static int BINARY_CONTENT
          binary content (may make difference for the database)
static int CHARACTER_CONTENT
          character content (may make difference for the database)
static int CHINK_SIZE_LARGE
           
static int CHINK_SIZE_MEDIUM
           
static int CHINK_SIZE_SMALL
           
static String CORPUS_CLASS
          LR classes supported at present
static String DB_PARAMETER_GUID
          key in T_PARAMETER that defines a unique id for the data store
static String DOCUMENT_CLASS
          LR classes supported at present
static String DUMMY_ENCODING
          dummy encoding type, do not use it
static String DUMMY_FEATURE_KEY
          dummy feature key, do not use it
static Long DUMMY_ID
          huh?
static int EMPTY_CONTENT
          document has no content
static int FALSE
           
protected static int FEATURE_OWNER_ANNOTATION
          used to store annotation's features
protected static int FEATURE_OWNER_CORPUS
          used to store corpus' features
protected static int FEATURE_OWNER_DOCUMENT
          used to store document's features
static int ORACLE_DB
          Oracle database type
static int POSTGRES_DB
          PostgreSQL database type
static int READ_ACCESS
          used internaly, may change in the future
static int TRUE
           
static int VALUE_TYPE_BINARY
          feature value is binary
static int VALUE_TYPE_BINARY_ARR
          feature value is array of binary values
static int VALUE_TYPE_BOOLEAN
          feature value is boolean
static int VALUE_TYPE_BOOLEAN_ARR
          feature value is array of bools
static int VALUE_TYPE_EMPTY_ARR
          feature value is array of floats
static int VALUE_TYPE_FLOAT
          feature value is float
static int VALUE_TYPE_FLOAT_ARR
          feature value is array of floats
static int VALUE_TYPE_INTEGER
          feature value is int
static int VALUE_TYPE_INTEGER_ARR
          feature value is array of ints
static int VALUE_TYPE_LONG
          feature value is long
static int VALUE_TYPE_LONG_ARR
          feature value is array of longs
static int VALUE_TYPE_NULL
          feature value is null
static int VALUE_TYPE_STRING
          feature value is string less than 4000 bytes
static int VALUE_TYPE_STRING_ARR
          feature value is array of strings
static int WRITE_ACCESS
          used internaly, may change in the future
static int X_ORACLE_DUPLICATE_GROUP_NAME
          this should be thrown if an attempt to create a group with duplicated name is made
static int X_ORACLE_DUPLICATE_USER_NAME
          see above
static int X_ORACLE_GROUP_OWNS_RESOURCES
          attempt to delete a group that owns resources is made
static int X_ORACLE_INCOMPLETE_DATA
          huh?
static int X_ORACLE_INSUFFICIENT_PRIVILEGES
          attempt to perform an operation that requres more privileged is made
static int X_ORACLE_INVALID_ACCESS_MODE
          attempt to access resource in mode that does not exist
static int X_ORACLE_INVALID_ANNOTATION
          attempt to remove annotation that does not exist is made
static int X_ORACLE_INVALID_ANNOTATION_SET
          attempt to remove annotation set that does not exist is made
static int X_ORACLE_INVALID_ANNOTATION_TYPE
          this is obsolete now?
static int X_ORACLE_INVALID_ARGUMENT
          huh?
static int X_ORACLE_INVALID_CONTENT_TYPE
          not supported content type - we support only character/binary/empty content since there are no many other options this error shoudkl indicate that the java code was not synced with the pl/sql one
static int X_ORACLE_INVALID_FEATURE_TYPE
          attempt to create a feature with invalid value type is made since value types are automatically assigned in the java code, this errror should indicate that the java code was changed but no changes were made to the relevant pl/sql code
static int X_ORACLE_INVALID_LR
          access to LR by id fails - no such resource
static int X_ORACLE_INVALID_LR_TYPE
          attempt to access resources by type is made, but no such type exists
static int X_ORACLE_INVALID_USER_GROUP
          invalid group id supplied for operation requiring such specifier
static int X_ORACLE_INVALID_USER_NAME
          no such user failure upon login
static int X_ORACLE_INVALID_USER_PASS
          -
static int X_ORACLE_NOT_IMPLEMENTED
          this should not be in use anymore
static int X_ORACLE_START
          user defined error codes in Oracle start with -21000
static int X_ORACLE_USER_OWNS_RESOURCES
          attempt to delete a user that owns resources is made
 
Constructor Summary
protected DBHelper()
           
 
Method Summary
static void cleanup(ResultSet rs)
          closes a result set note that Oracle jdbc classes do not have finalize() implementations so if they're not closed leaks may occur
static void cleanup(Statement stmt)
          closes a statement note that Oracle jdbc classes do not have finalize() implementations so if they're not closed leaks may occur
static Connection connect(String connectURL)
          connects to DB
static Connection connect(String connectURL, boolean usePool)
          connects to DB gets connection from pool if such exists
static Connection connect(String connectURL, String user, String pass)
          connects to DB
static void disconnect(Connection conn)
          disconnects from DB, may return connection to pool if such exists any uncommited transactions are rolled back
static void disconnect(Connection conn, boolean usePool)
          disconnects from DB, may return connection to pool if such exists any uncommited transactions are rolled back
static int getDatabaseType(String jdbcURL)
           
static String getSchemaPrefix(String jdbcURL)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CHINK_SIZE_SMALL

public static final int CHINK_SIZE_SMALL
See Also:
Constant Field Values

CHINK_SIZE_MEDIUM

public static final int CHINK_SIZE_MEDIUM
See Also:
Constant Field Values

CHINK_SIZE_LARGE

public static final int CHINK_SIZE_LARGE
See Also:
Constant Field Values

X_ORACLE_START

public static final int X_ORACLE_START
user defined error codes in Oracle start with -21000

See Also:
Constant Field Values

X_ORACLE_DUPLICATE_GROUP_NAME

public static final int X_ORACLE_DUPLICATE_GROUP_NAME
this should be thrown if an attempt to create a group with duplicated name is made

See Also:
Constant Field Values

X_ORACLE_DUPLICATE_USER_NAME

public static final int X_ORACLE_DUPLICATE_USER_NAME
see above

See Also:
Constant Field Values

X_ORACLE_INVALID_USER_NAME

public static final int X_ORACLE_INVALID_USER_NAME
no such user failure upon login

See Also:
Constant Field Values

X_ORACLE_INVALID_USER_PASS

public static final int X_ORACLE_INVALID_USER_PASS
-

See Also:
Constant Field Values

X_ORACLE_INVALID_USER_GROUP

public static final int X_ORACLE_INVALID_USER_GROUP
invalid group id supplied for operation requiring such specifier

See Also:
Constant Field Values

X_ORACLE_INVALID_LR

public static final int X_ORACLE_INVALID_LR
access to LR by id fails - no such resource

See Also:
Constant Field Values

X_ORACLE_INVALID_ACCESS_MODE

public static final int X_ORACLE_INVALID_ACCESS_MODE
attempt to access resource in mode that does not exist

See Also:
Constant Field Values

X_ORACLE_INVALID_ARGUMENT

public static final int X_ORACLE_INVALID_ARGUMENT
huh?

See Also:
Constant Field Values

X_ORACLE_NOT_IMPLEMENTED

public static final int X_ORACLE_NOT_IMPLEMENTED
this should not be in use anymore

See Also:
Constant Field Values

X_ORACLE_GROUP_OWNS_RESOURCES

public static final int X_ORACLE_GROUP_OWNS_RESOURCES
attempt to delete a group that owns resources is made

See Also:
Constant Field Values

X_ORACLE_USER_OWNS_RESOURCES

public static final int X_ORACLE_USER_OWNS_RESOURCES
attempt to delete a user that owns resources is made

See Also:
Constant Field Values

X_ORACLE_INCOMPLETE_DATA

public static final int X_ORACLE_INCOMPLETE_DATA
huh?

See Also:
Constant Field Values

X_ORACLE_INVALID_LR_TYPE

public static final int X_ORACLE_INVALID_LR_TYPE
attempt to access resources by type is made, but no such type exists

See Also:
Constant Field Values

X_ORACLE_INVALID_ANNOTATION_TYPE

public static final int X_ORACLE_INVALID_ANNOTATION_TYPE
this is obsolete now?

See Also:
Constant Field Values

X_ORACLE_INVALID_FEATURE_TYPE

public static final int X_ORACLE_INVALID_FEATURE_TYPE
attempt to create a feature with invalid value type is made since value types are automatically assigned in the java code, this errror should indicate that the java code was changed but no changes were made to the relevant pl/sql code

See Also:
Constant Field Values

X_ORACLE_INVALID_CONTENT_TYPE

public static final int X_ORACLE_INVALID_CONTENT_TYPE
not supported content type - we support only character/binary/empty content since there are no many other options this error shoudkl indicate that the java code was not synced with the pl/sql one

See Also:
Constant Field Values

X_ORACLE_INVALID_ANNOTATION

public static final int X_ORACLE_INVALID_ANNOTATION
attempt to remove annotation that does not exist is made

See Also:
Constant Field Values

X_ORACLE_INSUFFICIENT_PRIVILEGES

public static final int X_ORACLE_INSUFFICIENT_PRIVILEGES
attempt to perform an operation that requres more privileged is made

See Also:
Constant Field Values

X_ORACLE_INVALID_ANNOTATION_SET

public static final int X_ORACLE_INVALID_ANNOTATION_SET
attempt to remove annotation set that does not exist is made

See Also:
Constant Field Values

TRUE

public static final int TRUE
See Also:
Constant Field Values

FALSE

public static final int FALSE
See Also:
Constant Field Values

CHARACTER_CONTENT

public static final int CHARACTER_CONTENT
character content (may make difference for the database)

See Also:
Constant Field Values

BINARY_CONTENT

public static final int BINARY_CONTENT
binary content (may make difference for the database)

See Also:
Constant Field Values

EMPTY_CONTENT

public static final int EMPTY_CONTENT
document has no content

See Also:
Constant Field Values

DOCUMENT_CLASS

public static final String DOCUMENT_CLASS
LR classes supported at present

See Also:
Constant Field Values

CORPUS_CLASS

public static final String CORPUS_CLASS
LR classes supported at present

See Also:
Constant Field Values

DB_PARAMETER_GUID

public static final String DB_PARAMETER_GUID
key in T_PARAMETER that defines a unique id for the data store

See Also:
Constant Field Values

DUMMY_FEATURE_KEY

public static final String DUMMY_FEATURE_KEY
dummy feature key, do not use it

See Also:
Constant Field Values

DUMMY_ENCODING

public static final String DUMMY_ENCODING
dummy encoding type, do not use it

See Also:
Constant Field Values

READ_ACCESS

public static final int READ_ACCESS
used internaly, may change in the future

See Also:
Constant Field Values

WRITE_ACCESS

public static final int WRITE_ACCESS
used internaly, may change in the future

See Also:
Constant Field Values

DUMMY_ID

public static final Long DUMMY_ID
huh?


FEATURE_OWNER_CORPUS

protected static final int FEATURE_OWNER_CORPUS
used to store corpus' features

See Also:
Constant Field Values

FEATURE_OWNER_DOCUMENT

protected static final int FEATURE_OWNER_DOCUMENT
used to store document's features

See Also:
Constant Field Values

FEATURE_OWNER_ANNOTATION

protected static final int FEATURE_OWNER_ANNOTATION
used to store annotation's features

See Also:
Constant Field Values

VALUE_TYPE_NULL

public static final int VALUE_TYPE_NULL
feature value is null

See Also:
Constant Field Values

VALUE_TYPE_INTEGER

public static final int VALUE_TYPE_INTEGER
feature value is int

See Also:
Constant Field Values

VALUE_TYPE_LONG

public static final int VALUE_TYPE_LONG
feature value is long

See Also:
Constant Field Values

VALUE_TYPE_BOOLEAN

public static final int VALUE_TYPE_BOOLEAN
feature value is boolean

See Also:
Constant Field Values

VALUE_TYPE_STRING

public static final int VALUE_TYPE_STRING
feature value is string less than 4000 bytes

See Also:
Constant Field Values

VALUE_TYPE_BINARY

public static final int VALUE_TYPE_BINARY
feature value is binary

See Also:
Constant Field Values

VALUE_TYPE_FLOAT

public static final int VALUE_TYPE_FLOAT
feature value is float

See Also:
Constant Field Values

VALUE_TYPE_INTEGER_ARR

public static final int VALUE_TYPE_INTEGER_ARR
feature value is array of ints

See Also:
Constant Field Values

VALUE_TYPE_LONG_ARR

public static final int VALUE_TYPE_LONG_ARR
feature value is array of longs

See Also:
Constant Field Values

VALUE_TYPE_BOOLEAN_ARR

public static final int VALUE_TYPE_BOOLEAN_ARR
feature value is array of bools

See Also:
Constant Field Values

VALUE_TYPE_STRING_ARR

public static final int VALUE_TYPE_STRING_ARR
feature value is array of strings

See Also:
Constant Field Values

VALUE_TYPE_BINARY_ARR

public static final int VALUE_TYPE_BINARY_ARR
feature value is array of binary values

See Also:
Constant Field Values

VALUE_TYPE_FLOAT_ARR

public static final int VALUE_TYPE_FLOAT_ARR
feature value is array of floats

See Also:
Constant Field Values

VALUE_TYPE_EMPTY_ARR

public static final int VALUE_TYPE_EMPTY_ARR
feature value is array of floats

See Also:
Constant Field Values

ORACLE_DB

public static final int ORACLE_DB
Oracle database type

See Also:
Constant Field Values

POSTGRES_DB

public static final int POSTGRES_DB
PostgreSQL database type

See Also:
Constant Field Values
Constructor Detail

DBHelper

protected DBHelper()
Method Detail

cleanup

public static void cleanup(ResultSet rs)
                    throws PersistenceException
closes a result set note that Oracle jdbc classes do not have finalize() implementations so if they're not closed leaks may occur

Throws:
PersistenceException

cleanup

public static void cleanup(Statement stmt)
                    throws PersistenceException
closes a statement note that Oracle jdbc classes do not have finalize() implementations so if they're not closed leaks may occur

Throws:
PersistenceException

connect

public static Connection connect(String connectURL)
                          throws SQLException,
                                 ClassNotFoundException
connects to DB

Throws:
SQLException
ClassNotFoundException

connect

public static Connection connect(String connectURL,
                                 String user,
                                 String pass)
                          throws SQLException,
                                 ClassNotFoundException
connects to DB

Throws:
SQLException
ClassNotFoundException

disconnect

public static void disconnect(Connection conn)
                       throws PersistenceException
disconnects from DB, may return connection to pool if such exists any uncommited transactions are rolled back

Throws:
PersistenceException

connect

public static Connection connect(String connectURL,
                                 boolean usePool)
                          throws SQLException,
                                 ClassNotFoundException
connects to DB gets connection from pool if such exists

Throws:
SQLException
ClassNotFoundException

disconnect

public static void disconnect(Connection conn,
                              boolean usePool)
                       throws PersistenceException
disconnects from DB, may return connection to pool if such exists any uncommited transactions are rolled back

Throws:
PersistenceException

getSchemaPrefix

public static String getSchemaPrefix(String jdbcURL)

getDatabaseType

public static int getDatabaseType(String jdbcURL)

GATE
Version 3.1-2270