Skip to content

Commit

Permalink
apply service loader mediator (via bnd annotations), osgi.cdi (via os…
Browse files Browse the repository at this point in the history
…gi bundle annotations) & osgi contracts in a passive way

Signed-off-by: Raymond Augé <raymond.auge@liferay.com>
  • Loading branch information
rotty3000 committed Mar 28, 2020
1 parent e6e7cc3 commit d4c6f2f
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 7 deletions.
22 changes: 18 additions & 4 deletions api/bnd.bnd
Original file line number Diff line number Diff line change
@@ -1,12 +1,26 @@
-exportcontents: \
org.eclipse.microprofile.*

Import-Package: \
javax.enterprise.util;version="[1.1,3)", \
*

Bundle-SymbolicName: org.eclipse.microprofile.config

# For reproducible builds
-noextraheaders: true
-snapshot: SNAPSHOT

-contract: *;effective:=active
-define-contract: \
osgi.contract;\
osgi.contract=JavaCDI;\
version:List<Version>='2.0,1.1';\
uses:='\
javax.decorator,\
javax.enterprise.context,\
javax.enterprise.context.spi,\
javax.enterprise.event,\
javax.enterprise.inject,\
javax.enterprise.inject.spi,\
javax.enterprise.util',\
osgi.contract;\
osgi.contract=JavaInject;\
version:Version='1.0';\
uses:='javax.inject'
20 changes: 19 additions & 1 deletion api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
</parent>

<properties>
<bnd.version>5.0.0</bnd.version>
<bnd.version>5.0.1</bnd.version>
</properties>
<groupId>org.eclipse.microprofile.config</groupId>
<artifactId>microprofile-config-api</artifactId>
Expand All @@ -43,6 +43,24 @@
<version>1.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>biz.aQute.bnd</groupId>
<artifactId>biz.aQute.bnd.annotation</artifactId>
<version>${bnd.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.annotation.bundle</artifactId>
<version>1.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.service.cdi</artifactId>
<version>1.0.0</version>
<scope>provided</scope>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,17 @@
import static java.lang.annotation.ElementType.PARAMETER;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import static org.osgi.annotation.bundle.Requirement.Resolution.OPTIONAL;
import static org.osgi.service.cdi.CDIConstants.CDI_EXTENSION_PROPERTY;

import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import javax.enterprise.util.Nonbinding;
import javax.inject.Qualifier;

import org.osgi.annotation.bundle.Requirement;

/**
* <p>
* Binds the injection point with a configured value.
Expand Down Expand Up @@ -100,6 +104,8 @@
@Qualifier
@Retention(RUNTIME)
@Target({METHOD, FIELD, PARAMETER, TYPE})
@Requirement(namespace = CDI_EXTENSION_PROPERTY, name = "org.eclipse.microprofile.config", effective = "active")
@Requirement(namespace = CDI_EXTENSION_PROPERTY, name = "org.eclipse.microprofile.config", resolution = OPTIONAL)
public @interface ConfigProperty {
String UNCONFIGURED_VALUE="org.eclipse.microprofile.config.configproperty.unconfigureddvalue";
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
*
* @author <a href="mailto:struberg@apache.org">Mark Struberg</a>
* @author <a href="mailto:emijiang@uk.ibm.com">Emily Jiang</a>
*
*
*/
@org.osgi.annotation.versioning.Version("1.0")
@org.osgi.annotation.versioning.Version("1.0.1")
package org.eclipse.microprofile.config.inject;

Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@

import org.eclipse.microprofile.config.Config;

import aQute.bnd.annotation.spi.ServiceConsumer;

/**
* The service provider for implementations of the MicroProfile Configuration specification.
* <p>
Expand All @@ -36,6 +38,7 @@
* @author <a href="mailto:rmannibucau@apache.org">Romain Manni-Bucau</a>
* @author <a href="mailto:emijiang@uk.ibm.com">Emily Jiang</a>
*/
@ServiceConsumer(value = ConfigProviderResolver.class, effective = "active")
public abstract class ConfigProviderResolver {
/**
* Construct a new instance.
Expand Down

0 comments on commit d4c6f2f

Please sign in to comment.