tamaya-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anat...@apache.org
Subject [04/11] incubator-tamaya git commit: TAMAYA-124: Unifying annotations for SE and EE based injection.
Date Fri, 16 Oct 2015 18:59:46 GMT
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/3beb5a44/modules/injection/src/main/java/org/apache/tamaya/inject/WithLoadPolicy.java
----------------------------------------------------------------------
diff --git a/modules/injection/src/main/java/org/apache/tamaya/inject/WithLoadPolicy.java b/modules/injection/src/main/java/org/apache/tamaya/inject/WithLoadPolicy.java
deleted file mode 100644
index 19f9d74..0000000
--- a/modules/injection/src/main/java/org/apache/tamaya/inject/WithLoadPolicy.java
+++ /dev/null
@@ -1,40 +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.inject;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Annotation to define how config changes are handled for a type or per property/template method.
- * @see LoadPolicy
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(value = { ElementType.FIELD, ElementType.METHOD, ElementType.TYPE })
-public @interface WithLoadPolicy {
-
-    /**
-     * The load policy to be used. If this annotation is present a load policy must be defined.
-     * @return The load policy to be used, not null.
-     */
-    LoadPolicy value();
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/3beb5a44/modules/injection/src/main/java/org/apache/tamaya/inject/WithPropertyConverter.java
----------------------------------------------------------------------
diff --git a/modules/injection/src/main/java/org/apache/tamaya/inject/WithPropertyConverter.java b/modules/injection/src/main/java/org/apache/tamaya/inject/WithPropertyConverter.java
deleted file mode 100644
index f0c3796..0000000
--- a/modules/injection/src/main/java/org/apache/tamaya/inject/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.inject;
-
-
-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})
-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/3beb5a44/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfigChangeCallbackMethod.java
----------------------------------------------------------------------
diff --git a/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfigChangeCallbackMethod.java b/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfigChangeCallbackMethod.java
deleted file mode 100644
index a2b0f2a..0000000
--- a/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfigChangeCallbackMethod.java
+++ /dev/null
@@ -1,64 +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.inject.internal;
-
-import org.apache.tamaya.event.PropertyChangeSet;
-
-import java.lang.reflect.Method;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * This class holds a method object that is annotated to be a callback method to be called on configuration
- * changes.
- */
-public final class ConfigChangeCallbackMethod {
-
-    private static final Logger LOG = Logger.getLogger(ConfigChangeCallbackMethod.class.getName());
-
-    private Method callbackMethod;
-
-    public ConfigChangeCallbackMethod(Method methodCandidate) {
-        if (void.class.equals(methodCandidate.getReturnType()) &&
-                methodCandidate.getParameterCount() == 1 &&
-                methodCandidate.getParameterTypes()[0].equals(PropertyChangeSet.class)) {
-            this.callbackMethod = methodCandidate;
-        }
-    }
-
-    public PropertyChangeSetListener createConsumer(final Object instance) {
-        return new PropertyChangeSetListener() {
-            @Override
-            public void propertyChange(PropertyChangeSet propertyChangeSet) {
-                call(instance, propertyChangeSet);
-            }
-        };
-    }
-
-    public void call(Object instance, PropertyChangeSet configChangeEvent) {
-        try {
-            callbackMethod.setAccessible(true);
-            callbackMethod.invoke(instance, configChangeEvent);
-        } catch (Exception e) {
-            LOG.log(Level.SEVERE, "Error calling ConfigChange callback method " +
-                            callbackMethod.getDeclaringClass().getName() + '.' + callbackMethod.getName() + " on " + instance,
-                    e);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/3beb5a44/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfigTemplateInvocationHandler.java
----------------------------------------------------------------------
diff --git a/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfigTemplateInvocationHandler.java b/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfigTemplateInvocationHandler.java
index b2fec95..061eaad 100644
--- a/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfigTemplateInvocationHandler.java
+++ b/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfigTemplateInvocationHandler.java
@@ -20,7 +20,7 @@ package org.apache.tamaya.inject.internal;
 
 import org.apache.tamaya.Configuration;
 import org.apache.tamaya.TypeLiteral;
-import org.apache.tamaya.inject.DynamicValue;
+import org.apache.tamaya.inject.api.DynamicValue;
 
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.Method;
@@ -72,8 +72,8 @@ public final class ConfigTemplateInvocationHandler implements InvocationHandler
         if (method.getReturnType() == DynamicValue.class) {
             return DefaultDynamicValue.of(method, configuration);
         }
-        String configValue = InjectionUtils.getConfigValue(method);
-        Object result = InjectionUtils.adaptValue(method, TypeLiteral.of(method.getReturnType()), configValue);
+        String configValue = InjectionHelper.getConfigValue(method);
+        Object result = InjectionHelper.adaptValue(method, TypeLiteral.of(method.getReturnType()), configValue);
         if (result == null && method.isDefault()) {
             result = method.getDefaultValue();
         }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/3beb5a44/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfiguredField.java
----------------------------------------------------------------------
diff --git a/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfiguredField.java b/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfiguredField.java
index e824589..21122ff 100644
--- a/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfiguredField.java
+++ b/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfiguredField.java
@@ -21,7 +21,8 @@ package org.apache.tamaya.inject.internal;
 import org.apache.tamaya.ConfigException;
 import org.apache.tamaya.ConfigurationProvider;
 import org.apache.tamaya.TypeLiteral;
-import org.apache.tamaya.inject.DynamicValue;
+import org.apache.tamaya.inject.api.DynamicValue;
+import org.apache.tamaya.inject.api.InjectionUtils;
 
 import java.lang.reflect.Field;
 import java.security.AccessController;
@@ -100,14 +101,14 @@ public class ConfiguredField {
     private void applyValue(Object target,boolean resolve) throws ConfigException {
         Objects.requireNonNull(target);
         try {
-            String configValue = InjectionUtils.getConfigValue(this.annotatedField);
+            String configValue = InjectionHelper.getConfigValue(this.annotatedField);
             // Next step perform expression resolution, if any
             String evaluatedValue = resolve && configValue != null
-                    ? InjectionUtils.evaluateValue(configValue)
+                    ? InjectionHelper.evaluateValue(configValue)
                     : configValue;
 
             // Check for adapter/filter
-            Object value = InjectionUtils.adaptValue(this.annotatedField, TypeLiteral.of(this.annotatedField.getType()), evaluatedValue);
+            Object value = InjectionHelper.adaptValue(this.annotatedField, TypeLiteral.of(this.annotatedField.getType()), evaluatedValue);
             AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
                 @Override
                 public Object run() throws Exception {

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/3beb5a44/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfiguredSetterMethod.java
----------------------------------------------------------------------
diff --git a/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfiguredSetterMethod.java b/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfiguredSetterMethod.java
index 6eb6e74..ca4e21c 100644
--- a/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfiguredSetterMethod.java
+++ b/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfiguredSetterMethod.java
@@ -20,6 +20,7 @@ package org.apache.tamaya.inject.internal;
 
 import org.apache.tamaya.ConfigException;
 import org.apache.tamaya.TypeLiteral;
+import org.apache.tamaya.inject.api.InjectionUtils;
 
 import java.lang.reflect.Method;
 import java.security.AccessController;
@@ -59,15 +60,15 @@ public class ConfiguredSetterMethod {
      * @throws ConfigException if evaluation or conversion failed.
      */
     public void applyValue(Object target, boolean resolve) throws ConfigException {
-        String configValue = InjectionUtils.getConfigValue(this.setterMethod);
+        String configValue = InjectionHelper.getConfigValue(this.setterMethod);
         Objects.requireNonNull(target);
         try {
             String evaluatedString = resolve && configValue != null
-                    ? InjectionUtils.evaluateValue(configValue)
+                    ? InjectionHelper.evaluateValue(configValue)
                     : configValue;
 
             // Check for adapter/filter
-            Object value = InjectionUtils.adaptValue(this.setterMethod, TypeLiteral.of(this.setterMethod.getParameterTypes()[0]), evaluatedString);
+            Object value = InjectionHelper.adaptValue(this.setterMethod, TypeLiteral.of(this.setterMethod.getParameterTypes()[0]), evaluatedString);
 
             AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
                 @Override

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/3beb5a44/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfiguredType.java
----------------------------------------------------------------------
diff --git a/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfiguredType.java b/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfiguredType.java
index 10856d2..85a432c 100644
--- a/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfiguredType.java
+++ b/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfiguredType.java
@@ -26,11 +26,9 @@ import java.util.logging.Logger;
 
 import org.apache.tamaya.ConfigException;
 import org.apache.tamaya.inject.ConfigAutoInject;
-import org.apache.tamaya.inject.ConfigDefaultSections;
-import org.apache.tamaya.inject.Config;
 import org.apache.tamaya.inject.NoConfig;
-import org.apache.tamaya.event.ObservesConfigChange;
-import org.apache.tamaya.event.PropertyChangeSet;
+import org.apache.tamaya.inject.api.Config;
+import org.apache.tamaya.inject.api.ConfigDefaultSections;
 
 /**
  * Structure that contains and manages configuration related things for a configured type registered.
@@ -49,10 +47,6 @@ public class ConfiguredType {
      */
     private List<ConfiguredSetterMethod> configuredSetterMethods = new ArrayList<>();
     /**
-     * A list with all callback methods listening to config changes.
-     */
-    private List<ConfigChangeCallbackMethod> callbackMethods = new ArrayList<>();
-    /**
      * The basic type.
      */
     private Class type;
@@ -123,28 +117,10 @@ public class ConfiguredType {
                 continue;
             }
             if(isConfiguredMethod(m) || autoConfigure) {
-                ObservesConfigChange observesAnnot = m.getAnnotation(ObservesConfigChange.class);
                 Config propAnnot = m.getAnnotation(Config.class);
-                if (type.isInterface()) {
-                    // it is a template
-                    if (observesAnnot != null && m.isDefault()) {
-                        if (addObserverMethod(m)) {
-                            LOG.finer("Added configured observer for template: " + m.getClass().getName() + "#" +
-                                    m.toGenericString());
-                        }
-                    }
-                } else {
-                    if (observesAnnot != null) {
-                        if (addObserverMethod(m)) {
-                            LOG.finer("Added configured observer: " + m.getClass().getName() + "#" +
-                                    m.toGenericString());
-                        }
-                    } else {
-                        if (addPropertySetter(m, propAnnot)) {
-                            LOG.finer("Added configured setter: " + m.getClass().getName() + "#" +
-                                    m.toGenericString());
-                        }
-                    }
+                if (addPropertySetter(m, propAnnot)) {
+                    LOG.finer("Added configured setter: " + m.getClass().getName() + "#" +
+                            m.toGenericString());
                 }
             }
         }
@@ -170,27 +146,6 @@ public class ConfiguredType {
     }
 
 
-
-    private boolean addObserverMethod(Method m) {
-        if (m.getParameterTypes().length != 1) {
-            return false;
-        }
-        if (!m.getParameterTypes()[0].equals(PropertyChangeSet.class)) {
-            return false;
-        }
-        if (!void.class.equals(m.getReturnType())) {
-            return false;
-        }
-        try {
-            this.callbackMethods.add(new ConfigChangeCallbackMethod(m));
-            return true;
-        } catch (Exception e) {
-            throw new ConfigException("Failed to initialized configured callback method: " +
-                    m.getDeclaringClass().getName() + '.' + m.getName(), e);
-        }
-    }
-
-
     /**
      * Method called to configure an instance.
      *
@@ -203,11 +158,6 @@ public class ConfiguredType {
         for (ConfiguredSetterMethod method : configuredSetterMethods) {
             method.applyValue(instance, true);
 //            // TODO, if method should be recalled on changes, corresponding callbacks could be registered here
-//            WeakConfigListenerManager.of().registerConsumer(instance, method.createConsumer(instance));
-        }
-        // Register callbacks for this instance (weakly)
-        for (ConfigChangeCallbackMethod callback : callbackMethods) {
-            WeakConfigListenerManager.of().registerConsumer(instance, callback.createConsumer(instance));
         }
     }
 
@@ -259,14 +209,6 @@ public class ConfiguredType {
         return configuredSetterMethods;
     }
 
-    /**
-     * Get the registered annotated callback methods.
-     * @return the registered annotated callback methods, never null.
-     */
-    public Collection<ConfigChangeCallbackMethod> getObserverMethods(){
-        return callbackMethods;
-    }
-
     @Override
     public String toString() {
         return "ConfigDefaultSections{"+ this.getType().getName() + '}';

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/3beb5a44/modules/injection/src/main/java/org/apache/tamaya/inject/internal/DefaultConfigurationInjector.java
----------------------------------------------------------------------
diff --git a/modules/injection/src/main/java/org/apache/tamaya/inject/internal/DefaultConfigurationInjector.java b/modules/injection/src/main/java/org/apache/tamaya/inject/internal/DefaultConfigurationInjector.java
index 2e50217..e6ed12b 100644
--- a/modules/injection/src/main/java/org/apache/tamaya/inject/internal/DefaultConfigurationInjector.java
+++ b/modules/injection/src/main/java/org/apache/tamaya/inject/internal/DefaultConfigurationInjector.java
@@ -19,9 +19,6 @@
 package org.apache.tamaya.inject.internal;
 
 import org.apache.tamaya.ConfigurationProvider;
-import org.apache.tamaya.event.ObservesConfigChange;
-import org.apache.tamaya.inject.ConfigDefaultSections;
-import org.apache.tamaya.inject.Config;
 import org.apache.tamaya.inject.ConfigurationInjector;
 
 import javax.annotation.Priority;
@@ -33,8 +30,10 @@ import java.util.Objects;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.logging.Logger;
 
-import org.apache.tamaya.inject.ConfiguredItemSupplier;
+import org.apache.tamaya.inject.api.ConfiguredItemSupplier;
 import org.apache.tamaya.inject.NoConfig;
+import org.apache.tamaya.inject.api.Config;
+import org.apache.tamaya.inject.api.ConfigDefaultSections;
 
 /**
  * Simple injector singleton that also registers instances configured using weak references.
@@ -73,18 +72,12 @@ public final class DefaultConfigurationInjector implements ConfigurationInjector
             return true;
         }
         for (Field f : type.getDeclaredFields()) {
-            if (f.isAnnotationPresent(NoConfig.class)) {
-                return true;
-            }
-            if (f.isAnnotationPresent(ObservesConfigChange.class) || f.isAnnotationPresent(Config.class)) {
+            if (f.isAnnotationPresent(NoConfig.class) || f.isAnnotationPresent(Config.class)) {
                 return true;
             }
         }
         for (Method m : type.getDeclaredMethods()) {
-            if (m.isAnnotationPresent(NoConfig.class)) {
-                return true;
-            }
-            if (m.isAnnotationPresent(ObservesConfigChange.class) || m.isAnnotationPresent(Config.class)) {
+            if (m.isAnnotationPresent(NoConfig.class) || m.isAnnotationPresent(Config.class)) {
                 return true;
             }
         }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/3beb5a44/modules/injection/src/main/java/org/apache/tamaya/inject/internal/DefaultDynamicValue.java
----------------------------------------------------------------------
diff --git a/modules/injection/src/main/java/org/apache/tamaya/inject/internal/DefaultDynamicValue.java b/modules/injection/src/main/java/org/apache/tamaya/inject/internal/DefaultDynamicValue.java
index 9da9c6d..46a4bb1 100644
--- a/modules/injection/src/main/java/org/apache/tamaya/inject/internal/DefaultDynamicValue.java
+++ b/modules/injection/src/main/java/org/apache/tamaya/inject/internal/DefaultDynamicValue.java
@@ -20,18 +20,18 @@ package org.apache.tamaya.inject.internal;
 
 import org.apache.tamaya.ConfigException;
 import org.apache.tamaya.Configuration;
-import org.apache.tamaya.inject.ConfiguredItemSupplier;
-import org.apache.tamaya.spi.PropertyConverter;
 import org.apache.tamaya.TypeLiteral;
-import org.apache.tamaya.inject.DynamicValue;
-import org.apache.tamaya.inject.WithPropertyConverter;
+import org.apache.tamaya.inject.api.BaseDynamicValue;
+import org.apache.tamaya.inject.api.DynamicValue;
+import org.apache.tamaya.inject.api.InjectionUtils;
+import org.apache.tamaya.inject.api.WithPropertyConverter;
+import org.apache.tamaya.spi.PropertyConverter;
 
 import java.beans.PropertyChangeEvent;
 import java.beans.PropertyChangeListener;
 import java.io.IOException;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
-import java.io.Serializable;
 import java.lang.ref.WeakReference;
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
@@ -58,7 +58,7 @@ import java.util.logging.Logger;
  *
  * @param <T> The type of the value.
  */
-public final class DefaultDynamicValue<T> implements DynamicValue<T>, Serializable {
+public final class DefaultDynamicValue<T> extends BaseDynamicValue<T> {
 
     private static final long serialVersionUID = -2071172847144537443L;
 
@@ -112,7 +112,7 @@ public final class DefaultDynamicValue<T> implements DynamicValue<T>, Serializab
      * @param propertyConverter the optional converter to be used.
      */
     private DefaultDynamicValue(String propertyName, Configuration configuration, TypeLiteral<T> targetType,
-                        PropertyConverter<T> propertyConverter, List<String> keys) {
+                                PropertyConverter<T> propertyConverter, List<String> keys) {
         this.propertyName = Objects.requireNonNull(propertyName);
         this.keys = keys.toArray(new String[keys.size()]);
         this.configuration = Objects.requireNonNull(configuration);
@@ -121,7 +121,7 @@ public final class DefaultDynamicValue<T> implements DynamicValue<T>, Serializab
         this.value = evaluateValue();
     }
 
-    public static DynamicValue of(Field annotatedField, Configuration configuration){
+    public static DynamicValue of(Field annotatedField, Configuration configuration) {
         // Check for adapter/filter
         Type targetType = annotatedField.getGenericType();
         if (targetType == null) {
@@ -153,7 +153,7 @@ public final class DefaultDynamicValue<T> implements DynamicValue<T>, Serializab
                 TypeLiteral.of(targetType), propertyConverter, keys);
     }
 
-    public static DynamicValue of(Method method, Configuration configuration){
+    public static DynamicValue of(Method method, Configuration configuration) {
         // Check for adapter/filter
         Type targetType = method.getGenericReturnType();
         if (targetType == null) {
@@ -184,17 +184,6 @@ public final class DefaultDynamicValue<T> implements DynamicValue<T>, Serializab
                 configuration, TypeLiteral.of(targetType), propertyConverter, InjectionUtils.getKeys(method));
     }
 
-    /**
-     * Performs a commit, if necessary, and returns the current value.
-     *
-     * @return the non-null value held by this {@code DynamicValue}
-     * @throws org.apache.tamaya.ConfigException if there is no value present
-     * @see DefaultDynamicValue#isPresent()
-     */
-    public T commitAndGet() {
-        commit();
-        return get();
-    }
 
     /**
      * Commits a new value that has not been committed yet, make it the new value of the instance. On change any
@@ -284,25 +273,27 @@ public final class DefaultDynamicValue<T> implements DynamicValue<T>, Serializab
      */
     public boolean updateValue() {
         T newValue = evaluateValue();
-        if (Objects.equals(newValue, this.value)) {
-            return false;
-        }
-        switch (this.updatePolicy) {
-            case IMMEDIATE:
-                this.newValue = newValue;
-                commit();
-                break;
-            case LOG_AND_DISCARD:
-                Logger.getLogger(getClass().getName()).info("Discard change on " + this + ", newValue=" + newValue);
-                this.newValue = null;
-                break;
-            case NEVER:
-                this.newValue = null;
-                break;
-            case EXPLCIT:
-            default:
-                this.newValue = newValue;
-                break;
+        synchronized (this) {
+            if (Objects.equals(newValue, this.value)) {
+                return false;
+            }
+            switch (this.updatePolicy) {
+                case IMMEDIATE:
+                    this.newValue = newValue;
+                    commit();
+                    break;
+                case LOG_AND_DISCARD:
+                    Logger.getLogger(getClass().getName()).info("Discard change on " + this + ", newValue=" + newValue);
+                    this.newValue = null;
+                    break;
+                case NEVER:
+                    this.newValue = null;
+                    break;
+                case EXPLCIT:
+                default:
+                    this.newValue = newValue;
+                    break;
+            }
         }
         return true;
     }
@@ -344,69 +335,6 @@ public final class DefaultDynamicValue<T> implements DynamicValue<T>, Serializab
         return null;
     }
 
-    /**
-     * Return {@code true} if there is a value present, otherwise {@code false}.
-     *
-     * @return {@code true} if there is a value present, otherwise {@code false}
-     */
-    public boolean isPresent() {
-        return value != null;
-    }
-
-
-    /**
-     * Return the value if present, otherwise return {@code other}.
-     *
-     * @param other the value to be returned if there is no value present, may
-     *              be null
-     * @return the value, if present, otherwise {@code other}
-     */
-    public T orElse(T other) {
-        if (value == null) {
-            return other;
-        }
-        return value;
-    }
-
-    /**
-     * Return the value if present, otherwise invoke {@code other} and return
-     * the result of that invocation.
-     *
-     * @param other a {@code ConfiguredItemSupplier} whose result is returned if no value
-     *              is present
-     * @return the value if present otherwise the result of {@code other.get()}
-     * @throws NullPointerException if value is not present and {@code other} is
-     *                              null
-     */
-    public T orElseGet(ConfiguredItemSupplier<? extends T> other) {
-        if (value == null) {
-            return other.get();
-        }
-        return value;
-    }
-
-    /**
-     * Return the contained value, if present, otherwise throw an exception
-     * to be created by the provided supplier.
-     * <p>
-     * NOTE A method reference to the exception constructor with an empty
-     * argument list can be used as the supplier. For example,
-     * {@code IllegalStateException::new}
-     *
-     * @param <X>               Type of the exception to be thrown
-     * @param exceptionSupplier The supplier which will return the exception to
-     *                          be thrown
-     * @return the present value
-     * @throws X                    if there is no value present
-     * @throws NullPointerException if no value is present and
-     *                              {@code exceptionSupplier} is null
-     */
-    public <X extends Throwable> T orElseThrow(ConfiguredItemSupplier<? extends X> exceptionSupplier) throws X {
-        if (value == null) {
-            throw exceptionSupplier.get();
-        }
-        return value;
-    }
 
     /**
      * Serialization implementation that strips away the non serializable Optional part.
@@ -415,11 +343,9 @@ public final class DefaultDynamicValue<T> implements DynamicValue<T>, Serializab
      * @throws java.io.IOException if serialization fails.
      */
     private void writeObject(ObjectOutputStream oos) throws IOException {
-        oos.writeObject(updatePolicy);
-        if (isPresent()) {
-            oos.writeObject(this.value);
-        } else {
-            oos.writeObject(null);
+        synchronized (this) {
+            oos.writeObject(getUpdatePolicy());
+            oos.writeObject(get());
         }
     }
 
@@ -431,11 +357,13 @@ public final class DefaultDynamicValue<T> implements DynamicValue<T>, Serializab
      * @throws ClassNotFoundException
      */
     private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException {
-        this.updatePolicy = (UpdatePolicy) ois.readObject();
-        if (isPresent()) {
-            this.value = (T) ois.readObject();
+        synchronized (this) {
+            this.updatePolicy = (UpdatePolicy) ois.readObject();
+            if (isPresent()) {
+                this.value = (T) ois.readObject();
+            }
+            newValue = null;
         }
-        newValue = null;
     }
 
 

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/3beb5a44/modules/injection/src/main/java/org/apache/tamaya/inject/internal/InjectionHelper.java
----------------------------------------------------------------------
diff --git a/modules/injection/src/main/java/org/apache/tamaya/inject/internal/InjectionHelper.java b/modules/injection/src/main/java/org/apache/tamaya/inject/internal/InjectionHelper.java
new file mode 100644
index 0000000..9550a71
--- /dev/null
+++ b/modules/injection/src/main/java/org/apache/tamaya/inject/internal/InjectionHelper.java
@@ -0,0 +1,183 @@
+/*
+ * 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.inject.internal;
+
+import java.lang.reflect.AnnotatedElement;
+import java.lang.reflect.Field;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.tamaya.ConfigException;
+import org.apache.tamaya.ConfigurationProvider;
+import org.apache.tamaya.TypeLiteral;
+import org.apache.tamaya.inject.api.Config;
+import org.apache.tamaya.inject.api.ConfigDefault;
+import org.apache.tamaya.inject.api.ConfigDefaultSections;
+import org.apache.tamaya.inject.api.InjectionUtils;
+import org.apache.tamaya.inject.api.WithPropertyConverter;
+import org.apache.tamaya.resolver.spi.ExpressionEvaluator;
+import org.apache.tamaya.spi.PropertyConverter;
+import org.apache.tamaya.spi.ServiceContextManager;
+
+
+/**
+ * Utility class containing several aspects used in this module.
+ */
+@SuppressWarnings("unchecked")
+final class InjectionHelper {
+
+    private static final Logger LOG = Logger.getLogger(InjectionHelper.class.getName());
+
+    private static final boolean RESOLUTION_MODULE_LOADED = checkResolutionModuleLoaded();
+
+    private static boolean checkResolutionModuleLoaded() {
+        try {
+            Class.forName("org.apache.tamaya.resolver.internal.DefaultExpressionEvaluator");
+            return true;
+        } catch (ClassNotFoundException e) {
+            return false;
+        }
+    }
+
+    private InjectionHelper() {
+    }
+
+    /**
+     * Internally evaluated the current valid configuration keys based on the given annotations present.
+     *
+     * @return the keys to be returned, or null.
+     */
+    public static String getConfigValue(Method method) {
+        ConfigDefaultSections areasAnnot = method.getDeclaringClass().getAnnotation(ConfigDefaultSections.class);
+        return getConfigValueInternal(method, areasAnnot);
+    }
+
+
+    /**
+     * Internally evaluated the current valid configuration keys based on the given annotations present.
+     *
+     * @return the keys to be returned, or null.
+     */
+    public static String getConfigValue(Field field) {
+        ConfigDefaultSections areasAnnot = field.getDeclaringClass().getAnnotation(ConfigDefaultSections.class);
+        return getConfigValueInternal(field, areasAnnot);
+    }
+
+    /**
+     * Internally evaluated the current valid configuration keys based on the given annotations present.
+     *
+     * @return the keys to be returned, or null.
+     */
+    private static String getConfigValueInternal(AnnotatedElement element, ConfigDefaultSections areasAnnot) {
+        Config prop = element.getAnnotation(Config.class);
+        ConfigDefault defaultAnnot = element.getAnnotation(ConfigDefault.class);
+        List<String> keys;
+        if (prop == null) {
+            keys = InjectionUtils.evaluateKeys((Member) element, areasAnnot);
+        } else {
+            keys = InjectionUtils.evaluateKeys((Member) element, areasAnnot, prop);
+        }
+        String configValue = evaluteConfigValue(keys);
+        if (configValue == null && defaultAnnot != null) {
+            return defaultAnnot.value();
+        }
+        return configValue;
+    }
+
+
+    private static String evaluteConfigValue(List<String> keys) {
+        String configValue = null;
+        for (String key : keys) {
+            configValue = ConfigurationProvider.getConfiguration().get(key);
+            if (configValue != null) {
+                break;
+            }
+        }
+        return configValue;
+    }
+
+
+    @SuppressWarnings("rawtypes")
+    public static <T> T adaptValue(AnnotatedElement element, TypeLiteral<T> targetType, String configValue) {
+        // Check for adapter/filter
+        T adaptedValue = null;
+        WithPropertyConverter converterAnnot = element.getAnnotation(WithPropertyConverter.class);
+        Class<? extends PropertyConverter<T>> converterType;
+        if (converterAnnot != null) {
+            converterType = (Class<? extends PropertyConverter<T>>) converterAnnot.value();
+            if (!converterType.getName().equals(WithPropertyConverter.class.getName())) {
+                try {
+                    // TODO cache here...
+                    PropertyConverter<T> converter = PropertyConverter.class.cast(converterType.newInstance());
+                    adaptedValue = converter.convert(configValue);
+                } catch (Exception e) {
+                    LOG.log(Level.SEVERE, "Failed to convert using explicit PropertyConverter on " + element +
+                            ", trying default conversion.", e);
+                }
+            }
+        }
+        if (adaptedValue != null) {
+            return adaptedValue;
+        }
+        if (String.class == targetType.getType()) {
+            return (T) configValue;
+        } else {
+            List<PropertyConverter<T>> converters = ConfigurationProvider.getConfigurationContext()
+                    .getPropertyConverters(targetType);
+            for (PropertyConverter<T> converter : converters) {
+                adaptedValue = converter.convert(configValue);
+                if (adaptedValue != null) {
+                    return adaptedValue;
+                }
+            }
+            throw new ConfigException("Non convertible property type: " + element);
+        }
+    }
+
+    /**
+     * Method that allows to statically check, if the resolver module is loaded. If the module is loaded
+     * value expressions are automatically forwarded to the resolver module for resolution.
+     *
+     * @return true, if the resolver module is on the classpath.
+     */
+    public static boolean isResolutionModuleLoaded() {
+        return RESOLUTION_MODULE_LOADED;
+    }
+
+    /**
+     * Evaluates the given expression.
+     *
+     * @param expression the expression, not null.
+     * @return
+     */
+    public static String evaluateValue(String expression) {
+        if (!RESOLUTION_MODULE_LOADED) {
+            return expression;
+        }
+        ExpressionEvaluator evaluator = ServiceContextManager.getServiceContext().getService(ExpressionEvaluator.class);
+        if (evaluator != null) {
+            return evaluator.evaluateExpression("<injection>", expression);
+        }
+        return expression;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/3beb5a44/modules/injection/src/main/java/org/apache/tamaya/inject/internal/InjectionUtils.java
----------------------------------------------------------------------
diff --git a/modules/injection/src/main/java/org/apache/tamaya/inject/internal/InjectionUtils.java b/modules/injection/src/main/java/org/apache/tamaya/inject/internal/InjectionUtils.java
deleted file mode 100644
index af3fe19..0000000
--- a/modules/injection/src/main/java/org/apache/tamaya/inject/internal/InjectionUtils.java
+++ /dev/null
@@ -1,271 +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.inject.internal;
-
-import java.lang.reflect.AnnotatedElement;
-import java.lang.reflect.Field;
-import java.lang.reflect.Member;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.apache.tamaya.ConfigException;
-import org.apache.tamaya.ConfigurationProvider;
-import org.apache.tamaya.TypeLiteral;
-import org.apache.tamaya.inject.ConfigDefaultSections;
-import org.apache.tamaya.inject.Config;
-import org.apache.tamaya.inject.ConfigDefault;
-import org.apache.tamaya.inject.WithPropertyConverter;
-import org.apache.tamaya.resolver.spi.ExpressionEvaluator;
-import org.apache.tamaya.spi.PropertyConverter;
-import org.apache.tamaya.spi.ServiceContextManager;
-
-
-/**
- * Utility class containing several aspects used in this module.
- */
-@SuppressWarnings("unchecked")
-final class InjectionUtils {
-
-    private static final Logger LOG = Logger.getLogger(InjectionUtils.class.getName());
-
-    private static final boolean RESOLUTION_MODULE_LOADED = checkResolutionModuleLoaded();
-
-    private static boolean checkResolutionModuleLoaded() {
-        try {
-            Class.forName("org.apache.tamaya.resolver.internal.DefaultExpressionEvaluator");
-            return true;
-        } catch (ClassNotFoundException e) {
-            return false;
-        }
-    }
-
-    private InjectionUtils() {
-    }
-
-    /**
-     * Evaluates all absolute configuration key based on the annotations found on a class.
-     *
-     * @param areasAnnot         the (optional) annotation definining areas to be looked up.
-     * @param propertyAnnotation the annotation on field/method level that may defined one or
-     *                           several keys to be looked up (in absolute or relative form).
-     * @return the list current keys in order how they should be processed/looked up.
-     */
-    public static List<String> evaluateKeys(Member member, ConfigDefaultSections areasAnnot, Config propertyAnnotation) {
-        if(propertyAnnotation==null){
-            return evaluateKeys(member, areasAnnot);
-        }
-        List<String> keys = new ArrayList<>(Arrays.asList(propertyAnnotation.keys()));
-        if (keys.isEmpty()) {
-            keys.add(member.getName());
-        }
-        ListIterator<String> iterator = keys.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 (areasAnnot != null && areasAnnot.value().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 : areasAnnot.value()) {
-                        iterator.add(area.isEmpty() ? next : area + '.' + next);
-                    }
-                }
-            }
-        }
-        return keys;
-    }
-
-    /**
-     * Evaluates all absolute configuration key based on the member name found.
-     *
-     * @param areasAnnot the (optional) annotation definining areas to be looked up.
-     * @return the list current keys in order how they should be processed/looked up.
-     */
-    public static List<String> evaluateKeys(Member member, ConfigDefaultSections areasAnnot) {
-        List<String> keys = new ArrayList<>();
-        String name = member.getName();
-        String mainKey;
-        if (name.startsWith("get") || name.startsWith("set")) {
-            mainKey = Character.toLowerCase(name.charAt(3)) + name.substring(4);
-        } else {
-            mainKey = Character.toLowerCase(name.charAt(0)) + name.substring(1);
-        }
-        keys.add(mainKey);
-        if (areasAnnot != null) {
-            // Add prefixed entries, including absolute (root) entry for "" area keys.
-            for (String area : areasAnnot.value()) {
-                if (!area.isEmpty()) {
-                    keys.add(area + '.' + mainKey);
-                }
-            }
-        } else { // add package name
-            keys.add(member.getDeclaringClass().getName() + '.' + mainKey);
-        }
-        return keys;
-    }
-
-    /**
-     * Internally evaluated the current valid configuration keys based on the given annotations present.
-     *
-     * @return the keys to be returned, or null.
-     */
-    public static String getConfigValue(Method method) {
-        ConfigDefaultSections areasAnnot = method.getDeclaringClass().getAnnotation(ConfigDefaultSections.class);
-        return getConfigValueInternal(method, areasAnnot);
-    }
-
-
-    /**
-     * Internally evaluated the current valid configuration keys based on the given annotations present.
-     *
-     * @return the keys to be returned, or null.
-     */
-    public static String getConfigValue(Field field) {
-        ConfigDefaultSections areasAnnot = field.getDeclaringClass().getAnnotation(ConfigDefaultSections.class);
-        return getConfigValueInternal(field, areasAnnot);
-    }
-
-    /**
-     * Internally evaluated the current valid configuration keys based on the given annotations present.
-     *
-     * @return the keys to be returned, or null.
-     */
-    private static String getConfigValueInternal(AnnotatedElement element, ConfigDefaultSections areasAnnot) {
-        Config prop = element.getAnnotation(Config.class);
-        ConfigDefault defaultAnnot = element.getAnnotation(ConfigDefault.class);
-        List<String> keys;
-        if (prop == null) {
-            keys = InjectionUtils.evaluateKeys((Member) element, areasAnnot);
-        } else {
-            keys = InjectionUtils.evaluateKeys((Member) element, areasAnnot, prop);
-        }
-        String configValue = evaluteConfigValue(keys);
-        if (configValue == null && defaultAnnot != null) {
-            return defaultAnnot.value();
-        }
-        return configValue;
-    }
-
-    /**
-     * Collects all keys to be be accessed as defined by any annotations of type
-     * {@link ConfigDefaultSections}, {@link Config}.
-     * @param field the (optionally) annotated field instance
-     * @return the regarding key list to be accessed fomr the {@link org.apache.tamaya.Configuration}.
-     */
-    public static List<String> getKeys(Field field) {
-        ConfigDefaultSections areasAnnot = field.getDeclaringClass().getAnnotation(ConfigDefaultSections.class);
-        return InjectionUtils.evaluateKeys(field, areasAnnot, field.getAnnotation(Config.class));
-    }
-
-    /**
-     * Collects all keys to be be accessed as defined by any annotations of type
-     * {@link ConfigDefaultSections}, {@link Config}.
-     * @param method the (optionally) annotated method instance
-     * @return the regarding key list to be accessed fomr the {@link org.apache.tamaya.Configuration}.
-     */
-    public static List<String> getKeys(Method method) {
-        ConfigDefaultSections areasAnnot = method.getDeclaringClass().getAnnotation(ConfigDefaultSections.class);
-        return InjectionUtils.evaluateKeys(method, areasAnnot, method.getAnnotation(Config.class));
-    }
-
-    private static String evaluteConfigValue(List<String> keys) {
-        String configValue = null;
-        for (String key : keys) {
-            configValue = ConfigurationProvider.getConfiguration().get(key);
-            if (configValue != null) {
-                break;
-            }
-        }
-        return configValue;
-    }
-
-
-    @SuppressWarnings("rawtypes")
-    public static <T> T adaptValue(AnnotatedElement element, TypeLiteral<T> targetType, String configValue) {
-        // Check for adapter/filter
-        T adaptedValue = null;
-        WithPropertyConverter converterAnnot = element.getAnnotation(WithPropertyConverter.class);
-        Class<? extends PropertyConverter<T>> converterType;
-        if (converterAnnot != null) {
-            converterType = (Class<? extends PropertyConverter<T>>) converterAnnot.value();
-            if (!converterType.getName().equals(WithPropertyConverter.class.getName())) {
-                try {
-                    // TODO cache here...
-                    PropertyConverter<T> converter = PropertyConverter.class.cast(converterType.newInstance());
-                    adaptedValue = converter.convert(configValue);
-                } catch (Exception e) {
-                    LOG.log(Level.SEVERE, "Failed to convert using explicit PropertyConverter on " + element +
-                            ", trying default conversion.", e);
-                }
-            }
-        }
-        if (adaptedValue != null) {
-            return adaptedValue;
-        }
-        if (String.class == targetType.getType()) {
-            return (T) configValue;
-        } else {
-            List<PropertyConverter<T>> converters = ConfigurationProvider.getConfigurationContext()
-                    .getPropertyConverters(targetType);
-            for (PropertyConverter<T> converter : converters) {
-                adaptedValue = converter.convert(configValue);
-                if (adaptedValue != null) {
-                    return adaptedValue;
-                }
-            }
-            throw new ConfigException("Non convertible property type: " + element);
-        }
-    }
-
-    /**
-     * Method that allows to statically check, if the resolver module is loaded. If the module is loaded
-     * value expressions are automatically forwarded to the resolver module for resolution.
-     *
-     * @return true, if the resolver module is on the classpath.
-     */
-    public static boolean isResolutionModuleLoaded() {
-        return RESOLUTION_MODULE_LOADED;
-    }
-
-    /**
-     * Evaluates the given expression.
-     *
-     * @param expression the expression, not null.
-     * @return
-     */
-    public static String evaluateValue(String expression) {
-        if (!RESOLUTION_MODULE_LOADED) {
-            return expression;
-        }
-        ExpressionEvaluator evaluator = ServiceContextManager.getServiceContext().getService(ExpressionEvaluator.class);
-        if (evaluator != null) {
-            return evaluator.evaluateExpression("<injection>", expression);
-        }
-        return expression;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/3beb5a44/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ModelPopulator.java
----------------------------------------------------------------------
diff --git a/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ModelPopulator.java b/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ModelPopulator.java
index f0218b4..3fbc243 100644
--- a/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ModelPopulator.java
+++ b/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ModelPopulator.java
@@ -18,6 +18,7 @@
  */
 package org.apache.tamaya.inject.internal;
 
+import org.apache.tamaya.inject.api.InjectionUtils;
 import org.apache.tamaya.model.ConfigValidator;
 import org.apache.tamaya.model.spi.ParameterValidation;
 

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/3beb5a44/modules/injection/src/main/java/org/apache/tamaya/inject/internal/PropertyChangeSetListener.java
----------------------------------------------------------------------
diff --git a/modules/injection/src/main/java/org/apache/tamaya/inject/internal/PropertyChangeSetListener.java b/modules/injection/src/main/java/org/apache/tamaya/inject/internal/PropertyChangeSetListener.java
deleted file mode 100644
index d2abe73..0000000
--- a/modules/injection/src/main/java/org/apache/tamaya/inject/internal/PropertyChangeSetListener.java
+++ /dev/null
@@ -1,37 +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.inject.internal;
-
-import org.apache.tamaya.event.PropertyChangeSet;
-
-/**
- * Listner interface for {@link org.apache.tamaya.event.PropertyChangeSet} events.
- */
-public interface PropertyChangeSetListener {
-
-    /**
-     * This method gets called when a bound property is changed.
-     *
-     * @param evt A PropertyChangeEvent object describing the event source
-     *            and the property that has changed.
-     */
-
-    void propertyChange(PropertyChangeSet evt);
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/3beb5a44/modules/injection/src/main/java/org/apache/tamaya/inject/internal/WeakConfigListenerManager.java
----------------------------------------------------------------------
diff --git a/modules/injection/src/main/java/org/apache/tamaya/inject/internal/WeakConfigListenerManager.java b/modules/injection/src/main/java/org/apache/tamaya/inject/internal/WeakConfigListenerManager.java
deleted file mode 100644
index 412d074..0000000
--- a/modules/injection/src/main/java/org/apache/tamaya/inject/internal/WeakConfigListenerManager.java
+++ /dev/null
@@ -1,124 +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.inject.internal;
-
-import org.apache.tamaya.event.PropertyChangeSet;
-
-import java.util.Map;
-import java.util.WeakHashMap;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.StampedLock;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * Simple listener container that only holds weak references on the listeners.
- */
-public final class WeakConfigListenerManager {
-
-    private static final WeakConfigListenerManager INSTANCE = new WeakConfigListenerManager();
-
-    private static final Logger LOG = Logger.getLogger(WeakConfigListenerManager.class.getName());
-    private StampedLock lock = new StampedLock();
-    private Map<Object, PropertyChangeSetListener> listenerReferences = new WeakHashMap<>();
-
-    /**
-     * Private singleton constructor.
-     */
-    private WeakConfigListenerManager() {
-    }
-
-    public static WeakConfigListenerManager of() {
-        return INSTANCE;
-    }
-
-    /**
-     * Registers the given consumer for the instance. If a consumer already exists for this instance the given
-     * consumer is appended.
-     *
-     * @param instance the instance, not null.
-     * @param listener the consumer.
-     */
-    public void registerConsumer(Object instance, final PropertyChangeSetListener listener) {
-        Lock writeLock = lock.asWriteLock();
-        try {
-            writeLock.lock();
-            final PropertyChangeSetListener l = listenerReferences.get(instance);
-            if (l == null) {
-                listenerReferences.put(instance, listener);
-            } else {
-                listenerReferences.put(instance, new PropertyChangeSetListener() {
-                    @Override
-                    public void propertyChange(PropertyChangeSet evt) {
-                        l.propertyChange(evt);
-                        listener.propertyChange(evt);
-                    }
-                });
-            }
-        } finally {
-            writeLock.unlock();
-        }
-    }
-
-    /**
-     * Unregisters all consumers for the given instance.
-     *
-     * @param instance the instance, not null.
-     */
-    public void unregisterConsumer(Object instance) {
-        Lock writeLock = lock.asWriteLock();
-        try {
-            writeLock.lock();
-            listenerReferences.remove(instance);
-        } finally {
-            writeLock.unlock();
-        }
-    }
-
-    /**
-     * Publishes a change event to all consumers registered.
-     *
-     * @param change the change event, not null.
-     */
-    public void publishChangeEvent(PropertyChangeSet change) {
-        Lock readLock = lock.asReadLock();
-        try {
-            readLock.lock();
-            for (PropertyChangeSetListener l : listenerReferences.values()) {
-                try {
-                    l.propertyChange(change);
-                } catch (Exception e) {
-                    LOG.log(Level.SEVERE, "ConfigChangeListener failed: " + l.getClass().getName(), e);
-                }
-            }
-        } finally {
-            readLock.unlock();
-        }
-    }
-
-
-    @Override
-    public String toString() {
-        return "WeakConfigListenerManager{" +
-                "listenerReferences=" + listenerReferences +
-                '}';
-    }
-
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/3beb5a44/modules/injection/src/test/java/annottext/AnnotatedConfigBean.java
----------------------------------------------------------------------
diff --git a/modules/injection/src/test/java/annottext/AnnotatedConfigBean.java b/modules/injection/src/test/java/annottext/AnnotatedConfigBean.java
index 111aaff..dc65dad 100644
--- a/modules/injection/src/test/java/annottext/AnnotatedConfigBean.java
+++ b/modules/injection/src/test/java/annottext/AnnotatedConfigBean.java
@@ -18,14 +18,11 @@
  */
 package annottext;
 
-import org.apache.tamaya.event.ObservesConfigChange;
-import org.apache.tamaya.event.PropertyChangeSet;
-import org.apache.tamaya.inject.ConfigDefault;
-import org.apache.tamaya.inject.Config;
-import org.apache.tamaya.inject.DynamicValue;
-import org.apache.tamaya.inject.LoadPolicy;
+import org.apache.tamaya.inject.api.DynamicValue;
+import org.apache.tamaya.inject.api.LoadPolicy;
 import org.apache.tamaya.inject.NoConfig;
-import org.apache.tamaya.inject.WithLoadPolicy;
+import org.apache.tamaya.inject.api.Config;
+import org.apache.tamaya.inject.api.ConfigDefault;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -35,25 +32,23 @@ import java.util.List;
  * configuration system, nevertheless extending the overall Configuration interface.
  * Created by Anatole on 15.02.14.
  */
-@WithLoadPolicy(LoadPolicy.INITIAL)
 public class AnnotatedConfigBean {
 
-    @Config(keys = {"foo.bar.myprop", "mp", "common.testdata.myProperty"})
+    @Config({"foo.bar.myprop", "mp", "common.testdata.myProperty"})
     @ConfigDefault("ET")
     // @ConfigLoadPolicy(listener = MyListener.class)
     public String myParameter;
 
-    @Config(keys = "simple_value")
-    @WithLoadPolicy(LoadPolicy.LAZY)
+    @Config("simple_value")
     public String simpleValue;
 
     @Config
     String anotherValue;
 
-    @Config(keys = "host.name")
+    @Config("host.name")
     private String hostName;
 
-    @Config(keys = "host.name")
+    @Config("host.name")
     private DynamicValue<String> dynamicHostname;
 
     @NoConfig
@@ -78,14 +73,9 @@ public class AnnotatedConfigBean {
     public static final String CONSTANT = "a constant";
 
 
-    @Config(keys = "java.version")
+    @Config("java.version")
     void setJavaVersion(String version){
         this.javaVersion = version;
     }
 
-    @Config(keys="b")
-    @ObservesConfigChange
-    public void callBackTest(PropertyChangeSet value){
-        this.events.add(value.toString());
-    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/3beb5a44/modules/injection/src/test/java/annottext/AnnotatedConfigTemplate.java
----------------------------------------------------------------------
diff --git a/modules/injection/src/test/java/annottext/AnnotatedConfigTemplate.java b/modules/injection/src/test/java/annottext/AnnotatedConfigTemplate.java
index 9b19c14..a9f0933 100644
--- a/modules/injection/src/test/java/annottext/AnnotatedConfigTemplate.java
+++ b/modules/injection/src/test/java/annottext/AnnotatedConfigTemplate.java
@@ -18,36 +18,32 @@
  */
 package annottext;
 
-import org.apache.tamaya.inject.ConfigDefault;
-import org.apache.tamaya.inject.Config;
-import org.apache.tamaya.inject.DynamicValue;
-import org.apache.tamaya.inject.LoadPolicy;
-import org.apache.tamaya.inject.WithLoadPolicy;
+import org.apache.tamaya.inject.api.DynamicValue;
+import org.apache.tamaya.inject.api.Config;
+import org.apache.tamaya.inject.api.ConfigDefault;
 
 /**
  * An example showing some basic annotations, using an interface to be proxied by the
  * configuration system.
  * Created by Anatole on 15.02.14.
  */
-@WithLoadPolicy(LoadPolicy.INITIAL)
 public interface AnnotatedConfigTemplate {
 
-    @Config(keys = {"foo.bar.myprop", "mp","common.testdata.myProperty"})
+    @Config({"foo.bar.myprop", "mp","common.testdata.myProperty"})
     @ConfigDefault("ET")
     // @ConfigLoadPolicy(listener = MyListener.class)
     String myParameter();
 
-    @Config(keys = "simple_value")
-    @WithLoadPolicy(LoadPolicy.LAZY)
+    @Config("simple_value")
     String simpleValue();
 
     @Config
     String simplestValue();
 
-    @Config(keys = "host.name")
+    @Config("host.name")
     String hostName();
 
-    @Config(keys = "host.name")
+    @Config("host.name")
     DynamicValue<String> getDynamicValue();
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/3beb5a44/modules/injection/src/test/java/org/apache/tamaya/inject/internal/DefaultDynamicValueTest.java
----------------------------------------------------------------------
diff --git a/modules/injection/src/test/java/org/apache/tamaya/inject/internal/DefaultDynamicValueTest.java b/modules/injection/src/test/java/org/apache/tamaya/inject/internal/DefaultDynamicValueTest.java
index 3eb449d..9a55dde 100644
--- a/modules/injection/src/test/java/org/apache/tamaya/inject/internal/DefaultDynamicValueTest.java
+++ b/modules/injection/src/test/java/org/apache/tamaya/inject/internal/DefaultDynamicValueTest.java
@@ -21,9 +21,9 @@ package org.apache.tamaya.inject.internal;
 import org.apache.tamaya.ConfigException;
 import org.apache.tamaya.ConfigurationProvider;
 import org.apache.tamaya.builder.ConfigurationBuilder;
-import org.apache.tamaya.inject.Config;
-import org.apache.tamaya.inject.ConfiguredItemSupplier;
-import org.apache.tamaya.inject.DynamicValue;
+import org.apache.tamaya.inject.api.ConfiguredItemSupplier;
+import org.apache.tamaya.inject.api.DynamicValue;
+import org.apache.tamaya.inject.api.Config;
 import org.apache.tamaya.spi.PropertyConverter;
 import org.apache.tamaya.spi.PropertySource;
 import org.junit.Test;
@@ -42,13 +42,13 @@ import static org.junit.Assert.*;
  */
 public class DefaultDynamicValueTest {
 
-    @Config(keys="a")
+    @Config("a")
     String myValue;
 
-    @Config(keys="a")
+    @Config("a")
     String myValue2;
 
-    @Config(keys="a")
+    @Config("a")
     void setterMethod(String value){
 
     }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/3beb5a44/modules/injection/src/test/java/org/apache/tamaya/inject/internal/WeakConfigListenerManagerTest.java
----------------------------------------------------------------------
diff --git a/modules/injection/src/test/java/org/apache/tamaya/inject/internal/WeakConfigListenerManagerTest.java b/modules/injection/src/test/java/org/apache/tamaya/inject/internal/WeakConfigListenerManagerTest.java
deleted file mode 100644
index 747c23e..0000000
--- a/modules/injection/src/test/java/org/apache/tamaya/inject/internal/WeakConfigListenerManagerTest.java
+++ /dev/null
@@ -1,91 +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.inject.internal;
-
-import org.apache.tamaya.core.propertysource.SystemPropertySource;
-import org.apache.tamaya.event.PropertyChangeSet;
-import org.apache.tamaya.event.PropertyChangeSetBuilder;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-public class WeakConfigListenerManagerTest {
-
-    private PropertyChangeSetListener consumer = new PropertyChangeSetListener() {
-        @Override
-        public void propertyChange(PropertyChangeSet set) {
-            loggedSet = set;
-        }
-    };
-    private PropertyChangeSet loggedSet;
-
-    @Test
-    public void testOf() throws Exception {
-        assertNotNull(WeakConfigListenerManager.of());
-    }
-
-    @Test
-    public void testRegisterConsumer() throws Exception {
-        SystemPropertySource sysSrc = new SystemPropertySource();
-        WeakConfigListenerManager.of().registerConsumer(this, new PropertyChangeSetListener() {
-            @Override
-            public void propertyChange(PropertyChangeSet set) {
-                loggedSet = set;
-            }
-        });
-        PropertyChangeSet change = PropertyChangeSetBuilder.of(sysSrc).add("aaa", "aaaValue").build();
-        WeakConfigListenerManager.of().registerConsumer(this, consumer);
-        WeakConfigListenerManager.of().publishChangeEvent(change);
-        assertNotNull(loggedSet);
-        loggedSet = null;
-        WeakConfigListenerManager.of().unregisterConsumer(consumer);
-    }
-
-    @Test
-    public void testUnregisterConsumer() throws Exception {
-        SystemPropertySource sysSrc = new SystemPropertySource();
-        PropertyChangeSet change = PropertyChangeSetBuilder.of(sysSrc).add("aaa", "aaaValue").build();
-        PropertyChangeSetListener tempConsumer = new PropertyChangeSetListener() {
-            @Override
-            public void propertyChange(PropertyChangeSet set) {
-                loggedSet = set;
-            }
-        };
-        WeakConfigListenerManager.of().registerConsumer(this, tempConsumer);
-        WeakConfigListenerManager.of().publishChangeEvent(change);
-        assertNotNull(loggedSet);
-        loggedSet = null;
-        WeakConfigListenerManager.of().unregisterConsumer(this);
-        assertNull(loggedSet);
-        WeakConfigListenerManager.of().publishChangeEvent(change);
-        assertNull(loggedSet);
-    }
-
-    @Test
-    public void testPublishChangeEvent() throws Exception {
-        SystemPropertySource sysSrc = new SystemPropertySource();
-        WeakConfigListenerManager.of().publishChangeEvent(
-                PropertyChangeSetBuilder.of(sysSrc).add("aaa", "aaaValue").build());
-    }
-
-    @Test
-    public void testToString() throws Exception {
-        assertNotNull(WeakConfigListenerManager.of());
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/3beb5a44/modules/integration/cdi-se/src/main/java/org/apache/tamaya/integration/cdi/internal/CDIAwareServiceContext.java
----------------------------------------------------------------------
diff --git a/modules/integration/cdi-se/src/main/java/org/apache/tamaya/integration/cdi/internal/CDIAwareServiceContext.java b/modules/integration/cdi-se/src/main/java/org/apache/tamaya/integration/cdi/internal/CDIAwareServiceContext.java
index ee069eb..a847db8 100644
--- a/modules/integration/cdi-se/src/main/java/org/apache/tamaya/integration/cdi/internal/CDIAwareServiceContext.java
+++ b/modules/integration/cdi-se/src/main/java/org/apache/tamaya/integration/cdi/internal/CDIAwareServiceContext.java
@@ -19,7 +19,7 @@
 package org.apache.tamaya.integration.cdi.internal;
 
 import org.apache.tamaya.ConfigException;
-import org.apache.tamaya.clsupport.internal.CLAwareServiceContext;
+import org.apache.tamaya.clsupport.CLAwareServiceContext;
 import org.apache.tamaya.spi.ServiceContext;
 
 import javax.annotation.Priority;

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/3beb5a44/modules/integration/cdi-se/src/test/java/org/apache/tamaya/integration/cdi/ConfiguredClass.java
----------------------------------------------------------------------
diff --git a/modules/integration/cdi-se/src/test/java/org/apache/tamaya/integration/cdi/ConfiguredClass.java b/modules/integration/cdi-se/src/test/java/org/apache/tamaya/integration/cdi/ConfiguredClass.java
index 013a70a..9f4135e 100644
--- a/modules/integration/cdi-se/src/test/java/org/apache/tamaya/integration/cdi/ConfiguredClass.java
+++ b/modules/integration/cdi-se/src/test/java/org/apache/tamaya/integration/cdi/ConfiguredClass.java
@@ -20,15 +20,13 @@
  */
 package org.apache.tamaya.integration.cdi;
 
-import java.beans.PropertyChangeEvent;
+import org.apache.tamaya.inject.api.Config;
+import org.apache.tamaya.inject.api.ConfigDefault;
+
 import java.math.BigDecimal;
 
 import javax.inject.Singleton;
 
-import org.apache.tamaya.event.ObservesConfigChange;
-import org.apache.tamaya.inject.ConfigDefault;
-import org.apache.tamaya.inject.Config;
-
 /**
  * Class to be loaded from CDI to ensure fields are correctly configured using CDI injection mechanisms.
  */
@@ -38,11 +36,11 @@ public class ConfiguredClass{
     @Config
     private String testProperty;
 
-    @Config(keys = {"a.b.c.key1","a.b.c.key2","a.b.c.key3"})
+    @Config({"a.b.c.key1","a.b.c.key2","a.b.c.key3"})
     @ConfigDefault("The current \\${JAVA_HOME} env property is ${env:JAVA_HOME}.")
     String value1;
 
-    @Config(keys = {"foo","a.b.c.key2"})
+    @Config({"foo","a.b.c.key2"})
     private String value2;
 
     @Config
@@ -63,17 +61,12 @@ public class ConfiguredClass{
     @Config
     private boolean booleanT;
 
-    @Config(keys = "BD")
+    @Config("BD")
     private BigDecimal bigNumber;
 
-    @Config(keys = "double1")
+    @Config("double1")
     private double doubleValue;
 
-    @ObservesConfigChange
-    public void changeListener1(PropertyChangeEvent configChange){
-        // will be called
-    }
-
     public String getTestProperty() {
         return testProperty;
     }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/3beb5a44/modules/integration/cdi-se/src/test/java/org/apache/tamaya/integration/cdi/ConfiguredTest.java
----------------------------------------------------------------------
diff --git a/modules/integration/cdi-se/src/test/java/org/apache/tamaya/integration/cdi/ConfiguredTest.java b/modules/integration/cdi-se/src/test/java/org/apache/tamaya/integration/cdi/ConfiguredTest.java
index b0e85be..69e8ef9 100644
--- a/modules/integration/cdi-se/src/test/java/org/apache/tamaya/integration/cdi/ConfiguredTest.java
+++ b/modules/integration/cdi-se/src/test/java/org/apache/tamaya/integration/cdi/ConfiguredTest.java
@@ -46,9 +46,7 @@ public class ConfiguredTest{
         System.out.println("********************************************");
         System.out.println(item);
         System.out.println("********************************************");
-
         double actual = 1234.5678;
-
         MatcherAssert.assertThat(item.getDoubleValue(), is(actual));
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/3beb5a44/modules/integration/cdi-se/src/test/resources/META-INF/javaconfiguration.properties
----------------------------------------------------------------------
diff --git a/modules/integration/cdi-se/src/test/resources/META-INF/javaconfiguration.properties b/modules/integration/cdi-se/src/test/resources/META-INF/javaconfiguration.properties
new file mode 100644
index 0000000..0937669
--- /dev/null
+++ b/modules/integration/cdi-se/src/test/resources/META-INF/javaconfiguration.properties
@@ -0,0 +1,18 @@
+# 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.
+#
+double1=1234.5678
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/3beb5a44/modules/integration/cdi/src/main/java/org/apache/tamaya/integration/cdi/Config.java
----------------------------------------------------------------------
diff --git a/modules/integration/cdi/src/main/java/org/apache/tamaya/integration/cdi/Config.java b/modules/integration/cdi/src/main/java/org/apache/tamaya/integration/cdi/Config.java
deleted file mode 100644
index f8927b2..0000000
--- a/modules/integration/cdi/src/main/java/org/apache/tamaya/integration/cdi/Config.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.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 Config {
-
-    /**
-     * 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/3beb5a44/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
deleted file mode 100644
index 2a28b32..0000000
--- a/modules/integration/cdi/src/main/java/org/apache/tamaya/integration/cdi/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.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/3beb5a44/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
deleted file mode 100644
index 6f20130..0000000
--- a/modules/integration/cdi/src/main/java/org/apache/tamaya/integration/cdi/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.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/3beb5a44/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
index f8f786e..4cf5c53 100644
--- 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
@@ -20,6 +20,11 @@ import org.apache.tamaya.ConfigException;
 import org.apache.tamaya.ConfigOperator;
 import org.apache.tamaya.Configuration;
 import org.apache.tamaya.ConfigurationProvider;
+import org.apache.tamaya.inject.api.Config;
+import org.apache.tamaya.inject.api.ConfigDefault;
+import org.apache.tamaya.inject.api.ConfigDefaultSections;
+import org.apache.tamaya.inject.api.WithConfigOperator;
+import org.apache.tamaya.inject.api.WithPropertyConverter;
 import org.apache.tamaya.spi.PropertyConverter;
 
 import javax.enterprise.context.spi.CreationalContext;
@@ -46,9 +51,9 @@ import java.util.concurrent.ConcurrentHashMap;
 /**
  * CDI Extension module that adds injection mechanism for configuration.
  *
- * @see Config
- * @see ConfigDefault
- * @see org.apache.tamaya.integration.cdi.ConfigDefaultSections
+ * @see org.apache.tamaya.inject.api.Config
+ * @see org.apache.tamaya.inject.api.ConfigDefault
+ * @see org.apache.tamaya.inject.api.ConfigDefaultSections
  * @see ConfigException
  */
 public class ConfigurationExtension implements Extension {

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/3beb5a44/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
index 7d25e48..10906a4 100644
--- 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
@@ -21,11 +21,20 @@ import org.apache.tamaya.ConfigOperator;
 import org.apache.tamaya.Configuration;
 import org.apache.tamaya.ConfigurationProvider;
 import org.apache.tamaya.TypeLiteral;
+import org.apache.tamaya.inject.api.Config;
+import org.apache.tamaya.inject.api.ConfigDefault;
+import org.apache.tamaya.inject.api.ConfigDefaultSections;
+import org.apache.tamaya.inject.api.DynamicValue;
+import org.apache.tamaya.inject.api.WithConfigOperator;
+import org.apache.tamaya.inject.api.WithPropertyConverter;
 import org.apache.tamaya.spi.PropertyConverter;
 
 import javax.enterprise.context.ApplicationScoped;
 import javax.enterprise.inject.Produces;
 import javax.enterprise.inject.spi.InjectionPoint;
+import java.lang.reflect.Field;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
 import java.util.List;
 import java.util.logging.Level;
 import java.util.logging.Logger;
@@ -38,10 +47,22 @@ public class ConfigurationProducer {
 
     private static final Logger LOGGER = Logger.getLogger(ConfigurationProducer.class.getName());
 
+    private DynamicValue createynamicValue(final InjectionPoint injectionPoint) {
+        Member member = injectionPoint.getMember();
+        if(member instanceof Field) {
+            return DefaultDynamicValue.of((Field)member, ConfigurationProvider.getConfiguration());
+        } else if(member instanceof Method) {
+            return DefaultDynamicValue.of((Method)member, ConfigurationProvider.getConfiguration());
+        }
+        return null;
+    }
+
     @Produces
     @Config
     public Object resolveAndConvert(final InjectionPoint injectionPoint) {
-
+        if(DynamicValue.class.equals(injectionPoint.getAnnotated().getBaseType())){
+            return createynamicValue(injectionPoint);
+        }
         final Config annotation = injectionPoint.getAnnotated().getAnnotation(Config.class);
         final ConfigDefault defaultAnnot = injectionPoint.getAnnotated().getAnnotation(ConfigDefault.class);
         final ConfigDefaultSections typeAnnot = injectionPoint.getAnnotated().getAnnotation(ConfigDefaultSections.class);


Mime
View raw message