Package org.firebirdsql.management

## Class FBServiceManager

- java.lang.Object
- - org.firebirdsql.management.FBServiceManager

- All Implemented Interfaces:
    `ServiceManager`
  Direct Known Subclasses:
    `FBBackupManagerBase`, `FBMaintenanceManager`, `FBNBackupManager`, `FBStatisticsManager`, `FBTraceManager`, `FBUserManager`

      public class FBServiceManager
      extends java.lang.Object
      implements ServiceManager

  An implementation of the basic Firebird Service API functionality.
  Author:
    Roman Rokytskyy, Mark Rotteveel

- - ### Field Summary

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

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `FBServiceManager()` | Create a new instance of `FBServiceManager` based on the default GDSType.
    `FBServiceManager​(java.lang.String gdsType)` | Create a new instance of `FBServiceManager` based on a given GDSType.
    `FBServiceManager​(GDSType gdsType)` | Create a new instance of `FBServiceManager` based on a given GDSType.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `protected FbDatabase` | `attachDatabase()` |
    `FbService` | `attachServiceManager()` |
    `protected ServiceRequestBuffer` | `createRequestBuffer​(FbService service, int operation, int options)` |
    `protected void` | `executeServicesOperation​(FbService service, ServiceRequestBuffer srb)` |
    `protected void` | `executeServicesOperation​(ServiceRequestBuffer srb)` | Deprecated. Use `executeServicesOperation(FbService, ServiceRequestBuffer)`.
    `java.lang.String` | `getAuthPlugins()` | Get the list of authentication plugins to try.
    `java.lang.String` | `getCharSet()` |
    `java.lang.String` | `getDatabase()` | Returns the database path for the connection to the service manager.
    `java.lang.String` | `getDbCryptConfig()` | Get the database encryption plugin configuration.
    `java.lang.String` | `getHost()` | Returns the host for the connection to the service manager.
    `java.io.OutputStream` | `getLogger()` | Returns the logger for the connection to the service manager.
    `java.lang.String` | `getPassword()` | Returns the password for the connection to the service manager.
    `int` | `getPort()` | Returns the port for the connection to the service manager.
    `GDSServerVersion` | `getServerVersion()` | Obtains the server version through a service call.
    `java.lang.String` | `getServiceName()` |
    `java.lang.String` | `getUser()` | Get name of the user that performs the operation.
    `WireCrypt` | `getWireCrypt()` | Get the wire encryption level.
    `boolean` | `isWireCompression()` | Get if wire compression should be enabled.
    `void` | `queueService​(FbService service)` |
    `void` | `setAuthPlugins​(java.lang.String authPlugins)` | Sets the authentication plugins to try.
    `void` | `setCharSet​(java.lang.String charSet)` | Sets the encoding used for encoding or decoding string values.
    `void` | `setDatabase​(java.lang.String database)` | Sets the database path for the connection to the service manager.
    `void` | `setDbCryptConfig​(java.lang.String dbCryptConfig)` | Sets the database encryption plugin configuration.
    `void` | `setHost​(java.lang.String host)` | Sets the host for the connection to the service manager.
    `void` | `setLogger​(java.io.OutputStream logger)` | Sets the logger for the connection to the service manager.
    `void` | `setPassword​(java.lang.String password)` | Sets the password for the connection to the service manager.
    `void` | `setPort​(int port)` | Sets the port for the connection to the service manager.
    `void` | `setUser​(java.lang.String user)` | Set the name of the user that performs the operation.
    `void` | `setWireCompression​(boolean wireCompression)` | Sets if the connection should try to enable wire compression.
    `void` | `setWireCrypt​(WireCrypt wireCrypt)` | Set the wire encryption level.

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

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

