org.gcube.application.aquamaps.aquamapsservice.impl.db
Class DBSession

java.lang.Object
  extended by org.gcube.application.aquamaps.aquamapsservice.impl.db.DBSession
Direct Known Subclasses:
MySQLDBSession, PostGresSQLDBSession

public abstract class DBSession
extends java.lang.Object

Author:
lucio

Nested Class Summary
static class DBSession.ALTER_OPERATION
           
static class DBSession.ENGINE
           
 
Method Summary
 void alterColumn(java.lang.String tableName, DBSession.ALTER_OPERATION op, java.lang.String... columnsAndConstraintDefinition)
           
abstract  boolean checkExist(java.lang.String tableName, java.util.List<Field> keys)
           
 boolean checkTableExist(java.lang.String tableName)
           
 void close()
           
 void commit()
           
 void createIndex(java.lang.String tableName, java.lang.String columnName)
           
abstract  void createLikeTable(java.lang.String newTableName, java.lang.String oldTable)
           
abstract  void createTable(java.lang.String tableName, java.lang.String[] columnsAndConstraintDefinition)
           
 void deleteColumn(java.lang.String tableName, java.lang.String columnName)
           
abstract  int deleteOperation(java.lang.String tableName, java.util.List<Field> filters)
           
 void disableAutoCommit()
           
 void disableKeys(java.lang.String tableName)
           
 void dropTable(java.lang.String table)
           
 void dropView(java.lang.String view)
           
 void enableKeys(java.lang.String tableName)
           
abstract  java.sql.ResultSet executeFilteredQuery(java.util.List<Field> filters, java.lang.String table, java.lang.String orderColumn, PagedRequestSettings.OrderDirection orderMode)
           
 java.sql.ResultSet executeQuery(java.lang.String query)
          Deprecated. 
 void executeUpdate(java.lang.String query)
          Deprecated. 
abstract  java.sql.PreparedStatement fillParameters(java.util.List<Field> fields, int parameterOffset, java.sql.PreparedStatement ps)
           
 java.sql.Connection getConnection()
           
abstract  java.lang.Long getCount(java.lang.String tableName, java.util.List<Field> filters)
           
abstract  java.sql.ResultSet getDistinct(Field toSelect, java.util.List<Field> filters, java.lang.String table, java.lang.String orderColumn, PagedRequestSettings.OrderDirection orderMode)
           
abstract  java.sql.PreparedStatement getFilterCellByAreaQuery(HSPECFields filterByCodeType, java.lang.String sourceTableName, java.lang.String destinationTableName)
           
static DBCredentialDescriptor getInternalCredentials()
           
static DBSession getInternalDBSession()
           
static DBCredentialDescriptor getPostGisCredentials()
           
static DBSession getPostGisDBSession()
           
 java.sql.PreparedStatement getPreparedStatementForDelete(java.util.List<Field> fields, java.lang.String table)
           
 java.sql.PreparedStatement getPreparedStatementForDISTINCT(java.util.List<Field> filters, Field toSelect, java.lang.String table, java.lang.String orderColumn, PagedRequestSettings.OrderDirection orderDirection)
           
 java.sql.PreparedStatement getPreparedStatementForInsert(java.util.List<Field> fields, java.lang.String table)
           
 java.sql.PreparedStatement getPreparedStatementForInsertFromSelect(java.util.List<Field> fields, java.lang.String destTable, java.lang.String srcTable)
           
abstract  java.sql.PreparedStatement getPreparedStatementForInsertOnDuplicate(java.util.List<Field> fields, java.lang.String table, java.lang.Integer[] keyIndexes)
           
 java.sql.PreparedStatement getPreparedStatementForQuery(java.util.List<Field> filters, java.lang.String table, java.lang.String orderColumn, PagedRequestSettings.OrderDirection orderDirection)
           
 java.sql.PreparedStatement getPreparedStatementForUpdate(java.util.List<Field> toSet, java.util.List<Field> keys, java.lang.String tableName)
           
 long getTableCount(java.lang.String tableName)
           
