Interface Connection

All Known Implementing Classes:
AbstractConnection, AbstractTextConnection, CsvConnection, JaninoConnection, JdbcConnection, JexlConnection, LdapConnection, MailConnection, OracleConnection, ScriptConnection, ScriptellaConnection, ShellConnection, TextConnection, VelocityConnection, XPathConnection

public interface Connection
Represents a connection to the system provided by ScriptellaDriver.

The implementations are not required to be thread safe.

For most cases AbstractConnection may be used as a base for driver connection implementation.

Version:
1.0
Author:
Fyodor Kupolov
See Also:
  • Method Details

    • getDialectIdentifier

      DialectIdentifier getDialectIdentifier() throws ProviderException
      This method returns a language dialect identifier for this connection.
      Returns:
      dialect identifier.
      Throws:
      ProviderException - if driver failed to determine a language dialect.
    • executeScript

      void executeScript(Resource scriptContent, ParametersCallback parametersCallback) throws ProviderException
      Executes a script specified by its content.

      scriptContent may be used as a key for caching purposes, i.e. provider may precompile scripts and use compiled versions for subsequent executions. Please note that only inline text resources can be safely cached.

      Parameters:
      scriptContent - script content. Cannot be null.
      parametersCallback - callback to get parameter values. Cannot be null.
      Throws:
      ProviderException - if script execution failed.
    • executeQuery

      void executeQuery(Resource queryContent, ParametersCallback parametersCallback, QueryCallback queryCallback) throws ProviderException
      Executes a query specified by its content.

      Parameters:
      queryContent - query content. Cannot be null.
      parametersCallback - callback to get parameter values. Cannot be null.
      queryCallback - callback to call for each result set element produced by this query. Cannot be null.
      Throws:
      ProviderException - if query execution failed.
      See Also:
    • getExecutedStatementsCount

      long getExecutedStatementsCount()
      This method returns the number of executed statements or 0 if this feature is unsupported.

      If possible the connection should collect statistics about the number of executed statement. It's recommended to provide the most actual execution statistics, i.e. increment internal statements counter during a script or a query execution, so the monitoring tools would be able to track progress.

      Returns:
      number of executed statements or 0 if this feature is unsupported.
    • commit

      void commit() throws ProviderException
      Commits a current transaction (if any).

      Throwing an error during commit phase cause rollback.

      Throws:
      ProviderException - if a problem occured during commit phase.
    • rollback

      Rolls back a current transaction (if any).
      Throws:
      ProviderException - if driver fails to roll back a transaction.
      UnsupportedOperationException - if transactions are not supported
    • close

      void close() throws ProviderException
      Closes the connection and releases all related resources.
      Throws:
      ProviderException - if a critical failure occured.
    • toString

      String toString()
      Overrides:
      toString in class Object
      Returns:
      meaningful label for connection