- - ### Field Detail

    - #### BUFFER_SIZE

          public static final int BUFFER_SIZE

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### FBServiceManager

          public FBServiceManager()

      Create a new instance of `FBServiceManager` based on the default GDSType.

    - #### FBServiceManager

          public FBServiceManager​(java.lang.String gdsType)

      Create a new instance of `FBServiceManager` based on a given GDSType.
      Parameters:
        `gdsType` - type must be PURE_JAVA, EMBEDDED, or NATIVE

    - #### FBServiceManager

          public FBServiceManager​(GDSType gdsType)

      Create a new instance of `FBServiceManager` based on a given GDSType.
      Parameters:
        `gdsType` - The GDS implementation type to use

  - ### Method Detail

    - #### setCharSet

          public void setCharSet​(java.lang.String charSet)

      Description copied from interface: `ServiceManager`
      Sets the encoding used for encoding or decoding string values.

      If not set (or null), defaults to the value of system property `file.encoding`/

      Specified by:
        `setCharSet` in interface `ServiceManager`
      Parameters:
        `charSet` - Java charset name.

    - #### getCharSet

          public java.lang.String getCharSet()

      Specified by:
        `getCharSet` in interface `ServiceManager`

    - #### setUser

          public void setUser​(java.lang.String user)

      Set the name of the user that performs the operation.
      Specified by:
        `setUser` in interface `ServiceManager`
      Parameters:
        `user` - name of the user.

    - #### getUser

          public java.lang.String getUser()

      Get name of the user that performs the operation.
      Specified by:
        `getUser` in interface `ServiceManager`
      Returns:
        name of the user that performs the operation.

    - #### setPassword

          public void setPassword​(java.lang.String password)

      Description copied from interface: `ServiceManager`
      Sets the password for the connection to the service manager.
      Specified by:
        `setPassword` in interface `ServiceManager`
      Parameters:
        `password` - The password to set.

    - #### getPassword

          public java.lang.String getPassword()

      Description copied from interface: `ServiceManager`
      Returns the password for the connection to the service manager.
      Specified by:
        `getPassword` in interface `ServiceManager`
      Returns:
        Returns the password.

    - #### setDatabase

          public void setDatabase​(java.lang.String database)

      Description copied from interface: `ServiceManager`
      Sets the database path for the connection to the service manager.
      Specified by:
        `setDatabase` in interface `ServiceManager`
      Parameters:
        `database` - path for the connection to the service manager.

    - #### getDatabase

          public java.lang.String getDatabase()

      Description copied from interface: `ServiceManager`
      Returns the database path for the connection to the service manager.
      Specified by:
        `getDatabase` in interface `ServiceManager`
      Returns:
        the database path for the connection to the service manager.

    - #### getHost

          public java.lang.String getHost()

      Description copied from interface: `ServiceManager`
      Returns the host for the connection to the service manager.
      Specified by:
        `getHost` in interface `ServiceManager`
      Returns:
        Returns the host.

    - #### setHost

          public void setHost​(java.lang.String host)

      Description copied from interface: `ServiceManager`
      Sets the host for the connection to the service manager.
      Specified by:
        `setHost` in interface `ServiceManager`
      Parameters:
        `host` - The host to set.

    - #### getPort

          public int getPort()

      Description copied from interface: `ServiceManager`
      Returns the port for the connection to the service manager.
      Specified by:
        `getPort` in interface `ServiceManager`
      Returns:
        Returns the port.

    - #### setPort

          public void setPort​(int port)

      Description copied from interface: `ServiceManager`
      Sets the port for the connection to the service manager.
      Specified by:
        `setPort` in interface `ServiceManager`
      Parameters:
        `port` - The port to set.

    - #### getWireCrypt

          public WireCrypt getWireCrypt()

      Description copied from interface: `ServiceManager`
      Get the wire encryption level.
      Specified by:
        `getWireCrypt` in interface `ServiceManager`
      Returns:
        Wire encryption level

    - #### setWireCrypt

          public void setWireCrypt​(WireCrypt wireCrypt)

      Description copied from interface: `ServiceManager`
      Set the wire encryption level.
      Specified by:
        `setWireCrypt` in interface `ServiceManager`
      Parameters:
        `wireCrypt` - Wire encryption level (`null` not allowed)

    - #### getDbCryptConfig

          public java.lang.String getDbCryptConfig()

      Description copied from interface: `ServiceManager`
      Get the database encryption plugin configuration.
      Specified by:
        `getDbCryptConfig` in interface `ServiceManager`
      Returns:
        Database encryption plugin configuration, meaning plugin specific

    - #### setDbCryptConfig

          public void setDbCryptConfig​(java.lang.String dbCryptConfig)

      Description copied from interface: `ServiceManager`
      Sets the database encryption plugin configuration.
      Specified by:
        `setDbCryptConfig` in interface `ServiceManager`
      Parameters:
        `dbCryptConfig` - Database encryption plugin configuration, meaning plugin specific

    - #### getAuthPlugins

          public java.lang.String getAuthPlugins()

      Description copied from interface: `ServiceManager`
      Get the list of authentication plugins to try.
      Specified by:
        `getAuthPlugins` in interface `ServiceManager`
      Returns:
        comma-separated list of authentication plugins, or `null` for driver default

    - #### setAuthPlugins

          public void setAuthPlugins​(java.lang.String authPlugins)

      Description copied from interface: `ServiceManager`
      Sets the authentication plugins to try.

      Invalid names are skipped during authentication.

      Specified by:
        `setAuthPlugins` in interface `ServiceManager`
      Parameters:
        `authPlugins` - comma-separated list of authentication plugins, or `null` for driver default

    - #### isWireCompression

          public boolean isWireCompression()

      Description copied from interface: `ServiceManager`
      Get if wire compression should be enabled.

      Wire compression requires Firebird 3 or higher, and the server must have the zlib library. If compression cannot be negotiated, the connection will be made without wire compression.

      This property will be ignored for native connections. For native connections, the configuration in `firebird.conf` read by the client library will be used.

      Specified by:
        `isWireCompression` in interface `ServiceManager`
      Returns:
        `true` wire compression enabled

    - #### setWireCompression

          public void setWireCompression​(boolean wireCompression)

      Description copied from interface: `ServiceManager`
      Sets if the connection should try to enable wire compression.
      Specified by:
        `setWireCompression` in interface `ServiceManager`
      Parameters:
        `wireCompression` - `true` enable wire compression, `false` disable wire compression (the default)
      See Also:
        `ServiceManager.isWireCompression()`

    - #### getLogger

          public java.io.OutputStream getLogger()

      Description copied from interface: `ServiceManager`
      Returns the logger for the connection to the service manager.
      Specified by:
        `getLogger` in interface `ServiceManager`
      Returns:
        Returns the out.

    - #### setLogger

          public void setLogger​(java.io.OutputStream logger)

      Description copied from interface: `ServiceManager`
      Sets the logger for the connection to the service manager.
      Specified by:
        `setLogger` in interface `ServiceManager`
      Parameters:
        `logger` - The out to set.

    - #### getServiceName

          public java.lang.String getServiceName()

    - #### attachServiceManager

          public FbService attachServiceManager()
                                         throws java.sql.SQLException

      Throws:
        `java.sql.SQLException`

    - #### attachDatabase

          protected FbDatabase attachDatabase()
                                       throws java.sql.SQLException

      Throws:
        `java.sql.SQLException`

    - #### queueService

          public void queueService​(FbService service)
                            throws java.sql.SQLException,
                                   java.io.IOException

      Throws:
        `java.sql.SQLException`
        `java.io.IOException`

    - #### executeServicesOperation

          @Deprecated
          protected void executeServicesOperation​(ServiceRequestBuffer srb)
                                           throws java.sql.SQLException

      Deprecated.
      Use `executeServicesOperation(FbService, ServiceRequestBuffer)`.
      Execute a Services API operation in the database. All output from the operation is sent to this `ServiceManager`'s logger.
      Parameters:
        `srb` - The buffer containing the task request
      Throws:
        `java.sql.SQLException` - if a database access error occurs or incorrect parameters are supplied

    - #### executeServicesOperation

          protected final void executeServicesOperation​(FbService service,
                                                        ServiceRequestBuffer srb)
                                                 throws java.sql.SQLException

      Throws:
        `java.sql.SQLException`

    - #### createRequestBuffer

          protected ServiceRequestBuffer createRequestBuffer​(FbService service,
                                                             int operation,
                                                             int options)

    - #### getServerVersion

          public GDSServerVersion getServerVersion()
                                            throws java.sql.SQLException

      Description copied from interface: `ServiceManager`
      Obtains the server version through a service call.
      Specified by:
        `getServerVersion` in interface `ServiceManager`
      Returns:
        Parsed server version, or `GDSServerVersion.INVALID_VERSION` if parsing failed.
      Throws:
        `java.sql.SQLException` - For errors connecting to the service manager.