Class UniversalConnectionPoolExtension
- All Implemented Interfaces:
Extension
AbstractConfigurableExtension that provides injection support for UniversalConnectionPoolManager
and named UniversalConnectionPool instances.
As with all portable extensions, to begin to make use of the features enabled by this class, ensure its containing artifact (normally a jar file) is on the runtime classpath of your CDI-enabled application.
To support injection of the UniversalConnectionPoolManager, use normal CDI injection idioms:
// Inject the UniversalConnectionPoolManager into a private field named ucpManager:
@jakarta.inject.Inject
private oracle.ucp.admin.UniversalConnectionPoolManager ucpManager;
To support injection of a UniversalConnectionPool named test, first ensure that enough MicroProfile
Config configuration is present to create a valid PoolDataSource. For example, the following sample system
properties are sufficient for a PoolDataSource named test to be created:
oracle.ucp.jdbc.PoolDataSource.test.connectionFactoryClassName=oracle.jdbc.pool.OracleDataSource
oracle.ucp.jdbc.PoolDataSource.test.URL=jdbc:oracle:thin://@localhost:1521/XE
oracle.ucp.jdbc.PoolDataSource.test.user=scott
oracle.ucp.jdbc.PoolDataSource.test.password=tiger
See the UCPBackedDataSourceExtension documentation for more information about how PoolDataSource
instances are made eligible for injection from configuration such as this.
With configuration such as the above, you can now inject the implicit UniversalConnectionPool it also
defines:
// Inject a UniversalConnectionPool whose getName() method returns test into a private field named ucp:
@jakarta.inject.Inject
@jakarta.inject.Named("test")
private oracle.ucp.UniversalConnectionPool ucp; // assert "test".equals(ucp.getName());
Note: Working directly with a UniversalConnectionPool is for advanced use cases
only. Injecting and working with PoolDataSource instances is much more common, and PoolDataSource is
the interface recommended by Oracle's documentation for users to interact with. See UCPBackedDataSourceExtension's documentation for more details.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddBean(BeanConfigurator<oracle.ucp.UniversalConnectionPool> beanConfigurator, Named name, Properties properties) Called internally to permit subclasses to add aT-typed bean, qualified with at least the suppliedNamed, using the suppliedBeanConfigurator.protected final MatcherReturns aMatchergiven a configuration property name that can logically identify and provide access to at least its three component names.protected final StringGiven aMatcherthat has been produced by theAbstractConfigurableExtension.matcher(String)method, returns the relevant name.protected final StringpropertyName(Matcher configPropertyNameMatcher) Given aMatcherthat has been produced by theAbstractConfigurableExtension.matcher(String)method, returns the relevant property name, ornullif there is no such property name.Methods inherited from class io.helidon.integrations.cdi.configurable.AbstractConfigurableExtension
configPropertyNames, configPropertyValue, initializeNamedProperties, names, put
-
Constructor Details
-
UniversalConnectionPoolExtension
Deprecated.For use by CDI only.Creates a newUniversalConnectionPoolExtension.
-
-
Method Details
-
matcher
Description copied from class:AbstractConfigurableExtensionReturns aMatchergiven a configuration property name that can logically identify and provide access to at least its three component names.Implementations of this method must not return
null.Given a
Stringthat is a configuration property name, likecom.foo.Bar.name.propertyName, any implementation of this method must return a non-nullMatcherthat is capable of being supplied to theAbstractConfigurableExtension.name(Matcher)andAbstractConfigurableExtension.propertyName(Matcher)methods.- Specified by:
matcherin classAbstractConfigurableExtension<oracle.ucp.UniversalConnectionPool>- Parameters:
configPropertyName- a configuration property name that logically contains a type name, a name and a property name; must not benull- Returns:
- a non-
nullMatcher - See Also:
-
name
Description copied from class:AbstractConfigurableExtensionGiven aMatcherthat has been produced by theAbstractConfigurableExtension.matcher(String)method, returns the relevant name.Implementations of this method may return
null.- Specified by:
namein classAbstractConfigurableExtension<oracle.ucp.UniversalConnectionPool>- Parameters:
configPropertyNameMatcher- aMatcherproduced by theAbstractConfigurableExtension.matcher(String)method; must not benull- Returns:
- a name, or
null - See Also:
-
propertyName
Description copied from class:AbstractConfigurableExtensionGiven aMatcherthat has been produced by theAbstractConfigurableExtension.matcher(String)method, returns the relevant property name, ornullif there is no such property name.Most implementations of this method will use the
Matcher.group(int)method to produce the required property name.Implementations of this method may return
null.- Specified by:
propertyNamein classAbstractConfigurableExtension<oracle.ucp.UniversalConnectionPool>- Parameters:
configPropertyNameMatcher- aMatcherproduced by theAbstractConfigurableExtension.matcher(String)method; must not benull- Returns:
- a property name, or
null - See Also:
-
addBean
protected void addBean(BeanConfigurator<oracle.ucp.UniversalConnectionPool> beanConfigurator, Named name, Properties properties) Description copied from class:AbstractConfigurableExtensionCalled internally to permit subclasses to add aT-typed bean, qualified with at least the suppliedNamed, using the suppliedBeanConfigurator.Implementations of this method will be called from an observer method that is observing the
AfterBeanDiscoverycontainer lifecycle event.- Specified by:
addBeanin classAbstractConfigurableExtension<oracle.ucp.UniversalConnectionPool>- Parameters:
beanConfigurator- theBeanConfiguratorto use to actually add a new bean; must not benullname- aNamedinstance qualifying theT-typed bean to be added; may benullproperties- aPropertiesinstance containing properties relevant to the object; must not benull- See Also:
-