TAMAYA-260 - Beginning alignment to the MicroProfile Config 1.1 spec. - Change the default property name for injection. - Do something with classloader setting (but ignore the field for now) - Clean up pom file.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/commit/4a9c22f6 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/tree/4a9c22f6 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/diff/4a9c22f6 Branch: refs/heads/master Commit: 4a9c22f60e3e6e93c537eab215d00831f8c41f9e Parents: b9841fc Author: John D. Ament <john.d.am...@gmail.com> Authored: Wed Sep 20 23:06:14 2017 -0400 Committer: John Ament <john.am...@spartasystems.com> Committed: Tue Oct 3 13:40:43 2017 -0400 ---------------------------------------------------------------------- microprofile/pom.xml | 58 +++----------------- .../microprofile/MicroprofileConfigBuilder.java | 7 ++- .../cdi/MicroprofileConfigurationProducer.java | 20 ++----- 3 files changed, 18 insertions(+), 67 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/4a9c22f6/microprofile/pom.xml ---------------------------------------------------------------------- diff --git a/microprofile/pom.xml b/microprofile/pom.xml index 37bbb2b..9273e4f 100644 --- a/microprofile/pom.xml +++ b/microprofile/pom.xml @@ -33,17 +33,16 @@ under the License. <properties> <maven.compile.sourceLevel>1.8</maven.compile.sourceLevel> <maven.compile.targetLevel>1.8</maven.compile.targetLevel> - <microprofile.version>1.0</microprofile.version> + <microprofile.config.version>1.1</microprofile.config.version> <geronimo-atinject-1.0-spec.version>1.0</geronimo-atinject-1.0-spec.version> <geronimo-jcdi-1.1-spec.version>1.0</geronimo-jcdi-1.1-spec.version> <version.shrinkwrap.resolvers>2.2.6</version.shrinkwrap.resolvers> - <org.apache.tomcat.version>6.0.53</org.apache.tomcat.version> <tamaya-version>0.4-incubating-SNAPSHOT</tamaya-version> <arquillian.version>1.1.13.Final</arquillian.version> <arquillian-weld-embedded.version>2.0.0.Beta5</arquillian-weld-embedded.version> - <cdi2-api.version>2.0</cdi2-api.version> - <weld-shaded.version>3.0.0.Final</weld-shaded.version> - <weld.version>2.2.7.Final</weld.version> + <cdi-api.version>2.0</cdi-api.version> + <weld-shaded.version>3.0.1.Final</weld-shaded.version> + <weld.version>3.0.1.Final</weld.version> <deltaspike.version>1.1.0</deltaspike.version> <openejb.version>4.7.1</openejb.version> </properties> @@ -84,44 +83,20 @@ under the License. <dependency> <groupId>org.eclipse.microprofile.config</groupId> <artifactId>microprofile-config-api</artifactId> - <version>1.0</version> + <version>${microprofile.config.version}</version> </dependency> <dependency> <groupId>javax.enterprise</groupId> <artifactId>cdi-api</artifactId> - <version>1.2</version> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>org.apache.geronimo.specs</groupId> - <artifactId>geronimo-jcdi_1.1_spec</artifactId> - <version>${geronimo-jcdi-1.1-spec.version}</version> + <version>${cdi-api.version}</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.jboss.weld.se</groupId> - <artifactId>weld-se</artifactId> + <artifactId>weld-se-shaded</artifactId> <version>${weld.version}</version> <scope>test</scope> </dependency> - <dependency> - <groupId>org.apache.deltaspike.cdictrl</groupId> - <artifactId>deltaspike-cdictrl-weld</artifactId> - <version>${deltaspike.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.deltaspike.modules</groupId> - <artifactId>deltaspike-test-control-module-api</artifactId> - <version>${deltaspike.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.deltaspike.modules</groupId> - <artifactId>deltaspike-test-control-module-impl</artifactId> - <version>${deltaspike.version}</version> - <scope>test</scope> - </dependency> <!-- Microprofile TCK support only --> <dependency> <groupId>org.jboss.arquillian.testng</groupId> @@ -142,12 +117,6 @@ under the License. <scope>test</scope> <type>pom</type> </dependency> - <dependency> - <groupId>org.apache.openejb</groupId> - <artifactId>openejb-core</artifactId> - <version>${openejb.version}</version> - <scope>provided</scope> - </dependency> </dependencies> <profiles> @@ -160,13 +129,7 @@ under the License. <dependency> <groupId>org.eclipse.microprofile.config</groupId> <artifactId>microprofile-config-tck</artifactId> - <version>1.0</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.jboss.weld.se</groupId> - <artifactId>weld-se-shaded</artifactId> - <version>${weld-shaded.version}</version> + <version>${microprofile.config.version}</version> <scope>test</scope> </dependency> <dependency> @@ -175,11 +138,6 @@ under the License. <version>${arquillian-weld-embedded.version}</version> <scope>test</scope> </dependency> - <dependency> - <groupId>javax.enterprise</groupId> - <artifactId>cdi-api</artifactId> - <version>${cdi2-api.version}</version> - </dependency> </dependencies> <build> http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/4a9c22f6/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConfigBuilder.java ---------------------------------------------------------------------- diff --git a/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConfigBuilder.java b/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConfigBuilder.java index 7947e63..896311c 100644 --- a/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConfigBuilder.java +++ b/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConfigBuilder.java @@ -39,6 +39,7 @@ import java.util.Objects; final class MicroprofileConfigBuilder implements ConfigBuilder{ private ConfigurationContextBuilder contextBuilder; + private ClassLoader classLoader; MicroprofileConfigBuilder(ConfigurationContextBuilder contextBuilder){ this.contextBuilder = Objects.requireNonNull(contextBuilder); @@ -66,8 +67,7 @@ final class MicroprofileConfigBuilder implements ConfigBuilder{ new SystemPropertySource(400), new EnvironmentPropertySource(300), new MicroprofileDefaultProperties()); - contextBuilder.sortPropertySources(PropertySourceComparator.getInstance() - .setOrdinalKey("config_ordinal")); + contextBuilder.sortPropertySources(PropertySourceComparator.getInstance()); return this; } @@ -106,7 +106,8 @@ final class MicroprofileConfigBuilder implements ConfigBuilder{ @Override public ConfigBuilder forClassLoader(ClassLoader loader) { - return null; + this.classLoader = loader; + return this; } @Override http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/4a9c22f6/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/MicroprofileConfigurationProducer.java ---------------------------------------------------------------------- diff --git a/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/MicroprofileConfigurationProducer.java b/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/MicroprofileConfigurationProducer.java index e3eae2c..a6d8c96 100644 --- a/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/MicroprofileConfigurationProducer.java +++ b/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/MicroprofileConfigurationProducer.java @@ -16,8 +16,10 @@ */ package org.apache.tamaya.microprofile.cdi; -import org.apache.commons.lang.StringUtils; -import org.apache.tamaya.*; +import org.apache.tamaya.ConfigException; +import org.apache.tamaya.Configuration; +import org.apache.tamaya.ConfigurationProvider; +import org.apache.tamaya.TypeLiteral; import org.apache.tamaya.spi.ConversionContext; import org.apache.tamaya.spi.PropertyConverter; import org.eclipse.microprofile.config.Config; @@ -26,12 +28,9 @@ import org.eclipse.microprofile.config.inject.ConfigProperty; import org.eclipse.microprofile.config.spi.ConfigBuilder; import org.eclipse.microprofile.config.spi.ConfigProviderResolver; -import javax.annotation.Priority; import javax.enterprise.context.ApplicationScoped; -import javax.enterprise.context.Dependent; -import javax.enterprise.inject.*; +import javax.enterprise.inject.Produces; import javax.enterprise.inject.spi.InjectionPoint; -import javax.inject.Provider; import java.lang.reflect.AnnotatedElement; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; @@ -39,8 +38,6 @@ import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; -import static org.apache.commons.lang.WordUtils.uncapitalize; - /** * Producer bean for configuration properties. */ @@ -76,12 +73,7 @@ public class MicroprofileConfigurationProducer { static String getDefaultKey(InjectionPoint injectionPoint) { String memberName = injectionPoint.getMember().getName(); - String beanClassNames[] = injectionPoint.getBean().getBeanClass().getName().split("\\$"); - if(beanClassNames.length==1) { - return beanClassNames[0] + "." + uncapitalize(memberName); - }else{ - return beanClassNames[0] + "." + uncapitalize(beanClassNames[1]) + "." + uncapitalize(memberName); - } + return memberName; } static ConversionContext createConversionContext(String key, InjectionPoint injectionPoint) {