Module org.firebirdsql.jaybird
Package org.firebirdsql.gds.ng

# Class AbstractConnection<T extends IAttachProperties<T>,C extends FbAttachment>

java.lang.Object
org.firebirdsql.gds.ng.AbstractConnection<T,C>

Type Parameters:
  `T` - Type of attach properties
  `C` - Type of connection handle

Direct Known Subclasses:
  `WireConnection`

public abstract class AbstractConnection<T extends IAttachProperties<T>,C extends FbAttachment> extends Object
Abstract class with common logic for connections.

Since:
  3.0
Author:
  Mark Rotteveel

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected final T`
  `attachProperties`

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `AbstractConnection(T attachProperties, IEncodingFactory encodingFactory)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `final DbCryptCallback`
  `createDbCryptCallback()`
  Creates an instance of `DbCryptCallback` for this connection.
  `final T`
  `getAttachProperties()`
  `final Encoding`
  `getEncoding()`
  `final EncodingDefinition`
  `getEncodingDefinition()`
  `final IEncodingFactory`
  `getEncodingFactory()`
  `abstract C`
  `identify()`
  Performs the connection identification phase of the protocol and returns the connection handle implementation for the agreed protocol.
  `protected final boolean`
  `isLockedByCurrentThread()`
  `protected final LockCloseable`
  `withLock()`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### attachProperties

    protected final T extends IAttachProperties<T> attachProperties

- ## Constructor Details

  - ### AbstractConnection

    protected AbstractConnection(T attachProperties, IEncodingFactory encodingFactory) throws SQLException
    Throws:
      `SQLException`

- ## Method Details

  - ### withLock

    protected final LockCloseable withLock()
    See Also:
      - `FbAttachment.withLock()`

  - ### isLockedByCurrentThread

    protected final boolean isLockedByCurrentThread()
    See Also:
      - `FbAttachment.isLockedByCurrentThread()`

  - ### identify

    public abstract C identify() throws SQLException
    Performs the connection identification phase of the protocol and returns the connection handle implementation for the agreed protocol.
    Returns:
      Connection handle (ie `FbDatabase` or `FbService`)
    Throws:
      `SQLException` - For exceptions connecting

  - ### getAttachProperties

    public final T getAttachProperties()
    Returns:
      An immutable copy of the current attach properties.

  - ### getEncodingDefinition

    public final EncodingDefinition getEncodingDefinition()

  - ### getEncoding

    public final Encoding getEncoding()

  - ### getEncodingFactory

    public final IEncodingFactory getEncodingFactory()

  - ### createDbCryptCallback

    @InternalApi public final DbCryptCallback createDbCryptCallback() throws SQLException
    Creates an instance of `DbCryptCallback` for this connection.
    Returns:
      Database encryption callback.
    Throws:
      `SQLException` - For errors initializing the callback