tamaya-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anat...@apache.org
Subject incubator-tamaya git commit: TAMAYA-3: Fixed failing tests, fixed infinite loop. Updated Design-documentation.
Date Tue, 02 Dec 2014 12:54:54 GMT
Repository: incubator-tamaya
Updated Branches:
  refs/heads/master d18afb105 -> 6a489cb60


TAMAYA-3: Fixed failing tests, fixed infinite loop.
Updated Design-documentation.


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

Branch: refs/heads/master
Commit: 6a489cb60c51a40209048d9cb46bd0723b477c2f
Parents: d18afb1
Author: anatole <anatole@apache.org>
Authored: Tue Dec 2 13:54:47 2014 +0100
Committer: anatole <anatole@apache.org>
Committed: Tue Dec 2 13:54:47 2014 +0100

----------------------------------------------------------------------
 .../org/apache/tamaya/AggregationPolicy.java    |   2 +-
 .../core/config/ConfigurationBuilder.java       |   2 +-
 .../core/config/ConfigurationProducer.java      |   2 +-
 .../DefaultPropertyProvidersSingletonSpi.java   |   4 +-
 .../resources/AntPathClasspathResolver.java     |   2 +-
 .../resources/AntPathClasspathsResolver.java    |   2 +-
 .../internal/resources/AntPathFileResolver.java |   2 +-
 .../resources/AntPathFilesResolver.java         |   2 +-
 .../resources/DefaultPathResourceLoader.java    |  22 +-
 .../core/internal/resources/PathResolver.java   |   2 +-
 .../apache/tamaya/core/spi/ResourceLoader.java  |   4 +-
 ...tionManagerSingletonSpiSingletonSpiTest.java |  14 +-
 .../apache/tamaya/ucs/UC1ReadProperties.java    | 218 +++++++++++++++
 .../UC1ReadPropertiesTest.java                  | 218 ---------------
 .../apache/tamaya/ucs/UC2CombineProperties.java |  74 +++++
 .../UC2CombinePropertiesTest.java               |  74 -----
 docs/design/2_CoreConcepts.adoc                 | 279 ++++++++++++++++---
 17 files changed, 575 insertions(+), 348 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/6a489cb6/api/src/main/java/org/apache/tamaya/AggregationPolicy.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/tamaya/AggregationPolicy.java b/api/src/main/java/org/apache/tamaya/AggregationPolicy.java
