org.firebirdsql.gds.ng.wire

## Interface FbWireOperations

- All Known Implementing Classes:
    AbstractWireOperations, V10WireOperations, V11WireOperations, V13WireOperations

      public interface FbWireOperations

  Common connection operations shared by database and service handles
  Since:
    3.0
  Author:
    Mark Rotteveel

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static interface` | `FbWireOperations.ProcessAttachCallback`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `authReceiveResponse(FbWireAttachment.AcceptPacket acceptPacket, DbCryptCallback dbCryptCallback, FbWireOperations.ProcessAttachCallback processAttachCallback)` Receive authentication response from the server.
    `void` | `consumePackets(int numberOfResponses, WarningMessageCallback warningCallback)` Consumes packets notifying for warnings, but ignoring exceptions thrown from the packet.
    `void` | `enqueueDeferredAction(DeferredAction deferredAction)` Enqueue a deferred action.
    `XdrStreamAccess` | `getXdrStreamAccess()`
    `void` | `processDeferredActions()` Processes any deferred actions.
    `void` | `processResponse(Response response)`
    `void` | `processResponseWarnings(Response response, WarningMessageCallback warningCallback)` Checks if the response included a warning and signals that warning to the WarningMessageCallback.
    `GenericResponse` | `readGenericResponse(WarningMessageCallback callback)` Convenience method to read a Response to a GenericResponse
    `Response` | `readOperationResponse(int operationCode, WarningMessageCallback callback)` Reads the response from the server when the operation code has already been read.
    `Response` | `readResponse(WarningMessageCallback callback)` Reads the response from the server.
    `Response` | `readSingleResponse(WarningMessageCallback warningCallback)` Reads the response from the server.
    `SqlResponse` | `readSqlResponse(WarningMessageCallback callback)` Convenience method to read a Response to a SqlResponse
    `java.sql.SQLException` | `readStatusVector()` Process the status vector and returns the associated `SQLException` instance.
    `void` | `writeDirect(byte[] data)` Writes directly to the `OutputStream` of the underlying connection.

- - ### Method Detail

    - #### getXdrStreamAccess

          XdrStreamAccess getXdrStreamAccess()

      Returns:
        Instance of `XdrStreamAccess` for this service.

    - #### readStatusVector

          java.sql.SQLException readStatusVector()
                                                 throws java.sql.SQLException

      Process the status vector and returns the associated `SQLException` instance.

      NOTE: This method returns the SQLException read from the status vector, and only throws SQLException when an error occurs processing the status ector.

      Returns:
        SQLException from the status vector
      Throws:
        `java.sql.SQLException` - for errors reading or processing the status vector

    - #### readResponse

          Response readResponse(WarningMessageCallback callback)
                                throws java.sql.SQLException,
                                       java.io.IOException

      Reads the response from the server.
      Parameters:
        `callback` - Callback object for warnings, `null` for default callback
      Returns:
        `Response` read.
      Throws:
        `java.sql.SQLException` - For errors returned from the server, or when attempting to read
        `java.io.IOException` - For errors reading the response from the connection.

    - #### readOperationResponse

          Response readOperationResponse(int operationCode,
                                       WarningMessageCallback callback)
                                         throws java.sql.SQLException,
                                                java.io.IOException

      Reads the response from the server when the operation code has already been read.
      Parameters:
        `operationCode` - The operation code
        `callback` - Callback object for warnings, `null` for default callback
      Returns:
        `Response` read.
      Throws:
        `java.sql.SQLException` - For errors returned from the server, or when attempting to read
        `java.io.IOException` - For errors reading the response from the connection.
      See Also:
        `readResponse(WarningMessageCallback)`

    - #### readGenericResponse

          GenericResponse readGenericResponse(WarningMessageCallback callback)
                                              throws java.sql.SQLException,
                                                     java.io.IOException

      Convenience method to read a Response to a GenericResponse
      Parameters:
        `callback` - Callback object for warnings, `null` for default callback
      Returns:
        GenericResponse
      Throws:
        `java.sql.SQLException` - For errors returned from the server, or when attempting to read.
        `java.io.IOException` - For errors reading the response from the connection.

    - #### readSqlResponse

          SqlResponse readSqlResponse(WarningMessageCallback callback)
                                      throws java.sql.SQLException,
                                             java.io.IOException

      Convenience method to read a Response to a SqlResponse
      Parameters:
        `callback` - Callback object for warnings, `null` for default callback
      Returns:
        SqlResponse
      Throws:
        `java.sql.SQLException` - For errors returned from the server, or when attempting to read.
        `java.io.IOException` - For errors reading the response from the connection.

    - #### enqueueDeferredAction

          void enqueueDeferredAction(DeferredAction deferredAction)

      Enqueue a deferred action.

      FbDatabase implementations that do not support deferred actions are allowed to throw an `UnsupportedOperationException`

      Parameters:
        `deferredAction` - Deferred action

    - #### consumePackets

          void consumePackets(int numberOfResponses,
                            WarningMessageCallback warningCallback)

      Consumes packets notifying for warnings, but ignoring exceptions thrown from the packet.

      This method should only be used inside the implementation if either packets need to be ignored, or to ensure that there is no backlog of packets (eg when an exception occurs during processing of multiple package responses).

      Parameters:
        `numberOfResponses` - Number of responses to consume.
        `warningCallback` - Callback for warnings

    - #### processDeferredActions

          void processDeferredActions()

      Processes any deferred actions. Protocol versions that do not support deferred actions should simply do nothing.

    - #### readSingleResponse

          Response readSingleResponse(WarningMessageCallback warningCallback)
                                      throws java.sql.SQLException,
                                             java.io.IOException

      Reads the response from the server.
      Parameters:
        `warningCallback` - Callback object for signalling warnings, `null` to register warning on the default callback
      Returns:
        Response
      Throws:
        `java.sql.SQLException` - For errors returned from the server, or when attempting to read
        `java.io.IOException` - For errors reading the response from the connection.

    - #### processResponse

          void processResponse(Response response)
                               throws java.sql.SQLException

      Parameters:
        `response` - Response to process
      Throws:
        `java.sql.SQLException` - For errors returned from the server.

    - #### processResponseWarnings

          void processResponseWarnings(Response response,
                                     WarningMessageCallback warningCallback)

      Checks if the response included a warning and signals that warning to the WarningMessageCallback.
      Parameters:
        `response` - Response to process

    - #### writeDirect

          void writeDirect(byte[] data)
                           throws java.io.IOException

      Writes directly to the `OutputStream` of the underlying connection.

      Use of this method might lead to hard to find race conditions in the protocol. It is currently only used to allow `FbDatabase.cancelOperation(int)` to work.

      Parameters:
        `data` - Data to write
      Throws:
        `java.io.IOException` - If there is no socket, the socket is closed, or for errors writing to the socket.
      See Also:
        `WireConnection.writeDirect(byte[])`

    - #### authReceiveResponse

          void authReceiveResponse(FbWireAttachment.AcceptPacket acceptPacket,
                                 DbCryptCallback dbCryptCallback,
                                 FbWireOperations.ProcessAttachCallback processAttachCallback)
                                   throws java.io.IOException,
                                          java.sql.SQLException

      Receive authentication response from the server.

      This method is only relevant for protocol V13 or higher.

      Parameters:
        `acceptPacket` - Packet with `op_cond_accept` data, or `null` when the data should be read from the connection.
        `dbCryptCallback` - Database encryption callback (ignored by protocols v12 and lower)
        `processAttachCallback` - Callback for processing the final attach response
      Throws:
        `java.io.IOException` - For errors reading the response from the connection.
        `java.sql.SQLException` - For errors returned from the server, or when attempting to read.

Copyright © 2001-2021 Jaybird (Firebird JDBC/JCA) team. All rights reserved.