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

# Class AbstractProtocolDescriptor

java.lang.Object
org.firebirdsql.gds.ng.wire.AbstractProtocolDescriptor

All Implemented Interfaces:
  `ProtocolDescriptor`

Direct Known Subclasses:
  `Version10Descriptor`, `Version11Descriptor`, `Version12Descriptor`, `Version13Descriptor`, `Version15Descriptor`, `Version16Descriptor`, `Version18Descriptor`, `Version19Descriptor`

public abstract class AbstractProtocolDescriptor extends Object implements ProtocolDescriptor
Abstract class to simplify implementation of `ProtocolDescriptor`

Since:
  3.0
Author:
  Mark Rotteveel

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `AbstractProtocolDescriptor(int version, int architecture, int minimumType, int maximumType, boolean supportsWireCompression, int weight)`
  Initializes the basic ProtocolDescriptor fields.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `final ServiceParameterBuffer`
  `createAttachServiceParameterBuffer(WireServiceConnection connection)`
  Create an attach `ServiceParameterBuffer` implementation and populate it with supported properties for this protocol version.
  `BlrCalculator`
  `createBlrCalculator(FbWireDatabase database)`
  Create `BlrCalculator` implementation for this protocol version.
  `final DatabaseParameterBuffer`
  `createDatabaseParameterBuffer(WireDatabaseConnection connection)`
  Create `DatabaseParameterBuffer` implementation and populate it with supported properties for this protocol version.
  `boolean`
  `equals(Object other)`
  `final int`
  `getArchitecture()`
  `final int`
  `getMaximumType()`
  `final int`
  `getMinimumType()`
  `protected abstract ParameterConverter<WireDatabaseConnection,WireServiceConnection>`
  `getParameterConverter()`
  `final int`
  `getVersion()`
  `final int`
  `getWeight()`
  `final int`
  `hashCode()`
  `final boolean`
  `supportsWireCompression()`

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

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

  ### Methods inherited from interface org.firebirdsql.gds.ng.wire.ProtocolDescriptor

  `createAsynchronousChannel, createDatabase, createInputBlob, createOutputBlob, createService, createServiceParameterBuffer, createServiceRequestBuffer, createStatement, createTransaction, createWireOperations`

- ## Constructor Details

  - ### AbstractProtocolDescriptor

    protected AbstractProtocolDescriptor(int version, int architecture, int minimumType, int maximumType, boolean supportsWireCompression, int weight)
    Initializes the basic ProtocolDescriptor fields.
    Parameters:
      `version` - Version of the protocol
      `architecture` - Architecture of the protocol
      `minimumType` - Minimum supported protocol type
      `maximumType` - Maximum supported protocol type
      `supportsWireCompression` - `true` if this version supports zlib wire compression
      `weight` - Selection weight (higher values have higher preference)

- ## Method Details

  - ### getVersion

    public final int getVersion()
    Specified by:
      `getVersion` in interface `ProtocolDescriptor`
    Returns:
      The protocol version

  - ### getArchitecture

    public final int getArchitecture()
    Specified by:
      `getArchitecture` in interface `ProtocolDescriptor`
    Returns:
      Protocol architecture

  - ### getMinimumType

    public final int getMinimumType()
    Specified by:
      `getMinimumType` in interface `ProtocolDescriptor`
    Returns:
      Minimum supported protocol type

  - ### getMaximumType

    public final int getMaximumType()
    Specified by:
      `getMaximumType` in interface `ProtocolDescriptor`
    Returns:
      Maximum supported protocol type

  - ### supportsWireCompression

    public final boolean supportsWireCompression()
    Specified by:
      `supportsWireCompression` in interface `ProtocolDescriptor`
    Returns:
      `true` when zlib wire compression is supported

  - ### getWeight

    public final int getWeight()
    Specified by:
      `getWeight` in interface `ProtocolDescriptor`
    Returns:
      Preference weight

  - ### createBlrCalculator

    public BlrCalculator createBlrCalculator(FbWireDatabase database)
    Description copied from interface: `ProtocolDescriptor`
    Create `BlrCalculator` implementation for this protocol version.
    Specified by:
      `createBlrCalculator` in interface `ProtocolDescriptor`
    Parameters:
      `database` - FbWireDatabase of the current database
    Returns:
      BlrCalculator implementation

  - ### hashCode

    public final int hashCode()
    Overrides:
      `hashCode` in class `Object`
    Returns:
      Hash code based on `version`, `architecture`, `minimumType`, `maximumType` and `weight`.

  - ### equals

    public boolean equals(Object other)

    Default implementation for the rules described in `ProtocolDescriptor`. Returns `true` if the other object is of the exact same class as this instance.

    Overrides:
      `equals` in class `Object`

  - ### createDatabaseParameterBuffer

    public final DatabaseParameterBuffer createDatabaseParameterBuffer(WireDatabaseConnection connection) throws SQLException
    Description copied from interface: `ProtocolDescriptor`
    Create `DatabaseParameterBuffer` implementation and populate it with supported properties for this protocol version.
    Specified by:
      `createDatabaseParameterBuffer` in interface `ProtocolDescriptor`
    Parameters:
      `connection` - Connection
    Returns:
      DatabaseParameterBuffer implementation
    Throws:
      `SQLException`

  - ### createAttachServiceParameterBuffer

    public final ServiceParameterBuffer createAttachServiceParameterBuffer(WireServiceConnection connection) throws SQLException
    Description copied from interface: `ProtocolDescriptor`
    Create an attach `ServiceParameterBuffer` implementation and populate it with supported properties for this protocol version.
    Specified by:
      `createAttachServiceParameterBuffer` in interface `ProtocolDescriptor`
    Parameters:
      `connection` - Connection
    Returns:
      ServiceParameterBuffer implementation for attach
    Throws:
      `SQLException`

  - ### getParameterConverter

    protected abstract ParameterConverter<WireDatabaseConnection,WireServiceConnection> getParameterConverter()
    Returns:
      `ParameterConverter` for populating the database parameter buffer.