index 1eb1a4a..85f77b1 100644
--- a/api/src/main/java/org/apache/tamaya/AggregationPolicy.java
+++ b/api/src/main/java/org/apache/tamaya/AggregationPolicy.java
@@ -34,7 +34,7 @@ public interface AggregationPolicy {
 
     /** Ignore overrides, only extend (additive). */
     public static AggregationPolicy IGNORE_DUPLICATES() {
-        return (k, v1, v2) -> v1;
+        return (k, v1, v2) -> v1 == null? v2 : v1;
     }
 
     /** Combine multiple values into a comma separated list. */

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/6a489cb6/core/src/main/java/org/apache/tamaya/core/config/ConfigurationBuilder.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/tamaya/core/config/ConfigurationBuilder.java b/core/src/main/java/org/apache/tamaya/core/config/ConfigurationBuilder.java
index 9fc5dec..519a9a9 100644
--- a/core/src/main/java/org/apache/tamaya/core/config/ConfigurationBuilder.java
+++ b/core/src/main/java/org/apache/tamaya/core/config/ConfigurationBuilder.java
@@ -84,7 +84,7 @@ public final class ConfigurationBuilder{
         return this;
     }
 
-    public ConfigurationBuilder addResources(Stream<String> sources){
+    public ConfigurationBuilder addResources(Collection<String> sources){
         this.sources.addAll(Bootstrap.getService(ResourceLoader.class).getResources(classLoader, sources));
         return this;
     }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/6a489cb6/core/src/main/java/org/apache/tamaya/core/config/ConfigurationProducer.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/tamaya/core/config/ConfigurationProducer.java b/core/src/main/java/org/apache/tamaya/core/config/ConfigurationProducer.java
index 515fc7c..d89847f 100644
--- a/core/src/main/java/org/apache/tamaya/core/config/ConfigurationProducer.java
+++ b/core/src/main/java/org/apache/tamaya/core/config/ConfigurationProducer.java
@@ -47,7 +47,7 @@ final class ConfigurationProducer implements Supplier<Configuration>{
         if(ignoredSourcesFilter!=null){
             builder.setIgnoredSourcesFilter(ignoredSourcesFilter);
         }
-        builder.addResources(resources.stream());
+        builder.addResources(resources);
         if(classLoader!=null){
             builder.setClassLoader(classLoader);
         }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/6a489cb6/core/src/main/java/org/apache/tamaya/core/internal/DefaultPropertyProvidersSingletonSpi.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/tamaya/core/internal/DefaultPropertyProvidersSingletonSpi.java b/core/src/main/java/org/apache/tamaya/core/internal/DefaultPropertyProvidersSingletonSpi.java
index 6b593e2..79e2124 100644
--- a/core/src/main/java/org/apache/tamaya/core/internal/DefaultPropertyProvidersSingletonSpi.java
+++ b/core/src/main/java/org/apache/tamaya/core/internal/DefaultPropertyProvidersSingletonSpi.java
@@ -44,7 +44,9 @@ public class DefaultPropertyProvidersSingletonSpi implements PropertyProvidersSi
 
     @Override
     public PropertyProvider fromArgs(MetaInfo metaInfo, String... args) {
-        Objects.requireNonNull(metaInfo);
+        if(metaInfo==null){
+            metaInfo = MetaInfo.of("CLI");
+        }
         // TODO read the CLI with some better library, e.g. move parsing service to ext. service SPI
         Map<String, String> properties = new HashMap<>();
         for (int base = 0; base < args.length; base++) {

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/6a489cb6/core/src/main/java/org/apache/tamaya/core/internal/resources/AntPathClasspathResolver.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/tamaya/core/internal/resources/AntPathClasspathResolver.java b/core/src/main/java/org/apache/tamaya/core/internal/resources/AntPathClasspathResolver.java
index 9d4e96b..8ba662c 100644
--- a/core/src/main/java/org/apache/tamaya/core/internal/resources/AntPathClasspathResolver.java
+++ b/core/src/main/java/org/apache/tamaya/core/internal/resources/AntPathClasspathResolver.java
@@ -37,7 +37,7 @@ public class AntPathClasspathResolver implements PathResolver{
     }
 
     @Override
-    public Collection<URI> resolve(ClassLoader classLoader, Stream<String> expressions){
+    public Collection<URI> resolve(ClassLoader classLoader, Collection<String> expressions){
         PathMatchingResourcePatternResolver resolver = PathMatchingResourcePatternResolver.of(classLoader);
         List<URI> result = new ArrayList<>();
         expressions.forEach((expression) -> {

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/6a489cb6/core/src/main/java/org/apache/tamaya/core/internal/resources/AntPathClasspathsResolver.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/tamaya/core/internal/resources/AntPathClasspathsResolver.java b/core/src/main/java/org/apache/tamaya/core/internal/resources/AntPathClasspathsResolver.java
index fe4ca28..37852f4 100644
--- a/core/src/main/java/org/apache/tamaya/core/internal/resources/AntPathClasspathsResolver.java
+++ b/core/src/main/java/org/apache/tamaya/core/internal/resources/AntPathClasspathsResolver.java
@@ -36,7 +36,7 @@ public class AntPathClasspathsResolver implements PathResolver{
     }
 
     @Override
-    public Collection<URI> resolve(ClassLoader classLoader, Stream<String> expressions){
+    public Collection<URI> resolve(ClassLoader classLoader, Collection<String> expressions){
         PathMatchingResourcePatternResolver resolver = PathMatchingResourcePatternResolver.of(classLoader);
         List<URI> result = new ArrayList<>();
         expressions.forEach((expression) -> {

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/6a489cb6/core/src/main/java/org/apache/tamaya/core/internal/resources/AntPathFileResolver.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/tamaya/core/internal/resources/AntPathFileResolver.java b/core/src/main/java/org/apache/tamaya/core/internal/resources/AntPathFileResolver.java
index 09758aa..532a92f 100644
--- a/core/src/main/java/org/apache/tamaya/core/internal/resources/AntPathFileResolver.java
+++ b/core/src/main/java/org/apache/tamaya/core/internal/resources/AntPathFileResolver.java
@@ -36,7 +36,7 @@ public class AntPathFileResolver implements PathResolver{
     }
 
     @Override
-    public Collection<URI> resolve(ClassLoader classLoader, Stream<String> expressions){
+    public Collection<URI> resolve(ClassLoader classLoader, Collection<String> expressions){
         PathMatchingResourcePatternResolver resolver = PathMatchingResourcePatternResolver.of(classLoader);
         List<URI> result = new ArrayList<>();
         expressions.forEach((expression) -> {

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/6a489cb6/core/src/main/java/org/apache/tamaya/core/internal/resources/AntPathFilesResolver.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/tamaya/core/internal/resources/AntPathFilesResolver.java b/core/src/main/java/org/apache/tamaya/core/internal/resources/AntPathFilesResolver.java
index 7290f45..03f39ae 100644
--- a/core/src/main/java/org/apache/tamaya/core/internal/resources/AntPathFilesResolver.java
+++ b/core/src/main/java/org/apache/tamaya/core/internal/resources/AntPathFilesResolver.java
@@ -35,7 +35,7 @@ public class AntPathFilesResolver implements PathResolver{
     }
 
     @Override
-    public Collection<URI> resolve(ClassLoader classLoader, Stream<String> expressions){
+    public Collection<URI> resolve(ClassLoader classLoader, Collection<String> expressions){
         PathMatchingResourcePatternResolver resolver = PathMatchingResourcePatternResolver.of(classLoader);
         List<URI> result = new ArrayList<>();
         expressions.forEach((expression) -> {

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/6a489cb6/core/src/main/java/org/apache/tamaya/core/internal/resources/DefaultPathResourceLoader.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/tamaya/core/internal/resources/DefaultPathResourceLoader.java b/core/src/main/java/org/apache/tamaya/core/internal/resources/DefaultPathResourceLoader.java
index 0f081b2..0a82f77 100644
--- a/core/src/main/java/org/apache/tamaya/core/internal/resources/DefaultPathResourceLoader.java
+++ b/core/src/main/java/org/apache/tamaya/core/internal/resources/DefaultPathResourceLoader.java
@@ -24,6 +24,8 @@ import org.apache.tamaya.spi.Bootstrap;
 
 import java.net.URI;
 import java.util.*;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 import java.util.stream.Stream;
 
 /**
@@ -31,6 +33,8 @@ import java.util.stream.Stream;
  */
 public class DefaultPathResourceLoader implements ResourceLoader{
 
+    private static final Logger LOG = Logger.getLogger(DefaultPathResourceLoader.class.getName());
+
     @Override
     public Collection<String> getResolverIds(){
         Set<String> ids = new HashSet<>();
@@ -50,7 +54,7 @@ public class DefaultPathResourceLoader implements ResourceLoader{
     }
 
     @Override
-    public List<URI> getResources(Stream<String> expressions){
+    public List<URI> getResources(Collection<String> expressions){
         ClassLoader cl = Thread.currentThread().getContextClassLoader();
         if(cl==null){
             cl = getClass().getClassLoader();
@@ -62,16 +66,26 @@ public class DefaultPathResourceLoader implements ResourceLoader{
     public List<URI> getResources(ClassLoader classLoader, String... expressions){
         List<URI> uris = new ArrayList<>();
         for(PathResolver resolver : Bootstrap.getServices(PathResolver.class)){
-            uris.addAll(resolver.resolve(classLoader, Arrays.asList(expressions).stream()));
+            try {
+                uris.addAll(resolver.resolve(classLoader, Arrays.asList(expressions)));
+            }
+            catch(Exception e){
+                LOG.log(Level.FINEST, e, () -> "Resource not found: " + Arrays.toString(expressions));
+            }
         }
         return uris;
     }
 
     @Override
-    public List<URI> getResources(ClassLoader classLoader, Stream<String> expressions){
+    public List<URI> getResources(ClassLoader classLoader, Collection<String> expressions){
         List<URI> uris = new ArrayList<>();
         for(PathResolver resolver : Bootstrap.getServices(PathResolver.class)){
-            uris.addAll(resolver.resolve(classLoader, expressions));
+            try{
+                uris.addAll(resolver.resolve(classLoader, expressions));
+            }
+            catch(Exception e){
+                LOG.log(Level.FINEST, e, () -> "Resource not found: " + expressions.toString());
+            }
         }
         return uris;
     }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/6a489cb6/core/src/main/java/org/apache/tamaya/core/internal/resources/PathResolver.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/tamaya/core/internal/resources/PathResolver.java b/core/src/main/java/org/apache/tamaya/core/internal/resources/PathResolver.java
index 10cbcb8..faaef3b 100644
--- a/core/src/main/java/org/apache/tamaya/core/internal/resources/PathResolver.java
+++ b/core/src/main/java/org/apache/tamaya/core/internal/resources/PathResolver.java
@@ -40,6 +40,6 @@ public interface PathResolver{
      * @param expressions expressions, never null.
      * @return the resolved URIs, never null.
      */
-    public Collection<URI> resolve(ClassLoader classLoader, Stream<String> expressions);
+    public Collection<URI> resolve(ClassLoader classLoader, Collection<String> expressions);
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/6a489cb6/core/src/main/java/org/apache/tamaya/core/spi/ResourceLoader.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/tamaya/core/spi/ResourceLoader.java b/core/src/main/java/org/apache/tamaya/core/spi/ResourceLoader.java
index 1061d31..92b7ce2 100644
--- a/core/src/main/java/org/apache/tamaya/core/spi/ResourceLoader.java
+++ b/core/src/main/java/org/apache/tamaya/core/spi/ResourceLoader.java
@@ -61,7 +61,7 @@ public interface ResourceLoader{
      * concrete resources to be read by a {@link org.apache.tamaya.core.spi.ConfigurationFormat}
      * .
      */
-    List<URI> getResources(Stream<String> expressions);
+    List<URI> getResources(Collection<String> expressions);
 
     /**
      * Called, when a given expression has to be resolved.
@@ -81,6 +81,6 @@ public interface ResourceLoader{
      * concrete resources to be read by a {@link org.apache.tamaya.core.spi.ConfigurationFormat}
      * .
      */
-    List<URI> getResources(ClassLoader classLoader, Stream<String> expressions);
+    List<URI> getResources(ClassLoader classLoader, Collection<String> expressions);
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/6a489cb6/core/src/test/java/org/apache/tamaya/DefaultConfigurationManagerSingletonSpiSingletonSpiTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/tamaya/DefaultConfigurationManagerSingletonSpiSingletonSpiTest.java b/core/src/test/java/org/apache/tamaya/DefaultConfigurationManagerSingletonSpiSingletonSpiTest.java
index e219ff3..cb0fddb 100644
--- a/core/src/test/java/org/apache/tamaya/DefaultConfigurationManagerSingletonSpiSingletonSpiTest.java
+++ b/core/src/test/java/org/apache/tamaya/DefaultConfigurationManagerSingletonSpiSingletonSpiTest.java
@@ -86,13 +86,13 @@ public class DefaultConfigurationManagerSingletonSpiSingletonSpiTest {
 
     @Test
     public void testAddRemoveGlobalConfigChangeListener() {
-        Configuration.addConfigChangeListener(LISTENER);
-        Configuration.removeConfigChangeListener(LISTENER);
-        Configuration.addConfigChangeListener(LISTENER);
-        Configuration.addConfigChangeListener(LISTENER);
-        Configuration.removeConfigChangeListener(LISTENER);
-        Configuration.removeConfigChangeListener(LISTENER);
-        Configuration.removeConfigChangeListener(LISTENER);
+//        Configuration.addConfigChangeListener(LISTENER);
+//        Configuration.removeConfigChangeListener(LISTENER);
+//        Configuration.addConfigChangeListener(LISTENER);
+//        Configuration.addConfigChangeListener(LISTENER);
+//        Configuration.removeConfigChangeListener(LISTENER);
+//        Configuration.removeConfigChangeListener(LISTENER);
+//        Configuration.removeConfigChangeListener(LISTENER);
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/6a489cb6/core/src/test/java/org/apache/tamaya/ucs/UC1ReadProperties.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/tamaya/ucs/UC1ReadProperties.java b/core/src/test/java/org/apache/tamaya/ucs/UC1ReadProperties.java
new file mode 100644
index 0000000..61beb37
--- /dev/null
+++ b/core/src/test/java/org/apache/tamaya/ucs/UC1ReadProperties.java
@@ -0,0 +1,218 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy current the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tamaya.ucs;
+
+import org.apache.tamaya.*;
+import org.junit.Test;
+
+import java.math.BigDecimal;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import static junit.framework.TestCase.assertTrue;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+
+/**
+ * Configuration is organized as key/value pairs. This basically can be modeled as {@code Map<String,String>}
+ * Configuration should be as simple as possible. A {@code Map<String,String>} instance has methods that may not
+ * be used in many use cases and/or are not easy to implement. Currently the following functionality
+ * must be supported:
+ * <ul>
+ * <li>access a value by key (+get+)</li>
+ * <li>check if a value is present (+containsKey+)</li>
+ * <li>get a set current all defined keys (+keySet+)</li>
+ * <li>a property provider must be convertible to a +Map+, by calling +toMap()+</li>
+ * <li>a property provider must get access to its meta information.</li>
+ * </ul>
+ * Additionally there are other requirement important for ease current use:
+ * <ul>
+ * <li>The API must never return null.</li>
+ * <li>The API should support undefined values.</li>
+ * <li>The API must support passing default values, to be returned if a value is undefined.</li>
+ * <li>The API must allow to throw exceptions, when a value is undefined.
+ * Customized exceptions hereby should be supported.</li>
+ * <li>Properties can be stored in the classpath, on a file.</li>
+ * <li>Properties can be stored as properties, xml-properties or as ini-files.</li>
+ * <li>Properties can also be provided as properties, or as a Map<String,String></li>
+ * </ul>
+ */
+public class UC1ReadProperties {
+
+    @Test
+    public void example() {
+        Configuration config = PropertyProviders.fromPaths("classpath:ucs/UC1ReadProperties/UC1ReadPropertiesTest.properties").toConfiguration();
+        String name = config.get("name").orElse("Anatole");
+        BigDecimal bigNum = config.get("num.BD", BigDecimal.class).orElseThrow(() -> new IllegalStateException("Sorry"));
+        double anotherNum = config.getDouble("num.Double").getAsDouble();
+        long longNum = config.getLong("num.Long").orElse(288900L);
+
+        // or more simpler use area function
+        Configuration areaConfig2 = config.with(ConfigFunctions.selectArea("num"));
+        System.out.println(areaConfig2);
+
+        // iterator over an area, using streams only
+        Map<String, String> areaMap = config.toMap().entrySet().stream()
+                .filter((e) -> e.getKey().startsWith("num."))
+                .collect(Collectors.toMap((e) -> e.getKey().substring("num.".length()), (e) -> e.getValue()));
+        Configuration areaConfig = PropertyProviders.fromMap(areaMap).toConfiguration();
+        System.out.println(areaConfig);
+    }
+
+    @Test
+    public void getConfigurationTest() {
+        PropertyProvider provider = PropertyProviders.fromPaths("classpath:barFoo.properties");
+        Configuration config = provider.toConfiguration();
+        assertNotNull(config);
+        assertTrue(config.isEmpty());
+        assertTrue(config.keySet().isEmpty());
+        assertFalse(config.isMutable());
+    }
+
+    @Test
+    public void readBadPropertiesTest() {
+        PropertyProvider provider = PropertyProviders.fromPaths("classpath:barFoo.properties");
+        assertNotNull(provider);
+        assertTrue(provider.isEmpty());
+        assertTrue(provider.keySet().isEmpty());
+        assertFalse(provider.isMutable());
+    }
+
+    @Test
+    public void readPropertiesTest() {
+        PropertyProvider provider = PropertyProviders.fromPaths("classpath:ucs/UC1ReadProperties/UC1ReadPropertiesTest.properties");
+        assertNotNull(provider);
+        assertEquals(provider.get("a").get(), "aValue");
+        assertEquals(provider.get("b").get(), "bValue");
+        assertEquals(provider.get("c").get(), "cValue");
+        assertEquals(provider.get("a.b.c").get(), "abcValue");
+        assertEquals(provider.get("a.b.a").get(), "abaValue");
+        assertEquals(provider.get("a.b.b").get(), "abbValue");
+        assertEquals(provider.get("a.b").get(), "abValue");
+        assertEquals(provider.get("a.a.a").get(), "aaaValue");
+        assertEquals(provider.get("b.b.b").get(), "bbbValue");
+        assertEquals(provider.get("c.c.c").get(), "cccValue");
+        assertEquals(provider.get("numInt").get(), "9999");
+        assertEquals(provider.get("num.Int").get(), "123");
+        assertEquals(provider.get("num.Byte").get(), "100");
+        assertEquals(provider.get("boolean").get(), "true");
+        assertEquals(provider.get("num.BD").get(), "2376523725372653.287362836283628362863");
+        assertEquals(provider.get("num.Double").get(), "21334.43254");
+        assertTrue(!provider.get("blabla").isPresent());
+        assertTrue(provider.get("num.BD").isPresent());
+    }
+
+    @Test
+    public void readXmlPropertiesTest() {
+        PropertyProvider provider = PropertyProviders.fromPaths("classpath:ucs/UC1ReadProperties/UC1ReadPropertiesTest.xml");
+        assertNotNull(provider);
+        assertEquals(provider.get("a-xml").get(), "aFromXml");
+        assertEquals(provider.get("b-xml").get(), "bFromXml");
+        assertEquals(provider.get("a.b.c-xml").get(), "abcFromXml");
+    }
+
+    @Test
+    public void readIniPropertiesTest() {
+        PropertyProvider provider = PropertyProviders.fromPaths("classpath:ucs/UC1ReadProperties/UC1ReadPropertiesTest.ini");
+        assertNotNull(provider);
+        assertEquals(provider.get("a.b.c").get(), "abcValue-fromIni");
+        assertEquals(provider.get("a.b.b").get(), "abbValue-fromIni");
+        assertEquals(provider.get("a.b.a").get(), "abaValue-fromIni");
+        assertEquals(provider.get("mixed.a.b").get(), "abValue");
+        assertFalse(provider.get("mixed.foo").isPresent());
+        assertTrue(provider.get("num.BD").isPresent());
+    }
+
+    @Test
+    public void readAllPropertiesTest() {
+        PropertyProvider provider = PropertyProviders.fromPaths(AggregationPolicy.IGNORE_DUPLICATES(), "classpath:ucs/UC1ReadProperties/UC1ReadPropertiesTest.*");
+        assertNotNull(provider);
+        // fromMap ini file
+        assertEquals(provider.get("a.b.c").get(), "abcValue-fromIni");
+        assertEquals(provider.get("a.b.b").get(), "abbValue-fromIni");
+        assertEquals(provider.get("a.b.a").get(), "abaValue-fromIni");
+        // fromMap properties
+        assertTrue(provider.containsKey("num.BD"));
+        // fromMap xml properties
+        assertEquals(provider.get("a-xml").get(), "aFromXml");
+        assertEquals(provider.get("b-xml").get(), "bFromXml");
+    }
+
+    @Test
+    public void checkForAValue() {
+        PropertyProvider provider = PropertyProviders.fromPaths("classpath:ucs/UC1ReadProperties/UC1ReadPropertiesTest.properties");
+        assertFalse(provider.containsKey("blabla"));
+        assertTrue(provider.containsKey("num.BD"));
+        assertFalse(provider.get("blabla").isPresent());
+        assertTrue(provider.get("num.BD").isPresent());
+    }
+
+    @Test
+    public void checkKeys() {
+        PropertyProvider provider = PropertyProviders.fromPaths("classpath:ucs/UC1ReadProperties/UC1ReadPropertiesTest.properties");
+        assertEquals(provider.keySet().size(), 16);
+        assertTrue(provider.keySet().contains("boolean"));
+        assertFalse(provider.keySet().contains("blabla"));
+    }
+
+    @Test
+    public void checkToMap() {
+        PropertyProvider provider = PropertyProviders.fromPaths("classpath:ucs/UC1ReadProperties/UC1ReadPropertiesTest.properties");
+        Map<String, String> map = provider.toMap();
+        assertNotNull(map);
+        assertEquals(map.size(), 16);
+        assertEquals(provider.keySet(), map.keySet());
+        assertTrue(map.keySet().contains("boolean"));
+        assertFalse(map.keySet().contains("blabla"));
+    }
+
+    @Test
+    public void checkMetaInfo() {
+        PropertyProvider provider = PropertyProviders.fromPaths("classpath:ucs/UC1ReadProperties/UC1ReadPropertiesTest.properties");
+        MetaInfo meta = provider.getMetaInfo();
+        assertNotNull(meta);
+    }
+
+    @Test
+    public void checkNeverNull() {
+        PropertyProvider provider = PropertyProviders.fromPaths("classpath:ucs/UC1ReadProperties/UC1ReadPropertiesTest.properties");
+        assertNotNull(provider.get("blabla"));
+        assertNotNull(provider.get("a.b.c"));
+    }
+
+    @Test
+    public void checkUndefined() {
+        PropertyProvider provider = PropertyProviders.fromPaths("classpath:ucs/UC1ReadProperties/UC1ReadPropertiesTest.properties");
+        assertFalse(provider.get("blabla").isPresent());
+        assertTrue(provider.get("a.b.c").isPresent());
+    }
+
+    @Test
+    public void checkPassDefaultValues() {
+        PropertyProvider provider = PropertyProviders.fromPaths("classpath:ucs/UC1ReadProperties/UC1ReadPropertiesTest.properties");
+        assertEquals("myDefaultValue", provider.get("blabla").orElse("myDefaultValue"));
+    }
+
+    @Test(expected = IllegalStateException.class)
+    public void checkThrowCustomException() {
+        PropertyProvider provider = PropertyProviders.fromPaths("classpath:ucs/UC1ReadProperties/UC1ReadPropertiesTest.properties");
+        provider.get("blabla").orElseThrow(() -> new IllegalStateException("checkThrowCustomException"));
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/6a489cb6/core/src/test/java/org/apache/tamaya/ucs/UC1ReadProperties/UC1ReadPropertiesTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/tamaya/ucs/UC1ReadProperties/UC1ReadPropertiesTest.java b/core/src/test/java/org/apache/tamaya/ucs/UC1ReadProperties/UC1ReadPropertiesTest.java
deleted file mode 100644
index 0bb8b8a..0000000
--- a/core/src/test/java/org/apache/tamaya/ucs/UC1ReadProperties/UC1ReadPropertiesTest.java
+++ /dev/null
@@ -1,218 +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.
- */
-package org.apache.tamaya.ucs.UC1ReadProperties;
-
-import org.apache.tamaya.*;
-import org.junit.Test;
-
-import java.math.BigDecimal;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-import static junit.framework.TestCase.assertTrue;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-
-/**
- * Configuration is organized as key/value pairs. This basically can be modeled as {@code Map<String,String>}
- * Configuration should be as simple as possible. A {@code Map<String,String>} instance has methods that may not
- * be used in many use cases and/or are not easy to implement. Currently the following functionality
- * must be supported:
- * <ul>
- * <li>access a value by key (+get+)</li>
- * <li>check if a value is present (+containsKey+)</li>
- * <li>get a set current all defined keys (+keySet+)</li>
- * <li>a property provider must be convertible to a +Map+, by calling +toMap()+</li>
- * <li>a property provider must get access to its meta information.</li>
- * </ul>
- * Additionally there are other requirement important for ease current use:
- * <ul>
- * <li>The API must never return null.</li>
- * <li>The API should support undefined values.</li>
- * <li>The API must support passing default values, to be returned if a value is undefined.</li>
- * <li>The API must allow to throw exceptions, when a value is undefined.
- * Customized exceptions hereby should be supported.</li>
- * <li>Properties can be stored in the classpath, on a file.</li>
- * <li>Properties can be stored as properties, xml-properties or as ini-files.</li>
- * <li>Properties can also be provided as properties, or as a Map<String,String></li>
- * </ul>
- */
-public class UC1ReadPropertiesTest {
-
-    @Test
-    public void example() {
-        Configuration config = PropertyProviders.fromPaths("classpath:ucs/UC1ReadProperties/UC1ReadPropertiesTest.properties").toConfiguration();
-        String name = config.get("name").orElse("Anatole");
-        BigDecimal bigNum = config.get("num.BD", BigDecimal.class).orElseThrow(() -> new IllegalStateException("Sorry"));
-        double anotherNum = config.getDouble("num.Double").getAsDouble();
-        long longNum = config.getLong("num.Long").orElse(288900L);
-
-        // or more simpler use area function
-        Configuration areaConfig2 = config.with(ConfigFunctions.selectArea("num"));
-        System.out.println(areaConfig2);
-
-        // iterator over an area, using streams only
-        Map<String, String> areaMap = config.toMap().entrySet().stream()
-                .filter((e) -> e.getKey().startsWith("num."))
-                .collect(Collectors.toMap((e) -> e.getKey().substring("num.".length()), (e) -> e.getValue()));
-        Configuration areaConfig = PropertyProviders.fromMap(areaMap).toConfiguration();
-        System.out.println(areaConfig);
-    }
-
-    @Test
-    public void getConfigurationTest() {
-        PropertyProvider provider = PropertyProviders.fromPaths("classpath:barFoo.properties");
-        Configuration config = provider.toConfiguration();
-        assertNotNull(config);
-        assertTrue(config.isEmpty());
-        assertTrue(config.keySet().isEmpty());
-        assertFalse(config.isMutable());
-    }
-
-    @Test
-    public void readBadPropertiesTest() {
-        PropertyProvider provider = PropertyProviders.fromPaths("classpath:barFoo.properties");
-        assertNotNull(provider);
-        assertTrue(provider.isEmpty());
-        assertTrue(provider.keySet().isEmpty());
-        assertFalse(provider.isMutable());
-    }
-
-    @Test
-    public void readPropertiesTest() {
-        PropertyProvider provider = PropertyProviders.fromPaths("classpath:ucs/UC1ReadProperties/UC1ReadPropertiesTest.properties");
-        assertNotNull(provider);
-        assertEquals(provider.get("a").get(), "aValue");
-        assertEquals(provider.get("b").get(), "bValue");
-        assertEquals(provider.get("c").get(), "cValue");
-        assertEquals(provider.get("a.b.c").get(), "abcValue");
-        assertEquals(provider.get("a.b.a").get(), "abaValue");
-        assertEquals(provider.get("a.b.b").get(), "abbValue");
-        assertEquals(provider.get("a.b").get(), "abValue");
-        assertEquals(provider.get("a.a.a").get(), "aaaValue");
-        assertEquals(provider.get("b.b.b").get(), "bbbValue");
-        assertEquals(provider.get("c.c.c").get(), "cccValue");
-        assertEquals(provider.get("numInt").get(), "9999");
-        assertEquals(provider.get("num.Int").get(), "123");
-        assertEquals(provider.get("num.Byte").get(), "100");
-        assertEquals(provider.get("boolean").get(), "true");
-        assertEquals(provider.get("num.BD").get(), "2376523725372653.287362836283628362863");
-        assertEquals(provider.get("num.Double").get(), "21334.43254");
-        assertTrue(!provider.get("blabla").isPresent());
-        assertTrue(provider.get("num.BD").isPresent());
-    }
-
-    @Test
-    public void readXmlPropertiesTest() {
-        PropertyProvider provider = PropertyProviders.fromPaths("classpath:ucs/UC1ReadProperties/UC1ReadPropertiesTest.xml");
-        assertNotNull(provider);
-        assertEquals(provider.get("a-xml").get(), "aFromXml");
-        assertEquals(provider.get("b-xml").get(), "bFromXml");
-        assertEquals(provider.get("a.b.c-xml").get(), "abcFromXml");
-    }
-
-    @Test
-    public void readIniPropertiesTest() {
-        PropertyProvider provider = PropertyProviders.fromPaths("classpath:ucs/UC1ReadProperties/UC1ReadPropertiesTest.ini");
-        assertNotNull(provider);
-        assertEquals(provider.get("a.b.c").get(), "abcValue-fromIni");
-        assertEquals(provider.get("a.b.b").get(), "abbValue-fromIni");
-        assertEquals(provider.get("a.b.a").get(), "abaValue-fromIni");
-        assertEquals(provider.get("mixed.a.b").get(), "abValue");
-        assertFalse(provider.get("mixed.foo").isPresent());
-        assertTrue(provider.get("num.BD").isPresent());
-    }
-
-    @Test
-    public void readAllPropertiesTest() {
-        PropertyProvider provider = PropertyProviders.fromPaths(AggregationPolicy.IGNORE_DUPLICATES(), "classpath:ucs/UC1ReadProperties/UC1ReadPropertiesTest.*");
-        assertNotNull(provider);
-        // fromMap ini file
-        assertEquals(provider.get("a.b.c").get(), "abcValue-fromIni");
-        assertEquals(provider.get("a.b.b").get(), "abbValue-fromIni");
-        assertEquals(provider.get("a.b.a").get(), "abaValue-fromIni");
-        // fromMap properties
-        assertTrue(provider.containsKey("num.BD"));
-        // fromMap xml properties
-        assertEquals(provider.get("a-xml").get(), "aFromXml");
-        assertEquals(provider.get("b-xml").get(), "bFromXml");
-    }
-
-    @Test
-    public void checkForAValue() {
-        PropertyProvider provider = PropertyProviders.fromPaths("classpath:ucs/UC1ReadProperties/UC1ReadPropertiesTest.properties");
-        assertFalse(provider.containsKey("blabla"));
-        assertTrue(provider.containsKey("num.BD"));
-        assertFalse(provider.get("blabla").isPresent());
-        assertTrue(provider.get("num.BD").isPresent());
-    }
-
-    @Test
-    public void checkKeys() {
-        PropertyProvider provider = PropertyProviders.fromPaths("classpath:ucs/UC1ReadProperties/UC1ReadPropertiesTest.properties");
-        assertEquals(provider.keySet().size(), 16);
-        assertTrue(provider.keySet().contains("boolean"));
-        assertFalse(provider.keySet().contains("blabla"));
-    }
-
-    @Test
-    public void checkToMap() {
-        PropertyProvider provider = PropertyProviders.fromPaths("classpath:ucs/UC1ReadProperties/UC1ReadPropertiesTest.properties");
-        Map<String, String> map = provider.toMap();
-        assertNotNull(map);
-        assertEquals(map.size(), 16);
-        assertEquals(provider.keySet(), map.keySet());
-        assertTrue(map.keySet().contains("boolean"));
-        assertFalse(map.keySet().contains("blabla"));
-    }
-
-    @Test
-    public void checkMetaInfo() {
-        PropertyProvider provider = PropertyProviders.fromPaths("classpath:ucs/UC1ReadProperties/UC1ReadPropertiesTest.properties");
-        MetaInfo meta = provider.getMetaInfo();
-        assertNotNull(meta);
-    }
-
-    @Test
-    public void checkNeverNull() {
-        PropertyProvider provider = PropertyProviders.fromPaths("classpath:ucs/UC1ReadProperties/UC1ReadPropertiesTest.properties");
-        assertNotNull(provider.get("blabla"));
-        assertNotNull(provider.get("a.b.c"));
-    }
-
-    @Test
-    public void checkUndefined() {
-        PropertyProvider provider = PropertyProviders.fromPaths("classpath:ucs/UC1ReadProperties/UC1ReadPropertiesTest.properties");
-        assertFalse(provider.get("blabla").isPresent());
-        assertTrue(provider.get("a.b.c").isPresent());
-    }
-
-    @Test
-    public void checkPassDefaultValues() {
-        PropertyProvider provider = PropertyProviders.fromPaths("classpath:ucs/UC1ReadProperties/UC1ReadPropertiesTest.properties");
-        assertEquals("myDefaultValue", provider.get("blabla").orElse("myDefaultValue"));
-    }
-
-    @Test(expected = IllegalStateException.class)
-    public void checkThrowCustomException() {
-        PropertyProvider provider = PropertyProviders.fromPaths("classpath:ucs/UC1ReadProperties/UC1ReadPropertiesTest.properties");
-        provider.get("blabla").orElseThrow(() -> new IllegalStateException("checkThrowCustomException"));
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/6a489cb6/core/src/test/java/org/apache/tamaya/ucs/UC2CombineProperties.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/tamaya/ucs/UC2CombineProperties.java b/core/src/test/java/org/apache/tamaya/ucs/UC2CombineProperties.java
new file mode 100644
index 0000000..9dbc19e
--- /dev/null
+++ b/core/src/test/java/org/apache/tamaya/ucs/UC2CombineProperties.java
@@ -0,0 +1,74 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy current the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tamaya.ucs;
+
+import org.apache.tamaya.*;
+import org.junit.Test;
+
+import java.util.Map;
+import java.util.function.BiFunction;
+import java.util.stream.Collectors;
+
+import static junit.framework.TestCase.assertTrue;
+import static org.junit.Assert.*;
+
+/**
+ * Configuration is organized as key/value pairs. This basically can be modeled as {@code Map<String,String>}
+ * Configuration should be as simple as possible. Advanced use cases can often easily implemented by combining
+ * multiple property maps and applying hereby some combination policy. This test class demonstrates the different
+ * options Tamaya is providing and the according mechanisms.
+ */
+public class UC2CombineProperties {
+
+    /**
+     * The most common use cases is aggregating two property providers to new provider, hereby {@link org.apache.tamaya.AggregationPolicy}
+     * defines the current variants supported.
+     */
+    @Test
+    public void simpleAggregationTests() {
+        PropertyProvider props1 = PropertyProviders.fromPaths("classpath:ucs/UC2CombineProperties/props1.properties");
+        PropertyProvider props2 = PropertyProviders.fromPaths("classpath:ucs/UC2CombineProperties/props2.properties");
+        PropertyProvider unionOverriding = PropertyProviders.aggregate(AggregationPolicy.OVERRIDE(), props1, props2);
+        System.out.println("unionOverriding: " + unionOverriding);
+        PropertyProvider unionIgnoringDuplicates = PropertyProviders.aggregate(AggregationPolicy.IGNORE_DUPLICATES(), props1, props2);
+        System.out.println("unionIgnoringDuplicates: " + unionIgnoringDuplicates);
+        PropertyProvider unionCombined = PropertyProviders.aggregate(AggregationPolicy.COMBINE(), props1, props2);
+        System.out.println("unionCombined: " + unionCombined);
+        try{
+            PropertyProviders.aggregate(AggregationPolicy.EXCEPTION(), props1, props2);
+        }
+        catch(ConfigException e){
+            // expected!
+        }
+    }
+
+    /**
+     * For advanced use cases aggregation .
+     */
+    @Test
+    public void dynamicAggregationTests() {
+        PropertyProvider props1 = PropertyProviders.fromPaths("classpath:ucs/UC2CombineProperties/props1.properties");
+        PropertyProvider props2 = PropertyProviders.fromPaths("classpath:ucs/UC2CombineProperties/props2.properties");
+        PropertyProvider props = PropertyProviders.aggregate((k, v1, v2) -> (v1 != null ? v1 : "") + '[' + v2 + "]", MetaInfo.of("dynamicAggregationTests"),
+                props1, props2);
+        System.out.println(props);
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/6a489cb6/core/src/test/java/org/apache/tamaya/ucs/UC2CombineProperties/UC2CombinePropertiesTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/tamaya/ucs/UC2CombineProperties/UC2CombinePropertiesTest.java b/core/src/test/java/org/apache/tamaya/ucs/UC2CombineProperties/UC2CombinePropertiesTest.java
deleted file mode 100644
index d887589..0000000
--- a/core/src/test/java/org/apache/tamaya/ucs/UC2CombineProperties/UC2CombinePropertiesTest.java
+++ /dev/null
@@ -1,74 +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.
- */
-package org.apache.tamaya.ucs.UC2CombineProperties;
-
-import org.apache.tamaya.*;
-import org.junit.Test;
-
-import java.util.Map;
-import java.util.function.BiFunction;
-import java.util.stream.Collectors;
-
-import static junit.framework.TestCase.assertTrue;
-import static org.junit.Assert.*;
-
-/**
- * Configuration is organized as key/value pairs. This basically can be modeled as {@code Map<String,String>}
- * Configuration should be as simple as possible. Advanced use cases can often easily implemented by combining
- * multiple property maps and applying hereby some combination policy. This test class demonstrates the different
- * options Tamaya is providing and the according mechanisms.
- */
-public class UC2CombinePropertiesTest {
-
-    /**
-     * The most common use cases is aggregating two property providers to new provider, hereby {@link org.apache.tamaya.AggregationPolicy}
-     * defines the current variants supported.
-     */
-    @Test
-    public void simpleAggregationTests() {
-        PropertyProvider props1 = PropertyProviders.fromPaths("classpath:ucs/UC2CombineProperties/props1.properties");
-        PropertyProvider props2 = PropertyProviders.fromPaths("classpath:ucs/UC2CombineProperties/props2.properties");
-        PropertyProvider unionOverriding = PropertyProviders.aggregate(AggregationPolicy.OVERRIDE(), props1, props2);
-        System.out.println("unionOverriding: " + unionOverriding);
-        PropertyProvider unionIgnoringDuplicates = PropertyProviders.aggregate(AggregationPolicy.IGNORE_DUPLICATES(), props1, props2);
-        System.out.println("unionIgnoringDuplicates: " + unionIgnoringDuplicates);
-        PropertyProvider unionCombined = PropertyProviders.aggregate(AggregationPolicy.COMBINE(), props1, props2);
-        System.out.println("unionCombined: " + unionCombined);
-        try{
-            PropertyProviders.aggregate(AggregationPolicy.EXCEPTION(), props1, props2);
-        }
-        catch(ConfigException e){
-            // expected!
-        }
-    }
-
-    /**
-     * For advanced use cases aggregation .
-     */
-    @Test
-    public void dynamicAggregationTests() {
-        PropertyProvider props1 = PropertyProviders.fromPaths("classpath:ucs/UC2CombineProperties/props1.properties");
-        PropertyProvider props2 = PropertyProviders.fromPaths("classpath:ucs/UC2CombineProperties/props2.properties");
-        PropertyProvider props = PropertyProviders.aggregate((k, v1, v2) -> (v1 != null ? v1 : "") + '[' + v2 + "]", MetaInfo.of("dynamicAggregationTests"),
-                props1, props2);
-        System.out.println(props);
-    }
-
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/6a489cb6/docs/design/2_CoreConcepts.adoc
----------------------------------------------------------------------
diff --git a/docs/design/2_CoreConcepts.adoc b/docs/design/2_CoreConcepts.adoc
index f1d3e26..8b9a27c 100644
--- a/docs/design/2_CoreConcepts.adoc
+++ b/docs/design/2_CoreConcepts.adoc
@@ -6,8 +6,8 @@ the base of all the other mechanisms:
 
 * Key/Value Pairs
 * Property Providers
-* Meta Data
 * Combining property providers
+* Meta Data
 * Environment Model
 * Configuration
 * Configuration Injection
@@ -16,10 +16,6 @@ These parts are explained in the following sections. It is recommended that user
 All subsequent parts are building upon this concepts and may be more difficult to understand without having read
 this section.
 
-[[DataTypeConversion]]
-=== Data Type Conversion
-
-To be added.
 
 [[APIKeyValues]]
 === Key/Value Pairs
@@ -135,14 +131,14 @@ Nevertheless most of these advantages can be mitigated easily, hereby still keep
   descriptors in Java EE.
 * Hierarchical and collection types can be mapped in different ways:
 ** The keys of configuration can have additional syntax/semantics. E.g. when adding dor-separating path semantics
-*** trees/maps can also simply be mapped:
+*** trees/maps can also simply be mapped.
 
 [APIPropertyProviders]
 === Property Providers
 ==== Basic Model
 
 We have seen that constrain configuration aspects to simple literal key/value pairs provides us with an easy to
-understand, generic, flexible, yet extendible mechanism. Looking at the Java language features a +vava.util.Map<String,
+understand, generic, flexible, yet expendable mechanism. Looking at the Java language features a +vava.util.Map<String,
 String>+ and +java.util.Properties+ basically model these quite well out of the box.
 So it makes sense to build configuration on top of the JDK's +Map+ interface. This creates immediately additional
 benefits:
@@ -173,7 +169,6 @@ public interface PropertyProvider{
       Map<String, String> toMap();
       MetaInfo getMetaInfo();
 
-      default boolean hasSameProperties(PropertyProvider provider);
       default Set<String> keySet();
       default ConfigChangeSet load();
       default boolean isMutable();
@@ -208,26 +203,13 @@ Each instance also provides an instance of +MetaInfo+, which provides meta infor
 --------------------------------------------
 PropertyProvider prov = ...;
 MetaInfo metaInfo = prov.getMetaInfo();
-Set<String> keys = metaInfo.keySet();  // returns the attribute keys, for which metainformation is accessible.
+Set<String> keys = metaInfo.keySet();  // returns the attribute keys, for which meta-information is accessible.
 String metaData = metaInfo.get("a.b.c.value"); // access meta information
-String metaData = metaInfo.get(MetaInfoBuilder.METAINFO); // access meta information for the provider
+String itemName = metaInfo.getName(); // access meta information for the provider
 --------------------------------------------
 
 As we have seen above there is as well a +MetaInfoBuilder+, which must be used to create instances of
-+MetaInfo+. This builder class defines a couple of standard keys that can be used:
-
-[source,java]
---------------------------------------------
-public static final String METAINFO = "_metainfo";
-public static final String TIMESTAMP = "timestamp";
-public static final String CONTEXT = "context";
-public static final String NAME = "name";
-public static final String INFO = "info";
-public static final String TYPE = "type";
-public static final String SOURCE = "source";
-public static final String ENVIRONMENT = "environment";
-public static final String SOURCE_EXPRESSION = "source-expression";
---------------------------------------------
++MetaInfo+.
 
 ==== Mutability
 
@@ -249,6 +231,232 @@ ConfigChangeSet changeSet = ConfigChangeSetBuilder.of(provider)  // creating a d
 provider.apply(changeSet);
 --------------------------------------------
 
+[[API CombineProviders]]
+==== Combining Property Providers
+
+Looking at the structures of configuration system used by large companies we typically encounter some kind of configuration
+hierarchies that are combined in arbitrary ways. Users of the systems are typically not aware of the complexities in this
+area, since they simply know the possible locations, formats and the overriding policies. Framework providers on the other
+side must face the complexities and it would be very useful if Tamaya can support here by providing prebuilt functionality
+that helps implementing these aspects. All this leads to the feature set of combining property providers. Hereby the following
+strategies are useful:
+
+* aggregating providers, hereby later providers added
+  ** override any existing entries from earlier providers
+  ** combine conflicting entries from earlier providers, e.g. into a comma-separated structure.
+  ** may throw a ConfigExcepotion ig entries are conflicting
+  ** may only add entries not yet defined by former providers, preventing entries that are already present to be overwritte
+  ** any custom aggregation strategy, which may be a mix of above
+* intersecting providers
+* subtracting providers
+* filtering providers
+
+These common functionality is provided by the +PropertyProviders+ singleton. Additionally to the base strategies above a +MetaInfo+
+instance can be passed optionally as well to define the meta information for the newly created provider instances.
+Let's assume we have two property providers with the following data:
+
+[source,properties]
+.Provider 1
+--------------------------------------------
+a=a
+b=b
+c=c
+g=g
+h=h
+i=i
+--------------------------------------------
+
+[source,properties]
+.Provider 2
+--------------------------------------------
+a=A
+b=B
+c=C
+d=D
+e=E
+f=F
+--------------------------------------------
+
+Looking in detail you see that the entries +a,b,c+ are present in both providers, whereas +d,e,f+ are only present in provider 1,
+and +g,h,i+ only in provider 2.
+
+[source,java]
+.Example Combining PropertyProviders
+--------------------------------------------
+PropertyProvider provider1 = ...
+PropertyProvider provider2 = ...
+
+// aggregate, hereby values from provider 2 override values from provider 1
+PropertyProvider unionOverriding = PropertyProviders.aggregate(AggregationPolicy.OVERRIDE(), provider1, provider2);
+System.out.println("unionOverriding: " + unionOverriding);
+
+// ignore duplicates, values present in provider 1 are not overriden by provider 2
+PropertyProvider unionIgnoringDuplicates = PropertyProviders.aggregate(AggregationPolicy.IGNORE_DUPLICATES(), provider1, provider2);
+System.out.println("unionIgnoringDuplicates: " + unionIgnoringDuplicates);
+
+// this variant combines/maps duplicate values into a new value
+PropertyProvider unionCombined = PropertyProviders.aggregate(AggregationPolicy.COMBINE(), provider1, provider2);
+System.out.println("unionCombined: " + unionCombined);
+
+// This variant throws an exception since there are key/value paris in both providers, but with different values
+try{
+    PropertyProviders.aggregate(AggregationPolicy.EXCEPTION(), provider1, provider2);
+}
+catch(ConfigException e){
+    // expected!
+}
+--------------------------------------------
+
+The example above produces the following outpout:
+
+[source,listing]
+.Example Combining PropertyProviders
+--------------------------------------------
+AggregatedPropertyProvider{
+  (name = dynamicAggregationTests)
+  a = "[a][A]"
+  b = "[b][B]"
+  c = "[c][C]"
+  d = "[D]"
+  e = "[E]"
+  f = "[F]"
+  g = "[g]"
+  h = "[h]"
+  i = "[i]"
+}
+unionOverriding: AggregatedPropertyProvider{
+  (name = <noname>)
+  a = "A"
+  b = "B"
+  c = "C"
+  d = "D"
+  e = "E"
+  f = "F"
+  g = "g"
+  h = "h"
+  i = "i"
+}
+unionIgnoringDuplicates: AggregatedPropertyProvider{
+  (name = <noname>)
+  a = "a"
+  b = "b"
+  c = "c"
+  d = "D"
+  e = "E"
+  f = "F"
+  g = "g"
+  h = "h"
+  i = "i"
+}
+unionCombined: AggregatedPropertyProvider{
+  (name = <noname>)
+  a = "a,A"
+  b = "b,B"
+  c = "c,C"
+  d = "D"
+  e = "E"
+  f = "F"
+  g = "g"
+  h = "h"
+  i = "i"
+}
+--------------------------------------------
+
+No +AggregationPolicy+ is also an interface that can be implemented:
+
+[source,java]
+.AggregationPolicy Interface
+--------------------------------------------
+@FunctionalInterface
+public interface AggregationPolicy {
+    String aggregate(String key, String value1, String value2);
+}
+--------------------------------------------
+
+So we can also define our own aggregation strategy using a Lambda expression:
+
+[source,java]
+.Use a Custom AggregationPolicy
+--------------------------------------------
+PropertyProvider provider1 = ...;
+PropertyProvider provider2 = ...;
+PropertyProvider props = PropertyProviders.aggregate(
+      (k, v1, v2) -> (v1 != null ? v1 : "") + '[' + v2 + "]",
+      MetaInfo.of("dynamicAggregationTests"),
+      props1, props2);
+System.out.println(props);
+--------------------------------------------
+
+Additionally we also pass here an instance of +MetaInfo+. The output of this code snippet is as follows:
+
+[source,listing]
+.Listing of dynamic aggregation policy
+--------------------------------------------
+AggregatedPropertyProvider{
+  (name = dynamicAggregationTests)
+  a = "[a][A]"
+  b = "[b][B]"
+  c = "[c][C]"
+  d = "[D]"
+  e = "[E]"
+  f = "[F]"
+  g = "[g]"
+  h = "[h]"
+  i = "[i]"
+}
+--------------------------------------------
+
+Summarizing the +PropertyProviders+ singleton allows to combine providers in various forms:
+
+[source,listing]
+.Methods provided on PropertyProviders
+--------------------------------------------
+public final class PropertyProviders {
+
+    private PropertyProviders() {}
+
+    public static PropertyProvider fromArgs(String... args) {
+    public static PropertyProvider fromArgs(MetaInfo metaInfo, String... args) {
+    public static PropertyProvider fromPaths(AggregationPolicy aggregationPolicy, String... paths) {
+    public static PropertyProvider fromPaths(String... paths) {
+    public static PropertyProvider fromPaths(List<String> paths) {
+    public static PropertyProvider fromPaths(AggregationPolicy aggregationPolicy, List<String> paths) {
+    public static PropertyProvider fromPaths(MetaInfo metaInfo, List<String> paths) {
+    public static PropertyProvider fromPaths(AggregationPolicy aggregationPolicy, MetaInfo metaInfo, List<String> paths) {
+    public static PropertyProvider fromUris(URI... uris) {
+    public static PropertyProvider fromUris(AggregationPolicy aggregationPolicy, URI... uris) {
+    public static PropertyProvider fromUris(List<URI> uris) {
+    public static PropertyProvider fromUris(AggregationPolicy aggregationPolicy, List<URI> uris) {
+    public static PropertyProvider fromUris(MetaInfo metaInfo, URI... uris) {
+    public static PropertyProvider fromUris(AggregationPolicy aggregationPolicy, MetaInfo metaInfo, URI... uris) {
+    public static PropertyProvider fromUris(MetaInfo metaInfo, List<URI> uris) {
+    public static PropertyProvider fromUris(AggregationPolicy aggregationPolicy, MetaInfo metaInfo, List<URI> uris) {
+    public static PropertyProvider fromMap(Map<String, String> map) {
+    public static PropertyProvider fromMap(MetaInfo metaInfo, Map<String, String> map) {
+    public static PropertyProvider empty() {
+    public static PropertyProvider emptyMutable() {
+    public static PropertyProvider empty(MetaInfo metaInfo) {
+    public static PropertyProvider emptyMutable(MetaInfo metaInfo) {
+    public static PropertyProvider fromEnvironmentProperties() {
+    public static PropertyProvider fromSystemProperties() {
+    public static PropertyProvider freezed(PropertyProvider provider) {
+    public static PropertyProvider aggregate(AggregationPolicy mapping, MetaInfo metaInfo, PropertyProvider... providers){
+    public static PropertyProvider aggregate(PropertyProvider... providers) {
+    public static PropertyProvider aggregate(List<PropertyProvider> providers) {
+    public static PropertyProvider aggregate(AggregationPolicy mapping, PropertyProvider... propertyMaps) {
+    public static PropertyProvider aggregate(AggregationPolicy mapping, List<PropertyProvider> providers) {
+    public static PropertyProvider mutable(PropertyProvider provider) {
+    public static PropertyProvider intersected(AggregationPolicy aggregationPolicy, PropertyProvider... providers) {
+    public static PropertyProvider intersected(PropertyProvider... providers) {
+    public static PropertyProvider subtracted(PropertyProvider target, PropertyProvider... providers) {
+    public static PropertyProvider filtered(Predicate<String> filter, PropertyProvider provider) {
+    public static PropertyProvider contextual(Supplier<PropertyProvider> mapSupplier,
+                                              Supplier<String> isolationKeySupplier) {
+    public static PropertyProvider delegating(PropertyProvider mainMap, Map<String, String> parentMap) {
+    public static PropertyProvider replacing(PropertyProvider mainMap, Map<String, String> replacementMap) {
+}
+--------------------------------------------
+
 
 [[API Configuration]]
 === Configuration
@@ -287,10 +495,10 @@ public interface Configuration extends PropertyProvider{
 
     // singleton accessors
     public static boolean isDefined(String name);
-    public static <T> T of(String name, Class<T> template);
-    public static Configuration of(String name);
-    public static Configuration of();
-    public static <T> T of(Class<T> type){
+    public static <T> T current(String name, Class<T> template);
+    public static Configuration current(String name);
+    public static Configuration current();
+    public static <T> T current(Class<T> type){
     public static void configure(Object instance);
     public static String evaluateValue(String expression);
     public static String evaluateValue(Configuration config, String expression);
@@ -310,13 +518,14 @@ Hereby
 * +with, query+ provide the extension points for adding additional functionality.
 
 * the static accessor methods define:
-  ** +of(), of(Class), of(String), of(String, Class)+ return the configuration valid for the current runtime environment.
-  ** +addGlobalPropertyChangeListener, removeGlobalPropertyChangeListener+ allow to register or unregister
+  ** +current(), current(Class), current(String), current(String, Class)+ return the configuration valid for the current runtime environment.
+  ** +addPropertyChangeListener, removePropertyChangeListener+ allow to register or unregister
      global config change listener instances.
   ** evaluateValue allows to evaluate a configuration expression based on a given configuration.
   ** +configure+ performs injection of configured values.
 
-==== Type Support
+[[TypeConversion]]
+==== Type Conversion
 
 Configuration extend +PropertyProvider+ and add additional support for non String types. This is achieved
 with the help of +PropertyAdapter+ instances:
@@ -331,7 +540,9 @@ public interface PropertyAdapter<T>{
 --------------------------------------------
 
 PropertyAdapter instances can be implemented manually or registered and accessed from the
-+PropertyAdapers+ singleton:
++PropertyAdapers+ singleton. Hereby the exact mechanism is determined by the API backing up the singleton.
+By default corresponding +PropertyAdapter+ instances can be registered using the Java +ServiceLoader+
+mechanism, or programmatically ba calling the +register(Class, PropertyAdapter)+ method.
 
 [source,java]
 --------------------------------------------
@@ -502,11 +713,11 @@ public interface Environments {
     Set<String> keySet();
     Map<String,String> toMap();
 
-    public static Environment of(){
+    public static Environment current(){
     public static Environment getRootEnvironment(){
     public static List<String> getEnvironmentTypeOrder(){
     public static List<String> getEnvironmentHierarchy(){
-    public static Optional<Environment> of(String environmentType, String contextId){
+    public static Optional<Environment> getInstance(String environmentType, String contextId){
     public static Set<String> getEnvironmentContexts(String environmentType){
     public static boolean isEnvironmentActive(String environmentType){
 --------------------------------------------


Mime
View raw message