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
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
addBean
(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 Matcher
Returns aMatcher
given a configuration property name that can logically identify and provide access to at least its three component names.protected final String
Given aMatcher
that has been produced by theAbstractConfigurableExtension.matcher(String)
method, returns the relevant name.protected final String
propertyName
(Matcher configPropertyNameMatcher) Given aMatcher
that has been produced by theAbstractConfigurableExtension.matcher(String)
method, returns the relevant property name, ornull
if 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:AbstractConfigurableExtension
Returns aMatcher
given 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
String
that is a configuration property name, likecom.foo.Bar.name.propertyName
, any implementation of this method must return a non-null
Matcher
that is capable of being supplied to theAbstractConfigurableExtension.name(Matcher)
andAbstractConfigurableExtension.propertyName(Matcher)
methods.- Specified by:
matcher
in 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-
null
Matcher
- See Also:
-
name
Description copied from class:AbstractConfigurableExtension
Given aMatcher
that has been produced by theAbstractConfigurableExtension.matcher(String)
method, returns the relevant name.Implementations of this method may return
null
.- Specified by:
name
in classAbstractConfigurableExtension<oracle.ucp.UniversalConnectionPool>
- Parameters:
configPropertyNameMatcher
- aMatcher
produced by theAbstractConfigurableExtension.matcher(String)
method; must not benull
- Returns:
- a name, or
null
- See Also:
-
propertyName
Description copied from class:AbstractConfigurableExtension
Given aMatcher
that has been produced by theAbstractConfigurableExtension.matcher(String)
method, returns the relevant property name, ornull
if 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:
propertyName
in classAbstractConfigurableExtension<oracle.ucp.UniversalConnectionPool>
- Parameters:
configPropertyNameMatcher
- aMatcher
produced 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:AbstractConfigurableExtension
Called 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
AfterBeanDiscovery
container lifecycle event.- Specified by:
addBean
in classAbstractConfigurableExtension<oracle.ucp.UniversalConnectionPool>
- Parameters:
beanConfigurator
- theBeanConfigurator
to use to actually add a new bean; must not benull
name
- aNamed
instance qualifying theT
-typed bean to be added; may benull
properties
- aProperties
instance containing properties relevant to the object; must not benull
- See Also:
-