de.topicmapslab.majortom.database.jdbc.model
Interface IConnectionProvider

All Known Implementing Classes:
BasePostGreSqlConnectionProvider, HSQLDBConnectionProvider, MonetDBConnectionProvider, MySqlConnectionProvider, PostGreSqlConnectionProvider, RDBMSConnectionProvider, Sql99ConnectionProvider

public interface IConnectionProvider

Interface definition of a connection provider.

Author:
Sven Krosse

Field Summary
static java.lang.String DATABASE_NOT_EXISTS
           
static int STATE_DATABASE_IS_EMPTY
          state code if the database is empty
static int STATE_DATABASE_IS_INVALID
          state code if the database if invalid
static int STATE_DATABASE_IS_VALID
          state code if the database schema is valid
 
Method Summary
 void close()
          Closing the connection provider
 void createSchema()
          Method called by the connection provider to initialize the database schema.
 java.sql.DatabaseMetaData getDatabaseMetaData()
          Return the meta data of the existing connection.
 int getDatabaseState()
          Method checks if the schema of the current database connection is valid..
 java.lang.String getDriverClassName()
          Returning the name of the used driver class
 java.lang.String getRdbmsName()
          Returning the name of the used RDBMS
 JdbcTopicMapStore getTopicMapStore()
          Returns the internal reference of the encapsulated topic map store
<T extends ISession>
T
openSession()
          Creating a new session for accessing the database
 void setTopicMapStore(JdbcTopicMapStore store)
          Method set the internal reference of the JDBC topic map store to the given reference.
 

Field Detail

STATE_DATABASE_IS_EMPTY

static final int STATE_DATABASE_IS_EMPTY
state code if the database is empty

See Also:
Constant Field Values

STATE_DATABASE_IS_INVALID

static final int STATE_DATABASE_IS_INVALID
state code if the database if invalid

See Also:
Constant Field Values

STATE_DATABASE_IS_VALID

static final int STATE_DATABASE_IS_VALID
state code if the database schema is valid

See Also:
Constant Field Values

DATABASE_NOT_EXISTS

static final java.lang.String DATABASE_NOT_EXISTS
See Also:
Constant Field Values
Method Detail

openSession

<T extends ISession> T openSession()
Creating a new session for accessing the database

Returns:
the new session

close

void close()
           throws java.sql.SQLException
Closing the connection provider

Throws:
java.sql.SQLException - thrown if operation fails

getDatabaseMetaData

java.sql.DatabaseMetaData getDatabaseMetaData()
                                              throws de.topicmapslab.majortom.model.exception.TopicMapStoreException
Return the meta data of the existing connection. If the connection is not open, an exception will be thrown.

Returns:
the meta data
Throws:
de.topicmapslab.majortom.model.exception.TopicMapStoreException - thrown if the connection is not established

getTopicMapStore

JdbcTopicMapStore getTopicMapStore()
Returns the internal reference of the encapsulated topic map store


setTopicMapStore

void setTopicMapStore(JdbcTopicMapStore store)
Method set the internal reference of the JDBC topic map store to the given reference.

Parameters:
store - the topic map store

createSchema

void createSchema()
                  throws java.sql.SQLException
Method called by the connection provider to initialize the database schema.

Throws:
java.sql.SQLException

getDatabaseState

int getDatabaseState()
                     throws java.sql.SQLException
Method checks if the schema of the current database connection is valid..

Returns:

0 if the database is empty.
1 if the database schema is invalid.
2 if the database schema is valid.

Throws:
java.sql.SQLException

getRdbmsName

java.lang.String getRdbmsName()
Returning the name of the used RDBMS

Returns:
the name of the RDBMS

getDriverClassName

java.lang.String getDriverClassName()
Returning the name of the used driver class

Returns:
the name of the used driver class