You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tamaya.apache.org by an...@apache.org on 2015/10/12 08:03:07 UTC
[12/13] incubator-tamaya git commit: TAMAYA-116: CHeckstyle fixes for
cdi module (new).
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/04b3fc5e/modules/integration/cdi-se/src/test/java/org/apache/tamaya/integration/cdi/cfg/ProvidedPropertySource.java
----------------------------------------------------------------------
diff --git a/modules/integration/cdi-se/src/test/java/org/apache/tamaya/integration/cdi/cfg/ProvidedPropertySource.java b/modules/integration/cdi-se/src/test/java/org/apache/tamaya/integration/cdi/cfg/ProvidedPropertySource.java
new file mode 100644
index 0000000..1c383b4
--- /dev/null
+++ b/modules/integration/cdi-se/src/test/java/org/apache/tamaya/integration/cdi/cfg/ProvidedPropertySource.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy current the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.tamaya.integration.cdi.cfg;
+
+import org.apache.tamaya.spi.PropertySource;
+
+import javax.enterprise.inject.Vetoed;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Created by Anatole on 17.09.2015.
+ */
+@Vetoed
+class ProvidedPropertySource implements PropertySource{
+
+ final Map<String,String> config = new HashMap<>();
+
+ public ProvidedPropertySource(){
+ config.put("a.b.c.key3", "keys current a.b.c.key3");
+ config.put("a.b.c.key4", "keys current a.b.c.key4");
+ config.put("{meta}source.type:"+getClass().getName(), "PropertySourceProvider");
+ }
+
+ @Override
+ public int getOrdinal() {
+ return 10;
+ }
+
+ @Override
+ public String getName() {
+ return getClass().getName();
+ }
+
+ @Override
+ public String get(String key) {
+ return config.get(key);
+ }
+
+ @Override
+ public Map<String, String> getProperties() {
+ return config;
+ }
+
+ @Override
+ public boolean isScannable() {
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/04b3fc5e/modules/integration/cdi-se/src/test/java/org/apache/tamaya/integration/cdi/cfg/TestConfigProvider.java
----------------------------------------------------------------------
diff --git a/modules/integration/cdi-se/src/test/java/org/apache/tamaya/integration/cdi/cfg/TestConfigProvider.java b/modules/integration/cdi-se/src/test/java/org/apache/tamaya/integration/cdi/cfg/TestConfigProvider.java
new file mode 100644
index 0000000..7b89fba
--- /dev/null
+++ b/modules/integration/cdi-se/src/test/java/org/apache/tamaya/integration/cdi/cfg/TestConfigProvider.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy current the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tamaya.integration.cdi.cfg;
+
+import org.apache.tamaya.spi.PropertySource;
+import org.apache.tamaya.spi.PropertySourceProvider;
+
+import javax.enterprise.context.ApplicationScoped;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * Created by Anatole on 29.09.2014.
+ */
+@ApplicationScoped
+public class TestConfigProvider implements PropertySourceProvider {
+
+ private List<PropertySource> configs = new ArrayList<>();
+
+ public TestConfigProvider(){
+ configs.add(new ProvidedPropertySource());
+ }
+
+ @Override
+ public Collection<PropertySource> getPropertySources() {
+ return configs;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/04b3fc5e/modules/integration/cdi-se/src/test/java/org/apache/tamaya/integration/cdi/cfg/TestPropertySource.java
----------------------------------------------------------------------
diff --git a/modules/integration/cdi-se/src/test/java/org/apache/tamaya/integration/cdi/cfg/TestPropertySource.java b/modules/integration/cdi-se/src/test/java/org/apache/tamaya/integration/cdi/cfg/TestPropertySource.java
new file mode 100644
index 0000000..1db3d2c
--- /dev/null
+++ b/modules/integration/cdi-se/src/test/java/org/apache/tamaya/integration/cdi/cfg/TestPropertySource.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy current the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.tamaya.integration.cdi.cfg;
+
+import org.apache.tamaya.spi.PropertySource;
+
+import javax.inject.Singleton;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Created by Anatole on 17.09.2015.
+ */
+@Singleton
+public class TestPropertySource implements PropertySource{
+
+ final Map<String,String> config = new HashMap<>();
+
+ public TestPropertySource(){
+ config.put("a.b.c.key1", "keys current a.b.c.key1");
+ config.put("a.b.c.key2", "keys current a.b.c.key2");
+ config.put("a.b.key3", "keys current a.b.key3");
+ config.put("a.b.key4", "keys current a.b.key4");
+ config.put("a.key5", "keys current a.key5");
+ config.put("a.key6", "keys current a.key6");
+ config.put("int1", "123456");
+ config.put("int2", "111222");
+ config.put("testProperty", "testPropertyValue!");
+ config.put("booleanT", "true");
+ config.put("double1", "1234.5678");
+ config.put("BD", "123456789123456789123456789123456789.123456789123456789123456789123456789");
+ config.put("testProperty", "keys current testProperty");
+ config.put("runtimeVersion", "${java.version}");
+ config.put("{meta}source.type:"+getClass().getName(), "PropertySource");
+ }
+
+ @Override
+ public int getOrdinal() {
+ return 10;
+ }
+
+ @Override
+ public String getName() {
+ return getClass().getName();
+ }
+
+ @Override
+ public String get(String key) {
+ return config.get(key);
+ }
+
+ @Override
+ public Map<String, String> getProperties() {
+ return config;
+ }
+
+ @Override
+ public boolean isScannable() {
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/04b3fc5e/modules/integration/cdi-se/src/test/resources/META-INF/beans.xml
----------------------------------------------------------------------
diff --git a/modules/integration/cdi-se/src/test/resources/META-INF/beans.xml b/modules/integration/cdi-se/src/test/resources/META-INF/beans.xml
new file mode 100644
index 0000000..adee378
--- /dev/null
+++ b/modules/integration/cdi-se/src/test/resources/META-INF/beans.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy current the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://jboss.org/schema/cdi/beans_1_0.xsd">
+
+</beans>
+
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/04b3fc5e/modules/integration/cdi/pom.xml
----------------------------------------------------------------------
diff --git a/modules/integration/cdi/pom.xml b/modules/integration/cdi/pom.xml
new file mode 100644
index 0000000..a5206d0
--- /dev/null
+++ b/modules/integration/cdi/pom.xml
@@ -0,0 +1,207 @@
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy current the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.tamaya.ext</groupId>
+ <artifactId>tamaya-integration</artifactId>
+ <version>0.2-incubating-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>tamaya-cdi</artifactId>
+ <name>Apache Tamaya Modules Integration - CDI (Java EE)</name>
+
+ <properties>
+ <owb.version>1.6.2</owb.version>
+ <weld.version>2.2.7.Final</weld.version>
+ <geronimo-jcdi-1.1-spec.version>1.0</geronimo-jcdi-1.1-spec.version>
+ <geronimo-interceptor-1.2-spec.version>1.0</geronimo-interceptor-1.2-spec.version>
+ <geronimo-atinject-1.0-spec.version>1.0</geronimo-atinject-1.0-spec.version>
+ <bval.version>0.5</bval.version>
+ <ds.version>1.1.0</ds.version>
+ <javaee-api.version>6.0-6</javaee-api.version>
+ <openejb.version>4.7.1</openejb.version>
+ <tomee.version>1.7.1</tomee.version>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.jacoco</groupId>
+ <artifactId>jacoco-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>prepare-agent</id>
+ <goals>
+ <goal>prepare-agent</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.hamcrest</groupId>
+ <artifactId>hamcrest-library</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.hamcrest</groupId>
+ <artifactId>hamcrest-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+
+ <dependency>
+ <groupId>org.apache.tamaya</groupId>
+ <artifactId>tamaya-core</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tamaya</groupId>
+ <artifactId>tamaya-api</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.openejb</groupId>
+ <artifactId>javaee-api</artifactId>
+ <version>${javaee-api.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.tomitribe</groupId>
+ <artifactId>tomitribe-util</artifactId>
+ <version>1.1.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.openejb</groupId>
+ <artifactId>openejb-core</artifactId>
+ <version>${openejb.version}</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>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.deltaspike.modules</groupId>
+ <artifactId>deltaspike-test-control-module-api</artifactId>
+ <version>${ds.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.deltaspike.modules</groupId>
+ <artifactId>deltaspike-test-control-module-impl</artifactId>
+ <version>${ds.version}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <profiles>
+ <profile>
+ <id>OWB</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <dependencies>
+ <!-- OWB specific dependencies-->
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-atinject_1.0_spec</artifactId>
+ <version>${geronimo-atinject-1.0-spec.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-interceptor_1.2_spec</artifactId>
+ <version>${geronimo-interceptor-1.2-spec.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-annotation_1.2_spec</artifactId>
+ <version>1.0.MR2-SNAPSHOT</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-el_2.2_spec</artifactId>
+ <version>1.0.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-impl</artifactId>
+ <version>${owb.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-spi</artifactId>
+ <version>${owb.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-resource</artifactId>
+ <version>${owb.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.bval</groupId>
+ <artifactId>bval-jsr303</artifactId>
+ <version>${bval.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.deltaspike.cdictrl</groupId>
+ <artifactId>deltaspike-cdictrl-owb</artifactId>
+ <version>${ds.version}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+ <profile>
+ <id>Weld</id>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.weld.se</groupId>
+ <artifactId>weld-se</artifactId>
+ <version>${weld.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.deltaspike.cdictrl</groupId>
+ <artifactId>deltaspike-cdictrl-weld</artifactId>
+ <version>${ds.version}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+ </profiles>
+</project>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/04b3fc5e/modules/integration/cdi/src/main/java/org/apache/tamaya/integration/cdi/ConfigDefault.java
----------------------------------------------------------------------
diff --git a/modules/integration/cdi/src/main/java/org/apache/tamaya/integration/cdi/ConfigDefault.java b/modules/integration/cdi/src/main/java/org/apache/tamaya/integration/cdi/ConfigDefault.java
new file mode 100644
index 0000000..2a28b32
--- /dev/null
+++ b/modules/integration/cdi/src/main/java/org/apache/tamaya/integration/cdi/ConfigDefault.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tamaya.integration.cdi;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation to define a default keys to be returned, when no configured keys could be
+ * determined for a property/template accessor. The keys hereby can also contain a
+ * dynamic expression that is evaluated by the configuration system.
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(value = { ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER })
+public @interface ConfigDefault {
+
+ /**
+ * The default keys to be injected, if no such configuration entry was found. If keys was found and no default
+ * is defined, it is handled as a deployment error.
+ */
+ String value() default "";
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/04b3fc5e/modules/integration/cdi/src/main/java/org/apache/tamaya/integration/cdi/ConfigDefaultSections.java
----------------------------------------------------------------------
diff --git a/modules/integration/cdi/src/main/java/org/apache/tamaya/integration/cdi/ConfigDefaultSections.java b/modules/integration/cdi/src/main/java/org/apache/tamaya/integration/cdi/ConfigDefaultSections.java
new file mode 100644
index 0000000..6f20130
--- /dev/null
+++ b/modules/integration/cdi/src/main/java/org/apache/tamaya/integration/cdi/ConfigDefaultSections.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tamaya.integration.cdi;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation to control injection and resolution current a configured bean. The configuration keys
+ * to be resolved are basically determined by the {@link org.apache.tamaya.inject.ConfigProperty}
+ * annotation(s). Nevertheless these annotations can also have relative key names. This annotation allows
+ * to define a configuration area that is prefixed to all relative configuration keys within the
+ * corresponding class/template interface.
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(value = { ElementType.TYPE })
+public @interface ConfigDefaultSections {
+
+ /**
+ * Allows to declare an section names that are prepended to resolve relative configuration keys.
+ * @return the section names to used for key resolution.
+ */
+ String[] value() default {};
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/04b3fc5e/modules/integration/cdi/src/main/java/org/apache/tamaya/integration/cdi/ConfigProperty.java
----------------------------------------------------------------------
diff --git a/modules/integration/cdi/src/main/java/org/apache/tamaya/integration/cdi/ConfigProperty.java b/modules/integration/cdi/src/main/java/org/apache/tamaya/integration/cdi/ConfigProperty.java
new file mode 100644
index 0000000..686e63f
--- /dev/null
+++ b/modules/integration/cdi/src/main/java/org/apache/tamaya/integration/cdi/ConfigProperty.java
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tamaya.integration.cdi;
+
+
+import javax.enterprise.util.Nonbinding;
+import javax.inject.Qualifier;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation to enable injection current a configured property or define the returned data for
+ * a configuration template method. Hereby this annotation can be used in multiple ways and combined
+ * with other annotations such as {@link ConfigDefault}, {@link WithConfigOperator}, {@link WithPropertyConverter}.
+ *
+ * Below the most simple variant current a configured class is given:
+ * {@code
+ * pubic class ConfiguredItem{
+ *
+ * @ConfiguredProperty
+ * private String aValue;
+ * }
+ * When this class is configured, e.g. by passing it to {@link org.apache.tamaya.Configuration#configure(Object)},
+ * the following is happening:
+ * <ul>
+ * <li>The current valid Configuration is evaluated by calling {@code Configuration cfg = ConfigurationProvider.getConfiguration();}</li>
+ * <li>The current possible property keys are evaluated by calling {@code cfg.get("aValue");}</li>
+ * <li>if not successful, and a @ConfigDefault annotation is present, the default value is used.
+ * <li>If no value could be evaluated a ({@link org.apache.tamaya.ConfigException} is thrown.</li>
+ * <li>On success, since no type conversion is involved, the value is injected.</li>
+ * </ul>
+ *
+ * In the next example we explicitly define the property keys:
+ * {@code
+ * @ConfigDefaultSections("section1")
+ * pubic class ConfiguredItem{
+ *
+ * @ConfiguredProperty({"b", "[a.b.deprecated.keys]", "a"})
+ * @ConfigDefault("myDefaultValue")
+ * private String aValue;
+ * }
+ *
+ * Within this example we evaluate multiple possible keys (section1.b, a.b.deprecated.keys, section1.a). Evaluation is
+ * aborted if a key could be successfully resolved. Hereby the ordering current the annotations define the ordering
+ * current resolution, so in the example above
+ * resolution equals to {@code "section1.b", "a.b.deprecated.keys", "section1.a"}. If no value has bee found,
+ * the configured default {@code myDefaultValue} is returned.
+ */
+@Qualifier
+@Retention(RetentionPolicy.RUNTIME)
+@Target(value = { ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER })
+public @interface ConfigProperty {
+
+ /**
+ * Get the property names to be used. Hereby the first non null keys evaluated is injected as property keys.
+ *
+ * @return the property names, not null. If missing the field or method name being injected is used by default.
+ */
+ @Nonbinding
+ String[] value() default {};
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/04b3fc5e/modules/integration/cdi/src/main/java/org/apache/tamaya/integration/cdi/ConfigurationExtension.java
----------------------------------------------------------------------
diff --git a/modules/integration/cdi/src/main/java/org/apache/tamaya/integration/cdi/ConfigurationExtension.java b/modules/integration/cdi/src/main/java/org/apache/tamaya/integration/cdi/ConfigurationExtension.java
new file mode 100644
index 0000000..65e0433
--- /dev/null
+++ b/modules/integration/cdi/src/main/java/org/apache/tamaya/integration/cdi/ConfigurationExtension.java
@@ -0,0 +1,258 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tamaya.integration.cdi;
+
+import org.apache.tamaya.ConfigException;
+import org.apache.tamaya.ConfigOperator;
+import org.apache.tamaya.Configuration;
+import org.apache.tamaya.ConfigurationProvider;
+import org.apache.tamaya.spi.PropertyConverter;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.AfterBeanDiscovery;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.Extension;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.inject.spi.ProcessBean;
+import javax.enterprise.inject.spi.ProcessProducerMethod;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * CDI Extension module that adds injection mechanism for configuration.
+ *
+ * @see ConfigProperty
+ * @see ConfigDefault
+ * @see org.apache.tamaya.integration.cdi.ConfigDefaultSections
+ * @see ConfigException
+ */
+public class ConfigurationExtension implements Extension {
+
+ static final Map<Class, ConfigOperator> CUSTOM_OPERATORS = new ConcurrentHashMap<>();
+ static final Map<Class, PropertyConverter> CUSTOM_CONVERTERS = new ConcurrentHashMap<>();
+
+ /**
+ * Internally used conversion bean.
+ */
+ private static class ConverterBean implements Bean<Object> {
+
+ private final Bean<Object> delegate;
+ private final Set<Type> types;
+
+ public ConverterBean(final Bean convBean, final Set<Type> types) {
+ this.types = types;
+ this.delegate = convBean;
+ }
+
+ @Override
+ public Set<Type> getTypes() {
+ return types;
+ }
+
+ @Override
+ public Class<?> getBeanClass() {
+ return delegate.getBeanClass();
+ }
+
+ @Override
+ public Set<InjectionPoint> getInjectionPoints() {
+ return delegate.getInjectionPoints();
+ }
+
+ @Override
+ public String getName() {
+ return delegate.getName();
+ }
+
+ @Override
+ public Set<Annotation> getQualifiers() {
+ return delegate.getQualifiers();
+ }
+
+ @Override
+ public Class<? extends Annotation> getScope() {
+ return delegate.getScope();
+ }
+
+ @Override
+ public Set<Class<? extends Annotation>> getStereotypes() {
+ return delegate.getStereotypes();
+ }
+
+ @Override
+ public boolean isAlternative() {
+ return delegate.isAlternative();
+ }
+
+ @Override
+ public boolean isNullable() {
+ return delegate.isNullable();
+ }
+
+ @Override
+ public Object create(CreationalContext<Object> creationalContext) {
+ return delegate.create(creationalContext);
+ }
+
+ @Override
+ public void destroy(Object instance, CreationalContext<Object> creationalContext) {
+ delegate.destroy(instance, creationalContext);
+ }
+ }
+
+ private Set<Type> types = new HashSet<>();
+ private Bean<?> convBean;
+
+ /**
+ * Method that checks the configuration injection points during deployment for available configuration.
+ * @param pb the bean to process.
+ */
+ public void retrieveTypes(@Observes final ProcessBean<?> pb) {
+
+ final Set<InjectionPoint> ips = pb.getBean().getInjectionPoints();
+
+ for (InjectionPoint injectionPoint : ips) {
+ if (injectionPoint.getAnnotated().isAnnotationPresent(ConfigProperty.class)) {
+ final ConfigProperty annotation = injectionPoint.getAnnotated().getAnnotation(ConfigProperty.class);
+ final ConfigDefault defaultAnnot = injectionPoint.getAnnotated().getAnnotation(ConfigDefault.class);
+ final ConfigDefaultSections typeAnnot = injectionPoint.getAnnotated().getAnnotation(ConfigDefaultSections.class);
+ final List<String> keys = evaluateKeys(injectionPoint.getMember().getName(), annotation.value(), typeAnnot.value());
+
+ final WithConfigOperator withOperatorAnnot = injectionPoint.getAnnotated().getAnnotation(WithConfigOperator.class);
+ if(withOperatorAnnot!=null){
+ tryLoadOpererator(withOperatorAnnot.value());
+ }
+ final WithPropertyConverter withConverterAnnot = injectionPoint.getAnnotated().getAnnotation(WithPropertyConverter.class);
+ if(withConverterAnnot!=null){
+ tryLoadConverter(withConverterAnnot.value());
+ }
+
+ // We don't want to wait until the injection really fails at runtime.
+ // If there is a non resolvable configuration, we want to know at startup.
+ Configuration config = ConfigurationProvider.getConfiguration();
+ String keyFound = null;
+ String value = null;
+ for(String key:keys) {
+ value = config.get(key);
+ if(value!=null){
+ keyFound = key;
+ break;
+ }
+ }
+ if(value==null && defaultAnnot!=null){
+ value = defaultAnnot.value();
+ }
+ if(value==null){
+ throw new ConfigException(String.format(
+ "Can't resolve any of the possible config keys: %s. Please provide one of the given keys" +
+ "with a value in your configuration sources.",
+ keys.toString()));
+ }
+ types.add(injectionPoint.getType());
+ }
+ }
+ }
+
+ private void tryLoadOpererator(Class<? extends ConfigOperator> operatorClass) {
+ Objects.requireNonNull(operatorClass);
+ if(ConfigOperator.class == operatorClass){
+ return;
+ }
+ try{
+ if(!CUSTOM_OPERATORS.containsKey(operatorClass)) {
+ CUSTOM_OPERATORS.put(operatorClass, operatorClass.newInstance());
+ }
+ } catch(Exception e){
+ throw new ConfigException("Custom ConfigOperator could not be loaded: " + operatorClass.getName(), e);
+ }
+ }
+
+ private void tryLoadConverter(Class<? extends PropertyConverter> converterClass) {
+ Objects.requireNonNull(converterClass);
+ if(PropertyConverter.class == converterClass){
+ return;
+ }
+ try{
+ if(!CUSTOM_CONVERTERS.containsKey(converterClass)) {
+ CUSTOM_CONVERTERS.put(converterClass, converterClass.newInstance());
+ }
+ } catch(Exception e){
+ throw new ConfigException("Custom PropertyConverter could not be loaded: " + converterClass.getName(), e);
+ }
+ }
+
+ /**
+ * Evaluates the effective keys to be used. if no {@code keys} are defined, {@code memberName} is used.
+ * The effective keys are then combined with the sections given (if any) and only, if the given keys are not
+ * absolute keys (surrounded by brackets).
+ * @param memberName the default member name, not null.
+ * @param keys the keys, may be empty, but not null.
+ * @param sections the default sections, may be empty. May also be null.
+ * @return the list of keys to be finally used for configuration resolution in order of
+ * precedence. The first keys in the list that could be successfully resolved define the final
+ * configuration value.
+ */
+ public static List<String> evaluateKeys(String memberName, String[] keys, String[] sections) {
+ List<String> effKeys = new ArrayList<>(Arrays.asList(keys));
+ if (effKeys.isEmpty()) {
+ effKeys.add(memberName);
+ }
+ ListIterator<String> iterator = effKeys.listIterator();
+ while (iterator.hasNext()) {
+ String next = iterator.next();
+ if (next.startsWith("[") && next.endsWith("]")) {
+ // absolute key, strip away brackets, take key as is
+ iterator.set(next.substring(1, next.length() - 1));
+ } else {
+ if (sections != null && sections.length>0) {
+ // Remove original entry, since it will be replaced with prefixed entries
+ iterator.remove();
+ // Add prefixed entries, including absolute (root) entry for "" area keys.
+ for (String area : sections) {
+ iterator.add(area.isEmpty() ? next : area + '.' + next);
+ }
+ }
+ }
+ }
+ return effKeys;
+ }
+
+
+ public void captureConvertBean(@Observes final ProcessProducerMethod<?, ?> ppm) {
+ if (ppm.getAnnotated().isAnnotationPresent(ConfigProperty.class)) {
+ convBean = ppm.getBean();
+ }
+
+ }
+
+ public void addConverter(@Observes final AfterBeanDiscovery abd, final BeanManager bm) {
+ abd.addBean(new ConverterBean(convBean, types));
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/04b3fc5e/modules/integration/cdi/src/main/java/org/apache/tamaya/integration/cdi/ConfigurationProducer.java
----------------------------------------------------------------------
diff --git a/modules/integration/cdi/src/main/java/org/apache/tamaya/integration/cdi/ConfigurationProducer.java b/modules/integration/cdi/src/main/java/org/apache/tamaya/integration/cdi/ConfigurationProducer.java
new file mode 100644
index 0000000..c537df3
--- /dev/null
+++ b/modules/integration/cdi/src/main/java/org/apache/tamaya/integration/cdi/ConfigurationProducer.java
@@ -0,0 +1,117 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tamaya.integration.cdi;
+
+import org.apache.tamaya.ConfigException;
+import org.apache.tamaya.ConfigOperator;
+import org.apache.tamaya.Configuration;
+import org.apache.tamaya.ConfigurationProvider;
+import org.apache.tamaya.TypeLiteral;
+import org.apache.tamaya.spi.PropertyConverter;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.InjectionPoint;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * Producer bean for configuration properties.
+ */
+@ApplicationScoped
+public class ConfigurationProducer {
+
+ private static final Logger LOGGER = Logger.getLogger(ConfigurationProducer.class.getName());
+
+ @Produces
+ @ConfigProperty
+ public Object resolveAndConvert(final InjectionPoint injectionPoint) {
+
+ final ConfigProperty annotation = injectionPoint.getAnnotated().getAnnotation(ConfigProperty.class);
+ final ConfigDefault defaultAnnot = injectionPoint.getAnnotated().getAnnotation(ConfigDefault.class);
+ final ConfigDefaultSections typeAnnot = injectionPoint.getAnnotated().getAnnotation(ConfigDefaultSections.class);
+ final List<String> keys = ConfigurationExtension.evaluateKeys(injectionPoint.getMember().getName(), annotation.value(), typeAnnot.value());
+
+ final WithConfigOperator withOperatorAnnot = injectionPoint.getAnnotated().getAnnotation(WithConfigOperator.class);
+ ConfigOperator operator = null;
+ if(withOperatorAnnot!=null){
+ operator = ConfigurationExtension.CUSTOM_OPERATORS.get(withOperatorAnnot.value());
+ }
+ PropertyConverter customCnverter = null;
+ final WithPropertyConverter withConverterAnnot = injectionPoint.getAnnotated().getAnnotation(WithPropertyConverter.class);
+ if(withConverterAnnot!=null){
+ customCnverter = ConfigurationExtension.CUSTOM_CONVERTERS.get(withConverterAnnot.value());
+ }
+
+ // unless the extension is not installed, this should never happen because the extension
+ // enforces the resolvability of the config
+ Configuration config = ConfigurationProvider.getConfiguration();
+ if(operator!=null){
+ config = operator.operate(config);
+ }
+ final Class<?> toType = (Class<?>) injectionPoint.getAnnotated().getBaseType();
+ String textValue = null;
+ String defaultTextValue = defaultAnnot!=null?defaultAnnot.value():null;
+ String keyFound = null;
+ for(String key:keys) {
+ textValue = config.get(key);
+ if(textValue!=null){
+ keyFound = key;
+ break;
+ }
+ }
+ Object value = null;
+ if(keyFound!=null){
+ if(customCnverter!=null) {
+ value = customCnverter.convert(textValue);
+ }
+ if(value==null){
+ value = config.get(keyFound, toType);
+ }
+ } else if(defaultTextValue!=null){
+ if(customCnverter!=null) {
+ value = customCnverter.convert(defaultTextValue);
+ }
+ if(value==null) {
+ List<PropertyConverter<Object>> converters = ConfigurationProvider.getConfigurationContext()
+ .getPropertyConverters(TypeLiteral.of(toType));
+ for (PropertyConverter<Object> converter : converters) {
+ try {
+ value = converter.convert(defaultTextValue);
+ if (value != null) {
+ LOGGER.log(Level.FINEST, "Parsed default value from '" + defaultTextValue + "' into " +
+ injectionPoint);
+ break;
+ }
+ } catch (Exception e) {
+ LOGGER.log(Level.FINEST, "Failed to convert default value '" + defaultTextValue + "' for " +
+ injectionPoint, e);
+ }
+ }
+ }
+ }
+ if(value==null){
+ throw new ConfigException(String.format(
+ "Can't resolve any of the possible config keys: %s to the required target type: %s",
+ keys.toString(), toType.getName()));
+ }
+ LOGGER.finest(String.format("Injecting %s for key %s in class %s", keyFound, value.toString(), injectionPoint.toString()));
+ return value;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/04b3fc5e/modules/integration/cdi/src/main/java/org/apache/tamaya/integration/cdi/WithConfigOperator.java
----------------------------------------------------------------------
diff --git a/modules/integration/cdi/src/main/java/org/apache/tamaya/integration/cdi/WithConfigOperator.java b/modules/integration/cdi/src/main/java/org/apache/tamaya/integration/cdi/WithConfigOperator.java
new file mode 100644
index 0000000..f97524a
--- /dev/null
+++ b/modules/integration/cdi/src/main/java/org/apache/tamaya/integration/cdi/WithConfigOperator.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tamaya.integration.cdi;
+
+import org.apache.tamaya.ConfigOperator;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation to define an configuration operator to be used before accessing a configured keys.
+ * This allows filtering current configuration, e.g. for realizing views or ensuring security
+ * constraints.
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(value = {ElementType.TYPE, ElementType.METHOD, ElementType.PARAMETER})
+public @interface WithConfigOperator {
+
+ /**
+ * Define a custom adapter that should be used to adapt the configuration entry injected. This overrides any
+ * general org.apache.tamaya.core.internal registered. If no adapter is defined (default) and no corresponding adapter is
+ * registered, it is handled as a deployment error.
+ */
+ Class<? extends ConfigOperator> value();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/04b3fc5e/modules/integration/cdi/src/main/java/org/apache/tamaya/integration/cdi/WithPropertyConverter.java
----------------------------------------------------------------------
diff --git a/modules/integration/cdi/src/main/java/org/apache/tamaya/integration/cdi/WithPropertyConverter.java b/modules/integration/cdi/src/main/java/org/apache/tamaya/integration/cdi/WithPropertyConverter.java
new file mode 100644
index 0000000..dbc9d33
--- /dev/null
+++ b/modules/integration/cdi/src/main/java/org/apache/tamaya/integration/cdi/WithPropertyConverter.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tamaya.integration.cdi;
+
+
+import org.apache.tamaya.spi.PropertyConverter;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation to define a type adapter to be used before injecting a configured keys, or for applying changes.
+ * This will override any other adapter for performing the type conversion before
+ * injecting the field keys.
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(value = {ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})
+public @interface WithPropertyConverter {
+
+ /**
+ * Define a custom adapter or codec that should be used to adapt the configuration entry injected. This overrides any
+ * general org.apache.tamaya.core.internal registered. If no adapter is defined (default) and no corresponding adapter is
+ * registered, it is handled as a deployment error.
+ */
+ Class<? extends PropertyConverter<?>> value();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/04b3fc5e/modules/integration/cdi/src/main/java/org/apache/tamaya/integration/cdi2/ConfigDefault.java
----------------------------------------------------------------------
diff --git a/modules/integration/cdi/src/main/java/org/apache/tamaya/integration/cdi2/ConfigDefault.java b/modules/integration/cdi/src/main/java/org/apache/tamaya/integration/cdi2/ConfigDefault.java
deleted file mode 100644
index 420f1fd..0000000
--- a/modules/integration/cdi/src/main/java/org/apache/tamaya/integration/cdi2/ConfigDefault.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya.integration.cdi2;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Annotation to define a default keys to be returned, when no configured keys could be
- * determined for a property/template accessor. The keys hereby can also contain a
- * dynamic expression that is evaluated by the configuration system.
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(value = { ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER })
-public @interface ConfigDefault {
-
- /**
- * The default keys to be injected, if no such configuration entry was found. If keys was found and no default
- * is defined, it is handled as a deployment error.
- */
- String value() default "";
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/04b3fc5e/modules/integration/cdi/src/main/java/org/apache/tamaya/integration/cdi2/ConfigDefaultSections.java
----------------------------------------------------------------------
diff --git a/modules/integration/cdi/src/main/java/org/apache/tamaya/integration/cdi2/ConfigDefaultSections.java b/modules/integration/cdi/src/main/java/org/apache/tamaya/integration/cdi2/ConfigDefaultSections.java
deleted file mode 100644
index e6b5ba2..0000000
--- a/modules/integration/cdi/src/main/java/org/apache/tamaya/integration/cdi2/ConfigDefaultSections.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya.integration.cdi2;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Annotation to control injection and resolution current a configured bean. The configuration keys
- * to be resolved are basically determined by the {@link org.apache.tamaya.inject.ConfigProperty}
- * annotation(s). Nevertheless these annotations can also have relative key names. This annotation allows
- * to define a configuration area that is prefixed to all relative configuration keys within the
- * corresponding class/template interface.
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(value = { ElementType.TYPE })
-public @interface ConfigDefaultSections {
-
- /**
- * Allows to declare an section names that are prepended to resolve relative configuration keys.
- * @return the section names to used for key resolution.
- */
- String[] value() default {};
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/04b3fc5e/modules/integration/cdi/src/main/java/org/apache/tamaya/integration/cdi2/ConfigProperty.java
----------------------------------------------------------------------
diff --git a/modules/integration/cdi/src/main/java/org/apache/tamaya/integration/cdi2/ConfigProperty.java b/modules/integration/cdi/src/main/java/org/apache/tamaya/integration/cdi2/ConfigProperty.java
deleted file mode 100644
index 4077fce..0000000
--- a/modules/integration/cdi/src/main/java/org/apache/tamaya/integration/cdi2/ConfigProperty.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya.integration.cdi2;
-
-
-import javax.enterprise.util.Nonbinding;
-import javax.inject.Qualifier;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Annotation to enable injection current a configured property or define the returned data for
- * a configuration template method. Hereby this annotation can be used in multiple ways and combined
- * with other annotations such as {@link ConfigDefault}, {@link WithConfigOperator}, {@link WithPropertyConverter}.
- *
- * Below the most simple variant current a configured class is given:
- * {@code
- * pubic class ConfiguredItem{
- *
- * @ConfiguredProperty
- * private String aValue;
- * }
- * When this class is configured, e.g. by passing it to {@link org.apache.tamaya.Configuration#configure(Object)},
- * the following is happening:
- * <ul>
- * <li>The current valid Configuration is evaluated by calling {@code Configuration cfg = ConfigurationProvider.getConfiguration();}</li>
- * <li>The current possible property keys are evaluated by calling {@code cfg.get("aValue");}</li>
- * <li>if not successful, and a @ConfigDefault annotation is present, the default value is used.
- * <li>If no value could be evaluated a ({@link org.apache.tamaya.ConfigException} is thrown.</li>
- * <li>On success, since no type conversion is involved, the value is injected.</li>
- * </ul>
- *
- * In the next example we explicitly define the property keys:
- * {@code
- * @ConfigDefaultSections("section1")
- * pubic class ConfiguredItem{
- *
- * @ConfiguredProperty({"b", "[a.b.deprecated.keys]", "a"})
- * @ConfigDefault("myDefaultValue")
- * private String aValue;
- * }
- *
- * Within this example we evaluate multiple possible keys (section1.b, a.b.deprecated.keys, section1.a). Evaluation is
- * aborted if a key could be successfully resolved. Hereby the ordering current the annotations define the ordering
- * current resolution, so in the example above
- * resolution equals to {@code "section1.b", "a.b.deprecated.keys", "section1.a"}. If no value has bee found,
- * the configured default {@code myDefaultValue} is returned.
- */
-@Qualifier
-@Retention(RetentionPolicy.RUNTIME)
-@Target(value = { ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER })
-public @interface ConfigProperty {
-
- /**
- * Get the property names to be used. Hereby the first non null keys evaluated is injected as property keys.
- *
- * @return the property names, not null. If missing the field or method name being injected is used by default.
- */
- @Nonbinding
- String[] value() default {};
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/04b3fc5e/modules/integration/cdi/src/main/java/org/apache/tamaya/integration/cdi2/ConfigurationExtension.java
----------------------------------------------------------------------
diff --git a/modules/integration/cdi/src/main/java/org/apache/tamaya/integration/cdi2/ConfigurationExtension.java b/modules/integration/cdi/src/main/java/org/apache/tamaya/integration/cdi2/ConfigurationExtension.java
deleted file mode 100644
index ffec5d1..0000000
--- a/modules/integration/cdi/src/main/java/org/apache/tamaya/integration/cdi2/ConfigurationExtension.java
+++ /dev/null
@@ -1,257 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tamaya.integration.cdi2;
-
-import org.apache.tamaya.ConfigException;
-import org.apache.tamaya.ConfigOperator;
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.ConfigurationProvider;
-import org.apache.tamaya.spi.PropertyConverter;
-
-import javax.enterprise.context.spi.CreationalContext;
-import javax.enterprise.event.Observes;
-import javax.enterprise.inject.spi.AfterBeanDiscovery;
-import javax.enterprise.inject.spi.Bean;
-import javax.enterprise.inject.spi.BeanManager;
-import javax.enterprise.inject.spi.Extension;
-import javax.enterprise.inject.spi.InjectionPoint;
-import javax.enterprise.inject.spi.ProcessBean;
-import javax.enterprise.inject.spi.ProcessProducerMethod;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-
-/**
- * CDI Extension module that adds injection mechanism for configuration.
- *
- * @see ConfigProperty
- * @see ConfigDefault
- * @see org.apache.tamaya.integration.cdi2.ConfigDefaultSections
- * @see ConfigException
- */
-public class ConfigurationExtension implements Extension {
-
- static final Map<Class, ConfigOperator> CUSTOM_OPERATORS = new ConcurrentHashMap<>();
- static final Map<Class, PropertyConverter> CUSTOM_CONVERTERS = new ConcurrentHashMap<>();
-
- private static class ConverterBean implements Bean<Object> {
-
- private final Bean<Object> delegate;
- private final Set<Type> types;
-
- public ConverterBean(final Bean convBean, final Set<Type> types) {
- this.types = types;
- this.delegate = convBean;
- }
-
- @Override
- public Set<Type> getTypes() {
- return types;
- }
-
- @Override
- public Class<?> getBeanClass() {
- return delegate.getBeanClass();
- }
-
- @Override
- public Set<InjectionPoint> getInjectionPoints() {
- return delegate.getInjectionPoints();
- }
-
- @Override
- public String getName() {
- return delegate.getName();
- }
-
- @Override
- public Set<Annotation> getQualifiers() {
- return delegate.getQualifiers();
- }
-
- @Override
- public Class<? extends Annotation> getScope() {
- return delegate.getScope();
- }
-
- @Override
- public Set<Class<? extends Annotation>> getStereotypes() {
- return delegate.getStereotypes();
- }
-
- @Override
- public boolean isAlternative() {
- return delegate.isAlternative();
- }
-
- @Override
- public boolean isNullable() {
- return delegate.isNullable();
- }
-
- @Override
- public Object create(CreationalContext<Object> creationalContext) {
- return delegate.create(creationalContext);
- }
-
- @Override
- public void destroy(Object instance, CreationalContext<Object> creationalContext) {
- delegate.destroy(instance, creationalContext);
- }
- }
-
- private Set<Type> types = new HashSet<>();
- private Bean<?> convBean;
-
- /**
- * Method that checks the configuration injection points during deployment for available configuration.
- * @param pb the bean to process.
- */
- public void retrieveTypes(@Observes final ProcessBean<?> pb) {
-
- final Set<InjectionPoint> ips = pb.getBean().getInjectionPoints();
-
- for (InjectionPoint injectionPoint : ips) {
- if (injectionPoint.getAnnotated().isAnnotationPresent(ConfigProperty.class)) {
- final ConfigProperty annotation = injectionPoint.getAnnotated().getAnnotation(ConfigProperty.class);
- final ConfigDefault defaultAnnot = injectionPoint.getAnnotated().getAnnotation(ConfigDefault.class);
- final ConfigDefaultSections typeAnnot = injectionPoint.getAnnotated().getAnnotation(ConfigDefaultSections.class);
- final List<String> keys = evaluateKeys(injectionPoint.getMember().getName(), annotation.value(), typeAnnot.value());
-
- final WithConfigOperator withOperatorAnnot = injectionPoint.getAnnotated().getAnnotation(WithConfigOperator.class);
- if(withOperatorAnnot!=null){
- tryLoadOpererator(withOperatorAnnot.value());
- }
- final WithPropertyConverter withConverterAnnot = injectionPoint.getAnnotated().getAnnotation(WithPropertyConverter.class);
- if(withConverterAnnot!=null){
- tryLoadConverter(withConverterAnnot.value());
- }
-
- // We don't want to wait until the injection really fails at runtime.
- // If there is a non resolvable configuration, we want to know at startup.
- Configuration config = ConfigurationProvider.getConfiguration();
- String keyFound = null;
- String value = null;
- for(String key:keys) {
- value = config.get(key);
- if(value!=null){
- keyFound = key;
- break;
- }
- }
- if(value==null && defaultAnnot!=null){
- value = defaultAnnot.value();
- }
- if(value==null){
- throw new ConfigException(String.format(
- "Can't resolve any of the possible config keys: %s. Please provide one of the given keys" +
- "with a value in your configuration sources.",
- keys.toString()));
- }
- types.add(injectionPoint.getType());
- }
- }
- }
-
- private void tryLoadOpererator(Class<? extends ConfigOperator> operatorClass) {
- Objects.requireNonNull(operatorClass);
- if(ConfigOperator.class == operatorClass){
- return;
- }
- try{
- if(!CUSTOM_OPERATORS.containsKey(operatorClass)) {
- CUSTOM_OPERATORS.put(operatorClass, operatorClass.newInstance());
- }
- }
- catch(Exception e){
- throw new ConfigException("Custom ConfigOperator could not be loaded: " + operatorClass.getName(), e);
- }
- }
-
- private void tryLoadConverter(Class<? extends PropertyConverter> converterClass) {
- Objects.requireNonNull(converterClass);
- if(PropertyConverter.class == converterClass){
- return;
- }
- try{
- if(!CUSTOM_CONVERTERS.containsKey(converterClass)) {
- CUSTOM_CONVERTERS.put(converterClass, converterClass.newInstance());
- }
- }
- catch(Exception e){
- throw new ConfigException("Custom PropertyConverter could not be loaded: " + converterClass.getName(), e);
- }
- }
-
- /**
- * Evaluates the effective keys to be used. if no {@code keys} are defined, {@code memberName} is used.
- * The effective keys are then combined with the sections given (if any) and only, if the given keys are not
- * absolute keys (surrounded by brackets).
- * @param memberName the default member name, not null.
- * @param keys the keys, may be empty, but not null.
- * @param sections the default sections, may be empty. May also be null.
- * @return the list of keys to be finally used for configuration resolution in order of
- * precedence. The first keys in the list that could be successfully resolved define the final
- * configuration value.
- */
- public static List<String> evaluateKeys(String memberName, String[] keys, String[] sections) {
- List<String> effKeys = new ArrayList<>(Arrays.asList(keys));
- if (effKeys.isEmpty()) {
- effKeys.add(memberName);
- }
- ListIterator<String> iterator = effKeys.listIterator();
- while (iterator.hasNext()) {
- String next = iterator.next();
- if (next.startsWith("[") && next.endsWith("]")) {
- // absolute key, strip away brackets, take key as is
- iterator.set(next.substring(1, next.length() - 1));
- } else {
- if (sections != null && sections.length>0) {
- // Remove original entry, since it will be replaced with prefixed entries
- iterator.remove();
- // Add prefixed entries, including absolute (root) entry for "" area keys.
- for (String area : sections) {
- iterator.add(area.isEmpty() ? next : area + '.' + next);
- }
- }
- }
- }
- return effKeys;
- }
-
-
- public void captureConvertBean(@Observes final ProcessProducerMethod<?, ?> ppm) {
- if (ppm.getAnnotated().isAnnotationPresent(ConfigProperty.class)) {
- convBean = ppm.getBean();
- }
-
- }
-
- public void addConverter(@Observes final AfterBeanDiscovery abd, final BeanManager bm) {
- abd.addBean(new ConverterBean(convBean, types));
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/04b3fc5e/modules/integration/cdi/src/main/java/org/apache/tamaya/integration/cdi2/ConfigurationProducer.java
----------------------------------------------------------------------
diff --git a/modules/integration/cdi/src/main/java/org/apache/tamaya/integration/cdi2/ConfigurationProducer.java b/modules/integration/cdi/src/main/java/org/apache/tamaya/integration/cdi2/ConfigurationProducer.java
deleted file mode 100644
index 8b4ae9f..0000000
--- a/modules/integration/cdi/src/main/java/org/apache/tamaya/integration/cdi2/ConfigurationProducer.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tamaya.integration.cdi2;
-
-import org.apache.tamaya.ConfigException;
-import org.apache.tamaya.ConfigOperator;
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.ConfigurationProvider;
-import org.apache.tamaya.TypeLiteral;
-import org.apache.tamaya.spi.PropertyConverter;
-
-import javax.enterprise.context.ApplicationScoped;
-import javax.enterprise.inject.Produces;
-import javax.enterprise.inject.spi.InjectionPoint;
-import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-@ApplicationScoped
-public class ConfigurationProducer {
-
- private static final Logger LOGGER = Logger.getLogger(ConfigurationProducer.class.getName());
-
- @Produces
- @ConfigProperty
- public Object resolveAndConvert(final InjectionPoint injectionPoint) {
-
- final ConfigProperty annotation = injectionPoint.getAnnotated().getAnnotation(ConfigProperty.class);
- final ConfigDefault defaultAnnot = injectionPoint.getAnnotated().getAnnotation(ConfigDefault.class);
- final ConfigDefaultSections typeAnnot = injectionPoint.getAnnotated().getAnnotation(ConfigDefaultSections.class);
- final List<String> keys = ConfigurationExtension.evaluateKeys(injectionPoint.getMember().getName(), annotation.value(), typeAnnot.value());
-
- final WithConfigOperator withOperatorAnnot = injectionPoint.getAnnotated().getAnnotation(WithConfigOperator.class);
- ConfigOperator operator = null;
- if(withOperatorAnnot!=null){
- operator = ConfigurationExtension.CUSTOM_OPERATORS.get(withOperatorAnnot.value());
- }
- PropertyConverter customCnverter = null;
- final WithPropertyConverter withConverterAnnot = injectionPoint.getAnnotated().getAnnotation(WithPropertyConverter.class);
- if(withConverterAnnot!=null){
- customCnverter = ConfigurationExtension.CUSTOM_CONVERTERS.get(withConverterAnnot.value());
- }
-
- // unless the extension is not installed, this should never happen because the extension
- // enforces the resolvability of the config
- Configuration config = ConfigurationProvider.getConfiguration();
- if(operator!=null){
- config = operator.operate(config);
- }
- final Class<?> toType = (Class<?>) injectionPoint.getAnnotated().getBaseType();
- String textValue = null;
- String defaultTextValue = defaultAnnot!=null?defaultAnnot.value():null;
- String keyFound = null;
- for(String key:keys) {
- textValue = config.get(key);
- if(textValue!=null){
- keyFound = key;
- break;
- }
- }
- Object value = null;
- if(keyFound!=null){
- if(customCnverter!=null) {
- value = customCnverter.convert(textValue);
- }
- if(value==null){
- value = config.get(keyFound, toType);
- }
- }
- else if(defaultTextValue!=null){
- if(customCnverter!=null) {
- value = customCnverter.convert(defaultTextValue);
- }
- if(value==null) {
- List<PropertyConverter<Object>> converters = ConfigurationProvider.getConfigurationContext()
- .getPropertyConverters(TypeLiteral.of(toType));
- for (PropertyConverter<Object> converter : converters) {
- try {
- value = converter.convert(defaultTextValue);
- if (value != null) {
- LOGGER.log(Level.FINEST, "Parsed default value from '" + defaultTextValue + "' into " +
- injectionPoint);
- break;
- }
- } catch (Exception e) {
- LOGGER.log(Level.FINEST, "Failed to convert default value '" + defaultTextValue + "' for " +
- injectionPoint, e);
- }
- }
- }
- }
- if(value==null){
- throw new ConfigException(String.format(
- "Can't resolve any of the possible config keys: %s to the required target type: %s",
- keys.toString(), toType.getName()));
- }
- LOGGER.finest(String.format("Injecting %s for key %s in class %s", keyFound, value.toString(), injectionPoint.toString()));
- return value;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/04b3fc5e/modules/integration/cdi/src/main/java/org/apache/tamaya/integration/cdi2/WithConfigOperator.java
----------------------------------------------------------------------
diff --git a/modules/integration/cdi/src/main/java/org/apache/tamaya/integration/cdi2/WithConfigOperator.java b/modules/integration/cdi/src/main/java/org/apache/tamaya/integration/cdi2/WithConfigOperator.java
deleted file mode 100644
index 7d6ac66..0000000
--- a/modules/integration/cdi/src/main/java/org/apache/tamaya/integration/cdi2/WithConfigOperator.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya.integration.cdi2;
-
-import org.apache.tamaya.ConfigOperator;
-import org.apache.tamaya.Configuration;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Annotation to define an configuration operator to be used before accessing a configured keys.
- * This allows filtering current configuration, e.g. for realizing views or ensuring security
- * constraints.
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(value = {ElementType.TYPE, ElementType.METHOD, ElementType.PARAMETER})
-public @interface WithConfigOperator {
-
- /**
- * Define a custom adapter that should be used to adapt the configuration entry injected. This overrides any
- * general org.apache.tamaya.core.internal registered. If no adapter is defined (default) and no corresponding adapter is
- * registered, it is handled as a deployment error.
- */
- Class<? extends ConfigOperator> value();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/04b3fc5e/modules/integration/cdi/src/main/java/org/apache/tamaya/integration/cdi2/WithPropertyConverter.java
----------------------------------------------------------------------
diff --git a/modules/integration/cdi/src/main/java/org/apache/tamaya/integration/cdi2/WithPropertyConverter.java b/modules/integration/cdi/src/main/java/org/apache/tamaya/integration/cdi2/WithPropertyConverter.java
deleted file mode 100644
index f50edcb..0000000
--- a/modules/integration/cdi/src/main/java/org/apache/tamaya/integration/cdi2/WithPropertyConverter.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya.integration.cdi2;
-
-
-import org.apache.tamaya.spi.PropertyConverter;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Annotation to define a type adapter to be used before injecting a configured keys, or for applying changes.
- * This will override any other adapter for performing the type conversion before
- * injecting the field keys.
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(value = {ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})
-public @interface WithPropertyConverter {
-
- /**
- * Define a custom adapter or codec that should be used to adapt the configuration entry injected. This overrides any
- * general org.apache.tamaya.core.internal registered. If no adapter is defined (default) and no corresponding adapter is
- * registered, it is handled as a deployment error.
- */
- Class<? extends PropertyConverter<?>> value();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/04b3fc5e/modules/integration/cdi/src/main/resources/META-INF/beans.xml
----------------------------------------------------------------------
diff --git a/modules/integration/cdi/src/main/resources/META-INF/beans.xml b/modules/integration/cdi/src/main/resources/META-INF/beans.xml
index e71e480..562647f 100644
--- a/modules/integration/cdi/src/main/resources/META-INF/beans.xml
+++ b/modules/integration/cdi/src/main/resources/META-INF/beans.xml
@@ -1 +1,19 @@
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy current the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
<beans></beans>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/04b3fc5e/modules/integration/cdi/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
----------------------------------------------------------------------
diff --git a/modules/integration/cdi/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension b/modules/integration/cdi/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
index 78139d5..e82118a 100644
--- a/modules/integration/cdi/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
+++ b/modules/integration/cdi/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
@@ -1 +1,19 @@
-org.tomitribe.sabot.ConfigurationExtension
\ No newline at end of file
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy current the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+org.apache.tamaya.integration.cdi.ConfigurationExtension
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/04b3fc5e/modules/integration/cdi/src/test/java/org/apache/tamaya/integration/cdi/ConfigurationProducerFailedInjectionTest.java
----------------------------------------------------------------------
diff --git a/modules/integration/cdi/src/test/java/org/apache/tamaya/integration/cdi/ConfigurationProducerFailedInjectionTest.java b/modules/integration/cdi/src/test/java/org/apache/tamaya/integration/cdi/ConfigurationProducerFailedInjectionTest.java
new file mode 100644
index 0000000..6bfda3a
--- /dev/null
+++ b/modules/integration/cdi/src/test/java/org/apache/tamaya/integration/cdi/ConfigurationProducerFailedInjectionTest.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tamaya.integration.cdi;
+
+import org.apache.openejb.OpenEjbContainer;
+import org.junit.Test;
+
+import javax.ejb.embeddable.EJBContainer;
+
+public class ConfigurationProducerFailedInjectionTest {
+
+ @Test(expected = OpenEjbContainer.AssembleApplicationException.class)
+ public void notFoundShouldNotDeploy() {
+ // this explicitly tests that a non resolvable config makes
+ // the deployment fail and we won't have any failure at runtime
+ EJBContainer.createEJBContainer();
+ }
+
+}