abstract  java.util.List<java.util.List<Field>> insertOperation(java.lang.String tableName, java.util.List<java.util.List<Field>> rows)
           
 java.sql.PreparedStatement preparedStatement(java.lang.String query)
          Deprecated. 
abstract  int updateOperation(java.lang.String tableName, java.util.List<java.util.List<Field>> keys, java.util.List<java.util.List<Field>> rows)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getConnection

public java.sql.Connection getConnection()
Returns:
the connection

getInternalCredentials

public static DBCredentialDescriptor getInternalCredentials()
                                                     throws java.lang.Exception
Returns:
Throws:
java.lang.Exception

getPostGisCredentials

public static DBCredentialDescriptor getPostGisCredentials()
                                                    throws java.lang.Exception
Throws:
java.lang.Exception

getInternalDBSession

public static DBSession getInternalDBSession()
                                      throws java.lang.Exception
Throws:
java.lang.Exception

getPostGisDBSession

public static DBSession getPostGisDBSession()
                                     throws java.lang.Exception
Throws:
java.lang.Exception

close

public void close()
           throws java.lang.Exception
Throws:
java.lang.Exception

disableAutoCommit

public void disableAutoCommit()
                       throws java.lang.Exception
Throws:
java.lang.Exception

commit

public void commit()
            throws java.lang.Exception
Throws:
java.lang.Exception

executeQuery

@Deprecated
public java.sql.ResultSet executeQuery(java.lang.String query)
                                throws java.lang.Exception
Deprecated. 

Parameters:
query -
Throws:
java.lang.Exception

createTable

public abstract void createTable(java.lang.String tableName,
                                 java.lang.String[] columnsAndConstraintDefinition)
                          throws java.lang.Exception
Throws:
java.lang.Exception

disableKeys

public void disableKeys(java.lang.String tableName)
                 throws java.lang.Exception
Throws:
java.lang.Exception

enableKeys

public void enableKeys(java.lang.String tableName)
                throws java.lang.Exception
Throws:
java.lang.Exception

createLikeTable

public abstract void createLikeTable(java.lang.String newTableName,
                                     java.lang.String oldTable)
                              throws java.lang.Exception
Throws:
java.lang.Exception

alterColumn

public void alterColumn(java.lang.String tableName,
                        DBSession.ALTER_OPERATION op,
                        java.lang.String... columnsAndConstraintDefinition)
                 throws java.lang.Exception
Throws:
java.lang.Exception

createIndex

public void createIndex(java.lang.String tableName,
                        java.lang.String columnName)
                 throws java.lang.Exception
Throws:
java.lang.Exception

deleteColumn

public void deleteColumn(java.lang.String tableName,
                         java.lang.String columnName)
                  throws java.lang.Exception
Throws:
java.lang.Exception

dropTable

public void dropTable(java.lang.String table)
               throws java.lang.Exception
Throws:
java.lang.Exception

dropView

public void dropView(java.lang.String view)
              throws java.lang.Exception
Throws:
java.lang.Exception

getFilterCellByAreaQuery

public abstract java.sql.PreparedStatement getFilterCellByAreaQuery(HSPECFields filterByCodeType,
                                                                    java.lang.String sourceTableName,
                                                                    java.lang.String destinationTableName)
                                                             throws java.lang.Exception
Throws:
java.lang.Exception

getPreparedStatementForQuery

public java.sql.PreparedStatement getPreparedStatementForQuery(java.util.List<Field> filters,
                                                               java.lang.String table,
                                                               java.lang.String orderColumn,
                                                               PagedRequestSettings.OrderDirection orderDirection)
                                                        throws java.sql.SQLException
Throws:
java.sql.SQLException

getPreparedStatementForDISTINCT

public java.sql.PreparedStatement getPreparedStatementForDISTINCT(java.util.List<Field> filters,
                                                                  Field toSelect,
                                                                  java.lang.String table,
                                                                  java.lang.String orderColumn,
                                                                  PagedRequestSettings.OrderDirection orderDirection)
                                                           throws java.sql.SQLException
Throws:
java.sql.SQLException

