Class DataSourceServiceProvider


  • @ApplicationScoped
    public class DataSourceServiceProvider
    extends Object
    Provides DataSourceService instances and caches them in a global cache.
    Author:
    mtaal
    • Constructor Detail

      • DataSourceServiceProvider

        public DataSourceServiceProvider()
    • Method Detail

      • getDataSource

        public DataSourceService getDataSource​(String dataSourceIdentifier)
        Checks the internal cache for a datasource with the requested name and returns it if found. If not found a new one is created, which is cached and then returned.
        Parameters:
        dataSourceIdentifier - the name by which to search and identify the data source.
        Returns:
        a DataSourceService object
      • getDataSource

        public DataSourceService getDataSource​(String dataSourceIdentifier,
                                               boolean useCache)
        Checks the internal cache for a datasource with the requested name and returns it if found. A second boolean parameter can be use to specify whether the datasource can be returned from a cache if available, or if a fresh, not-shared copy is expected
        Parameters:
        dataSourceIdentifier - the name by which to search and identify the data source.
        useCache - if true, the datasource will be read from a cache, if available. If false, a new instance will be created and will not be cached
        Returns:
        a DataSourceService object