org.firebirdsql.gds.ng.jna

## Class JnaService

- java.lang.Object
- - org.firebirdsql.gds.ng.AbstractFbAttachment<T>
  - - org.firebirdsql.gds.ng.AbstractFbService<JnaServiceConnection>
    - - org.firebirdsql.gds.ng.jna.JnaService

- All Implemented Interfaces:
    java.lang.AutoCloseable, FbAttachment, FbService, JnaAttachment, ExceptionListenable

      public final class JnaService
      extends AbstractFbService<JnaServiceConnection>
      implements JnaAttachment

  Implementation of `FbService` for native client access.
  Since:
    3.0
  Author:
    Mark Rotteveel

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `STATUS_VECTOR_SIZE`

    - ### Fields inherited from class org.firebirdsql.gds.ng.AbstractFbAttachment

      `connection, exceptionListenerDispatcher`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `JnaService(JnaServiceConnection connection)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `afterAttachActions()` Additional tasks to execute directly after attach operation.
    `void` | `attach()` Attach to the attachment type.
    `protected void` | `checkConnected()` Checks if the attachment is connected, and throws a `SQLException` if it isn't connected.
    `ServiceParameterBuffer` | `createServiceParameterBuffer()` Creates an empty `ServiceParameterBuffer`.
    `ServiceRequestBuffer` | `createServiceRequestBuffer()`
    `protected void` | `finalize()`
    `int` | `getHandle()`
    `com.sun.jna.ptr.IntByReference` | `getJnaHandle()`
    `byte[]` | `getServiceInfo(ServiceParameterBuffer serviceParameterBuffer, ServiceRequestBuffer serviceRequestBuffer, int maxBufferLength)` Performs a service info request (service query.
    `protected void` | `internalDetach()` Actual implementation of service detach.
    `void` | `processStatusVector(ISC_STATUS[] statusVector, WarningMessageCallback warningMessageCallback)`
    `void` | `startServiceAction(ServiceRequestBuffer serviceRequestBuffer)` Starts a service action.

    - ### Methods inherited from class org.firebirdsql.gds.ng.AbstractFbService

      `addServiceListener, close, getDescribeServiceRequestBuffer, getServiceInfo, getServiceInformationProcessor, getServiceWarningCallback, removeServiceListener`

    - ### Methods inherited from class org.firebirdsql.gds.ng.AbstractFbAttachment

      `addExceptionListener, createDbCryptCallback, getDatatypeCoder, getEncoding, getEncodingFactory, getServerVersion, getServerVersionInformation, getSynchronizationObject, isAttached, removeExceptionListener, safelyDetach, setAttached, setDetached, setServerVersion`

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

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

    - ### Methods inherited from interface org.firebirdsql.gds.ng.FbAttachment

      `close, getDatatypeCoder, getEncoding, getEncodingFactory, getServerVersion, getSynchronizationObject, isAttached`

    - ### Methods inherited from interface org.firebirdsql.gds.ng.listeners.ExceptionListenable

      `addExceptionListener, removeExceptionListener`

- - ### Field Detail

    - #### STATUS_VECTOR_SIZE

          public static final int STATUS_VECTOR_SIZE

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### JnaService

          public JnaService(JnaServiceConnection connection)

  - ### Method Detail

    - #### createServiceParameterBuffer

          public ServiceParameterBuffer createServiceParameterBuffer()

      Description copied from interface: `FbService`
      Creates an empty `ServiceParameterBuffer`.

      Attach expects a service parameter buffer to have the version as the first item. This needs to be added explicitly.

      Specified by:
        `createServiceParameterBuffer` in interface `FbService`
      Returns:
        Service

    - #### createServiceRequestBuffer

          public ServiceRequestBuffer createServiceRequestBuffer()

      Specified by:
        `createServiceRequestBuffer` in interface `FbService`
      Returns:
        An empty service request buffer

    - #### checkConnected

          protected void checkConnected()
                                 throws java.sql.SQLException

      Description copied from class: `AbstractFbAttachment`
      Checks if the attachment is connected, and throws a `SQLException` if it isn't connected.
      Specified by:
        `checkConnected` in class `AbstractFbAttachment<JnaServiceConnection>`
      Throws:
        `java.sql.SQLException`

    - #### getServiceInfo

          public byte[] getServiceInfo(ServiceParameterBuffer serviceParameterBuffer,
                              ServiceRequestBuffer serviceRequestBuffer,
                              int maxBufferLength)
                                throws java.sql.SQLException

      Description copied from interface: `FbService`
      Performs a service info request (service query.
      Specified by:
        `getServiceInfo` in interface `FbService`
      Parameters:
        `serviceParameterBuffer` - Service parameters (can be null)
        `serviceRequestBuffer` - Service request info
        `maxBufferLength` - Maximum response buffer length to use
      Returns:
        The response buffer (note: length is the actual length of the response, not `maxBufferLength`
      Throws:
        `java.sql.SQLException` - For errors retrieving the information.

    - #### startServiceAction

          public void startServiceAction(ServiceRequestBuffer serviceRequestBuffer)
                                  throws java.sql.SQLException

      Description copied from interface: `FbService`
      Starts a service action.
      Specified by:
        `startServiceAction` in interface `FbService`
      Parameters:
        `serviceRequestBuffer` - Service action request details
      Throws:
        `java.sql.SQLException` - For errors starting the service action.

    - #### attach

          public void attach()
                      throws java.sql.SQLException

      Description copied from interface: `FbAttachment`
      Attach to the attachment type.
      Specified by:
        `attach` in interface `FbAttachment`
      Throws:
        `java.sql.SQLException`

    - #### afterAttachActions

          protected void afterAttachActions()
                                     throws java.sql.SQLException

      Additional tasks to execute directly after attach operation.

      Implementation retrieves service information like server version.

      Throws:
        `java.sql.SQLException` - For errors reading or writing database information.

    - #### internalDetach

          protected void internalDetach()
                                 throws java.sql.SQLException

      Description copied from class: `AbstractFbService`
      Actual implementation of service detach.

      Implementations of this method should only be called from `AbstractFbService.close()`, and should not notify service listeners of the service `ServiceListener.detaching(FbService)` and `ServiceListener.detached(FbService)` events.

      Specified by:
        `internalDetach` in class `AbstractFbService<JnaServiceConnection>`
      Throws:
        `java.sql.SQLException`

    - #### getHandle

          public int getHandle()

      Specified by:
        `getHandle` in interface `FbAttachment`
      Specified by:
        `getHandle` in interface `FbService`
      Returns:
        The attachment handle value

    - #### getJnaHandle

          public com.sun.jna.ptr.IntByReference getJnaHandle()

    - #### processStatusVector

          public void processStatusVector(ISC_STATUS[] statusVector,
                                 WarningMessageCallback warningMessageCallback)
                                   throws java.sql.SQLException

      Throws:
        `java.sql.SQLException`

    - #### finalize

          protected void finalize()
                           throws java.lang.Throwable

      Overrides:
        `finalize` in class `java.lang.Object`
      Throws:
        `java.lang.Throwable`

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