tamaya-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anat...@apache.org
Subject [14/21] incubator-tamaya git commit: - Minimalized current API for further discussions.
Date Fri, 15 Jul 2016 12:04:40 GMT
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/modules/builder/src/main/java/org/apache/tamaya/builder/internal/OSGIServiceComparator.java
----------------------------------------------------------------------
diff --git a/modules/builder/src/main/java/org/apache/tamaya/builder/internal/OSGIServiceComparator.java b/modules/builder/src/main/java/org/apache/tamaya/builder/internal/OSGIServiceComparator.java
new file mode 100644
index 0000000..2ee3ef5
--- /dev/null
+++ b/modules/builder/src/main/java/org/apache/tamaya/builder/internal/OSGIServiceComparator.java
@@ -0,0 +1,69 @@
+/*
+ * 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.builder.internal;
+
+import org.osgi.framework.ServiceReference;
+
+import javax.annotation.Priority;
+import java.util.Comparator;
+
+/**
+ * Comparator implementation for odering services loaded based on their increasing priority values.
+ */
+class OSGIServiceComparator implements Comparator<ServiceReference> {
+
+    @Override
+    public int compare(ServiceReference o1, ServiceReference o2) {
+        int prio = getPriority(o1) - getPriority(o2);
+        if (prio < 0) {
+            return 1;
+        } else if (prio > 0) {
+            return -1;
+        } else {
+            return 0; //o1.getClass().getSimpleName().compareTo(o2.getClass().getSimpleName());
+        }
+    }
+
+    /**
+     * Checks the given instance for a @Priority annotation. If present the annotation's value s evaluated. If no such
+     * annotation is present, a default priority is returned (1);
+     *
+     * @param o the instance, not null.
+     * @return a priority, by default 1.
+     */
+    public static int getPriority(Object o) {
+        return getPriority(o.getClass());
+    }
+
+    /**
+     * Checks the given type optionally annotated with a @Priority. If present the annotation's value s evaluated.
+     * If no such annotation is present, a default priority is returned (1);
+     *
+     * @param type the type, not null.
+     * @return a priority, by default 1.
+     */
+    public static int getPriority(Class type) {
+        int prio = 1;
+        Priority priority = (Priority)type.getAnnotation(Priority.class);
+        if (priority != null) {
+            prio = priority.value();
+        }
+        return prio;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/modules/builder/src/main/java/org/apache/tamaya/builder/internal/OSGIServiceContext.java
----------------------------------------------------------------------
diff --git a/modules/builder/src/main/java/org/apache/tamaya/builder/internal/OSGIServiceContext.java b/modules/builder/src/main/java/org/apache/tamaya/builder/internal/OSGIServiceContext.java
new file mode 100644
index 0000000..05c830f
--- /dev/null
+++ b/modules/builder/src/main/java/org/apache/tamaya/builder/internal/OSGIServiceContext.java
@@ -0,0 +1,82 @@
+/*
+ * 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.builder.internal;
+
+import org.apache.tamaya.builder.spi.ServiceContext;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Objects;
+
+/**
+ * ServiceContext implementation based on OSGI Service mechanisms.
+ */
+public class OSGIServiceContext implements ServiceContext{
+
+    private static final OSGIServiceComparator REF_COMPARATOR = new OSGIServiceComparator();
+
+    private final BundleContext bundleContext;
+
+    public OSGIServiceContext(BundleContext bundleContext){
+        this.bundleContext = Objects.requireNonNull(bundleContext);
+    }
+
+    public boolean isInitialized(){
+        return bundleContext != null;
+    }
+
+
+    @Override
+    public int ordinal() {
+        return 10;
+    }
+
+    @Override
+    public <T> T getService(Class<T> serviceType) {
+        ServiceReference<T> ref = this.bundleContext.getServiceReference(serviceType);
+        if(ref!=null){
+            return this.bundleContext.getService(ref);
+        }
+        return null;
+    }
+
+    @Override
+    public <T> List<T> getServices(Class<T> serviceType) {
+        List<ServiceReference<T>> refs = new ArrayList<>();
+        try {
+            refs.addAll(this.bundleContext.getServiceReferences(serviceType, null));
+            Collections.sort(refs, REF_COMPARATOR);
+            List<T> services = new ArrayList<>(refs.size());
+            for(ServiceReference<T> ref:refs){
+                T service = bundleContext.getService(ref);
+                if(service!=null) {
+                    services.add(service);
+                }
+            }
+            return services;
+        } catch (InvalidSyntaxException e) {
+            e.printStackTrace();
+            return Collections.emptyList();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/modules/builder/src/main/java/org/apache/tamaya/builder/internal/OSGIServiceLoader.java
----------------------------------------------------------------------
diff --git a/modules/builder/src/main/java/org/apache/tamaya/builder/internal/OSGIServiceLoader.java b/modules/builder/src/main/java/org/apache/tamaya/builder/internal/OSGIServiceLoader.java
new file mode 100644
index 0000000..cf307d5
--- /dev/null
+++ b/modules/builder/src/main/java/org/apache/tamaya/builder/internal/OSGIServiceLoader.java
@@ -0,0 +1,156 @@
+/*
+ * 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.builder.internal;
+
+import java.io.BufferedReader;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleEvent;
+import org.osgi.framework.BundleListener;
+import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceFactory;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.util.tracker.ServiceTracker;
+
+/**
+ * An bundle listener that registers services defined in META-INF/services, when a bundle is starting.
+ *
+ * @author anatole@apache.org
+ */
+public class OSGIServiceLoader implements BundleListener {
+    // Provide logging
+    private static final Logger log = Logger.getLogger(OSGIServiceLoader.class.getName());
+
+    private Map<Class, ServiceTracker<Object,Object>> services = new ConcurrentHashMap<>();
+
+    @Override
+    public void bundleChanged(BundleEvent bundleEvent) {
+        // Parse and create metadta on STARTING
+        if (bundleEvent.getType() == BundleEvent.STARTED) {
+            Bundle bundle = bundleEvent.getBundle();
+            if (bundle.getEntry("META-INF/services/") == null) {
+                return;
+            }
+            Enumeration<String> entryPaths = bundle.getEntryPaths("META-INF/services/");
+            while (entryPaths.hasMoreElements()) {
+                String entryPath = entryPaths.nextElement();
+                if(!entryPath.endsWith("/")) {
+                    processEntryPath(bundle, entryPath);
+                }
+            }
+        }
+    }
+
+    private void processEntryPath(Bundle bundle, String entryPath) {
+        try {
+            String serviceName = entryPath.substring("META-INF/services/".length());
+            Class<?> serviceClass = bundle.loadClass(serviceName);
+
+            URL child = bundle.getEntry(entryPath);
+            InputStream inStream = child.openStream();
+
+            BufferedReader br = new BufferedReader(new InputStreamReader(inStream, "UTF-8"));
+            String implClassName = br.readLine();
+            while (implClassName != null){
+                int hashIndex = implClassName.indexOf("#");
+                if (hashIndex > 0) {
+                    implClassName = implClassName.substring(0, hashIndex-1);
+                }
+                else if (hashIndex == 0) {
+                    implClassName = "";
+                }
+                implClassName = implClassName.trim();
+                if (implClassName.length() > 0) {
+                    try {
+                        // Load the service class
+                        Class<?> implClass = bundle.loadClass(implClassName);
+                        if (!serviceClass.isAssignableFrom(implClass)) {
+                            log.warning("Configured service: " + implClassName + " is not assignble to " +
+                                    serviceClass.getName());
+                            continue;
+                        }
+                        // Provide service properties
+                        Hashtable<String, String> props = new Hashtable<>();
+                        props.put(Constants.VERSION_ATTRIBUTE, bundle.getVersion().toString());
+                        String vendor = bundle.getHeaders().get(Constants.BUNDLE_VENDOR);
+                        props.put(Constants.SERVICE_VENDOR, (vendor != null ? vendor : "anonymous"));
+                        // Translate annotated @Priority into a service ranking
+                        props.put(Constants.SERVICE_RANKING,
+                                String.valueOf(PriorityServiceComparator.getPriority(implClass)));
+
+                        // Register the service factory on behalf of the intercepted bundle
+                        JDKUtilServiceFactory factory = new JDKUtilServiceFactory(implClass);
+                        BundleContext bundleContext = bundle.getBundleContext();
+                        bundleContext.registerService(serviceName, factory, props);
+                    }
+                    catch(Exception e){
+                        log.log(Level.SEVERE,
+                                "Failed to load service class using ServiceLoader logic: " + implClassName, e);
+                    }
+                }
+                implClassName = br.readLine();
+            }
+            br.close();
+        }
+        catch (RuntimeException rte) {
+            throw rte;
+        }
+        catch (Exception e) {
+            log.log(Level.SEVERE, "Failed to read services from: " + entryPath, e);
+        }
+    }
+
+
+    /**
+     * Service factory simply instantiating the configured service.
+     */
+    static class JDKUtilServiceFactory implements ServiceFactory
+    {
+        private final Class<?> serviceClass;
+
+        public JDKUtilServiceFactory(Class<?> serviceClass) {
+            this.serviceClass = serviceClass;
+        }
+
+        @Override
+        public Object getService(Bundle bundle, ServiceRegistration registration) {
+            try {
+                return serviceClass.newInstance();
+            }
+            catch (Exception ex) {
+                ex.printStackTrace();
+                throw new IllegalStateException("Cannot instanciate service", ex);
+            }
+        }
+
+        @Override
+        public void ungetService(Bundle bundle, ServiceRegistration registration, Object service) {
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/modules/builder/src/main/java/org/apache/tamaya/builder/internal/PriorityServiceComparator.java
----------------------------------------------------------------------
diff --git a/modules/builder/src/main/java/org/apache/tamaya/builder/internal/PriorityServiceComparator.java b/modules/builder/src/main/java/org/apache/tamaya/builder/internal/PriorityServiceComparator.java
new file mode 100644
index 0000000..c7e3656
--- /dev/null
+++ b/modules/builder/src/main/java/org/apache/tamaya/builder/internal/PriorityServiceComparator.java
@@ -0,0 +1,67 @@
+/*
+ * 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.builder.internal;
+
+import javax.annotation.Priority;
+import java.util.Comparator;
+
+/**
+ * Comparator implementation for odering services loaded based on their increasing priority values.
+ */
+public class PriorityServiceComparator implements Comparator<Object> {
+
+    @Override
+    public int compare(Object o1, Object o2) {
+        int prio = getPriority(o1) - getPriority(o2);
+        if (prio < 0) {
+            return 1;
+        } else if (prio > 0) {
+            return -1;
+        } else {
+            return o1.getClass().getSimpleName().compareTo(o2.getClass().getSimpleName());
+        }
+    }
+
+    /**
+     * Checks the given instance for a @Priority annotation. If present the annotation's value s evaluated. If no such
+     * annotation is present, a default priority is returned (1);
+     *
+     * @param o the instance, not null.
+     * @return a priority, by default 1.
+     */
+    public static int getPriority(Object o) {
+        return getPriority(o.getClass());
+    }
+
+    /**
+     * Checks the given type optionally annotated with a @Priority. If present the annotation's value s evaluated.
+     * If no such annotation is present, a default priority is returned (1);
+     *
+     * @param type the type, not null.
+     * @return a priority, by default 1.
+     */
+    public static int getPriority(Class type) {
+        int prio = 1;
+        Priority priority = (Priority)type.getAnnotation(Priority.class);
+        if (priority != null) {
+            prio = priority.value();
+        }
+        return prio;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/modules/builder/src/main/java/org/apache/tamaya/builder/internal/PropertyConverterManager.java
----------------------------------------------------------------------
diff --git a/modules/builder/src/main/java/org/apache/tamaya/builder/internal/PropertyConverterManager.java b/modules/builder/src/main/java/org/apache/tamaya/builder/internal/PropertyConverterManager.java
new file mode 100644
index 0000000..1f975ae
--- /dev/null
+++ b/modules/builder/src/main/java/org/apache/tamaya/builder/internal/PropertyConverterManager.java
@@ -0,0 +1,448 @@
+/*
+ * 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.builder.internal;
+
+import org.apache.tamaya.ConfigException;
+import org.apache.tamaya.TypeLiteral;
+import org.apache.tamaya.builder.internal.converters.EnumConverter;
+import org.apache.tamaya.builder.spi.ConversionContext;
+import org.apache.tamaya.builder.spi.PropertyConverter;
+import org.apache.tamaya.builder.spi.ServiceContextManager;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.Type;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReadWriteLock;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * Manager that deals with {@link PropertyConverter} instances.
+ * This class is thread-safe.
+ */
+public class PropertyConverterManager {
+    /**
+     * The logger used.
+     */
+    private static final Logger LOG = Logger.getLogger(PropertyConverterManager.class.getName());
+    /**
+     * The registered converters.
+     */
+    private final Map<TypeLiteral<?>, List<PropertyConverter<?>>> converters = new ConcurrentHashMap<>();
+    /**
+     * The transitive converters.
+     */
+    private final Map<TypeLiteral<?>, List<PropertyConverter<?>>> transitiveConverters = new ConcurrentHashMap<>();
+    /**
+     * The lock used.
+     */
+    private final ReadWriteLock lock = new ReentrantReadWriteLock();
+
+    private static final Comparator<Object> PRIORITY_COMPARATOR = new Comparator<Object>() {
+
+        @Override
+        public int compare(Object o1, Object o2) {
+            int prio = DefaultServiceContext.getPriority(o1) - DefaultServiceContext.getPriority(o2);
+            if (prio < 0) {
+                return 1;
+            } else if (prio > 0) {
+                return -1;
+            } else {
+                return o1.getClass().getSimpleName().compareTo(o2.getClass().getSimpleName());
+            }
+        }
+    };
+
+    /**
+     * Constructor.
+     */
+    public PropertyConverterManager() {
+        this(true);
+    }
+
+    public PropertyConverterManager(boolean init) {
+        if (init) {
+            initConverters();
+        }
+    }
+
+    /**
+     * Registers the default converters provided out of the box.
+     */
+    protected void initConverters() {
+        for (PropertyConverter conv : ServiceContextManager.getServiceContext().getServices(PropertyConverter.class)) {
+            Type type = TypeLiteral.getGenericInterfaceTypeParameters(conv.getClass(), PropertyConverter.class)[0];
+            register(TypeLiteral.of(type), conv);
+        }
+    }
+
+    /**
+     * Registers a ew converter instance.
+     *
+     * @param targetType the target type, not null.
+     * @param converter  the converter, not null.
+     * @param <T>        the type.
+     */
+    public <T> void register(TypeLiteral<T> targetType, PropertyConverter<T> converter) {
+        Objects.requireNonNull(converter);
+        Lock writeLock = lock.writeLock();
+        try {
+            writeLock.lock();
+            List converters = List.class.cast(this.converters.get(targetType));
+            List<PropertyConverter<?>> newConverters = new ArrayList<>();
+            if (converters != null) {
+                newConverters.addAll(converters);
+            }
+            newConverters.add(converter);
+            Collections.sort(newConverters, PRIORITY_COMPARATOR);
+            this.converters.put(targetType, Collections.unmodifiableList(newConverters));
+            // evaluate transitive closure for all inherited supertypes and implemented interfaces
+            // direct implemented interfaces
+            for (Class<?> ifaceType : targetType.getRawType().getInterfaces()) {
+                converters = List.class.cast(this.transitiveConverters.get(TypeLiteral.of(ifaceType)));
+                newConverters = new ArrayList<>();
+                if (converters != null) {
+                    newConverters.addAll(converters);
+                }
+                newConverters.add(converter);
+                Collections.sort(newConverters, PRIORITY_COMPARATOR);
+                this.transitiveConverters.put(TypeLiteral.of(ifaceType), Collections.unmodifiableList(newConverters));
+            }
+            Class<?> superClass = targetType.getRawType().getSuperclass();
+            while (superClass != null && !superClass.equals(Object.class)) {
+                converters = List.class.cast(this.transitiveConverters.get(TypeLiteral.of(superClass)));
+                newConverters = new ArrayList<>();
+                if (converters != null) {
+                    newConverters.addAll(converters);
+                }
+                newConverters.add(converter);
+                Collections.sort(newConverters, PRIORITY_COMPARATOR);
+                this.transitiveConverters.put(TypeLiteral.of(superClass), Collections.unmodifiableList(newConverters));
+                for (Class<?> ifaceType : superClass.getInterfaces()) {
+                    converters = List.class.cast(this.transitiveConverters.get(TypeLiteral.of(ifaceType)));
+                    newConverters = new ArrayList<>();
+                    if (converters != null) {
+                        newConverters.addAll(converters);
+                    }
+                    newConverters.add(converter);
+                    Collections.sort(newConverters, PRIORITY_COMPARATOR);
+                    this.transitiveConverters.put(TypeLiteral.of(ifaceType), Collections.unmodifiableList(newConverters));
+                }
+                superClass = superClass.getSuperclass();
+            }
+        } finally {
+            writeLock.unlock();
+        }
+    }
+
+    /**
+     * Allows to evaluate if a given target type is supported.
+     *
+     * @param targetType the target type, not null.
+     * @return true, if a converter for the given type is registered, or a default one can be created.
+     */
+    public boolean isTargetTypeSupported(TypeLiteral<?> targetType) {
+        return converters.containsKey(targetType) || transitiveConverters.containsKey(targetType) || createDefaultPropertyConverter(targetType) != null;
+    }
+
+    /**
+     * Get a map of all property converters currently registered. This will not contain the converters that
+     * may be created, when an instance is adapted, which provides a String constructor or compatible
+     * factory methods taking a single String instance.
+     *
+     * @return the current map of instantiated and registered converters.
+     * @see #createDefaultPropertyConverter(org.apache.tamaya.TypeLiteral)
+     */
+    public Map<TypeLiteral<?>, List<PropertyConverter<?>>> getPropertyConverters() {
+        Lock readLock = lock.readLock();
+        try {
+            readLock.lock();
+            return new HashMap<>(this.converters);
+        } finally {
+            readLock.unlock();
+        }
+    }
+
+    /**
+     * Get the list of all current registered converters for the given target type.
+     * If not converters are registered, they component tries to create and register a dynamic
+     * converter based on String costructor or static factory methods available.
+     * The converters provided are of the following type and returned in the following order:
+     * <ul>
+     * <li>Converters mapped explicitly to the required target type are returned first, ordered
+     * by decreasing priority. This means, if explicit converters are registered these are used
+     * primarly for converting a value.</li>
+     * <li>The target type of each explicitly registered converter also can be transitively mapped to
+     * 1) all directly implemented interfaces, 2) all its superclasses (except Object), 3) all the interfaces
+     * implemented by its superclasses. These groups of transitive converters is returned similarly in the
+     * order as mentioned, whereas also here a priority based decreasing ordering is applied.</li>
+     * <li>java.lang wrapper classes and native types are automatically mapped.</li>
+     * <li>If no explicit converters are registered, for Enum types a default implementation is provided that
+     * compares the configuration values with the different enum members defined (cases sensitive mapping).</li>
+     * </ul>
+     * <p>
+     * So given that list above directly registered mappings always are tried first, before any transitive mapping
+     * should be used. Also in all cases @Priority annotations are honored for ordering of the converters in place.
+     * Transitive conversion is supported for all directly implemented interfaces (including inherited ones) and
+     * the inheritance hierarchy (exception Object). Superinterfaces of implemented interfaces are ignored.
+     *
+     * @param targetType the target type, not null.
+     * @param <T>        the type class
+     * @return the ordered list of converters (may be empty for not convertible types).
+     * @see #createDefaultPropertyConverter(org.apache.tamaya.TypeLiteral)
+     */
+    public <T> List<PropertyConverter<T>> getPropertyConverters(TypeLiteral<T> targetType) {
+        Lock readLock = lock.readLock();
+        List<PropertyConverter<T>> converterList = new ArrayList<>();
+        List<PropertyConverter<T>> converters;
+        // direct mapped converters
+        try {
+            readLock.lock();
+            addConvertersToList(List.class.cast(this.converters.get(targetType)), converterList);
+        } finally {
+            readLock.unlock();
+        }
+        // transitive converter
+        try {
+            readLock.lock();
+            addConvertersToList(List.class.cast(this.transitiveConverters.get(targetType)), converterList);
+        } finally {
+            readLock.unlock();
+        }
+        // handling of java.lang wrapper classes
+        TypeLiteral<T> boxedType = mapBoxedType(targetType);
+        if (boxedType != null) {
+            try {
+                readLock.lock();
+                addConvertersToList(List.class.cast(this.converters.get(boxedType)), converterList);
+            } finally {
+                readLock.unlock();
+            }
+        }
+        if (converterList.isEmpty()) {
+            // adding any converters created on the fly, e.g. for enum types.
+            PropertyConverter<T> defaultConverter = createDefaultPropertyConverter(targetType);
+            if (defaultConverter != null) {
+                register(targetType, defaultConverter);
+                try {
+                    readLock.lock();
+                    addConvertersToList(List.class.cast(this.converters.get(targetType)), converterList);
+                } finally {
+                    readLock.unlock();
+                }
+            }
+        }
+        // check for parametrized types, ignoring param type
+        // direct mapped converters
+        if(targetType.getType()!=null) {
+            try {
+                readLock.lock();
+                addConvertersToList(List.class.cast(this.converters.get(
+                        TypeLiteral.of(targetType.getRawType()))), converterList);
+            } finally {
+                readLock.unlock();
+            }
+        }
+        return converterList;
+    }
+
+    private <T> void addConvertersToList(Collection<PropertyConverter<T>> converters, List<PropertyConverter<T>> converterList) {
+        if (converters != null) {
+            for(PropertyConverter<T> conv:converters) {
+                if(!converterList.contains(conv)) {
+                    converterList.add(conv);
+                }
+            }
+        }
+    }
+
+    /**
+     * Maps native types to the corresponding boxed types.
+     *
+     * @param targetType the native type.
+     * @param <T>        the type
+     * @return the boxed type, or null.
+     */
+    private <T> TypeLiteral<T> mapBoxedType(TypeLiteral<T> targetType) {
+        Type parameterType = targetType.getType();
+        if (parameterType == int.class) {
+            return TypeLiteral.class.cast(TypeLiteral.of(Integer.class));
+        }
+        if (parameterType == short.class) {
+            return TypeLiteral.class.cast(TypeLiteral.of(Short.class));
+        }
+        if (parameterType == byte.class) {
+            return TypeLiteral.class.cast(TypeLiteral.of(Byte.class));
+        }
+        if (parameterType == long.class) {
+            return TypeLiteral.class.cast(TypeLiteral.of(Long.class));
+        }
+        if (parameterType == boolean.class) {
+            return TypeLiteral.class.cast(TypeLiteral.of(Boolean.class));
+        }
+        if (parameterType == char.class) {
+            return TypeLiteral.class.cast(TypeLiteral.of(Character.class));
+        }
+        if (parameterType == float.class) {
+            return TypeLiteral.class.cast(TypeLiteral.of(Float.class));
+        }
+        if (parameterType == double.class) {
+            return TypeLiteral.class.cast(TypeLiteral.of(Double.class));
+        }
+        if (parameterType == int[].class) {
+            return TypeLiteral.class.cast(TypeLiteral.of(Integer[].class));
+        }
+        if (parameterType == short[].class) {
+            return TypeLiteral.class.cast(TypeLiteral.of(Short[].class));
+        }
+        if (parameterType == byte[].class) {
+            return TypeLiteral.class.cast(TypeLiteral.of(Byte[].class));
+        }
+        if (parameterType == long[].class) {
+            return TypeLiteral.class.cast(TypeLiteral.of(Long[].class));
+        }
+        if (parameterType == boolean.class) {
+            return TypeLiteral.class.cast(TypeLiteral.of(Boolean.class));
+        }
+        if (parameterType == char[].class) {
+            return TypeLiteral.class.cast(TypeLiteral.of(Character[].class));
+        }
+        if (parameterType == float[].class) {
+            return TypeLiteral.class.cast(TypeLiteral.of(Float[].class));
+        }
+        if (parameterType == double[].class) {
+            return TypeLiteral.class.cast(TypeLiteral.of(Double[].class));
+        }
+        return null;
+    }
+
+    /**
+     * Creates a dynamic PropertyConverter for the given target type.
+     *
+     * @param targetType the target type
+     * @param <T>        the type class
+     * @return a new converter, or null.
+     */
+    protected <T> PropertyConverter<T> createDefaultPropertyConverter(final TypeLiteral<T> targetType) {
+        if (Enum.class.isAssignableFrom(targetType.getRawType())) {
+            return new EnumConverter<>(targetType.getRawType());
+        }
+        PropertyConverter<T> converter = null;
+        final Method factoryMethod = getFactoryMethod(targetType.getRawType(), "of", "valueOf", "instanceOf", "getInstance", "from", "fromString", "parse");
+        if (factoryMethod != null) {
+            converter = new DefaultPropertyConverter<>(factoryMethod, targetType.getRawType());
+        }
+        if (converter == null) {
+            final Constructor<T> constr;
+            try {
+                constr = targetType.getRawType().getDeclaredConstructor(String.class);
+            } catch (NoSuchMethodException e) {
+                LOG.log(Level.FINEST, "No matching constrctor for " + targetType, e);
+                return null;
+            }
+            converter = new PropertyConverter<T>() {
+                    @Override
+                    public T convert(String value, ConversionContext context) {
+                        AccessController.doPrivileged(new PrivilegedAction<Object>() {
+                            @Override
+                            public Object run() {
+                                AccessController.doPrivileged(new PrivilegedAction<Object>() {
+                                    @Override
+                                    public Object run() {
+                                        constr.setAccessible(true);
+                                        return null;
+                                    }
+                                });
+                                return null;
+                            }
+                        });
+                        try {
+                            return constr.newInstance(value);
+                        } catch (Exception e) {
+                            LOG.log(Level.SEVERE, "Error creating new PropertyConverter instance " + targetType, e);
+                        }
+                        return null;
+                    }
+                };
+        }
+        return converter;
+    }
+
+    /**
+     * Tries to evaluate a factory method that can be used to create an instance based on a String.
+     *
+     * @param type        the target type
+     * @param methodNames the possible static method names
+     * @return the first method found, or null.
+     */
+    private Method getFactoryMethod(Class<?> type, String... methodNames) {
+        Method m;
+        for (String name : methodNames) {
+            try {
+                m = type.getDeclaredMethod(name, String.class);
+                return m;
+            } catch (NoSuchMethodException | RuntimeException e) {
+                LOG.finest("No such factory method found on type: " + type.getName() + ", methodName: " + name);
+            }
+        }
+        return null;
+    }
+
+    private static class DefaultPropertyConverter<T> implements PropertyConverter<T> {
+
+        private final Method factoryMethod;
+        private final Class<T> targetType;
+
+        DefaultPropertyConverter(Method factoryMethod, Class<T> targetType){
+            this.factoryMethod = Objects.requireNonNull(factoryMethod);
+            this.targetType =  Objects.requireNonNull(targetType);
+        }
+
+        @Override
+        public T convert(String value, ConversionContext context) {
+            context.addSupportedFormats(getClass(), "<String -> "+factoryMethod.toGenericString());
+
+            if (!Modifier.isStatic(factoryMethod.getModifiers())) {
+                throw new ConfigException(factoryMethod.toGenericString() +
+                        " is not a static method. Only static " +
+                        "methods can be used as factory methods.");
+            }
+            try {
+                AccessController.doPrivileged(new PrivilegedAction<Object>() {
+                    @Override
+                    public Object run() {
+                        factoryMethod.setAccessible(true);
+                        return null;
+                    }
+                });
+                Object invoke = factoryMethod.invoke(null, value);
+                return targetType.cast(invoke);
+            } catch (Exception e) {
+                throw new ConfigException("Failed to decode '" + value + "'", e);
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/modules/builder/src/main/java/org/apache/tamaya/builder/internal/PropertyFilterComparator.java
----------------------------------------------------------------------
diff --git a/modules/builder/src/main/java/org/apache/tamaya/builder/internal/PropertyFilterComparator.java b/modules/builder/src/main/java/org/apache/tamaya/builder/internal/PropertyFilterComparator.java
new file mode 100644
index 0000000..bb163a4
--- /dev/null
+++ b/modules/builder/src/main/java/org/apache/tamaya/builder/internal/PropertyFilterComparator.java
@@ -0,0 +1,60 @@
+/*
+ * 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.builder.internal;
+
+import org.apache.tamaya.builder.spi.PropertyFilter;
+
+import javax.annotation.Priority;
+import java.io.Serializable;
+import java.util.Comparator;
+
+/**
+ * Comparator for PropertyFilters based on their priority annotations.
+ */
+public class PropertyFilterComparator implements Comparator<PropertyFilter>, Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * Compare 2 filters for ordering the filter chain.
+     *
+     * @param filter1 the first filter
+     * @param filter2 the second filter
+     * @return the comparison result
+     */
+    private int comparePropertyFilters(PropertyFilter filter1, PropertyFilter filter2) {
+        Priority prio1 = filter1.getClass().getAnnotation(Priority.class);
+        Priority prio2 = filter2.getClass().getAnnotation(Priority.class);
+        int ord1 = prio1 != null ? prio1.value() : 0;
+        int ord2 = prio2 != null ? prio2.value() : 0;
+
+        if (ord1 < ord2) {
+            return -1;
+        } else if (ord1 > ord2) {
+            return 1;
+        } else {
+            return filter1.getClass().getName().compareTo(filter2.getClass().getName());
+        }
+    }
+
+    @Override
+    public int compare(PropertyFilter filter1, PropertyFilter filter2) {
+        return comparePropertyFilters(filter1, filter2);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/modules/builder/src/main/java/org/apache/tamaya/builder/internal/PropertyFiltering.java
----------------------------------------------------------------------
diff --git a/modules/builder/src/main/java/org/apache/tamaya/builder/internal/PropertyFiltering.java b/modules/builder/src/main/java/org/apache/tamaya/builder/internal/PropertyFiltering.java
new file mode 100644
index 0000000..75d7ad7
--- /dev/null
+++ b/modules/builder/src/main/java/org/apache/tamaya/builder/internal/PropertyFiltering.java
@@ -0,0 +1,147 @@
+/*
+ * 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.builder.internal;
+
+import org.apache.tamaya.builder.spi.ConfigurationContext;
+import org.apache.tamaya.builder.spi.FilterContext;
+import org.apache.tamaya.builder.spi.PropertyFilter;
+import org.apache.tamaya.builder.spi.PropertySource;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * Implementation of the Configuration API. This class uses the current {@link ConfigurationContext} to evaluate the
+ * chain of {@link PropertySource} and {@link PropertyFilter}
+ * instance to evaluate the current Configuration.
+ */
+public final class PropertyFiltering{
+    /**
+     * The logger.
+     */
+    private static final Logger LOG = Logger.getLogger(PropertyFiltering.class.getName());
+
+    /**
+     * The maximal number of filter cycles performed before aborting.
+     */
+    private static final int MAX_FILTER_LOOPS = 10;
+
+    /**
+     * Private singleton constructor.
+     */
+    private PropertyFiltering(){}
+
+    public static String applyFilter(String key, Map<String,String> configData, ConfigurationContext configurationContext) {
+        // Apply filters to values, prevent values filtered to null!
+        String result = configData.get(key);
+        for (int i = 0; i < MAX_FILTER_LOOPS; i++) {
+            boolean changed = false;
+            // Apply filters to values, prevent values filtered to null!
+            FilterContext filterContext = new FilterContext(key, configData, true);
+            for (PropertyFilter filter : configurationContext.getPropertyFilters()) {
+                String newValue = filter.filterProperty(result, filterContext);
+                if (newValue != null && !newValue.equals(result)) {
+                    changed = true;
+                    if (LOG.isLoggable(Level.FINEST)) {
+                        LOG.finest("Filter - " + key + ": " + result + " -> " + newValue + " by " + filter);
+                    }
+                } else if (result != null && !result.equals(newValue)) {
+                    changed = true;
+                    if (LOG.isLoggable(Level.FINEST)) {
+                        LOG.finest("Filter - " + key + ": " + result + " -> " + newValue + " by " + filter);
+                    }
+                }
+                result = newValue;
+            }
+            if (!changed) {
+                LOG.finest("Finishing filter loop, no changes detected.");
+                break;
+            } else {
+                if (i == (MAX_FILTER_LOOPS - 1)) {
+                    if (LOG.isLoggable(Level.WARNING)) {
+                        LOG.warning("Maximal filter loop count reached, aborting filter evaluation after cycles: " + i);
+                    }
+                } else {
+                    LOG.finest("Repeating filter loop, changes detected.");
+                }
+            }
+        }
+        return result;
+    }
+
+    public static Map<String, String> applyFilters(Map<String, String> inputMap, ConfigurationContext configurationContext) {
+        Map<String, String> resultMap = new HashMap<>(inputMap);
+        // Apply filters to values, prevent values filtered to null!
+        Map<String, String> metaData = filterMetadata(inputMap);
+        for (int i = 0; i < MAX_FILTER_LOOPS; i++) {
+            AtomicInteger changes = new AtomicInteger();
+            for (Map.Entry<String, String> entry : inputMap.entrySet()) {
+                FilterContext filterContext = new FilterContext(entry.getKey(), inputMap, false);
+                for (PropertyFilter filter : configurationContext.getPropertyFilters()) {
+                    final String k = entry.getKey();
+                    final String v = entry.getValue();
+                    String newValue = filter.filterProperty(v, filterContext);
+                    if (newValue != null && !newValue.equals(v)) {
+                        changes.incrementAndGet();
+                        LOG.finest("Filter - " + k + ": " + v + " -> " + newValue + " by " + filter);
+                    } else if (v != null && !v.equals(newValue)) {
+                        changes.incrementAndGet();
+                        LOG.finest("Filter - " + k + ": " + v + " -> " + newValue + " by " + filter);
+                    }
+                    // Remove null values
+                    if (null != newValue) {
+                        resultMap.put(k, newValue);
+                    }
+                    else{
+                        resultMap.remove(k);
+                    }
+                }
+            }
+            if (changes.get() == 0) {
+                LOG.finest("Finishing filter loop, no changes detected.");
+                break;
+            } else {
+                if (i == (MAX_FILTER_LOOPS - 1)) {
+                    if (LOG.isLoggable(Level.WARNING)) {
+                        LOG.warning("Maximal filter loop count reached, aborting filter evaluation after cycles: " + i);
+                    }
+                } else {
+                    LOG.finest("Repeating filter loop, changes detected: " + changes.get());
+                }
+                changes.set(0);
+            }
+        }
+        return resultMap;
+    }
+
+    private static Map<String, String> filterMetadata(Map<String, String> inputMap) {
+        Map<String,String> result = new HashMap<>();
+        for(Map.Entry<String,String> en:inputMap.entrySet()){
+            if(en.getKey().startsWith("_")){
+                result.put(en.getKey(), en.getValue());
+            }
+        }
+        return Collections.unmodifiableMap(result);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/modules/builder/src/main/java/org/apache/tamaya/builder/internal/PropertySourceComparator.java
----------------------------------------------------------------------
diff --git a/modules/builder/src/main/java/org/apache/tamaya/builder/internal/PropertySourceComparator.java b/modules/builder/src/main/java/org/apache/tamaya/builder/internal/PropertySourceComparator.java
new file mode 100644
index 0000000..ce02944
--- /dev/null
+++ b/modules/builder/src/main/java/org/apache/tamaya/builder/internal/PropertySourceComparator.java
@@ -0,0 +1,54 @@
+/*
+ * 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.builder.internal;
+
+import org.apache.tamaya.builder.spi.PropertySource;
+
+import java.io.Serializable;
+import java.util.Comparator;
+
+/**
+ * Comparator for ordering of PropertySources based on their ordinal method and class name.
+ */
+public class PropertySourceComparator implements Comparator<PropertySource>, Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * Order property source reversely, the most important come first.
+     *
+     * @param source1 the first PropertySource
+     * @param source2 the second PropertySource
+     * @return the comparison result.
+     */
+    private int comparePropertySources(PropertySource source1, PropertySource source2) {
+        if (source1.getOrdinal() < source2.getOrdinal()) {
+            return -1;
+        } else if (source1.getOrdinal() > source2.getOrdinal()) {
+            return 1;
+        } else {
+            return source1.getClass().getName().compareTo(source2.getClass().getName());
+        }
+    }
+
+    @Override
+    public int compare(PropertySource source1, PropertySource source2) {
+        return comparePropertySources(source1, source2);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/modules/builder/src/main/java/org/apache/tamaya/builder/internal/ReflectionUtil.java
----------------------------------------------------------------------
diff --git a/modules/builder/src/main/java/org/apache/tamaya/builder/internal/ReflectionUtil.java b/modules/builder/src/main/java/org/apache/tamaya/builder/internal/ReflectionUtil.java
new file mode 100644
index 0000000..d32d1c4
--- /dev/null
+++ b/modules/builder/src/main/java/org/apache/tamaya/builder/internal/ReflectionUtil.java
@@ -0,0 +1,42 @@
+/*
+ * 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.builder.internal;
+
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+
+
+/**
+ * Small utility class used by other parts.
+ */
+public final class ReflectionUtil {
+
+    private ReflectionUtil(){}
+
+    public static ParameterizedType getParametrizedType(Class<?> clazz) {
+        Type[] genericTypes = clazz.getGenericInterfaces();
+        for (Type type : genericTypes) {
+            if (type instanceof ParameterizedType) {
+                return (ParameterizedType) type;
+            }
+
+        }
+        return null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/modules/builder/src/main/java/org/apache/tamaya/builder/propertysource/BasePropertySource.java
----------------------------------------------------------------------
diff --git a/modules/builder/src/main/java/org/apache/tamaya/builder/propertysource/BasePropertySource.java b/modules/builder/src/main/java/org/apache/tamaya/builder/propertysource/BasePropertySource.java
new file mode 100644
index 0000000..bd33c08
--- /dev/null
+++ b/modules/builder/src/main/java/org/apache/tamaya/builder/propertysource/BasePropertySource.java
@@ -0,0 +1,101 @@
+/*
+ * 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.builder.propertysource;
+
+import org.apache.tamaya.builder.spi.PropertySource;
+import org.apache.tamaya.builder.spi.PropertyValue;
+import org.apache.tamaya.builder.spi.PropertyValueBuilder;
+
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * Abstract {@link PropertySource} that allows to set a default ordinal that will be used, if no
+ * ordinal is provided with the config.
+ */
+public abstract class BasePropertySource implements PropertySource{
+    /** default ordinal that will be used, if no ordinal is provided with the config. */
+    private final int defaultOrdinal;
+
+    /**
+     * Constructor.
+     * @param defaultOrdinal default ordinal that will be used, if no ordinal is provided with the config.
+     */
+    protected BasePropertySource(int defaultOrdinal){
+        this.defaultOrdinal = defaultOrdinal;
+    }
+
+    /**
+     * Constructor, using a default ordinal of 0.
+     */
+    protected BasePropertySource(){
+        this(0);
+    }
+
+    @Override
+    public String getName() {
+        return getClass().getSimpleName();
+    }
+
+    @Override
+    public int getOrdinal() {
+        PropertyValue configuredOrdinal = get(TAMAYA_ORDINAL);
+
+        if(configuredOrdinal!=null){
+            try {
+                return Integer.parseInt(configuredOrdinal.getValue());
+            } catch (Exception e) {
+                Logger.getLogger(getClass().getName()).log(Level.WARNING,
+                        "Configured Ordinal is not an int number: " + configuredOrdinal.getValue(), e);
+            }
+        }
+        return getDefaultOrdinal();
+    }
+
+    /**
+     * Returns the  default ordinal used, when no ordinal is set, or the ordinal was not parseable to an int value.
+     * @return the  default ordinal used, by default 0.
+     */
+    public int getDefaultOrdinal(){
+        return defaultOrdinal;
+    }
+
+    @Override
+    public PropertyValue get(String key) {
+        Map<String,String> properties = getProperties();
+        String val = properties.get(key);
+        if(val==null){
+            return null;
+        }
+        PropertyValueBuilder b = new PropertyValueBuilder(key, val, getName());
+        String metaKeyStart = "_" + key + ".";
+        for(Map.Entry<String,String> en:properties.entrySet()) {
+            if(en.getKey().startsWith(metaKeyStart) && en.getValue()!=null){
+                b.addContextData(en.getKey().substring(metaKeyStart.length()), en.getValue());
+            }
+        }
+        return b.build();
+    }
+
+    @Override
+    public boolean isScannable(){
+        return true;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/modules/builder/src/main/java/org/apache/tamaya/builder/propertysource/CLIPropertySource.java
----------------------------------------------------------------------
diff --git a/modules/builder/src/main/java/org/apache/tamaya/builder/propertysource/CLIPropertySource.java b/modules/builder/src/main/java/org/apache/tamaya/builder/propertysource/CLIPropertySource.java
new file mode 100644
index 0000000..e75fb8b
--- /dev/null
+++ b/modules/builder/src/main/java/org/apache/tamaya/builder/propertysource/CLIPropertySource.java
@@ -0,0 +1,101 @@
+/*
+ * 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.builder.propertysource;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+
+/**
+ * PropertySource that allows to add the programs main arguments as configuration entries. Unix syntax using '--' and
+ * '-' params is supported.
+ */
+public class CLIPropertySource extends BasePropertySource{
+
+    /** The original main arguments. */
+    private static String[] args = new String[0];
+
+    /** The map of parsed main arguments. */
+    private static Map<String,String> mainArgs;
+
+    /** Initializes the initial state. */
+    static{
+        initMainArgs(args);
+    }
+
+
+    /**
+     * Creates a new instance.
+     */
+    public CLIPropertySource(){}
+
+    /**
+     * Configure the main arguments, hereby parsing and mapping the main arguments into
+     * configuration propertiesi as key-value pairs.
+     * @param args the main arguments, not null.
+     */
+    public static void initMainArgs(String... args){
+        CLIPropertySource.args = Objects.requireNonNull(args);
+        // TODO is there a way to figure out the args?
+        String argsProp = System.getProperty("main.args");
+        if(argsProp!=null){
+            CLIPropertySource.args = argsProp.split("\\s");
+        }
+        Map<String,String> result = null;
+        if(CLIPropertySource.args==null){
+            result = Collections.emptyMap();
+        }else{
+            result = new HashMap<>();
+            String prefix = System.getProperty("main.args.prefix");
+            if(prefix==null){
+                prefix="";
+            }
+            String key = null;
+            for(String arg:CLIPropertySource.args){
+                if(arg.startsWith("--")){
+                    arg = arg.substring(2);
+                    int index = arg.indexOf("=");
+                    if(index>0){
+                        key = arg.substring(0,index).trim();
+                        result.put(prefix+key, arg.substring(index+1).trim());
+                        key = null;
+                    }else{
+                        result.put(prefix+arg, arg);
+                    }
+                }else if(arg.startsWith("-")){
+                    key = arg.substring(1);
+                }else{
+                    if(key!=null){
+                        result.put(prefix+key, arg);
+                        key = null;
+                    }else{
+                        result.put(prefix+arg, arg);
+                    }
+                }
+            }
+        }
+        CLIPropertySource.mainArgs = Collections.unmodifiableMap(result);
+    }
+
+    @Override
+    public Map<String, String> getProperties() {
+        return Collections.unmodifiableMap(mainArgs);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/modules/builder/src/main/java/org/apache/tamaya/builder/propertysource/EnvironmentPropertySource.java
----------------------------------------------------------------------
diff --git a/modules/builder/src/main/java/org/apache/tamaya/builder/propertysource/EnvironmentPropertySource.java b/modules/builder/src/main/java/org/apache/tamaya/builder/propertysource/EnvironmentPropertySource.java
new file mode 100644
index 0000000..59873b0
--- /dev/null
+++ b/modules/builder/src/main/java/org/apache/tamaya/builder/propertysource/EnvironmentPropertySource.java
@@ -0,0 +1,102 @@
+/*
+ * 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.builder.propertysource;
+
+import org.apache.tamaya.builder.spi.PropertySource;
+import org.apache.tamaya.builder.spi.PropertyValue;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.logging.Logger;
+
+/**
+ * This {@link PropertySource} provides all Properties which are set
+ * via
+ * {@code export myprop=myval} on UNIX Systems or
+ * {@code set myprop=myval} on Windows. You can disable this feature by setting {@code tamaya.envprops.disable}
+ * or {@code tamaya.defaults.disable}.
+ */
+public class EnvironmentPropertySource implements PropertySource {
+
+    private static final Logger LOG = Logger.getLogger(EnvironmentPropertySource.class.getName());
+
+    /**
+     * default ordinal for {@link EnvironmentPropertySource}
+     */
+    public static final int DEFAULT_ORDINAL = 300;
+
+    private final boolean disabled = evaluateDisabled();
+
+    private boolean evaluateDisabled() {
+        String value = System.getProperty("tamaya.envprops.disable");
+        if(value==null){
+            value = System.getenv("tamaya.envprops.disable");
+        }
+        if(value==null){
+            value = System.getProperty("tamaya.defaults.disable");
+        }
+        if(value==null){
+            value = System.getenv("tamaya.defaults.disable");
+        }
+        if(value==null){
+            return false;
+        }
+        return value.isEmpty() || Boolean.parseBoolean(value);
+    }
+
+    @Override
+    public int getOrdinal() {
+        return DEFAULT_ORDINAL;
+    }
+
+    @Override
+    public String getName() {
+        if(disabled){
+            return "environment-properties(disabled)";
+        }
+        return "environment-properties";
+    }
+
+    @Override
+    public PropertyValue get(String key) {
+        if(disabled){
+            return null;
+        }
+        return PropertyValue.of(key, System.getenv(key), getName());
+    }
+
+    @Override
+    public Map<String, String> getProperties() {
+        if(disabled){
+            return Collections.emptyMap();
+        }
+        Map<String, String> entries = new HashMap<>(System.getenv());
+        for (Map.Entry<String, String> entry : System.getenv().entrySet()) {
+            entries.put("_" + entry.getKey() + ".source", getName());
+        }
+        return entries;
+    }
+
+    @Override
+    public boolean isScannable() {
+        return true;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/modules/builder/src/main/java/org/apache/tamaya/builder/propertysource/SimplePropertySource.java
----------------------------------------------------------------------
diff --git a/modules/builder/src/main/java/org/apache/tamaya/builder/propertysource/SimplePropertySource.java b/modules/builder/src/main/java/org/apache/tamaya/builder/propertysource/SimplePropertySource.java
new file mode 100644
index 0000000..e1df180
--- /dev/null
+++ b/modules/builder/src/main/java/org/apache/tamaya/builder/propertysource/SimplePropertySource.java
@@ -0,0 +1,137 @@
+/*
+ * 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.builder.propertysource;
+
+import org.apache.tamaya.ConfigException;
+import org.apache.tamaya.builder.spi.PropertySource;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Properties;
+import java.util.logging.Logger;
+
+/**
+ * Simple implementation of a {@link PropertySource} for properties-files.
+ */
+public class SimplePropertySource extends BasePropertySource {
+
+    private static final Logger LOG = Logger.getLogger(SimplePropertySource.class.getName());
+    /**
+     * The property source name.
+     */
+    private String name;
+    /**
+     * The current properties.
+     */
+    private Map<String, String> properties;
+
+    /**
+     * Creates a new Properties based PropertySource based on the given URL.
+     *
+     * @param propertiesLocation the URL encoded location, not null.
+     */
+    public SimplePropertySource(File propertiesLocation) {
+        super(0);
+        try {
+            this.name = propertiesLocation.toString();
+            this.properties = load(propertiesLocation.toURI().toURL());
+        } catch (IOException e) {
+            throw new ConfigException("Failed to load properties from " + propertiesLocation, e);
+        }
+    }
+
+    /**
+     * Creates a new Properties based PropertySource based on the given URL.
+     *
+     * @param propertiesLocation the URL encoded location, not null.
+     */
+    public SimplePropertySource(URL propertiesLocation) {
+        super(0);
+        this.properties = load(propertiesLocation);
+        this.name = propertiesLocation.toString();
+    }
+
+    /**
+     * Creates a new Properties based PropertySource based on the given properties map.
+     *
+     * @param name       the name, not null.
+     * @param properties the properties, not null.
+     */
+    public SimplePropertySource(String name, Map<String, String> properties) {
+        super(0);
+        this.properties = new HashMap<>(properties);
+        this.name = Objects.requireNonNull(name);
+    }
+
+    /**
+     * Creates a new Properties based PropertySource based on the given URL.
+     *
+     * @param name               The property source name
+     * @param propertiesLocation the URL encoded location, not null.
+     */
+    public SimplePropertySource(String name, URL propertiesLocation) {
+        super(0);
+        this.properties = load(propertiesLocation);
+        this.name = Objects.requireNonNull(name);
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+
+    @Override
+    public Map<String, String> getProperties() {
+        return this.properties;
+    }
+
+    /**
+     * loads the Properties from the given URL
+     *
+     * @param propertiesFile {@link java.net.URL} to load Properties from
+     * @return loaded {@link java.util.Properties}
+     * @throws IllegalStateException in case of an error while reading properties-file
+     */
+    private Map<String, String> load(URL propertiesFile) {
+        Map<String, String> properties = new HashMap<>();
+        try (InputStream stream = propertiesFile.openStream()) {
+            Properties props = new Properties();
+            if (stream != null) {
+                props.load(stream);
+            }
+            for (String key : props.stringPropertyNames()) {
+                properties.put(key, props.getProperty(key));
+                if(getName()==null){
+                    LOG.warning("No Property Source name found for " + this +", ommitting source meta-entries.");
+                }else {
+                    properties.put("_" + key + ".source", getName());
+                }
+            }
+        } catch (IOException e) {
+            throw new ConfigException("Error loading properties " + propertiesFile, e);
+        }
+        return properties;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/modules/builder/src/main/java/org/apache/tamaya/builder/propertysource/SystemPropertySource.java
----------------------------------------------------------------------
diff --git a/modules/builder/src/main/java/org/apache/tamaya/builder/propertysource/SystemPropertySource.java b/modules/builder/src/main/java/org/apache/tamaya/builder/propertysource/SystemPropertySource.java
new file mode 100644
index 0000000..d07c070
--- /dev/null
+++ b/modules/builder/src/main/java/org/apache/tamaya/builder/propertysource/SystemPropertySource.java
@@ -0,0 +1,125 @@
+/*
+ * 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.builder.propertysource;
+
+import org.apache.tamaya.builder.spi.PropertySource;
+import org.apache.tamaya.builder.spi.PropertyValue;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+/**
+ * This {@link PropertySource} manages the system properties. You can disable this feature by
+ * setting {@code tamaya.envprops.disable} or {@code tamaya.defaults.disable}.
+ */
+public class SystemPropertySource implements PropertySource {
+
+    /**
+     * default ordinal for {@link SystemPropertySource}
+     */
+    public static final int DEFAULT_ORDINAL = 1000;
+
+    private volatile Map<String,String> cachedProperties;
+
+    /**
+     * previous System.getProperties().hashCode()
+     * so we can check if we need to reload
+     */
+    private int previousHash;
+
+    private final boolean disabled = evaluateDisabled();
+
+    private boolean evaluateDisabled() {
+        String value = System.getProperty("tamaya.sysprops.disable");
+        if(value==null){
+            value = System.getenv("tamaya.sysprops.disable");
+        }
+        if(value==null){
+            value = System.getProperty("tamaya.defaults.disable");
+        }
+        if(value==null){
+            value = System.getenv("tamaya.defaults.disable");
+        }
+        if(value==null){
+            return false;
+        }
+        return value.isEmpty() || Boolean.parseBoolean(value);
+    }
+
+
+
+    public SystemPropertySource() {
+        cachedProperties = loadProperties();
+        previousHash = System.getProperties().hashCode();
+    }
+
+    private Map<String, String> loadProperties() {
+        Map<String,String> props = new HashMap<>();
+        Properties sysProps = System.getProperties();
+        for(String name: sysProps.stringPropertyNames()) {
+            props.put(name,sysProps.getProperty(name));
+            props.put("_"+name+".source",getName());
+        }
+        return props;
+    }
+
+    @Override
+    public int getOrdinal() {
+        return DEFAULT_ORDINAL;
+    }
+
+    @Override
+    public String getName() {
+        if(disabled){
+            return "system-properties(disabled)";
+        }
+        return "system-properties";
+    }
+
+    @Override
+    public PropertyValue get(String key) {
+        if(disabled){
+            return null;
+        }
+        return PropertyValue.of(key, System.getProperty(key), getName());
+    }
+
+    @Override
+    public Map<String, String> getProperties() {
+        if(disabled){
+            return Collections.emptyMap();
+        }
+        // only need to reload and fill our map if something has changed
+        // synchronization was removed, Instance was marked as volatile. In the worst case it
+        // is reloaded twice, but the values will be the same.
+        if (previousHash != System.getProperties().hashCode()) {
+            Map<String, String> properties = loadProperties();
+            this.cachedProperties = Collections.unmodifiableMap(properties);
+            previousHash = System.getProperties().hashCode();
+        }
+        return this.cachedProperties;
+    }
+
+    @Override
+    public boolean isScannable() {
+        return true;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/modules/builder/src/main/java/org/apache/tamaya/builder/provider/JavaConfigurationProvider.java
----------------------------------------------------------------------
diff --git a/modules/builder/src/main/java/org/apache/tamaya/builder/provider/JavaConfigurationProvider.java b/modules/builder/src/main/java/org/apache/tamaya/builder/provider/JavaConfigurationProvider.java
new file mode 100644
index 0000000..63a52bd
--- /dev/null
+++ b/modules/builder/src/main/java/org/apache/tamaya/builder/provider/JavaConfigurationProvider.java
@@ -0,0 +1,85 @@
+/*
+ * 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.builder.provider;
+
+import org.apache.tamaya.ConfigException;
+import org.apache.tamaya.builder.propertysource.SimplePropertySource;
+import org.apache.tamaya.builder.spi.PropertySource;
+import org.apache.tamaya.builder.spi.PropertySourceProvider;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.List;
+
+/**
+ * Provider which reads all {@code javaconfiguration.properties} files from classpath. By setting
+ * {@code tamaya.defaultprops.disable} or {@code tamaya.defaults.disable} as system or environment property this feature
+ * can be disabled.
+ */
+public class JavaConfigurationProvider implements PropertySourceProvider {
+    /** Default location in the classpath, where Tamaya looks for configuration by default. */
+    public static final String DEFAULT_PROPERTIES_FILE_NAME="META-INF/javaconfiguration.properties";
+
+    private final boolean disabled = evaluateDisabled();
+
+    private boolean evaluateDisabled() {
+        String value = System.getProperty("tamaya.defaultprops.disable");
+        if(value==null){
+            value = System.getenv("tamaya.defaultprops.disable");
+        }
+        if(value==null){
+            value = System.getProperty("tamaya.defaults.disable");
+        }
+        if(value==null){
+            value = System.getenv("tamaya.defaults.disable");
+        }
+        if(value==null){
+            return false;
+        }
+        return value.isEmpty() || Boolean.parseBoolean(value);
+    }
+
+    @Override
+    public Collection<PropertySource> getPropertySources() {
+        if(disabled){
+            return Collections.emptySet();
+        }
+        List<PropertySource> propertySources = new ArrayList<>();
+        try {
+            ClassLoader cl = Thread.currentThread().getContextClassLoader();
+            if(cl!=null) {
+                Enumeration<URL> urls = Thread.currentThread().getContextClassLoader()
+                        .getResources(DEFAULT_PROPERTIES_FILE_NAME);
+                while (urls.hasMoreElements()) {
+                    propertySources.add(new SimplePropertySource(urls.nextElement()));
+                }
+            }
+
+        } catch (IOException e) {
+            throw new ConfigException("Error while loading javaconfiguration.properties", e);
+        }
+        return Collections.unmodifiableList(propertySources);
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/modules/builder/src/main/java/org/apache/tamaya/builder/spi/ConfigurationContext.java
----------------------------------------------------------------------
diff --git a/modules/builder/src/main/java/org/apache/tamaya/builder/spi/ConfigurationContext.java b/modules/builder/src/main/java/org/apache/tamaya/builder/spi/ConfigurationContext.java
new file mode 100644
index 0000000..c206e98
--- /dev/null
+++ b/modules/builder/src/main/java/org/apache/tamaya/builder/spi/ConfigurationContext.java
@@ -0,0 +1,159 @@
+/*
+ * 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.builder.spi;
+
+
+import org.apache.tamaya.TypeLiteral;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Central SPI for programmatically dealing with the setup of the configuration system.
+ * This includes adding and enlisting {@link PropertySource}s,
+ * managing {@link PropertyConverter}s, ConfigFilters, etc.
+ */
+public interface ConfigurationContext {
+
+    /**
+     * This method can be used for programmatically adding {@link PropertySource}s.
+     * It is not needed for normal 'usage' by end users, but only for Extension Developers!
+     *
+     * @param propertySourcesToAdd the PropertySources to add
+     */
+    void addPropertySources(PropertySource... propertySourcesToAdd);
+
+    /**
+     * This method returns the current list of registered PropertySources ordered via their ordinal.
+     * PropertySources with a lower ordinal come last. The PropertySource with the
+     * highest ordinal comes first.
+     * If two PropertySources have the same ordinal number they will get sorted
+     * using their class name just to ensure the user at least gets the same ordering
+     * after a JVM restart, hereby names before are added last.
+     * PropertySources are loaded when this method is called the first time, which basically is
+     * when the first time configuration is accessed.
+     *
+     * @return a sorted list of registered PropertySources.  The returned list need not be modifiable
+     */
+    List<PropertySource> getPropertySources();
+
+
+    /**
+     * This method can be used for programmatically adding {@link PropertyConverter}s.
+     * It is not needed for normal 'usage' by end users, but only for Extension Developers!
+     *
+     * @param <T> the type of the type literal
+     * @param typeToConvert the type which the converter is for
+     * @param propertyConverter the PropertyConverters to add for this type
+     */
+    <T> void addPropertyConverter(TypeLiteral<T> typeToConvert, PropertyConverter<T> propertyConverter);
+
+    /**
+     * <p>
+     * This method returns the Map of registered PropertyConverters
+     * per type.
+     * The List for each type is ordered via their {@link javax.annotation.Priority} and
+     * cladd name.
+     * </p>
+     *
+     * <p>A simplified scenario could be like:</p>
+     * <pre>
+     *  {
+     *      Date.class -&gt; {StandardDateConverter, TimezoneDateConverter, MyCustomDateConverter }
+     *      Boolean.class -&gt; {StandardBooleanConverter, FrenchBooleanConverter}
+     *      Integer.class -&gt; {DynamicDefaultConverter}
+     *  }
+     * </pre>
+     *
+     * @return map with sorted list of registered PropertySources per type.
+     */
+    Map<TypeLiteral<?>, List<PropertyConverter<?>>> getPropertyConverters();
+
+    /**
+     * <p>
+     * This method returns the registered PropertyConverters for a given type.
+     * The List for each type is ordered via their {@link javax.annotation.Priority}.
+     * </p>
+     *
+     * <p>
+     * PropertyConverters with a higher Priority come first. The PropertyConverter with the
+     * lowest Priority comes last.
+     * If two PropertyConverter have the same ordinal number they will get sorted
+     * using their class name just to ensure the user at least gets the same ordering
+     * after a JVM restart.
+     * </p>
+     *
+     * <p>
+     * Additionally if a PropertyProvider is accessed, which is not registered the implementation
+     * should try to figure out, if there could be a default implementation as follows:</p>
+     * <ol>
+     *     <li>Look for static factory methods: {@code of(String), valueOf(String), getInstance(String),
+     *     instanceOf(String), fomr(String)}</li>
+     *     <li>Look for a matching constructor: {@code T(String)}.</li>
+     * </ol>
+     *
+     * <p>
+     * If a correspoding factory method or constructor could be found, a corresponding
+     * PropertyConverter should be created and registered automatically for the given
+     * type.
+     * </p>
+     *
+     * <p> The scenario could be like:</p>
+     *
+     * <pre>
+     *  {
+     *      Date.class -&gt; {MyCustomDateConverter,StandardDateConverter, TimezoneDateConverter}
+     *      Boolean.class -&gt; {StandardBooleanConverter, FrenchBooleanConverter}
+     *      Integer.class -&gt; {DynamicDefaultConverter}
+     *  }
+     * </pre>
+     *
+     * <p>
+     * The converters returned for a type should be used as a chain, whereas the result of the
+     * first converter that is able to convert the configured value, is taken as the chain's result.
+     * No more converters are called after a converter has successfully converted the input into
+     * the required target type.
+     * </p>
+     * 
+     * @param <T> the type of the type literal
+     * @param type type of the desired converter
+     * @return a sorted list of registered PropertySources per type.
+     */
+    <T> List<PropertyConverter<T>> getPropertyConverters(TypeLiteral<T> type);
+
+    /**
+     * Access the current PropertyFilter instances.
+     * @return the list of registered PropertyFilters, never null.
+     */
+    List<PropertyFilter> getPropertyFilters();
+
+    /**
+     * Access the {@link PropertyValueCombinationPolicy} used to evaluate the final
+     * property values.
+     * @return the {@link PropertyValueCombinationPolicy} used, never null.
+     */
+    PropertyValueCombinationPolicy getPropertyValueCombinationPolicy();
+
+    /**
+     * Creates a {@link ConfigurationContextBuilder} preinitialized with the data from this instance.
+     * @return a new builder instance, never null.
+     */
+    ConfigurationContextBuilder toBuilder();
+
+}


Mime
View raw message