org.firebirdsql.gds.ng

## Class AbstractFbService<T extends AbstractConnection<IServiceProperties,? extends FbService>>

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

- All Implemented Interfaces:
    java.lang.AutoCloseable, FbAttachment, FbService, ExceptionListenable
  Direct Known Subclasses:
    AbstractFbWireService, JnaService

      public abstract class AbstractFbService<T extends AbstractConnection<IServiceProperties,? extends FbService>>
      extends AbstractFbAttachment<T>
      implements FbService

  Abstract service implementation.
  Since:
    3.0
  Author:
    Mark Rotteveel

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected ServiceListenerDispatcher` | `serviceListenerDispatcher`

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

      `connection, exceptionListenerDispatcher`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `AbstractFbService(T connection, DatatypeCoder datatypeCoder)`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addServiceListener(ServiceListener listener)` Adds a `ServiceListener` instance to this database.
    `void` | `close()` Detaches and closes the connection.
    `protected ServiceRequestBuffer` | `getDescribeServiceRequestBuffer()`
    `<R> R` | `getServiceInfo(ServiceParameterBuffer serviceParameterBuffer, ServiceRequestBuffer serviceRequestBuffer, int bufferLength, InfoProcessor<R> infoProcessor)` Request service info (service query).
    `protected InfoProcessor<FbService>` | `getServiceInformationProcessor()`
    `protected WarningMessageCallback` | `getServiceWarningCallback()`
    `protected abstract void` | `internalDetach()` Actual implementation of service detach.
    `void` | `removeServiceListener(ServiceListener listener)` Removes a `ServiceListener` instance from this database.

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

      `addExceptionListener, checkConnected, forceClose, getDatatypeCoder, getEncoding, getEncodingFactory, getNetworkTimeout, getServerVersion, getServerVersionInformation, isAttached, isLockedByCurrentThread, removeExceptionListener, safelyDetach, setAttached, setDetached, setServerVersion, withLock`

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

      `createServiceParameterBuffer, createServiceRequestBuffer, getHandle, getServiceInfo, startServiceAction`

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

      `attach, forceClose, getDatatypeCoder, getEncoding, getEncodingFactory, getNetworkTimeout, getServerVersion, isAttached, isLockedByCurrentThread, setNetworkTimeout, withLock`

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

      `addExceptionListener, removeExceptionListener`

- - ### Field Detail

    - #### serviceListenerDispatcher

          protected final ServiceListenerDispatcher serviceListenerDispatcher

  - ### Constructor Detail

    - #### AbstractFbService

          protected AbstractFbService(T connection,
                                      DatatypeCoder datatypeCoder)

  - ### Method Detail

    - #### getServiceInfo

          public final <R> R getServiceInfo(ServiceParameterBuffer serviceParameterBuffer,
                                            ServiceRequestBuffer serviceRequestBuffer,
                                            int bufferLength,
                                            InfoProcessor<R> infoProcessor)
                                     throws java.sql.SQLException

      Description copied from interface: `FbService`
      Request service info (service query).
      Specified by:
        `getServiceInfo` in interface `FbService`
      Parameters:
        `serviceParameterBuffer` - Service parameters
        `serviceRequestBuffer` - Service request info
        `bufferLength` - Response buffer length to use
        `infoProcessor` - Implementation of `InfoProcessor` to transform the info response
      Returns:
        Transformed info response of type T
      Throws:
        `java.sql.SQLException` - For errors retrieving or transforming the response.

    - #### addServiceListener

          public final void addServiceListener(ServiceListener listener)

      Description copied from interface: `FbService`
      Adds a `ServiceListener` instance to this database.
      Specified by:
        `addServiceListener` in interface `FbService`
      Parameters:
        `listener` - Database listener

    - #### removeServiceListener

          public final void removeServiceListener(ServiceListener listener)

      Description copied from interface: `FbService`
      Removes a `ServiceListener` instance from this database.
      Specified by:
        `removeServiceListener` in interface `FbService`
      Parameters:
        `listener` - Database Listener

    - #### internalDetach

          protected abstract void internalDetach()
                                          throws java.sql.SQLException

      Actual implementation of service detach.

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

      Throws:
        `java.sql.SQLException`

    - #### close

          public final void close()
                           throws java.sql.SQLException

      Detaches and closes the connection.

      Implementation note: Calls `AbstractFbAttachment.checkConnected()` and notifies service listeners of the detaching event, then calls `internalDetach()` and finally notifies service listeners of database detach and removes all listeners.

      Specified by:
        `close` in interface `java.lang.AutoCloseable`
      Specified by:
        `close` in interface `FbAttachment`
      Throws:
        `java.sql.SQLException` - If not currently connected, or another problem occurred detaching.

    - #### getServiceWarningCallback

          protected final WarningMessageCallback getServiceWarningCallback()

      Returns:
        The warning callback for this service.

    - #### getDescribeServiceRequestBuffer

          protected ServiceRequestBuffer getDescribeServiceRequestBuffer()

    - #### getServiceInformationProcessor

          protected InfoProcessor<FbService> getServiceInformationProcessor()

Copyright © 2001-2025 Jaybird (Firebird JDBC) team. All rights reserved.