Interface DatasourceManager


  • public interface DatasourceManager
    • Method Detail

      • getConnection

        SRConnection getConnection​(java.lang.String dataSource)
                            throws java.sql.SQLException
        Retrieves a JDBC new connection for the given named datasource. If the datasource named is currently faulted, the connection may come from its failover datasource, if there is one.

        Throws IllegalArgumentException if the provided datasource does not exist.

        Throws:
        java.sql.SQLException
      • getConnection

        SRConnection getConnection​(long dataSource)
                            throws java.sql.SQLException
        Retrieves a JDBC new connection for the datasource with the given id. If the datasource is currently faulted, the connection may come from its failover datasource, if there is one.
        Throws:
        java.sql.SQLException
      • beginTransaction

        java.lang.String beginTransaction​(java.lang.String datasource,
                                          int isolationLevel,
                                          long timeout)
                                   throws java.sql.SQLException
        Begins a transaction against the named datasource.
        Parameters:
        datasource - The name of the datasource to use
        isolationLevel - a constant from java.sql.Connection indicating the new transaction's isolation level.
        timeout - Time to wait between uses of the transaction's connection before it will be automatically rolled back and closed.
        Returns:
        A new transaction ID, which will be used for all further interaction with this transaction.
        Throws:
        java.sql.SQLException
      • commitTransaction

        void commitTransaction​(java.lang.String txId)
                        throws java.sql.SQLException
        Commits any pending statements for the given transaction.
        Throws:
        java.sql.SQLException
      • rollbackTransaction

        void rollbackTransaction​(java.lang.String txId)
                          throws java.sql.SQLException
        Rolls back any statements executed on this transaction since the last commit or since the beginning of the transaction
        Throws:
        java.sql.SQLException
      • closeTransaction

        void closeTransaction​(java.lang.String txId)
                       throws java.sql.SQLException
        Closes the given transaction. The transaction ID is no longer valid after this method completes.
        Throws:
        java.sql.SQLException
      • touchTransaction

        void touchTransaction​(java.lang.String txId)
        Updates the last-used time for the transaction, if it still exists.
      • getTransactionConnection

        SRConnection getTransactionConnection​(java.lang.String txId)
                                       throws java.sql.SQLException
        Returns the connection for a given transaction id.
        Throws:
        java.sql.SQLException
      • getDatasource

        Datasource getDatasource​(java.lang.String name)
        Looks up a datasource by name. Will return null if the datasource doesn't exist
      • getDatasource

        Datasource getDatasource​(long id)
      • getDatasources

        java.util.List<Datasource> getDatasources()
        Returns a list of all known datasources currently installed. This list is not backed by the manager - changes to it will not have any effect.