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

# Interface ProtocolDescriptor

All Known Implementing Classes:
  `AbstractProtocolDescriptor`, `Version10Descriptor`, `Version11Descriptor`, `Version12Descriptor`, `Version13Descriptor`, `Version15Descriptor`, `Version16Descriptor`, `Version18Descriptor`

public interface ProtocolDescriptor
Descriptor of protocol information.

The driver maintains a list of default protocol descriptors that are loaded using a `ServiceLoader` from the file `META-INF/services/org.firebirdsql.gds.ng.wire.ProtocolDescriptor`

Protocol descriptors loaded this way are required to adhere to the following rules:

- They provide a no-arg constructor
- All instances of a specific implementation class created with the no-arg constructor have the same `Object.hashCode()`.
- All instances of a specific implementation class created with the no-arg constructor are considered equal to each other by the `Object.equals(Object)` implementation

Since:
  3.0
Author:
  Mark Rotteveel

## Method Summary

Modifier and Type
Method
Description
`FbWireAsynchronousChannel`
`createAsynchronousChannel(FbWireDatabase database)`
Create a disconnected asynchronous channel.
`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.
`FbWireDatabase`
`createDatabase(WireDatabaseConnection connection)`
Create `FbWireDatabase` implementation for this protocol.
`DatabaseParameterBuffer`
`createDatabaseParameterBuffer(WireDatabaseConnection connection)`
Create `DatabaseParameterBuffer` implementation and populate it with supported properties for this protocol version.
`FbWireBlob`
`createInputBlob(FbWireDatabase database, FbWireTransaction transaction, BlobParameterBuffer blobParameterBuffer, long blobId)`
Create an input `FbWireBlob` implementation for this protocol version.
`FbWireBlob`
`createOutputBlob(FbWireDatabase database, FbWireTransaction transaction, BlobParameterBuffer blobParameterBuffer)`
Create an output `FbWireBlob` implementation for this protocol version.
`FbWireService`
`createService(WireServiceConnection connection)`
Create `FbWireService` implementation for this protocol.
`ServiceParameterBuffer`
`createServiceParameterBuffer(WireServiceConnection connection)`
Creates a normal `ServiceParameterBuffer`.
`ServiceRequestBuffer`
`createServiceRequestBuffer(WireServiceConnection connection)`
`FbWireStatement`
`createStatement(FbWireDatabase database)`
Create `FbStatement` implementation for this protocol.
`FbWireTransaction`
`createTransaction(FbWireDatabase database, int transactionHandle, TransactionState initialState)`
Create `FbTransaction` implementation for this protocol.
`FbWireOperations`
`createWireOperations(WireConnection<?,?> connection, WarningMessageCallback defaultWarningMessageCallback)`
Create an `FbWireOperations` implementation for this protocol version.
`int`
`getArchitecture()`
`int`
`getMaximumType()`
`int`
`getMinimumType()`
`int`
`getVersion()`
`int`
`getWeight()`
`boolean`
`supportsWireCompression()`

## Method Details

### getVersion

int getVersion()

Returns:
  The protocol version

### getArchitecture

int getArchitecture()

Returns:
  Protocol architecture

### getMinimumType

int getMinimumType()

Returns:
  Minimum supported protocol type

### getMaximumType

int getMaximumType()

Returns:
  Maximum supported protocol type

### supportsWireCompression

boolean supportsWireCompression()

Returns:
  `true` when zlib wire compression is supported

### getWeight

int getWeight()

Returns:
  Preference weight

### createDatabase

FbWireDatabase createDatabase(WireDatabaseConnection connection)
Create `FbWireDatabase` implementation for this protocol.

Parameters:
  `connection` - WireDatabaseConnection to this database
Returns:
  FbWireDatabase implementation

### createService

FbWireService createService(WireServiceConnection connection)
Create `FbWireService` implementation for this protocol.

Parameters:
  `connection` - WireServiceConnection to this service
Returns:
  FbWireService implementation

### createTransaction

FbWireTransaction createTransaction(FbWireDatabase database, int transactionHandle, TransactionState initialState)
Create `FbTransaction` implementation for this protocol.

Parameters:
  `database` - FbWireDatabase of the current database
  `transactionHandle` - Transaction handle
  `initialState` - Initial transaction state (either `TransactionState.ACTIVE` or `TransactionState.PREPARED`).
Returns:
  FbTransaction implementation

### createStatement

FbWireStatement createStatement(FbWireDatabase database)
Create `FbStatement` implementation for this protocol.

Parameters:
  `database` - FbWireDatabase of the current database
Returns:
  FbStatement implementation

### createDatabaseParameterBuffer

DatabaseParameterBuffer createDatabaseParameterBuffer(WireDatabaseConnection connection) throws SQLException
Create `DatabaseParameterBuffer` implementation and populate it with supported properties for this protocol version.

Parameters:
  `connection` - Connection
Returns:
  DatabaseParameterBuffer implementation
Throws:
  `SQLException`

### createAttachServiceParameterBuffer

ServiceParameterBuffer createAttachServiceParameterBuffer(WireServiceConnection connection) throws SQLException
Create an attach `ServiceParameterBuffer` implementation and populate it with supported properties for this protocol version.

Parameters:
  `connection` - Connection
Returns:
  ServiceParameterBuffer implementation for attach
Throws:
  `SQLException`

### createServiceParameterBuffer

ServiceParameterBuffer createServiceParameterBuffer(WireServiceConnection connection)
Creates a normal `ServiceParameterBuffer`.

Parameters:
  `connection` - Connection
Returns:
  ServiceParameterBuffer implementation

### createServiceRequestBuffer

ServiceRequestBuffer createServiceRequestBuffer(WireServiceConnection connection)

Returns:
  An empty service request buffer

### createBlrCalculator

BlrCalculator createBlrCalculator(FbWireDatabase database)
Create `BlrCalculator` implementation for this protocol version.

Parameters:
  `database` - FbWireDatabase of the current database
Returns:
  BlrCalculator implementation

### createOutputBlob

FbWireBlob createOutputBlob(FbWireDatabase database, FbWireTransaction transaction, BlobParameterBuffer blobParameterBuffer) throws SQLException
Create an output `FbWireBlob` implementation for this protocol version.

Parameters:
  `database` - FbWireDatabase of the current database
  `transaction` - FbWireTransaction to associate with the blob
  `blobParameterBuffer` - Blob Parameter Buffer
Returns:
  FbWireBlob implementation
Throws:
  `SQLException` - if the database is not attached or the transaction is not active

### createInputBlob

FbWireBlob createInputBlob(FbWireDatabase database, FbWireTransaction transaction, BlobParameterBuffer blobParameterBuffer, long blobId) throws SQLException
Create an input `FbWireBlob` implementation for this protocol version.

Parameters:
  `database` - FbWireDatabase of the current database
  `transaction` - FbWireTransaction to associate with the blob
  `blobParameterBuffer` - Blob Parameter Buffer
  `blobId` - Blob Id (must be non-zero for input blob)
Returns:
  FbWireBlob implementation
Throws:
  `SQLException` - if the database is not attached or the transaction is not active

### createAsynchronousChannel

FbWireAsynchronousChannel createAsynchronousChannel(FbWireDatabase database)
Create a disconnected asynchronous channel.

Parameters:
  `database` - The parent database handle.
Returns:
  Asynchronous channel implementation

### createWireOperations

FbWireOperations createWireOperations(WireConnection<?,?> connection, WarningMessageCallback defaultWarningMessageCallback)
Create an `FbWireOperations` implementation for this protocol version.

Parameters:
  `connection` - WireConnection instance (non-`null`)
  `defaultWarningMessageCallback` - default warning message callback (non-`null`)
Returns:
  Wire operations implementation