de.topicmapslab.majortom.database.jdbc.postgres.optimized
Class PostGreSqlConnectionProvider

java.lang.Object
  extended by de.topicmapslab.majortom.database.jdbc.rdbms.RDBMSConnectionProvider
      extended by de.topicmapslab.majortom.database.jdbc.postgres.base.BasePostGreSqlConnectionProvider
          extended by de.topicmapslab.majortom.database.jdbc.postgres.sql99.Sql99ConnectionProvider
              extended by de.topicmapslab.majortom.database.jdbc.postgres.optimized.PostGreSqlConnectionProvider
All Implemented Interfaces:
IConnectionProvider

public class PostGreSqlConnectionProvider
extends Sql99ConnectionProvider

Special connection provider for PostGreSQL.

Author:
Sven Krosse

Field Summary
private  boolean procedureBestLabel
           
private  boolean procedureBestLabelWithTheme
           
private  boolean procedureRemoveDuplicates
           
private  boolean procedureRemoveDuplicateTopicContent
           
private  boolean procedureScopeByThemes
           
private  boolean procedureTopicsByTypeTransitive
           
private  boolean procedureTransitiveSubtypes
           
private  boolean procedureTransitiveSubtypesArray
           
private  boolean procedureTransitiveSupertypes
           
private  boolean procedureTransitiveSupertypesArray
           
private  boolean procedureTransitiveTypes
           
private  boolean procedureTypesAndSubtypes
           
private  boolean procedureTypesAndSubtypesArray
           
 
Fields inherited from class de.topicmapslab.majortom.database.jdbc.postgres.base.BasePostGreSqlConnectionProvider
schemaInformation
 
Fields inherited from interface de.topicmapslab.majortom.database.jdbc.model.IConnectionProvider
DATABASE_NOT_EXISTS, STATE_DATABASE_IS_EMPTY, STATE_DATABASE_IS_INVALID, STATE_DATABASE_IS_VALID
 
Constructor Summary
PostGreSqlConnectionProvider()
          constructor
PostGreSqlConnectionProvider(java.lang.String host, java.lang.String datatbase, java.lang.String user, java.lang.String password)
          Constructor
 
Method Summary
private  void checkStoredProcedures()
          Internal method to check the store procedures
 void createSchema()
          Method called by the connection provider to initialize the database schema.
protected  boolean existsProcedureBestLabel()
          Method checks if the procedure 'best_label' exists.
protected  boolean existsProcedureBestLabelWithTheme()
          Method checks if the procedure 'best_label' exists.
protected  boolean existsProcedureRemoveDuplicates()
          Method checks if the procedure 'remove_duplicates' exists.
protected  boolean existsProcedureRemoveDuplicateTopicContent()
          Method checks if the procedure 'remove_duplicate_topiccontent' exists.
protected  boolean existsProcedureScopeByThemes()
          Method checks if the procedure 'scope_by_themes' exists.
protected  boolean existsProcedureTopicsByTypeTransitive()
          Method checks if the procedure 'topics_by_type_transitive' exists.
protected  boolean existsProcedureTransitiveSubtypes()
          Method checks if the procedure 'transitive_subtypes' exists.
protected  boolean existsProcedureTransitiveSubtypesArray()
          Method checks if the procedure 'transitive_subtypes' with array parameter exists.
protected  boolean existsProcedureTransitiveSupertypes()
          Method checks if the procedure 'transitive_supertypes' exists.
protected  boolean existsProcedureTransitiveSupertypesArray()
          Method checks if the procedure 'transitive_supertypes' with array parameter exists.
protected  boolean existsProcedureTransitiveTypes()
          Method checks if the procedure 'transitive_types' exists.
protected  boolean existsProcedureTypesAndSubtypes()
          Method checks if the procedure 'types_and_subtypes' exists.
protected  boolean existsProcedureTypesAndSubtypesArray()
          Method checks if the procedure 'types_and_subtypes' with array parameter exists.
protected  java.lang.String getSchemaQuery()
          Returns the SQL query to create the database schema.
 PostGreSqlSession 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.
 
Methods inherited from class de.topicmapslab.majortom.database.jdbc.postgres.base.BasePostGreSqlConnectionProvider
getConnection, getDatabaseState, getDriverClassName, getRdbmsName
 
Methods inherited from class de.topicmapslab.majortom.database.jdbc.rdbms.RDBMSConnectionProvider
close, getConnectionCount, getDatabase, getDatabaseMetaData, getGlobalSession, getHost, getPassword, getSchemaQueries, getTopicMapStore, getUrl, getUser
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

procedureScopeByThemes

private boolean procedureScopeByThemes

procedureTopicsByTypeTransitive

private boolean procedureTopicsByTypeTransitive

procedureTransitiveSubtypes

private boolean procedureTransitiveSubtypes

procedureTransitiveSubtypesArray

private boolean procedureTransitiveSubtypesArray

