Interface DataSourceManager


  • public interface DataSourceManager
    Manager for persistence resources such as DataSources and EntityManagerFactories. This interface provides methods to obtain DataSources based on connection properties, retrieve EntityManagerFactories, and manage the lifecycle of connections.
    Since:
    8.5.0
    Author:
    Norman Lorenz
    • Method Detail

      • closeAllConnections

        void closeAllConnections()
        Closes all managed connections and releases associated resources. This method should be called during application shutdown to ensure proper cleanup.
      • closeConnection

        void closeConnection​(ConnectionIdentifier connectionIdentifier)
        Closes the connection associated with the given connection identifier. This method should be called to release resources when the connection is no longer needed.
        Parameters:
        connectionIdentifier - the identifier of the connection to be closed
      • getDataSource

        DataSource getDataSource​(ConnectionProperties connectionProperties)
                          throws FcPersistenceException
        Retrieves a DataSource based on the provided connection properties. The returned DataSource is managed by this manager (and underlying connection pool) and should not be closed by the caller.
        Parameters:
        connectionProperties - the properties used to configure the DataSource
        Returns:
        a DataSource configured with the given connection properties
        Throws:
        IllegalArgumentException - if the connection properties are invalid
        IllegalStateException - if the DataSource cannot be created
        FcDriverException - if there is an error related to the database driver
        FcPersistenceException