Skip to content

Commit

Permalink
Squashable commit; refining; adjusting Hikari extension to fit
Browse files Browse the repository at this point in the history
Signed-off-by: Laird Nelson <laird.nelson@oracle.com>
  • Loading branch information
ljnelson committed Feb 14, 2024
1 parent 13ad00b commit eb4d5ce
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 19 deletions.
5 changes: 0 additions & 5 deletions integrations/cdi/datasource-hikaricp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,6 @@
<artifactId>HikariCP</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.eclipse.microprofile.config</groupId>
<artifactId>microprofile-config-api</artifactId>
<scope>compile</scope>
</dependency>

<!-- Provided-scoped dependencies. -->
<dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2021 Oracle and/or its affiliates.
* Copyright (c) 2018, 2024 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -49,7 +49,6 @@
import jakarta.enterprise.inject.spi.configurator.BeanConfigurator;
import jakarta.enterprise.util.TypeLiteral;
import jakarta.inject.Named;
import org.eclipse.microprofile.config.Config;

/**
* An {@link Extension} that arranges for named {@link DataSource}
Expand Down Expand Up @@ -160,13 +159,13 @@ private void processAnnotatedType(@Observes
if (dataSourceDefinitions != null && !dataSourceDefinitions.isEmpty()) {
for (final DataSourceDefinition dsd : dataSourceDefinitions) {
assert dsd != null;
final Set<String> knownDataSourceNames = this.getDataSourceNames();
final Set<String> knownDataSourceNames = this.names();
assert knownDataSourceNames != null;
final String dataSourceName = dsd.name();
if (!knownDataSourceNames.contains(dataSourceName)) {
final Entry<? extends String, ? extends Properties> entry = toProperties(dsd);
if (entry != null) {
this.putDataSourceProperties(dataSourceName, entry.getValue());
this.put(dataSourceName, entry.getValue());
}
}
}
Expand All @@ -183,8 +182,6 @@ private <T extends DataSource> void processInjectionPoint(@Observes final Proces
if (type instanceof Class && DataSource.class.isAssignableFrom((Class<?>) type)) {
final Set<? extends Annotation> qualifiers = injectionPoint.getQualifiers();
if (qualifiers != null && !qualifiers.isEmpty()) {
final Config config = this.getConfig();
assert config != null;
for (final Annotation qualifier : qualifiers) {
if (qualifier instanceof Named) {
final String dataSourceName = ((Named) qualifier).value();
Expand All @@ -202,10 +199,9 @@ private <T extends DataSource> void processInjectionPoint(@Observes final Proces
// bootstrap here by issuing a
// request for a commonly present
// data source property value.
config.getOptionalValue("javax.sql.DataSource."
+ dataSourceName
+ ".dataSourceClassName",
String.class);
configPropertyValue("javax.sql.DataSource."
+ dataSourceName
+ ".dataSourceClassName");
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2023 Oracle and/or its affiliates.
* Copyright (c) 2020, 2024 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,7 +16,7 @@

/**
* CDI integration for the <a
* href="https://github.com/brettwooldridge/HikariCP/blob/HikariCP-2.7.8/README.md#-hikaricpits-fasterhikari-hikal%C4%93-origin-japanese-light-ray"
* href="https://github.com/brettwooldridge/HikariCP/blob/HikariCP-5.1.0/README.md#-hikaricpits-fasterhikari-hikal%C4%93-origin-japanese-light-ray"
* target="_parent">Hikari connection pool</a>.
*
* @see
Expand All @@ -27,9 +27,8 @@

requires com.zaxxer.hikari;
requires jakarta.annotation;
requires microprofile.config.api;

requires static microprofile.metrics.api;
requires microprofile.metrics.api;

requires transitive io.helidon.integrations.datasource.cdi;
requires transitive jakarta.cdi;
Expand Down

0 comments on commit eb4d5ce

Please sign in to comment.