getPreparedStatementForUpdate

public java.sql.PreparedStatement getPreparedStatementForUpdate(java.util.List<Field> toSet,
                                                                java.util.List<Field> keys,
                                                                java.lang.String tableName)
                                                         throws java.sql.SQLException
Throws:
java.sql.SQLException

getPreparedStatementForInsertFromSelect

public java.sql.PreparedStatement getPreparedStatementForInsertFromSelect(java.util.List<Field> fields,
                                                                          java.lang.String destTable,
                                                                          java.lang.String srcTable)
                                                                   throws java.lang.Exception
Throws:
java.lang.Exception

getPreparedStatementForInsert

public java.sql.PreparedStatement getPreparedStatementForInsert(java.util.List<Field> fields,
                                                                java.lang.String table)
                                                         throws java.lang.Exception
Throws:
java.lang.Exception

getPreparedStatementForInsertOnDuplicate

public abstract java.sql.PreparedStatement getPreparedStatementForInsertOnDuplicate(java.util.List<Field> fields,
                                                                                    java.lang.String table,
                                                                                    java.lang.Integer[] keyIndexes)
                                                                             throws java.lang.Exception
Throws:
java.lang.Exception

getPreparedStatementForDelete

public java.sql.PreparedStatement getPreparedStatementForDelete(java.util.List<Field> fields,
                                                                java.lang.String table)
                                                         throws java.lang.Exception
Throws:
java.lang.Exception

preparedStatement

@Deprecated
public java.sql.PreparedStatement preparedStatement(java.lang.String query)
                                             throws java.lang.Exception
Deprecated. 

Throws:
java.lang.Exception

fillParameters

public abstract java.sql.PreparedStatement fillParameters(java.util.List<Field> fields,
                                                          int parameterOffset,
                                                          java.sql.PreparedStatement ps)
                                                   throws java.sql.SQLException
Throws:
java.sql.SQLException

checkExist

public abstract boolean checkExist(java.lang.String tableName,
                                   java.util.List<Field> keys)
                            throws java.lang.Exception
Throws:
java.lang.Exception

insertOperation

public abstract java.util.List<java.util.List<Field>> insertOperation(java.lang.String tableName,
                                                                      java.util.List<java.util.List<Field>> rows)
                                                               throws java.lang.Exception
Throws:
java.lang.Exception

updateOperation

public abstract int updateOperation(java.lang.String tableName,
                                    java.util.List<java.util.List<Field>> keys,
                                    java.util.List<java.util.List<Field>> rows)
                             throws java.lang.Exception
Throws:
java.lang.Exception

executeFilteredQuery

public abstract java.sql.ResultSet executeFilteredQuery(java.util.List<Field> filters,
                                                        java.lang.String table,
                                                        java.lang.String orderColumn,
                                                        PagedRequestSettings.OrderDirection orderMode)
                                                 throws java.lang.Exception
Throws:
java.lang.Exception

getCount

public abstract java.lang.Long getCount(java.lang.String tableName,
                                        java.util.List<Field> filters)
                                 throws java.lang.Exception
Throws:
java.lang.Exception

deleteOperation

public abstract int deleteOperation(java.lang.String tableName,
                                    java.util.List<Field> filters)
                             throws java.lang.Exception
Throws:
java.lang.Exception

getTableCount

public long getTableCount(java.lang.String tableName)
                   throws java.lang.Exception
Throws:
java.lang.Exception

getDistinct

public abstract java.sql.ResultSet getDistinct(Field toSelect,
                                               java.util.List<Field> filters,
                                               java.lang.String table,
                                               java.lang.String orderColumn,
                                               PagedRequestSettings.OrderDirection orderMode)
                                        throws java.lang.Exception
Throws:
java.lang.Exception

executeUpdate

@Deprecated
public void executeUpdate(java.lang.String query)
                   throws java.lang.Exception
Deprecated. 

Throws:
java.lang.Exception

checkTableExist

public boolean checkTableExist(java.lang.String tableName)
                        throws java.lang.Exception
Throws:
java.lang.Exception