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

    public abstract class AbstractProtocolDescriptor
    extends java.lang.Object
    implements ProtocolDescriptor

Abstract class to simplify implementation of `ProtocolDescriptor`

Since:
  3.0
Author:
  Mark Rotteveel

### Constructor Summary

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

### Method Summary

All Methods Instance Methods Abstract Methods Concrete Methods
`ServiceParameterBuffer` `createAttachServiceParameterBuffer(WireServiceConnection connection)` Create an attach `ServiceParameterBuffer` implementation and populate it with supported properties for this protocol version.
`DatabaseParameterBuffer` `createDatabaseParameterBuffer(WireDatabaseConnection connection)` Create `DatabaseParameterBuffer` implementation and populate it with supported properties for this protocol version.
`boolean` `equals(java.lang.Object other)`
`int` `getArchitecture()`
`int` `getMaximumType()`
`int` `getMinimumType()`
`protected abstract ParameterConverter<WireDatabaseConnection,WireServiceConnection>` `getParameterConverter()`
`int` `getVersion()`
`int` `getWeight()`
`int` `hashCode()`
`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, createBlrCalculator, createDatabase, createInputBlob, createOutputBlob, createService, createServiceParameterBuffer, createServiceRequestBuffer, createStatement, createTransaction, createWireOperations`

### Constructor Detail

#### 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 Detail

#### 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

#### hashCode

    public final int hashCode()

Overrides:
  `hashCode` in class `java.lang.Object`
Returns:
  Hash code based on `version`, `architecture`, `minimumType`, `maximumType` and `weight`.

#### equals

    public boolean equals(java.lang.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 `java.lang.Object`

#### createDatabaseParameterBuffer

    public final DatabaseParameterBuffer createDatabaseParameterBuffer(WireDatabaseConnection connection)
                                                                throws java.sql.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:
  `java.sql.SQLException`

#### createAttachServiceParameterBuffer

    public final ServiceParameterBuffer createAttachServiceParameterBuffer(WireServiceConnection connection)
                                                                    throws java.sql.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:
  `java.sql.SQLException`

#### getParameterConverter

    protected abstract ParameterConverter<WireDatabaseConnection,WireServiceConnection> getParameterConverter()

Returns:
  `ParameterConverter` for populating the database parameter buffer.