You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tamaya.apache.org by an...@apache.org on 2016/07/20 00:59:17 UTC

[7/7] incubator-tamaya git commit: - Minimalized API. - Propagated change to rest of modules.

- Minimalized API.
- Propagated change to rest of modules.


Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/7144e3f9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/7144e3f9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/7144e3f9

Branch: refs/heads/tamaya-next
Commit: 7144e3f983cdbb441949e9e54b0c7ec0d31ca7f7
Parents: a728930
Author: anatole <an...@apache.org>
Authored: Wed Jul 20 02:58:59 2016 +0200
Committer: anatole <an...@apache.org>
Committed: Wed Jul 20 02:58:59 2016 +0200

----------------------------------------------------------------------
 .../java/org/apache/tamaya/Configuration.java   |  70 --
 .../org/apache/tamaya/ConfigExceptionTest.java  |  90 +-
 .../org/apache/tamaya/TestConfiguration.java    |  81 --
 .../tamaya/TestConfigurationProvider.java       |  34 -
 .../java/org/apache/tamaya/TypeLiteralTest.java |  61 --
 .../services/org.apache.tamaya.Configuration    |  19 +
 ....tamaya.builder.spi.ConfigurationProviderSpi |  19 -
 ...org.apache.tamaya.builder.spi.ServiceContext |  19 -
 code/core/pom.xml                               |  18 -
 .../examples/builder/UsingABuilderExample.java  |   4 +-
 modules/adaptersupport/pom.xml                  |  66 ++
 .../apache/tamaya/adapter/AdapterManager.java   | 143 +++
 .../org/apache/tamaya/adapter/package-info.java |  27 +
 .../adapter/spi/ConfigurationAdapter.java       |  52 ++
 ...ache.tamaya.adapter.spi.ConfigurationAdapter |  18 +
 modules/builder/pom.xml                         |  15 +
 .../tamaya/builder/ConfigurationBuilder.java    | 605 ------------
 ...DefaultPropertySourceBasedConfiguration.java | 306 +++++++
 .../ProgrammaticConfigurationContext.java       | 388 --------
 .../PropertySourceBasedConfiguration.java       |  76 ++
 ...PropertySourceBasedConfigurationBuilder.java | 483 ++++++++++
 .../tamaya/builder/PropertySourceBuilder.java   |   1 +
 .../tamaya/builder/SimplePropertySource.java    |  86 --
 .../internal/DefaultConfigurationContext.java   | 278 ------
 .../DefaultConfigurationContextBuilder.java     | 153 ----
 .../internal/DefaultConfigurationProvider.java  |  62 --
 .../builder/internal/DefaultServiceContext.java | 156 ----
 .../tamaya/builder/internal/OSGIActivator.java  |  53 --
 .../builder/internal/OSGIServiceComparator.java |  69 --
 .../builder/internal/OSGIServiceContext.java    |  82 --
 .../builder/internal/OSGIServiceLoader.java     | 156 ----
 .../internal/PriorityServiceComparator.java     |  67 --
 .../internal/PropertyConverterManager.java      | 448 ---------
 .../builder/internal/PropertyFiltering.java     |   8 +-
 ...PropertySourceBasedConfigurationAdapter.java |  41 +
 .../org/apache/tamaya/builder/package-info.java |   9 +-
 .../builder/spi/ConfigurationContext.java       | 159 ----
 .../spi/ConfigurationContextBuilder.java        | 174 ----
 .../builder/spi/ConfigurationProviderSpi.java   |  76 --
 .../tamaya/builder/spi/ConversionContext.java   | 255 ------
 .../tamaya/builder/spi/PropertyConverter.java   |  44 -
 .../tamaya/builder/spi/ServiceContext.java      |  59 --
 .../builder/spi/ServiceContextManager.java      | 118 ---
 .../builder/ConfigurationBuilderTest.java       | 908 -------------------
 ...ertySourceBasedConfigurationBuilderTest.java | 899 ++++++++++++++++++
 .../ConverterTestsPropertySource.java           |   4 +-
 .../internal/converters/EnumConverterTest.java  |   2 +-
 modules/defaultconfig/pom.xml                   |  62 ++
 .../defaults/ConfigurationWithDefaults.java     |  72 ++
 .../ConfigurationWithDefaultsAdapter.java       |  37 +
 .../DefaultConfigurationWithDefaults.java       | 105 +++
 .../apache/tamaya/defaults/package-info.java    |  26 +
 ...ache.tamaya.adapter.spi.ConfigurationAdapter |  17 +
 modules/formats/pom.xml                         |   5 +
 .../format/FlattenedDefaultPropertySource.java  |   4 +-
 .../internal/DefaultDynamicValueTest.java       |   4 +-
 modules/pom.xml                                 |   4 +
 .../tamaya/servicecontext/ServiceContext.java   |  67 ++
 .../servicecontext/ServiceContextManager.java   | 116 +++
 .../internal/DefaultServiceContext.java         | 155 ++++
 .../servicecontext/internal/OSGIActivator.java  |  51 ++
 .../internal/OSGIServiceComparator.java         |  69 ++
 .../internal/OSGIServiceContext.java            |  98 ++
 .../internal/OSGIServiceLoader.java             | 156 ++++
 .../internal/PriorityServiceComparator.java     |  67 ++
 ...tServiceContextTest$InvalidPriorityInterface |  18 +
 ...efaultServiceContextTest$MultiImplsInterface |  20 +
 .../internal/PriorityServiceComparator.java     |  67 ++
 .../internal/PropertyConverterManager.java      | 449 +++++++++
 .../tamaya/types/internal/ReflectionUtil.java   |  42 +
 .../adapters/DefaultTypedConfiguration.java     | 154 ++++
 .../converters/BigDecimalConverter.java         |  63 ++
 .../converters/BigIntegerConverter.java         |  94 ++
 .../internal/converters/BooleanConverter.java   |  57 ++
 .../internal/converters/ByteConverter.java      |  71 ++
 .../internal/converters/CharConverter.java      |  69 ++
 .../internal/converters/ClassConverter.java     |  63 ++
 .../internal/converters/CurrencyConverter.java  |  90 ++
 .../internal/converters/DoubleConverter.java    |  82 ++
 .../internal/converters/EnumConverter.java      |  68 ++
 .../internal/converters/FloatConverter.java     |  81 ++
 .../internal/converters/IntegerConverter.java   |  74 ++
 .../internal/converters/LongConverter.java      |  72 ++
 .../internal/converters/NumberConverter.java    |  72 ++
 .../internal/converters/ShortConverter.java     |  72 ++
 .../types/internal/converters/URIConverter.java |  47 +
 .../types/internal/converters/URLConverter.java |  47 +
 .../org/apache/tamaya/types/package-info.java   |  28 +
 .../tamaya/types/spi/ConversionContext.java     | 234 +++++
 .../tamaya/types/spi/PropertyConverter.java     |  44 +
 ...ache.tamaya.adapter.spi.ConfigurationAdapter |  17 +
 .../internal/PropertyConverterManagerTest.java  | 178 ++++
 .../converters/BigDecimalConverterTest.java     | 103 +++
 .../converters/BooleanConverterTest.java        | 108 +++
 .../internal/converters/ByteConverterTest.java  |  81 ++
 .../internal/converters/CharConverterTest.java  |  86 ++
 .../ConverterTestsPropertySource.java           | 253 ++++++
 .../converters/CurrencyConverterTest.java       | 154 ++++
 .../converters/DoubleConverterTest.java         | 175 ++++
 .../internal/converters/EnumConverterTest.java  |  59 ++
 .../internal/converters/FloatConverterTest.java | 176 ++++
 .../converters/IntegerConverterTest.java        | 111 +++
 .../internal/converters/LongConverterTest.java  | 111 +++
 .../converters/NumberConverterTest.java         | 103 +++
 .../internal/converters/ShortConverterTest.java | 111 +++
 .../types/util/mockito/NotMockedAnswer.java     |  57 ++
 .../tamaya/types/util/types/CustomTypeA.java    |  34 +
 .../tamaya/types/util/types/CustomTypeB.java    |  39 +
 .../tamaya/types/util/types/CustomTypeC.java    |  36 +
 .../types/CustomTypeCPropertyConverter.java     |  29 +
 110 files changed, 7514 insertions(+), 4761 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/7144e3f9/code/api/src/main/java/org/apache/tamaya/Configuration.java
