Interface IDriverService


public interface IDriverService
Service for managing JDBC drivers, including registering, unregistering, and retrieving driver information.
Since:
8.5.0
Author:
Norman Lorenz
  • Method Details

    • getInstance

      static IDriverService getInstance()
      Retrieves the singleton instance of the IDriverService using CDI.
      Returns:
      the singleton instance of the IDriverService
    • exportDriverData

      void exportDriverData(String runtimeId, OutputStream os, PersistenceUser user) throws FcDriverException
      Exports the driver data associated with the specified runtime ID to the provided output stream.
      Parameters:
      runtimeId - the ID of the driver runtime to export. Must not be blank.
      os - the output stream to write the driver data to. Must not be null.
      user - the user performing the export
      Throws:
      IllegalArgumentException - if the runtime ID is blank or if the output stream is null.
      FcDriverException - if there was an error during export or if no driver with the given runtime ID exists.
    • getDriverByJdbcUrl

      Driver getDriverByJdbcUrl(String jdbcUrl, PersistenceUser user) throws FcDriverException
      Retrieves the JDBC driver instance that accepts the given JDBC URL. If multiple drivers accept the URL, the one with latest version is returned.
      Parameters:
      jdbcUrl - the JDBC URL to find the driver for
      user - the user requesting the driver
      Returns:
      the JDBC driver instance that accepts the given JDBC URL, or null if no such driver is found.
      Throws:
      IllegalArgumentException - if the JDBC URL is blank
      FcDriverException
    • getDriverInfo

      IDriverInfo getDriverInfo(String runtimeId, PersistenceUser user) throws FcDriverException
      Retrieves the driver information for the specified runtime ID.
      Parameters:
      runtimeId - the ID of the driver runtime
      user - the user requesting the driver information
      Returns:
      the driver information associated with the given runtime ID
      Throws:
      IllegalArgumentException - if the runtime ID is blank
      FcDriverException
    • getDriverStorageDirectory

      @NotNull @NotNull File getDriverStorageDirectory(PersistenceUser user) throws FcDriverException
      Gets the directory where driver JAR files are stored.
      Parameters:
      user - the user requesting the directory
      Returns:
      the directory where driver JAR files are stored
      Throws:
      FcDriverException
    • getRegisteredDrivers

      @NotNull @NotNull List<IDriverInfo> getRegisteredDrivers(PersistenceUser user) throws FcDriverException
      Retrieves a list of all registered driver information.
      Parameters:
      user - the user requesting the list of registered drivers
      Returns:
      a list of all registered driver information
      Throws:
      FcDriverException - if there was an error retrieving the list of registered drivers
    • isDriverRegisteredForJdbcUrl

      boolean isDriverRegisteredForJdbcUrl(String jdbcUrl)
      Checks if there is a registered JDBC driver that accepts the given JDBC URL.
      Parameters:
      jdbcUrl - the JDBC URL to check
      Returns:
      true if a registered driver accepts the given JDBC URL, false otherwise
      Throws:
      IllegalArgumentException - if the JDBC URL is blank
    • registerDriver

      @NotNull @NotNull IDriverInfo registerDriver(InputStream driverStream, String fileName, PersistenceUser user) throws FcDriverException
      Registers a new JDBC driver from the provided input stream. The input stream is expected to contain a valid JDBC driver JAR file. The file name is used to store the driver JAR file on the filesystem. If a file with the same name already exists, a unique name will be generated.
      Parameters:
      driverStream - Input stream containing the JDBC driver JAR file. Must not be null.
      fileName - The name of the driver file. Must not be blank.
      user - the user performing the registration
      Throws:
      IllegalArgumentException - if driverStream is null or fileName is blank.
      FcDriverException - if there was an error writing the driver data to a file, loading the driver or if the driver is already registered.
    • unregisterDriver

      void unregisterDriver(String runtimeId, PersistenceUser user) throws FcDriverException
      Unregisters the JDBC driver associated with the specified runtime ID. This will also remove the driver JAR file from the filesystem.
      Parameters:
      runtimeId - the ID of the driver runtime to unregister. Must not be blank.
      user - the user performing the unregistration
      Throws:
      IllegalArgumentException - if the runtime ID is blank.
      FcDriverException - if there was an error during unregistration or if no driver with the given runtime ID exists.
    • unregisterDriverByFingerprint

      void unregisterDriverByFingerprint(String fingerprint, PersistenceUser system) throws FcDriverException
      Unregisters the JDBC driver associated with the specified SHA-256 fingerprint. This will also remove the driver JAR file from the filesystem.
      Parameters:
      fingerprint - the SHA-256 fingerprint of the driver to unregister. Must not be blank.
      system - the system user performing the unregistration
      Throws:
      IllegalArgumentException - if the fingerprint is blank.
      FcDriverException - if there was an error during unregistration or if no driver with the given fingerprint exists.