org.firebirdsql.gds.ng.wire

## Class AbstractWireOperations

- java.lang.Object
- - org.firebirdsql.gds.ng.wire.AbstractWireOperations

- All Implemented Interfaces:
    FbWireOperations
  Direct Known Subclasses:
    V10WireOperations

      public abstract class AbstractWireOperations
      extends java.lang.Object
      implements FbWireOperations

  Since:
    3.0
  Author:
    Mark Rotteveel

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface org.firebirdsql.gds.ng.wire.FbWireOperations

      `FbWireOperations.ProcessAttachCallback`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `AbstractWireOperations(WireConnection<?,?> connection, WarningMessageCallback defaultWarningMessageCallback, java.lang.Object syncObject)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `addServerKeys(byte[] serverKeys)`
    `protected void` | `clearServerKeys()`
    `void` | `consumePackets(int numberOfResponses, WarningMessageCallback warningCallback)` Consumes packets notifying for warnings, but ignoring exceptions thrown from the packet.
    `protected IAttachProperties<?>` | `getAttachProperties()`
    `protected ClientAuthBlock` | `getClientAuthBlock()`
    `protected WireConnection<?,?>` | `getConnection()`
    `protected WarningMessageCallback` | `getDefaultWarningMessageCallback()`
    `protected Encoding` | `getEncoding()`
    `protected java.util.List<EncryptionIdentifier>` | `getEncryptionIdentifiers()`
    `protected java.lang.Object` | `getSynchronizationObject()`
    `protected XdrInputStream` | `getXdrIn()` Gets the XdrInputStream.
    `protected XdrOutputStream` | `getXdrOut()` Gets the XdrOutputStream.
    `XdrStreamAccess` | `getXdrStreamAccess()`
    `protected Response` | `processOperation(int operation)` Reads the response based on the specified operation.
    `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 warningCallback)` Convenience method to read a Response to a GenericResponse
    `int` | `readNextOperation()` Reads the next operation.
    `Response` | `readOperationResponse(int operationCode, WarningMessageCallback warningCallback)` Reads the response from the server when the operation code has already been read.
    `Response` | `readResponse(WarningMessageCallback warningCallback)` Reads the response from the server.
    `Response` | `readSingleResponse(WarningMessageCallback warningCallback)` Reads the response from the server.
    `SqlResponse` | `readSqlResponse(WarningMessageCallback warningCallback)` 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.

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

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

    - ### Methods inherited from interface org.firebirdsql.gds.ng.wire.FbWireOperations

      `authReceiveResponse, enqueueDeferredAction, processDeferredActions`

- - ### Constructor Detail

    - #### AbstractWireOperations

          protected AbstractWireOperations(WireConnection<?,?> connection,
                                WarningMessageCallback defaultWarningMessageCallback,
                                java.lang.Object syncObject)

  - ### Method Detail

    - #### getXdrStreamAccess

          public final XdrStreamAccess getXdrStreamAccess()

      Specified by:
        `getXdrStreamAccess` in interface `FbWireOperations`
      Returns:
        Instance of `XdrStreamAccess` for this service.

    - #### getEncoding

          protected final Encoding getEncoding()

    - #### getXdrIn

          protected final XdrInputStream getXdrIn()
                                           throws java.sql.SQLException

      Gets the XdrInputStream.
      Returns:
        Instance of XdrInputStream
      Throws:
        `java.sql.SQLException` - If no connection is opened or when exceptions occur retrieving the InputStream

    - #### getXdrOut

          protected final XdrOutputStream getXdrOut()
                                             throws java.sql.SQLException

      Gets the XdrOutputStream.
      Returns:
        Instance of XdrOutputStream
      Throws:
        `java.sql.SQLException` - If no connection is opened or when exceptions occur retrieving the OutputStream

    - #### readStatusVector

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

      Description copied from interface: `FbWireOperations`
      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.

      Specified by:
        `readStatusVector` in interface `FbWireOperations`
      Returns:
        SQLException from the status vector
      Throws:
        `java.sql.SQLException` - for errors reading or processing the status vector

    - #### readResponse

          public final Response readResponse(WarningMessageCallback warningCallback)
                                      throws java.sql.SQLException,
                                             java.io.IOException

      Description copied from interface: `FbWireOperations`
      Reads the response from the server.
      Specified by:
        `readResponse` in interface `FbWireOperations`
      Parameters:
        `warningCallback` - 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

          public final Response readOperationResponse(int operationCode,
                                       WarningMessageCallback warningCallback)
                                               throws java.sql.SQLException,
                                                      java.io.IOException

      Description copied from interface: `FbWireOperations`
      Reads the response from the server when the operation code has already been read.
      Specified by:
        `readOperationResponse` in interface `FbWireOperations`
      Parameters:
        `operationCode` - The operation code
        `warningCallback` - 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:
        `FbWireOperations.readResponse(WarningMessageCallback)`

    - #### readSingleResponse

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

      Description copied from interface: `FbWireOperations`
      Reads the response from the server.
      Specified by:
        `readSingleResponse` in interface `FbWireOperations`
      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.

    - #### readNextOperation

          public final int readNextOperation()
                                      throws java.io.IOException

      Reads the next operation. Forwards call to `WireConnection.readNextOperation()`.
      Returns:
        next operation
      Throws:
        `java.io.IOException` - For errors reading the operation from the connection

    - #### processOperation

          protected final Response processOperation(int operation)
                                             throws java.sql.SQLException,
                                                    java.io.IOException

      Reads the response based on the specified operation.
      Parameters:
        `operation` - Database operation
      Returns:
        Response object for the operation
      Throws:
        `java.sql.SQLException` - For errors reading the response from the connection.
        `java.io.IOException` - For errors reading the response from the connection.

    - #### processResponse

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

      Specified by:
        `processResponse` in interface `FbWireOperations`
      Parameters:
        `response` - Response to process
      Throws:
        `java.sql.SQLException` - For errors returned from the server.

    - #### processResponseWarnings

          public final void processResponseWarnings(Response response,
                                     WarningMessageCallback warningCallback)

      Checks if the response included a warning and signals that warning to the WarningMessageCallback.
      Specified by:
        `processResponseWarnings` in interface `FbWireOperations`
      Parameters:
        `response` - Response to process

    - #### readGenericResponse

          public final GenericResponse readGenericResponse(WarningMessageCallback warningCallback)
                                                    throws java.sql.SQLException,
                                                           java.io.IOException

      Description copied from interface: `FbWireOperations`
      Convenience method to read a Response to a GenericResponse
      Specified by:
        `readGenericResponse` in interface `FbWireOperations`
      Parameters:
        `warningCallback` - 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

          public final SqlResponse readSqlResponse(WarningMessageCallback warningCallback)
                                            throws java.sql.SQLException,
                                                   java.io.IOException

      Description copied from interface: `FbWireOperations`
      Convenience method to read a Response to a SqlResponse
      Specified by:
        `readSqlResponse` in interface `FbWireOperations`
      Parameters:
        `warningCallback` - 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.

    - #### consumePackets

          public final void consumePackets(int numberOfResponses,
                            WarningMessageCallback warningCallback)

      Description copied from interface: `FbWireOperations`
      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).

      Specified by:
        `consumePackets` in interface `FbWireOperations`
      Parameters:
        `numberOfResponses` - Number of responses to consume.
        `warningCallback` - Callback for warnings

    - #### writeDirect

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

      Description copied from interface: `FbWireOperations`
      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.

      Specified by:
        `writeDirect` in interface `FbWireOperations`
      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[])`

    - #### getSynchronizationObject

          protected final java.lang.Object getSynchronizationObject()

    - #### addServerKeys

          protected final void addServerKeys(byte[] serverKeys)
                                      throws java.sql.SQLException

      Throws:
        `java.sql.SQLException`

    - #### clearServerKeys

          protected final void clearServerKeys()

    - #### getClientAuthBlock

          protected final ClientAuthBlock getClientAuthBlock()

    - #### getAttachProperties

          protected final IAttachProperties<?> getAttachProperties()

      Returns:
        Immutable attach properties

    - #### getEncryptionIdentifiers

          protected final java.util.List<EncryptionIdentifier> getEncryptionIdentifiers()

    - #### getConnection

          protected final WireConnection<?,?> getConnection()

    - #### getDefaultWarningMessageCallback

          protected final WarningMessageCallback getDefaultWarningMessageCallback()

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