----------------------------------------------------------------------
diff --git a/code/api/src/main/java/org/apache/tamaya/Configuration.java b/code/api/src/main/java/org/apache/tamaya/Configuration.java
index 188a3ff..2b63d29 100644
--- a/code/api/src/main/java/org/apache/tamaya/Configuration.java
+++ b/code/api/src/main/java/org/apache/tamaya/Configuration.java
@@ -47,79 +47,9 @@ public interface Configuration {
     String get(String key);
 
     /**
-     * Access a property.
-     *
-     * @param key the property's key, not null.
-     * @param defaultValue value to be returned, if no value is present.
-     * @return the property's keys.
-     */
-    String getOrDefault(String key, final String defaultValue);
-
-//    /**
-//     * Access a property providing a value supplier called, if no configured value is available.
-//     *
-//     * @param key the property's key, not null.
-//     * @param defaultValueSupplier value supplier to be called, if no value is present.
-//     * @return the property value.
-//     */
-//    default String getOrDefault(String key, Supplier<String> defaultValueSupplier){
-//        String value = get(key);
-//        if(value==null){
-//            return defaultValueSupplier.supply();
-//        }
-//        return value;
-//    }
-
-    /**
      * Access all currently known configuration properties as a full {@code Map<String,String>}.
      * @return all currently known configuration properties.
      */
     Map<String,String> getProperties();
 
-//    /**
-//     * Access a typed property providing a conversion.
-//     *
-//     * @param key the property's key, not null.
-//     * @param conversion the value conversion, called if a configured value is present for the given key,
-//     *                   not null.
-//     * @return the property value, or null, if no such value has been found.
-//     */
-//    default <T> T get(String key, Function<String,T> conversion){
-//        String value = get(key);
-//        if(value!=null){
-//            return conversion.apply(value);
-//        }
-//        return null;
-//    }
-//
-//    /**
-//     * Access a typed property providing a conversion and a default value.
-//     *
-//     * @param key the property's key, not null.
-//     * @param conversion the value conversion, called if a configured value is present for the given key,
-//     *                   not null.
-//     * @param defaultValue the default value to be returned, if no configured value has been found, including
-//     *                     {@code null}.
-//     * @return the property value, or null, if no such value has been found.
-//     */
-//    default <T> T getOrDefault(String key, Function<String,T> conversion, final T defaultValue){
-//        return getOrDefault(key, conversion, () -> defaultValue);
-//    }
-//    /**
-//     * Access a typed property providing a conversion and a default value supplier.
-//     *
-//     * @param key the property's key, not null.
-//     * @param conversion the value conversion, called if a configured value is present for the given key,
-//     *                   not null.
-//     * @param defaultValueSupplier the default value supplier to be called, if no configured value has been found..
-//     * @return the property value, or null, if no such value has been found.
-//     */
-//    default <T> T getOrDefault(String key, Function<String,T> conversion, Supplier<T> defaultValueSupplier){
-//        String value = get(key);
-//        if(value!=null){
-//            return conversion.apply(value);
-//        }
-//        return defaultValueSupplier.supply();
-//    }
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/7144e3f9/code/api/src/test/java/org/apache/tamaya/ConfigExceptionTest.java
----------------------------------------------------------------------
diff --git a/code/api/src/test/java/org/apache/tamaya/ConfigExceptionTest.java b/code/api/src/test/java/org/apache/tamaya/ConfigExceptionTest.java
index 09b8d88..fa7da0a 100644
--- a/code/api/src/test/java/org/apache/tamaya/ConfigExceptionTest.java
+++ b/code/api/src/test/java/org/apache/tamaya/ConfigExceptionTest.java
@@ -1,45 +1,45 @@
-///*
-// * Licensed to the Apache Software Foundation (ASF) under one
-// * or more contributor license agreements.  See the NOTICE file
-// * distributed with this work for additional information
-// * regarding copyright ownership.  The ASF licenses this file
-// * to you under the Apache License, Version 2.0 (the
-// * "License"); you may not use this file except in compliance
-// * with the License.  You may obtain a copy of the License at
-// *
-// *   http://www.apache.org/licenses/LICENSE-2.0
-// *
-// * Unless required by applicable law or agreed to in writing,
-// * software distributed under the License is distributed on an
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// * KIND, either express or implied.  See the License for the
-// * specific language governing permissions and limitations
-// * under the License.
-// */
-//package org.apache.tamaya;
-//
-//import org.junit.Test;
-//
-//import static org.junit.Assert.*;
-//
-///**
-// * Tests instantiating {@link ConfigException}.
-// */
-//public class ConfigExceptionTest {
-//
-//    @Test
-//    public void testCreationMessage(){
-//        ConfigException ex = new ConfigException("test");
-//        assertNull(ex.getCause());
-//        assertEquals(ex.getMessage(), "test");
-//    }
-//
-//    @Test
-//    public void testCreationMessageThrowable(){
-//        Exception e = new IllegalStateException("blabla");
-//        ConfigException ex = new ConfigException("test", e);
-//        assertTrue(ex.getCause() == e);
-//        assertEquals("test", ex.getMessage());
-//    }
-//
-//}
\ No newline at end of file
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy 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;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * Tests instantiating {@link ConfigException}.
+ */
+public class ConfigExceptionTest {
+
+    @Test
+    public void testCreationMessage(){
+        ConfigException ex = new ConfigException("test");
+        assertNull(ex.getCause());
+        assertEquals(ex.getMessage(), "test");
+    }
+
+    @Test
+    public void testCreationMessageThrowable(){
+        Exception e = new IllegalStateException("blabla");
+        ConfigException ex = new ConfigException("test", e);
+        assertTrue(ex.getCause() == e);
+        assertEquals("test", ex.getMessage());
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/7144e3f9/code/api/src/test/java/org/apache/tamaya/TestConfiguration.java
----------------------------------------------------------------------
diff --git a/code/api/src/test/java/org/apache/tamaya/TestConfiguration.java b/code/api/src/test/java/org/apache/tamaya/TestConfiguration.java
index a324be1..5038bc7 100644
--- a/code/api/src/test/java/org/apache/tamaya/TestConfiguration.java
+++ b/code/api/src/test/java/org/apache/tamaya/TestConfiguration.java
@@ -46,87 +46,6 @@ public class TestConfiguration implements Configuration{
     }
 
     @Override
-    public String getOrDefault(String key, String defaultValue) {
-        String val = get(key);
-        if(val==null){
-            return defaultValue;
-        }
-        return val;
-    }
-
-//    @Override
-//    public <T> T getOrDefault(String key, Class<T> type, T defaultValue) {
-//        T val = get(key, type);
-//        if(val==null){
-//            return defaultValue;
-//        }
-//        return val;
-//    }
-//
-//    @Override
-//    public <T> T get(String key, Class<T> type) {
-//        if(type.equals(Long.class)){
-//            return (T)(Object)Long.MAX_VALUE;
-//        }
-//        else if(type.equals(Integer.class)){
-//            return (T)(Object) Integer.MAX_VALUE;
-//        }
-//        else if(type.equals(Double.class)){
-//            return (T)(Object) Double.MAX_VALUE;
-//        }
-//        else if(type.equals(Float.class)){
-//            return (T)(Object) Float.MAX_VALUE;
-//        }
-//        else if(type.equals(Short.class)){
-//            return (T)(Object) Short.MAX_VALUE;
-//        }
-//        else if(type.equals(Byte.class)){
-//            return (T)(Object) Byte.MAX_VALUE;
-//        }
-//        else if(type.equals(Boolean.class)){
-//            if("booleanTrue".equals(key)) {
-//                return (T)Boolean.TRUE;
-//            }
-//            else{
-//                return (T)Boolean.FALSE;
-//            }
-//        }
-//        else if(type.equals(String.class)){
-//            return (T)"aStringValue";
-//        }
-//        throw new ConfigException("No such property: " + key);
-//    }
-//
-//    @Override
-//    public <T> T get(String key, TypeLiteral<T> type) {
-//        throw new RuntimeException("Method not implemented yet.");
-//    }
-//
-//    @Override
-//    public <T> T getOrDefault(String key, TypeLiteral<T> type, T defaultValue) {
-//        T val = get(key, type);
-//        if(val==null){
-//            return defaultValue;
-//        }
-//        return val;
-//    }
-//
-//    @Override
-//    public Configuration with(ConfigOperator operator) {
-//        return null;
-//    }
-//
-//    @Override
-//    public <T> T query(ConfigQuery<T> query) {
-//        throw new RuntimeException("Method not implemented yet.");
-//    }
-//
-//    @Override
-//    public ConfigurationContext getContext() {
-//        return null;
-//    }
-
-    @Override
     public Map<String, String> getProperties() {
         throw new RuntimeException("Method not implemented yet.");
     }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/7144e3f9/code/api/src/test/java/org/apache/tamaya/TestConfigurationProvider.java
----------------------------------------------------------------------
diff --git a/code/api/src/test/java/org/apache/tamaya/TestConfigurationProvider.java b/code/api/src/test/java/org/apache/tamaya/TestConfigurationProvider.java
deleted file mode 100644
index cc66d35..0000000
--- a/code/api/src/test/java/org/apache/tamaya/TestConfigurationProvider.java
+++ /dev/null
@@ -1,34 +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;
-
-
-/**
- * Test Configuration class, that is used to testdata the default methods provided by the API.
- */
-public class TestConfigurationProvider extends ConfigurationProvider {
-
-    private static final Configuration config = new TestConfiguration();
-
-    @Override
-    public Configuration getConfiguration() {
-        return config;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/7144e3f9/code/api/src/test/java/org/apache/tamaya/TypeLiteralTest.java
----------------------------------------------------------------------
diff --git a/code/api/src/test/java/org/apache/tamaya/TypeLiteralTest.java b/code/api/src/test/java/org/apache/tamaya/TypeLiteralTest.java
deleted file mode 100644
index a04636d..0000000
--- a/code/api/src/test/java/org/apache/tamaya/TypeLiteralTest.java
+++ /dev/null
@@ -1,61 +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;
-//
-//import org.junit.Test;
-//
-//import java.util.ArrayList;
-//import java.util.List;
-//
-//import static org.junit.Assert.assertEquals;
-//
-///**
-// * Tests for the {@link TypeLiteral} class.
-// */
-//public class TypeLiteralTest {
-//
-//    @Test
-//    public void test_constrcutor(){
-//        TypeLiteral<List<String>> listTypeLiteral = new TypeLiteral<List<String>>(){};
-//        assertEquals(List.class, listTypeLiteral.getRawType());
-//        assertEquals(String.class, TypeLiteral.getTypeParameters(listTypeLiteral.getType())[0]);
-//    }
-//
-//    @Test
-//    public void test_of(){
-//        class MyListClass extends ArrayList<String>{}
-//        TypeLiteral<MyListClass> listTypeLiteral = TypeLiteral.of(MyListClass.class);
-//        assertEquals(MyListClass.class, listTypeLiteral.getRawType());
-//        assertEquals(MyListClass.class, listTypeLiteral.getType());
-//    }
-//
-//    @Test
-//    public void test_getTypeParameter(){
-//        TypeLiteral<List<String>> listTypeLiteral = new TypeLiteral<List<String>>(){};
-//        assertEquals(List.class, listTypeLiteral.getRawType());
-//        assertEquals(String.class, TypeLiteral.getTypeParameters(listTypeLiteral.getType())[0]);
-//    }
-//
-//    @Test
-//    public void test_getGenericInterfaceTypeParameter(){
-//        class MyListClass extends ArrayList<String> implements List<String>{}
-//        assertEquals(String.class, TypeLiteral.getGenericInterfaceTypeParameters(MyListClass.class, List.class)[0]);
-//    }
-//
-//}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/7144e3f9/code/api/src/test/resources/META-INF/services/org.apache.tamaya.Configuration
----------------------------------------------------------------------
diff --git a/code/api/src/test/resources/META-INF/services/org.apache.tamaya.Configuration b/code/api/src/test/resources/META-INF/services/org.apache.tamaya.Configuration
new file mode 100644
index 0000000..cb8aac4
--- /dev/null
+++ b/code/api/src/test/resources/META-INF/services/org.apache.tamaya.Configuration
@@ -0,0 +1,19 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy current the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+org.apache.tamaya.TestConfiguration

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/7144e3f9/code/api/src/test/resources/META-INF/services/org.apache.tamaya.builder.spi.ConfigurationProviderSpi
----------------------------------------------------------------------
diff --git a/code/api/src/test/resources/META-INF/services/org.apache.tamaya.builder.spi.ConfigurationProviderSpi b/code/api/src/test/resources/META-INF/services/org.apache.tamaya.builder.spi.ConfigurationProviderSpi
deleted file mode 100644
index b9c5ba5..0000000
--- a/code/api/src/test/resources/META-INF/services/org.apache.tamaya.builder.spi.ConfigurationProviderSpi
+++ /dev/null
@@ -1,19 +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 current the License at
-#
-#    http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-org.apache.tamaya.TestConfigurationProvider

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/7144e3f9/code/api/src/test/resources/META-INF/services/org.apache.tamaya.builder.spi.ServiceContext
----------------------------------------------------------------------
diff --git a/code/api/src/test/resources/META-INF/services/org.apache.tamaya.builder.spi.ServiceContext b/code/api/src/test/resources/META-INF/services/org.apache.tamaya.builder.spi.ServiceContext
deleted file mode 100644
index 8da8805..0000000
--- a/code/api/src/test/resources/META-INF/services/org.apache.tamaya.builder.spi.ServiceContext
+++ /dev/null
@@ -1,19 +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 current the License at
-#
-#    http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-org.apache.tamaya.builder.spi.TestServiceContext
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/7144e3f9/code/core/pom.xml
----------------------------------------------------------------------
diff --git a/code/core/pom.xml b/code/core/pom.xml
index 94e966e..5e7f358 100644
--- a/code/core/pom.xml
+++ b/code/core/pom.xml
@@ -30,10 +30,6 @@ under the License.
     <name>Apache Tamaya Core Implementation</name>
     <packaging>bundle</packaging>
 
-    <properties>
-        <osgi.compendium.version>5.0.0</osgi.compendium.version>
-     </properties>
-
     <dependencies>
         <dependency>
             <groupId>org.apache.tamaya</groupId>
@@ -48,20 +44,6 @@ under the License.
             <groupId>org.hamcrest</groupId>
             <artifactId>java-hamcrest</artifactId>
         </dependency>
-        <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>org.osgi.compendium</artifactId>
-            <scope>provided</scope>
-            <version>${osgi.compendium.version}</version>
-            <optional>true</optional>
-        </dependency>
-        <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>org.osgi.core</artifactId>
-            <version>${osgi.version}</version>
-            <scope>provided</scope>
-            <optional>true</optional>
-        </dependency>
     </dependencies>
 
     <build>

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/7144e3f9/examples/7-builder-example/src/main/java/org/apache/tamaya/examples/builder/UsingABuilderExample.java
----------------------------------------------------------------------
diff --git a/examples/7-builder-example/src/main/java/org/apache/tamaya/examples/builder/UsingABuilderExample.java b/examples/7-builder-example/src/main/java/org/apache/tamaya/examples/builder/UsingABuilderExample.java
index de73854..13f5aab 100644
--- a/examples/7-builder-example/src/main/java/org/apache/tamaya/examples/builder/UsingABuilderExample.java
+++ b/examples/7-builder-example/src/main/java/org/apache/tamaya/examples/builder/UsingABuilderExample.java
@@ -19,7 +19,7 @@
 package org.apache.tamaya.examples.builder;
 
 import org.apache.tamaya.Configuration;
-import org.apache.tamaya.builder.ConfigurationBuilder;
+import org.apache.tamaya.builder.PropertySourceBasedConfigurationBuilder;
 import org.apache.tamaya.resource.ConfigResources;
 
 
@@ -33,7 +33,7 @@ public class UsingABuilderExample {
 
     public static void main(String... args) {
 
-        ConfigurationBuilder builder = new ConfigurationBuilder();
+        PropertySourceBasedConfigurationBuilder builder = new PropertySourceBasedConfigurationBuilder();
         Configuration config = builder.addPropertySources(ConfigResources.getResourceResolver().getResources("META-INF/boot/*.ini"))
                 .addPropertySources(ConfigResources.getResourceResolver().getResources("META-INF/config/*.properties"))
                 .enableProvidedPropertyConverters()

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/7144e3f9/modules/adaptersupport/pom.xml
----------------------------------------------------------------------
diff --git a/modules/adaptersupport/pom.xml b/modules/adaptersupport/pom.xml
new file mode 100644
index 0000000..798c84f
--- /dev/null
+++ b/modules/adaptersupport/pom.xml
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy current the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.tamaya.ext</groupId>
+        <artifactId>tamaya-extensions</artifactId>
+        <version>0.3-incubating-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>tamaya-adaptersupport</artifactId>
+    <name>Apache Tamaya Modules - Configuration Adapter Support</name>
+    <packaging>jar</packaging> <!-- bundle -->
+
+    <inceptionYear>2016</inceptionYear>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.tamaya</groupId>
+            <artifactId>tamaya-api</artifactId>
+            <version>${project.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.tamaya.ext</groupId>
+            <artifactId>tamaya-servicecontext</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.hamcrest</groupId>
+            <artifactId>java-hamcrest</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.mockito</groupId>
+            <artifactId>mockito-core</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+        </dependency>
+
+
+    </dependencies>
+
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/7144e3f9/modules/adaptersupport/src/main/java/org/apache/tamaya/adapter/AdapterManager.java
----------------------------------------------------------------------
diff --git a/modules/adaptersupport/src/main/java/org/apache/tamaya/adapter/AdapterManager.java b/modules/adaptersupport/src/main/java/org/apache/tamaya/adapter/AdapterManager.java
new file mode 100644
index 0000000..4ae50ac
--- /dev/null
+++ b/modules/adaptersupport/src/main/java/org/apache/tamaya/adapter/AdapterManager.java
@@ -0,0 +1,143 @@
+/*
+ * 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.adapter;
+
+import org.apache.tamaya.ConfigException;
+import org.apache.tamaya.Configuration;
+import org.apache.tamaya.adapter.spi.ConfigurationAdapter;
+import org.apache.tamaya.servicecontext.ServiceContext;
+import org.apache.tamaya.servicecontext.ServiceContextManager;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+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 ConfigurationAdapter} instances.
+ * This class is thread-safe.
+ */
+public final class AdapterManager implements ConfigurationAdapter{
+    /**
+     * The logger used.
+     */
+    private static final Logger LOG = Logger.getLogger(AdapterManager.class.getName());
+    /**
+     * The registered converters.
+     */
+    private final List<ConfigurationAdapter> adapters = new ArrayList<>();
+
+    private static final AdapterManager INSTANCE = new AdapterManager();
+
+    /**
+     * 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) {
+            ServiceContext serviceContext = ServiceContextManager.getServiceContext();
+            int prio = serviceContext.getPriority(o1) - serviceContext.getPriority(o2);
+            if (prio < 0) {
+                return 1;
+            } else if (prio > 0) {
+                return -1;
+            } else {
+                return o1.getClass().getSimpleName().compareTo(o2.getClass().getSimpleName());
+            }
+        }
+    };
+
+    /**
+     * Get the instance of the adapter manager.
+     * @return the instance of the adapter manager, not null.
+     */
+    public static final AdapterManager getInstance(){
+        return INSTANCE;
+    }
+
+    /**
+     * Constructor.
+     */
+    private AdapterManager() {
+        this.adapters.addAll(ServiceContextManager.getServiceContext().getServices(ConfigurationAdapter.class));
+        Collections.sort(this.adapters, PRIORITY_COMPARATOR);
+    }
+
+    /**
+     * Registers a new adapter instance.
+     *
+     * @param adapter the new adapter, not null.
+     */
+    public void registerAdapter(ConfigurationAdapter adapter) {
+        Lock writeLock = lock.writeLock();
+        try {
+            writeLock.lock();
+            this.adapters.addAll(ServiceContextManager.getServiceContext().getServices(ConfigurationAdapter.class));
+            Collections.sort(this.adapters, PRIORITY_COMPARATOR);
+        } finally {
+            writeLock.unlock();
+        }
+    }
+
+    /**
+     * Get a list of all currently loaded {@link ConfigurationAdapter} in order of relevance.
+     *
+     * @return the list of currently available adapters.
+     */
+    public List<ConfigurationAdapter> getAdapters() {
+        Lock readLock = lock.readLock();
+        try {
+            readLock.lock();
+            return new ArrayList<>(this.adapters);
+        } finally {
+            readLock.unlock();
+        }
+    }
+
+    @Override
+    public <T> T adapt(Configuration configuration, Class<T> targetType) {
+        for(ConfigurationAdapter adapter:adapters){
+            try {
+                Object o = adapter.adapt(configuration, targetType);
+                if(o!=null){
+                    return (T)o;
+                }
+            }catch(Exception e){
+                LOG.log(Level.SEVERE, "Error adapting configuration to: " + targetType.getName(), e);
+            }
+        }
+        throw new ConfigException("Cannot adapt configuration to " + targetType.getName());
+    }
+
+
+    @Override
+    public String toString() {
+        return "AdapterManager{" +
+                "adapters=" + adapters +
+                '}';
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/7144e3f9/modules/adaptersupport/src/main/java/org/apache/tamaya/adapter/package-info.java
----------------------------------------------------------------------
diff --git a/modules/adaptersupport/src/main/java/org/apache/tamaya/adapter/package-info.java b/modules/adaptersupport/src/main/java/org/apache/tamaya/adapter/package-info.java
new file mode 100644
index 0000000..0442f0f
--- /dev/null
+++ b/modules/adaptersupport/src/main/java/org/apache/tamaya/adapter/package-info.java
@@ -0,0 +1,27 @@
+/*
+ * 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.
+ */
+/**
+ * This package provides a singleton managing the currently available
+ * {@link org.apache.tamaya.adapter.spi.org.apache.tamaya.adapter.spi.ConfigurationAdapter}
+ * instances. It also supports creating proxy interfaces supporting multiple adapted types
+ * at once.
+ *
+ * @see org.apache.tamaya.Configuration
+ */
+package org.apache.tamaya.adapter;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/7144e3f9/modules/adaptersupport/src/main/java/org/apache/tamaya/adapter/spi/ConfigurationAdapter.java
----------------------------------------------------------------------
diff --git a/modules/adaptersupport/src/main/java/org/apache/tamaya/adapter/spi/ConfigurationAdapter.java b/modules/adaptersupport/src/main/java/org/apache/tamaya/adapter/spi/ConfigurationAdapter.java
new file mode 100644
index 0000000..79ea7a1
--- /dev/null
+++ b/modules/adaptersupport/src/main/java/org/apache/tamaya/adapter/spi/ConfigurationAdapter.java
@@ -0,0 +1,52 @@
+/*
+ * 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.adapter.spi;
+
+import org.apache.tamaya.ConfigException;
+import org.apache.tamaya.Configuration;
+
+import java.util.Map;
+
+/**
+ * <p>A adapter that transforms/adapts a {@link org.apache.tamaya.Configuration} to implement
+ * another interface. Adapters are ordered internally by their annotated {@link javax.annotation.Priority}
+ * value (highest first). Returning a non null value for the adapted target type ends traversal of
+ * possible adapters and returns immedeately the result.
+ *
+ * Normally adapters should not be cached. Caching is within the responsibility of the caller logic.
+ * <h3>Implementation Requirements</h3>
+ * Implementations of this interface must be
+ * <ul>
+ *  <li>Thread safe</li>
+ *  <li>Immutable</li>
+ * </ul>
+ */
+public interface ConfigurationAdapter {
+
+    /**
+     * Adapts a configuration. If this factory is not capable of providing the required
+     * target type, it is safe to return {@code null}.
+     *
+     * @param configuration the configuration to be adapted, not null.
+     * @param targetType the target type, not null.
+     * @return the adapter, or null.
+     */
+    <T> T adapt(Configuration configuration, Class<T> targetType);
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/7144e3f9/modules/adaptersupport/src/test/resources/META-INF/services/org.apache.tamaya.adapter.spi.ConfigurationAdapter
----------------------------------------------------------------------
diff --git a/modules/adaptersupport/src/test/resources/META-INF/services/org.apache.tamaya.adapter.spi.ConfigurationAdapter b/modules/adaptersupport/src/test/resources/META-INF/services/org.apache.tamaya.adapter.spi.ConfigurationAdapter
new file mode 100644
index 0000000..f3199f2
--- /dev/null
+++ b/modules/adaptersupport/src/test/resources/META-INF/services/org.apache.tamaya.adapter.spi.ConfigurationAdapter
@@ -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 current the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/7144e3f9/modules/builder/pom.xml
----------------------------------------------------------------------
diff --git a/modules/builder/pom.xml b/modules/builder/pom.xml
index 96f6244..815867c 100644
--- a/modules/builder/pom.xml
+++ b/modules/builder/pom.xml
@@ -39,6 +39,21 @@ under the License.
             <version>${project.version}</version>
             <scope>provided</scope>
         </dependency>
+        <dependency>
+            <groupId>org.apache.tamaya.ext</groupId>
+            <artifactId>tamaya-adaptersupport</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.tamaya.ext</groupId>
+            <artifactId>tamaya-types</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.tamaya.ext</groupId>
+            <artifactId>tamaya-servicecontext</artifactId>
+            <version>${project.version}</version>
+        </dependency>
 
         <dependency>
             <groupId>org.apache.tamaya.ext</groupId>

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/7144e3f9/modules/builder/src/main/java/org/apache/tamaya/builder/ConfigurationBuilder.java
----------------------------------------------------------------------
diff --git a/modules/builder/src/main/java/org/apache/tamaya/builder/ConfigurationBuilder.java b/modules/builder/src/main/java/org/apache/tamaya/builder/ConfigurationBuilder.java
deleted file mode 100644
index 6188f83..0000000
--- a/modules/builder/src/main/java/org/apache/tamaya/builder/ConfigurationBuilder.java
+++ /dev/null
@@ -1,605 +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.builder;
-
-import org.apache.tamaya.ConfigException;
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.builder.spi.PropertyConverter;
-import org.apache.tamaya.TypeLiteral;
-import org.apache.tamaya.format.ConfigurationData;
-import org.apache.tamaya.format.ConfigurationFormats;
-import org.apache.tamaya.format.FlattenedDefaultPropertySource;
-import org.apache.tamaya.builder.spi.ConfigurationContext;
-import org.apache.tamaya.builder.spi.PropertyFilter;
-import org.apache.tamaya.builder.spi.PropertySource;
-import org.apache.tamaya.builder.spi.PropertySourceProvider;
-import org.apache.tamaya.builder.spi.PropertyValueCombinationPolicy;
-import org.apache.tamaya.spisupport.DefaultConfiguration;
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Collection;
-import java.util.Objects;
-
-import static java.lang.String.format;
-
-/**
- * <p>Builder class used for building a configuration manually without relying
- * only on the Service Provider Interface API.</p>
- *
- * <p><strong>Features of the builder</strong></p>
- *
- * <ol>
- *   <li>Adding of property converters manually</li>
- *   <li>Adding of property sources directly</li>
- *   <li>Adding of property sources via URL</li>
- *   <li>Adding of property source providers directly</li>
- *   <li>Enabling and disabling of via SPI mechanism provided resources as converters,
- *       property sources, etc.</li>
- * </ol>
- *
- * <p><strong>Example</strong></p>
- *
- * <pre>{@code ConfigurationBuilder builder = new ConfigurationBuilder();
- * builder.disableProvidedPropertySources()           // Do not load provided property
- *        .disableProvidedPropertySourceProviders()   // sources and providers automatically
- *        .addPropertySource("file:/etc/conf.properties"); // Load properties from conf.properties
- *
- * Configuration config = builder.build();
- * }</pre>
- *
- * <p><strong>Support for configuration formats</strong></p>
- *
- * The configuration builder allows you to put property resources
- * via a URL, as shown in the code example above, without implementing
- * a {@link PropertySource PropertySource} or providing an
- * instance of a {@link PropertySource PropertySource}.
- * If a property resource in
- * a specific format can be added to configuration builder or not depends
- * on the available implementations of
- * {@link org.apache.tamaya.format.ConfigurationFormat} in the classpath.
- * Which formats are available can be checked via
- * {@link org.apache.tamaya.format.ConfigurationFormats#getFormats()}.
- */
-public class ConfigurationBuilder {
-    /** Builder used to create new ConfigurationContext instances. */
-    private final ProgrammaticConfigurationContext.Builder contextBuilder = new ProgrammaticConfigurationContext.Builder();
-
-    /**
-     * Flag if the config has already been built.
-     * Configuration can be built only once
-     */
-    private boolean built;
-
-    /**
-     * Flag if all existing property converter service providers
-     * should be loaded if the configuration is build.
-     */
-    private boolean loadProvidedPropertyConverters = true;
-
-    /**
-     * Flag if all existing property source service providers
-     * will be loaded if the configuration is build.
-     */
-    private boolean loadProvidedPropertySources = false;
-    private boolean loadProvidedPropertySourceProviders = false;
-
-    private boolean isLoadProvidedPropertyFilters = false;
-
-    /**
-     * Creates a new builder instance.
-     */
-    public ConfigurationBuilder() {
-    }
-
-    /**
-     * Allows to set configuration context during unit tests.
-     */
-    ConfigurationBuilder setConfigurationContext(ConfigurationContext configurationContext) {
-        //noinspection deprecation
-        contextBuilder.setConfigurationContext(configurationContext);
-        return this;
-    }
-
-    /**
-     * Adds one resources with properties in an arbitrary format
-     * to the configuration to be build.
-     *
-     * <p>If a specific format is supported depends on the available
-     * {@link org.apache.tamaya.format.ConfigurationFormat} implementations.</p>
-     *
-     * <pre>{@code URL resource = new URL("file:/etc/service/config.json");
-     *
-     * builder.addPropertySources(resource);}
-     * </pre>
-     *
-     * @param url resource with properties for the the configuration to be build.
-     *
-     * @return the builder instance currently used
-     *
-     * @see org.apache.tamaya.format.ConfigurationFormat
-     * @see org.apache.tamaya.format.ConfigurationFormats#getFormats()
-     */
-    public ConfigurationBuilder addPropertySource(URL url) {
-        try {
-            ConfigurationData data = getConfigurationDataFromURL(url);
-
-            FlattenedDefaultPropertySource propertySource = new FlattenedDefaultPropertySource(data);
-            addPropertySources(propertySource);
-        } catch (IOException e) {
-            throw new ConfigException("Failed to read " + url.toString(), e);
-        }
-        return this;
-    }
-
-    protected ConfigurationData getConfigurationDataFromURL(URL url) throws IOException {
-        ConfigurationData data = ConfigurationFormats.readConfigurationData(url);
-
-        if (null == data) {
-            String mesg = format("No configuration format found which is able " +
-                                 "to read properties from %s.", url.toString());
-
-            throw new ConfigException(mesg);
-        }
-
-        return data;
-    }
-
-    /**
-     * Adds one or more resources with properties in an arbitrary format
-     * to the configuration to be build.
-     *
-     * <p>If a specific format is supported depends on the available
-     * {@link org.apache.tamaya.format.ConfigurationFormat} implementations.</p>
-     *
-     *<pre>{@code URL first = new URL("file:/etc/service/config.json");
-     * URL second = new URL("file:/etc/defaults/values.properties");
-     *
-     * builder.addPropertySources(first, second);}
-     *</pre>
-     *
-     * @param urls list of resources with properties for the configuration to be
-     *             build.
-     *
-     * @return the builder instance currently used
-     *
-     * @see org.apache.tamaya.format.ConfigurationFormat
-     * @see org.apache.tamaya.format.ConfigurationFormats#getFormats()
-     */
-    public ConfigurationBuilder addPropertySources(URL... urls) {
-        for(URL url:urls){
-            if(url!=null){
-                addPropertySource(url);
-            }
-        }
-        return this;
-    }
-
-    /**
-     * Adds one or more resources with properties in an arbitrary format
-     * to the configuration to be build.
-     *
-     * <p>If a specific format is supported depends on the available
-     * {@link org.apache.tamaya.format.ConfigurationFormat} implementations.</p>
-     *
-     *<pre>{@code URL first = new URL("file:/etc/service/config.json");
-     * URL second = new URL("file:/etc/defaults/values.properties");
-     *
-     * builder.addPropertySources(first, second);}
-     *</pre>
-     *
-     * @param urls list of resources with properties for the configuration to be
-     *             build.
-     *
-     * @return the builder instance currently used
-     *
-     * @see org.apache.tamaya.format.ConfigurationFormat
-     * @see org.apache.tamaya.format.ConfigurationFormats#getFormats()
-     */
-    public ConfigurationBuilder addPropertySources(Collection<URL> urls) {
-        for(URL url:urls) {
-            if (url != null) {
-                addPropertySource(url);
-            }
-        }
-        return this;
-    }
-
-
-    /**
-     * Adds one or more resources with properties in an arbitrary format
-     * to the configuration to be build.
-     *
-     * <p>If a specific format is supported depends on the available
-     * {@link org.apache.tamaya.format.ConfigurationFormat} implementations.</p>
-     *
-     *<pre>{@code builder.addPropertySources("file:/etc/service/config.json",
-     *                            "file:/etc/defaults/values.properties");}
-     *</pre>
-     *
-     * @param urls list of resources with properties for the configuration to be
-     *             build.
-     *
-     * @return the builder instance currently used
-     *
-     * @see org.apache.tamaya.format.ConfigurationFormat
-     * @see org.apache.tamaya.format.ConfigurationFormats#getFormats()
-     */
-    public ConfigurationBuilder addPropertySources(String... urls) {
-        for(String url:urls) {
-            if (url != null) {
-                try{
-                    addPropertySource(new URL(url));
-                } catch(Exception e){
-                    throw new ConfigException("Invalid URL: " + url);
-                }
-            }
-        }
-        return this;
-    }
-
-    /**
-     * Adds one or more property source instances to the configuration to be build.
-     *
-     *<pre>{@code PropertySource first = new CustomPropertySource();
-     * PropertySource second = new YetAnotherPropertySource();
-     *
-     * builder.addPropertySources(first, second)};
-     *</pre>
-     *
-     * @param sources list of property source instances with properties for the
-     *                configuration to be build.
-     *
-     * @return the builder instance currently used
-     *
-     * @see PropertySource
-     */
-    public ConfigurationBuilder addPropertySources(PropertySource... sources){
-        checkBuilderState();
-
-        contextBuilder.addPropertySources(Objects.requireNonNull(sources));
-        return this;
-    }
-
-    private void checkBuilderState() {
-        if (built) {
-            throw new IllegalStateException("Configuration has already been build.");
-        }
-    }
-
-    /**
-     * Adds one or more property source provider instances to the configuration to be build.
-     *
-     * <pre>{@code PropertySourceProvider jc = new JavaConfigurationProvider();
-     *
-     * builder.addPropertySources(jc)};
-     * </pre>
-     *
-     * @param providers list of property source provider instances each providing a set
-     *                  of property source instances for the configuration to be build.
-     *
-     * @return the builder instance currently used
-     *
-     * @see PropertySourceProvider
-     */
-    public ConfigurationBuilder addPropertySourceProviders(PropertySourceProvider... providers){
-        contextBuilder.addPropertySourceProviders(providers);
-        return this;
-    }
-
-    /**
-     * Adds one or more property filter instances to the configuration to be build.
-     *
-     * <pre>{@code PropertyFilter quoteReplacingFilter = new QuoteFilter();
-     * PropertyFilter commaRemovingFilter = new CommaFilter();
-     *
-     * builder.addPropertyFilters(commaRemovingFilter, quoteReplacingFilter)};
-     * </pre>
-     *
-     * @param filters list of property filter instances which should be applied
-     *                to the properties of the configuration to be build.
-     *
-     * @return the builder instance currently used
-     *
-     * @see PropertyFilter
-     * @see #disableProvidedPropertyFilters()
-     * @see #enabledProvidedPropertyFilters()
-     */
-    public ConfigurationBuilder addPropertyFilters(PropertyFilter... filters){
-        Objects.requireNonNull(filters);
-
-        contextBuilder.addPropertyFilters(filters);
-        return this;
-    }
-
-
-    /**
-     * @param propertyValueCombinationPolicy combination policy to use for this builder. 
-     * @return the builder instance currently in use.
-     */
-    public ConfigurationBuilder setPropertyValueCombinationPolicy(PropertyValueCombinationPolicy propertyValueCombinationPolicy){
-        contextBuilder.setPropertyValueCombinationPolicy(propertyValueCombinationPolicy);
-        return this;
-    }
-
-    /**
-     * Adds a property converter for the a given type to the configuration to
-     * be build.
-     *
-     * <pre>{@code PropertyConverter<MyType> converter = value -> new MyType(value, 42);
-     *
-     * builder.addPropertyConverter(MyType.class, converter}
-     * </pre>
-     *
-     * @param <T> the type of the configuration
-     * @param type the required target type the converter should be applied to
-     * @param converter the converter to be used to convert the string property
-     *                  to the given target type.
-     *
-     * @return the builder instance currently used
-     *
-     * @see PropertyConverter
-     * @see #enableProvidedPropertyConverters()
-     * @see #disableProvidedPropertyConverters()
-     */
-    public <T> ConfigurationBuilder addPropertyConverter(Class<T> type, PropertyConverter<T> converter) {
-        Objects.requireNonNull(type);
-        Objects.requireNonNull(converter);
-        return addPropertyConverter(TypeLiteral.of(type), (PropertyConverter<Object>)converter);
-    }
-
-    /**
-     * Adds a propertyConverter of a given type.
-     *  
-     * @param <T> the type of the configuration
-     * @param type type literal of this converter.
-     * @param propertyConverter property converter.
-     * @return the builder instance currently used
-     */
-    public <T> ConfigurationBuilder addPropertyConverter(TypeLiteral<T> type, PropertyConverter<T> propertyConverter){
-        Objects.requireNonNull(type);
-        Objects.requireNonNull(propertyConverter);
-        contextBuilder.addPropertyConverter(type, propertyConverter);
-        return this;
-    }
-
-    /**
-     * Checks if the automatic loading of all {@link PropertyConverter
-     * PropertyConverter} service providers is enabled or disabled.
-     *
-     * @return {@code true} if the automatic loading is enabled,
-     *         otherwise {@code false}.
-     *
-     * @see #enableProvidedPropertyConverters()
-     * @see #disableProvidedPropertyConverters()
-     * @see #addPropertyConverter(Class, PropertyConverter)
-     * @see #addPropertyConverter(org.apache.tamaya.TypeLiteral, PropertyConverter)
-     */
-    public boolean isPropertyConverterLoadingEnabled() {
-        return loadProvidedPropertyConverters;
-    }
-
-    /**
-     * Enables the loading of all {@link PropertyConverter}
-     * service providers.
-     *
-     * @return the builder instance currently used
-     *
-     * @see PropertyConverter
-     * @see #disableProvidedPropertyConverters()
-     * @see #enableProvidedPropertyConverters()
-     */
-    public ConfigurationBuilder enableProvidedPropertyConverters() {
-        checkBuilderState();
-
-        loadProvidedPropertyConverters = true;
-
-        return this;
-    }
-
-    /**
-     * Disables the automatic loading of all {@link PropertyConverter}
-     * service providers.
-     *
-     * @return the builder instance currently used
-     *
-     * @see PropertyConverter
-     * @see #enableProvidedPropertyConverters()
-     * @see #addPropertyConverter(Class, PropertyConverter)
-     */
-    public ConfigurationBuilder disableProvidedPropertyConverters() {
-        checkBuilderState();
-
-        loadProvidedPropertyConverters = false;
-
-        return this;
-    }
-
-
-    /**
-     * Enables the automatic loading of all {@link PropertySource}
-     * service providers.
-     *
-     * @return the builder instance currently used
-     *
-     * @see PropertySource
-     * @see #disableProvidedPropertySources()
-     */
-    public ConfigurationBuilder enableProvidedPropertySources() {
-        checkBuilderState();
-
-        loadProvidedPropertySources = true;
-
-        return this;
-    }
-
-    /**
-     * Checks if the automatic loading of all {@link PropertySource
-     * PropertySource} service providers is enabled or disabled.
-     *
-     * @return {@code true} if the automatic loading is enabled,
-     *         otherwise {@code false}.
-     */
-    public boolean isPropertySourcesLoadingEnabled() {
-        return loadProvidedPropertySources;
-    }
-
-
-    /**
-     * Checks if the automatic loading of all {@link PropertyFilter
-     * PropertyFilter} service providers is enabled or disabled.
-     *
-     * @return {@code true} if the automatic loading is enabled,
-     *         otherwise {@code false}.
-     */
-    public boolean isPropertyFilterLoadingEnabled() {
-        return isLoadProvidedPropertyFilters;
-    }
-
-    /**
-     * Enables the automatic loading of all {@link PropertyFilter}
-     * service providers.
-     *
-     * @return the builder instance currently used
-     *
-     * @see PropertyFilter
-     * @see #disableProvidedPropertyFilters()
-     * @see #addPropertyFilters(PropertyFilter...)
-     */
-    public ConfigurationBuilder enabledProvidedPropertyFilters() {
-        checkBuilderState();
-
-        isLoadProvidedPropertyFilters = true;
-
-        return this;
-    }
-
-    /**
-     * Disables the automatic loading of all {@link PropertyFilter}
-     * service providers.
-     *
-     * @see PropertyFilter
-     * @see #enabledProvidedPropertyFilters()
-     * @see #addPropertyFilters(PropertyFilter...)
-     *
-     * @return the builder instance currently used
-     */
-    public ConfigurationBuilder disableProvidedPropertyFilters() {
-        checkBuilderState();
-
-        isLoadProvidedPropertyFilters = false;
-
-        return this;
-    }
-
-    /**
-     * Disables the automatic loading of all {@link PropertySource}
-     * service providers.
-     *
-     * @return the builder instance currently used
-     *
-     * @see PropertySource
-     * @see #enableProvidedPropertySources()
-     */
-    public ConfigurationBuilder disableProvidedPropertySources() {
-        checkBuilderState();
-
-        loadProvidedPropertySources = false;
-
-        return this;
-    }
-
-    /**
-     * Enables the automatic loading of {@link PropertySourceProvider
-     * property source providers} provided via the SPI API.
-     *
-     * @return the builder instance currently used
-     *
-     * @see PropertySourceProvider
-     */
-    public ConfigurationBuilder enableProvidedPropertySourceProviders() {
-        checkBuilderState();
-
-        loadProvidedPropertySourceProviders = true;
-
-        return this;
-    }
-
-    /**
-     * Disables the automatic loading of {@link PropertySourceProvider
-     * property source providers} provided via the SPI API.
-     *
-     * @return the builder instance currently used
-     */
-    public ConfigurationBuilder disableProvidedPropertySourceProviders() {
-        checkBuilderState();
-
-        loadProvidedPropertySourceProviders = false;
-
-        return this;
-    }
-
-    /**
-     * Checks if the automatic loading of {@link PropertySourceProvider
-     * PropertySourceProviders} is enabled or disabled.
-     *
-     * @return {@code true} if the automatic loading is enabled,
-     *         otherwise {@code false}.
-     */
-    public boolean isPropertySourceProvidersLoadingEnabled() {
-        return loadProvidedPropertySourceProviders;
-    }
-
-    //X TODO think on a functionality/API for using the default PropertyConverters and use the configured ones here
-    //X TODO as overrides used first.
-
-
-    /**
-     * Builds a new configuration based on the configuration of this builder instance.
-     *
-     * @return a new {@link org.apache.tamaya.Configuration configuration instance},
-     *         never {@code null}.
-     */
-    public Configuration build() {
-        checkBuilderState();
-
-        built = true;
-
-        contextBuilder.loadProvidedPropertyConverters(isPropertyConverterLoadingEnabled());
-        contextBuilder.loadProvidedPropertySources(isPropertySourcesLoadingEnabled());
-        contextBuilder.loadProvidedPropertySourceProviders(isPropertySourceProvidersLoadingEnabled());
-        contextBuilder.loadProvidedPropertyFilters(isLoadProvidedPropertyFilters);
-
-        return new DefaultConfiguration(contextBuilder.build());
-    }
-
-    /**
-     * Mapper to map a URL given as string to an URL instance.
-     */
-    private static class StringToURLMapper {
-        public URL apply(String u) {
-            try {
-                return new URL(u);
-            } catch (MalformedURLException e) {
-                throw new ConfigException(u + " is not a valid URL", e);
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/7144e3f9/modules/builder/src/main/java/org/apache/tamaya/builder/DefaultPropertySourceBasedConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/builder/src/main/java/org/apache/tamaya/builder/DefaultPropertySourceBasedConfiguration.java b/modules/builder/src/main/java/org/apache/tamaya/builder/DefaultPropertySourceBasedConfiguration.java
new file mode 100644
index 0000000..a459a4c
--- /dev/null
+++ b/modules/builder/src/main/java/org/apache/tamaya/builder/DefaultPropertySourceBasedConfiguration.java
@@ -0,0 +1,306 @@
+/*
+ * 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;
+
+import org.apache.tamaya.builder.internal.PropertyFiltering;
+import org.apache.tamaya.builder.spi.PropertyFilter;
+import org.apache.tamaya.builder.spi.PropertySource;
+import org.apache.tamaya.builder.spi.PropertySourceProvider;
+import org.apache.tamaya.builder.spi.PropertyValueCombinationPolicy;
+import org.apache.tamaya.servicecontext.ServiceContextManager;
+
+import javax.annotation.Priority;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * Default Implementation of a simple ConfigurationContext.
+ */
+class DefaultPropertySourceBasedConfiguration implements PropertySourceBasedConfiguration {
+    /** The logger used. */
+    private final static Logger LOG = Logger.getLogger(DefaultPropertySourceBasedConfiguration.class.getName());
+
+    /**
+     * The current unmodifiable list of loaded {@link PropertySource} instances.
+     */
+    private List<PropertySource> immutablePropertySources;
+
+    /**
+     * The current unmodifiable list of loaded {@link PropertyFilter} instances.
+     */
+    private List<PropertyFilter> immutablePropertyFilters;
+
+    /**
+     * The overriding policy used when combining PropertySources registered to evalute the final configuration
+     * values.
+     */
+    private PropertyValueCombinationPolicy propertyValueCombinationPolicy;
+
+    /**
+     * Lock for internal synchronization.
+     */
+    private final ReentrantReadWriteLock propertySourceLock = new ReentrantReadWriteLock();
+
+    /** Comparator used for ordering property sources. */
+    private final PropertySourceComparator propertySourceComparator = new PropertySourceComparator();
+
+    /** Comparator used for ordering property filters. */
+    private final PropertyFilterComparator propertyFilterComparator = new PropertyFilterComparator();
+
+
+    /**
+     * The first time the Configuration system gets invoked we do initialize
+     * all our {@link PropertySource}s and
+     * {@link PropertyFilter}s which are known at startup.
+     */
+    public DefaultPropertySourceBasedConfiguration() {
+        List<PropertySource> propertySources = new ArrayList<>();
+
+        // first we load all PropertySources which got registered via java.util.ServiceLoader
+        propertySources.addAll(ServiceContextManager.getServiceContext().getServices(PropertySource.class));
+
+        // after that we add all PropertySources which get dynamically registered via their PropertySourceProviders
+        propertySources.addAll(evaluatePropertySourcesFromProviders());
+
+        // now sort them according to their ordinal values
+        Collections.sort(propertySources, new PropertySourceComparator());
+
+        immutablePropertySources = Collections.unmodifiableList(propertySources);
+        LOG.info("Registered " + immutablePropertySources.size() + " property sources: " +
+                immutablePropertySources);
+
+        // as next step we pick up the PropertyFilters pretty much the same way
+        List<PropertyFilter> propertyFilters = new ArrayList<>();
+        propertyFilters.addAll(ServiceContextManager.getServiceContext().getServices(PropertyFilter.class));
+        Collections.sort(propertyFilters, new PropertyFilterComparator());
+        immutablePropertyFilters = Collections.unmodifiableList(propertyFilters);
+        LOG.info("Registered " + immutablePropertyFilters.size() + " property filters: " +
+                immutablePropertyFilters);
+
+        immutablePropertyFilters = Collections.unmodifiableList(propertyFilters);
+        LOG.info("Registered " + immutablePropertyFilters.size() + " property filters: " +
+                immutablePropertyFilters);
+        propertyValueCombinationPolicy = ServiceContextManager.getServiceContext().getService(PropertyValueCombinationPolicy.class);
+        if(propertyValueCombinationPolicy==null) {
+            propertyValueCombinationPolicy = PropertyValueCombinationPolicy.DEFAULT_OVERRIDING_COLLECTOR;
+        }
+        LOG.info("Using PropertyValueCombinationPolicy: " + propertyValueCombinationPolicy);
+    }
+
+    DefaultPropertySourceBasedConfiguration(PropertySourceBasedConfigurationBuilder builder) {
+        List<PropertySource> propertySources = new ArrayList<>();
+        // first we load all PropertySources which got registered via java.util.ServiceLoader
+        propertySources.addAll(builder.propertySources.values());
+        // now sort them according to their ordinal values
+        Collections.sort(propertySources, propertySourceComparator);
+        immutablePropertySources = Collections.unmodifiableList(propertySources);
+        LOG.info("Registered " + immutablePropertySources.size() + " property sources: " +
+                immutablePropertySources);
+
+        // as next step we pick up the PropertyFilters pretty much the same way
+        List<PropertyFilter> propertyFilters = new ArrayList<>();
+        propertyFilters.addAll(ServiceContextManager.getServiceContext().getServices(PropertyFilter.class));
+        Collections.sort(propertyFilters, propertyFilterComparator);
+        immutablePropertyFilters = Collections.unmodifiableList(propertyFilters);
+        LOG.info("Registered " + immutablePropertyFilters.size() + " property filters: " +
+                immutablePropertyFilters);
+
+        propertyValueCombinationPolicy = builder.combinationPolicy;
+        if(propertyValueCombinationPolicy==null){
+            propertyValueCombinationPolicy = ServiceContextManager.getServiceContext().getService(PropertyValueCombinationPolicy.class);
+        }
+        if(propertyValueCombinationPolicy==null){
+            propertyValueCombinationPolicy = PropertyValueCombinationPolicy.DEFAULT_OVERRIDING_COLLECTOR;
+        }
+        LOG.info("Using PropertyValueCombinationPolicy: " + propertyValueCombinationPolicy);
+    }
+
+    @Override
+    public String get(String key) {
+        Map<String,String> value = evaluteRawValue(key);
+        if(value==null || value.get(key)==null){
+            return null;
+        }
+        return PropertyFiltering.applyFilter(key, value, this);
+    }
+
+    /**
+     * Get the current properties, composed by the loaded {@link PropertySource} and filtered
+     * by registered {@link PropertyFilter}.
+     *
+     * @return the final properties.
+     */
+    @Override
+    public Map<String, String> getProperties() {
+        return PropertyFiltering.applyFilters(evaluateUnfilteredMap(), this);
+    }
+
+    protected Map<String, String> evaluateUnfilteredMap() {
+        List<PropertySource> propertySources = new ArrayList<>(getPropertySources());
+        Collections.reverse(propertySources);
+        Map<String, String> result = new HashMap<>();
+        for (PropertySource propertySource : propertySources) {
+            try {
+                int origSize = result.size();
+                Map<String, String> otherMap = propertySource.getProperties();
+                LOG.log(Level.FINEST, null, "Overriding with properties from " + propertySource.getName());
+                result.putAll(otherMap);
+                LOG.log(Level.FINEST, null, "Handled properties from " + propertySource.getName() + "(new: " +
+                        (result.size() - origSize) + ", overrides: " + origSize + ", total: " + result.size());
+            } catch (Exception e) {
+                LOG.log(Level.SEVERE, "Error adding properties from PropertySource: " + propertySource + ", ignoring PropertySource.", e);
+            }
+        }
+        return result;
+    }
+
+    protected Map<String,String> evaluteRawValue(String key) {
+        List<PropertySource> propertySources = getPropertySources();
+        Map<String,String> unfilteredValue = null;
+        PropertyValueCombinationPolicy combinationPolicy = getPropertyValueCombinationPolicy();
+        for (PropertySource propertySource : propertySources) {
+            unfilteredValue = combinationPolicy.collect(unfilteredValue, key, propertySource);
+        }
+        return unfilteredValue;
+    }
+
+    /**
+     * Pick up all {@link PropertySourceProvider}s and return all the
+     * {@link PropertySource}s they like to register.
+     */
+    private Collection<? extends PropertySource> evaluatePropertySourcesFromProviders() {
+        List<PropertySource> propertySources = new ArrayList<>();
+        Collection<PropertySourceProvider> propertySourceProviders = ServiceContextManager.getServiceContext().getServices(PropertySourceProvider.class);
+        for (PropertySourceProvider propertySourceProvider : propertySourceProviders) {
+            Collection<PropertySource> sources = propertySourceProvider.getPropertySources();
+            LOG.finer("PropertySourceProvider " + propertySourceProvider.getClass().getName() +
+                    " provided the following property sources: " + sources);
+                propertySources.addAll(sources);
+        }
+
+        return propertySources;
+    }
+
+    @Override
+    public void addPropertySources(PropertySource... propertySourcesToAdd) {
+        Lock writeLock = propertySourceLock.writeLock();
+        try {
+            writeLock.lock();
+            List<PropertySource> newPropertySources = new ArrayList<>(this.immutablePropertySources);
+            newPropertySources.addAll(Arrays.asList(propertySourcesToAdd));
+            Collections.sort(newPropertySources, new PropertySourceComparator());
+
+            this.immutablePropertySources = Collections.unmodifiableList(newPropertySources);
+        } finally {
+            writeLock.unlock();
+        }
+    }
+
+    private static 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);
+        }
+    }
+
+    private static 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);
+        }
+    }
+
+    @Override
+    public List<PropertySource> getPropertySources() {
+        return immutablePropertySources;
+    }
+
+    @Override
+    public List<PropertyFilter> getPropertyFilters() {
+        return immutablePropertyFilters;
+    }
+
+    @Override
+    public PropertyValueCombinationPolicy getPropertyValueCombinationPolicy(){
+        return propertyValueCombinationPolicy;
+    }
+
+    @Override
+    public PropertySourceBasedConfigurationBuilder toBuilder() {
+        return new PropertySourceBasedConfigurationBuilder()
+                .setConfiguration(this);
+    }
+
+}