Class AbstractDataSourceExtension

  • All Implemented Interfaces:
    javax.enterprise.inject.spi.Extension
    Direct Known Subclasses:
    HikariCPBackedDataSourceExtension, UCPBackedDataSourceExtension

    public abstract class AbstractDataSourceExtension
    extends Object
    implements javax.enterprise.inject.spi.Extension
    An abstract Extension whose subclasses arrange for DataSource instances to be added as CDI beans.

    Thread Safety

    As with all CDI portable extensions, this class' instances are not safe for concurrent use by multiple threads.

    • Method Detail

      • addBean

        protected abstract void addBean​(javax.enterprise.inject.spi.configurator.BeanConfigurator<DataSource> beanConfigurator,
                                        javax.inject.Named name,
                                        Properties properties)
        Called to permit subclasses to add a DataSource-typed bean using the supplied BeanConfigurator.

        Implementations of this method will be called from an observer method that is observing the AfterBeanDiscovery container lifecycle event.

        Parameters:
        beanConfigurator - the BeanConfigurator to use to actually add a new bean; must not be null
        name - a Named instance qualifying the DataSource-typed bean to be added; may be null
        properties - a Properties instance containing properties relevant to the data source; must not be null
      • getConfig

        protected final org.eclipse.microprofile.config.Config getConfig()
        Returns the Config instance used to acquire configuration property values.

        This method never returns null.

        Returns:
        a non-null Config instance
        See Also:
        Config
      • putDataSourceProperties

        protected final Properties putDataSourceProperties​(String dataSourceName,
                                                           Properties properties)
        Adds additional synthesized properties to an internal map of data source properties whose contents will be processed eventually by the addBean(BeanConfigurator, Named, Properties) method.

        This method may return null.

        Parameters:
        dataSourceName - the name of the data source under which the supplied Properties will be indexed; may be null
        properties - the Properties to put; may be null
        Returns:
        the prior Properties indexed under the supplied dataSourceName, or null
      • getPropertyNames

        protected final Set<String> getPropertyNames()
        Returns a Set of all known configuration property names.

        This method never returns null.

        The Set returned by this method is unmodifiable.

        The Set returned by this method is not safe for concurrent use by multiple threads.

        Any other semantics of the Set returned by this method are governed by the MicroProfile Config specification.

        Returns:
        a non-null, unmodifiable Set of all known configuration property names
        See Also:
        Config.getConfigSources(), ConfigSource.getPropertyNames()