procedureTransitiveSupertypes

private boolean procedureTransitiveSupertypes

procedureTransitiveSupertypesArray

private boolean procedureTransitiveSupertypesArray

procedureTransitiveTypes

private boolean procedureTransitiveTypes

procedureBestLabel

private boolean procedureBestLabel

procedureBestLabelWithTheme

private boolean procedureBestLabelWithTheme

procedureTypesAndSubtypes

private boolean procedureTypesAndSubtypes

procedureTypesAndSubtypesArray

private boolean procedureTypesAndSubtypesArray

procedureRemoveDuplicates

private boolean procedureRemoveDuplicates

procedureRemoveDuplicateTopicContent

private boolean procedureRemoveDuplicateTopicContent
Constructor Detail

PostGreSqlConnectionProvider

public PostGreSqlConnectionProvider()
constructor


PostGreSqlConnectionProvider

public PostGreSqlConnectionProvider(java.lang.String host,
                                    java.lang.String datatbase,
                                    java.lang.String user,
                                    java.lang.String password)
Constructor

Parameters:
host - the host
database - database
user - the user
password - the password
Method Detail

openSession

public PostGreSqlSession openSession()
Creating a new session for accessing the database

Specified by:
openSession in interface IConnectionProvider
Overrides:
openSession in class Sql99ConnectionProvider
Returns:
the new session

createSchema

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

Specified by:
createSchema in interface IConnectionProvider
Overrides:
createSchema in class Sql99ConnectionProvider
Throws:
java.sql.SQLException

getSchemaQuery

protected java.lang.String getSchemaQuery()
Returns the SQL query to create the database schema.

Overrides:
getSchemaQuery in class Sql99ConnectionProvider
Returns:
the query

setTopicMapStore

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

Specified by:
setTopicMapStore in interface IConnectionProvider
Overrides:
setTopicMapStore in class BasePostGreSqlConnectionProvider
Parameters:
store - the topic map store

checkStoredProcedures

private void checkStoredProcedures()
                            throws java.sql.SQLException
Internal method to check the store procedures

Throws:
java.sql.SQLException

existsProcedureScopeByThemes

protected boolean existsProcedureScopeByThemes()
Method checks if the procedure 'scope_by_themes' exists.

Returns:
true if the procedure exists, false otherwise.

existsProcedureTopicsByTypeTransitive

protected boolean existsProcedureTopicsByTypeTransitive()
Method checks if the procedure 'topics_by_type_transitive' exists.

Returns:
true if the procedure exists, false otherwise.

existsProcedureTransitiveSubtypes

protected boolean existsProcedureTransitiveSubtypes()
Method checks if the procedure 'transitive_subtypes' exists.

Returns:
true if the procedure exists, false otherwise.

existsProcedureTransitiveSubtypesArray

protected boolean existsProcedureTransitiveSubtypesArray()
Method checks if the procedure 'transitive_subtypes' with array parameter exists.

Returns:
true if the procedure exists, false otherwise.

existsProcedureTransitiveSupertypes

protected boolean existsProcedureTransitiveSupertypes()
Method checks if the procedure 'transitive_supertypes' exists.

Returns:
true if the procedure exists, false otherwise.

existsProcedureTransitiveSupertypesArray

protected boolean existsProcedureTransitiveSupertypesArray()
Method checks if the procedure 'transitive_supertypes' with array parameter exists.

Returns:
true if the procedure exists, false otherwise.

existsProcedureTransitiveTypes

protected boolean existsProcedureTransitiveTypes()
Method checks if the procedure 'transitive_types' exists.

Returns:
true if the procedure exists, false otherwise.

existsProcedureTypesAndSubtypes

protected boolean existsProcedureTypesAndSubtypes()
Method checks if the procedure 'types_and_subtypes' exists.

Returns:
true if the procedure exists, false otherwise.

existsProcedureTypesAndSubtypesArray

protected boolean existsProcedureTypesAndSubtypesArray()
Method checks if the procedure 'types_and_subtypes' with array parameter exists.

Returns:
true if the procedure exists, false otherwise.

existsProcedureBestLabel

protected boolean existsProcedureBestLabel()
Method checks if the procedure 'best_label' exists.

Returns:
true if the procedure exists, false otherwise.

existsProcedureBestLabelWithTheme

protected boolean existsProcedureBestLabelWithTheme()
Method checks if the procedure 'best_label' exists.

Returns:
true if the procedure exists, false otherwise.

existsProcedureRemoveDuplicates

protected boolean existsProcedureRemoveDuplicates()
Method checks if the procedure 'remove_duplicates' exists.

Returns:
true if the procedure exists, false otherwise.

existsProcedureRemoveDuplicateTopicContent

protected boolean existsProcedureRemoveDuplicateTopicContent()
Method checks if the procedure 'remove_duplicate_topiccontent' exists.

Returns:
true if the procedure exists, false otherwise.