From 3d19fd013c164c02b8eab21cad9c1f545f6278da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Raymond=20Aug=C3=A9?= Date: Tue, 5 Oct 2021 15:53:57 -0400 Subject: [PATCH] OSGi import/export headers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - element added to silence a complaint from bnd about well formed entries - let bnd generate default manifest spec entries, as well as setting all other headers - added BND SPI annotations to add the necessary parts to make ServiceLoader work in OSGi (passively) fixes #242 Signed-off-by: Raymond Augé --- .gitignore | 5 ++ pom.xml | 54 ++++++++++++++++--- r2dbc-spi-test/pom.xml | 14 ++--- r2dbc-spi/pom.xml | 21 +++++--- .../r2dbc/spi/ConnectionFactoryProvider.java | 7 +++ 5 files changed, 78 insertions(+), 23 deletions(-) diff --git a/.gitignore b/.gitignore index 79f736d..fd996a1 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,11 @@ dependency-reduced-pom.xml buildNumber.properties .mvn/timing.properties +# Eclipse +.project +.classpath +.settings + # IntelliJ out/ build/ diff --git a/pom.xml b/pom.xml index 698aedf..5a6c254 100644 --- a/pom.xml +++ b/pom.xml @@ -41,6 +41,9 @@ 3.0.2 5.7.0 3.17.2 + 6.0.0 + 8.0.0 + 1 UTF-8 UTF-8 1.0.3 @@ -62,18 +65,22 @@ + nebhale Ben Hale bhale@pivotal.io + mp911de Mark Paluch mpaluch@vmware.com + mirromutth Mirro Mutth mirromutth@gmail.com + gregturn Greg Turnquist gturnquist@pivotal.io @@ -106,6 +113,46 @@ + + biz.aQute.bnd + bnd-maven-plugin + ${bnd.version} + + + + bnd-process + + + + + + true + + org.apache.maven.plugins maven-compiler-plugin @@ -129,12 +176,7 @@ 3.2.0 - - true - - - ${project.version} - + ${project.build.outputDirectory}/META-INF/MANIFEST.MF diff --git a/r2dbc-spi-test/pom.xml b/r2dbc-spi-test/pom.xml index e0c3469..5fb1ed2 100644 --- a/r2dbc-spi-test/pom.xml +++ b/r2dbc-spi-test/pom.xml @@ -77,6 +77,10 @@ + + biz.aQute.bnd + bnd-maven-plugin + org.apache.maven.plugins maven-compiler-plugin @@ -84,16 +88,6 @@ org.apache.maven.plugins maven-jar-plugin - - - - true - - - r2dbc.spi.test - - - org.apache.maven.plugins diff --git a/r2dbc-spi/pom.xml b/r2dbc-spi/pom.xml index d63f58b..7824e2d 100644 --- a/r2dbc-spi/pom.xml +++ b/r2dbc-spi/pom.xml @@ -39,6 +39,16 @@ reactive-streams ${reactive-streams.version} + + biz.aQute.bnd + biz.aQute.bnd.annotation + ${bnd.version} + + + org.osgi + osgi.annotation + ${osgi.annotation.version} + com.google.code.findbugs jsr305 @@ -63,6 +73,10 @@ + + biz.aQute.bnd + bnd-maven-plugin + org.apache.maven.plugins maven-compiler-plugin @@ -70,13 +84,6 @@ org.apache.maven.plugins maven-jar-plugin - - - - r2dbc.spi - - - org.apache.maven.plugins diff --git a/r2dbc-spi/src/main/java/io/r2dbc/spi/ConnectionFactoryProvider.java b/r2dbc-spi/src/main/java/io/r2dbc/spi/ConnectionFactoryProvider.java index 6a3dc89..c21a72e 100644 --- a/r2dbc-spi/src/main/java/io/r2dbc/spi/ConnectionFactoryProvider.java +++ b/r2dbc-spi/src/main/java/io/r2dbc/spi/ConnectionFactoryProvider.java @@ -16,8 +16,13 @@ package io.r2dbc.spi; +import static aQute.bnd.annotation.Cardinality.MULTIPLE; +import static aQute.bnd.annotation.Resolution.OPTIONAL; + import java.util.ServiceLoader; +import aQute.bnd.annotation.spi.ServiceConsumer; + /** * A Java Service interface for implementations to examine a collection of {@link ConnectionFactoryOptions} and optionally return an implementation of {@link ConnectionFactory}. *

{@link ConnectionFactoryProvider} implementations are typically discovered by {@link ConnectionFactories} from the class path using {@link ServiceLoader}. @@ -27,6 +32,8 @@ * @see ConnectionFactories * @see ServiceLoader */ +@ServiceConsumer(cardinality = MULTIPLE, effective = "active", value = ConnectionFactoryProvider.class) +@ServiceConsumer(cardinality = MULTIPLE, resolution = OPTIONAL, value = ConnectionFactoryProvider.class) public interface ConnectionFactoryProvider { /**